Arduino frameworks
- AltSoftSerial UART with WT61 IMU - UART with Pi on TX0/RX0 (and USB)
This commit is contained in:
@@ -11,7 +11,58 @@ Sensor interface running on Arduino Nano, communicating with Pi via UART.
|
||||
## Current Capabilities
|
||||
|
||||
- Battery voltage monitoring (voltage divider on A0)
|
||||
- Serial output at 9600 baud, 1Hz update rate
|
||||
- WT61 IMU/gyro via AltSoftSerial (9-axis: accel, gyro, euler angles)
|
||||
- Duplex UART to Pi at 115200 baud, 10Hz telemetry output
|
||||
- Simple text-based protocol for easy debugging
|
||||
|
||||
## Dependencies
|
||||
|
||||
Install via Arduino Library Manager:
|
||||
- **AltSoftSerial** by Paul Stoffregen - for WT61 IMU serial
|
||||
|
||||
## Pin Assignments
|
||||
|
||||
| Pin | Function |
|
||||
|-----|----------|
|
||||
| A0 | Battery voltage (via divider) |
|
||||
| D0 (RX) | Pi UART RX ← Arduino TX |
|
||||
| D1 (TX) | Pi UART TX → Arduino RX |
|
||||
| D8 | WT61 IMU RX (AltSoftSerial) |
|
||||
| D9 | WT61 IMU TX (unused, AltSoftSerial fixed pin) |
|
||||
| D13 | Status LED (heartbeat) |
|
||||
|
||||
## Hardware
|
||||
|
||||
- **MCU**: Arduino Nano (ATmega328P)
|
||||
- **Pi Connection**: UART at 115200 baud (TX→RX, RX→TX, common GND)
|
||||
- **IMU**: WT61 module at 9600 baud, 20Hz output
|
||||
- **Voltage sensing**: Resistor divider (100k/47k) scaled for 0-20V input
|
||||
|
||||
## Protocol
|
||||
|
||||
Simple text lines, one per sensor reading:
|
||||
```
|
||||
V_bat: 12.45
|
||||
Ax: 0.02
|
||||
Ay: -0.01
|
||||
Az: 1.00
|
||||
Gx: 0.50
|
||||
Gy: -0.25
|
||||
Gz: 0.10
|
||||
Roll: 2.35
|
||||
Pitch: -1.20
|
||||
Yaw: 45.80
|
||||
```
|
||||
|
||||
If IMU data is stale (no valid packets for 200ms):
|
||||
```
|
||||
IMU: STALE
|
||||
```
|
||||
|
||||
Commands from Pi are echoed back:
|
||||
```
|
||||
ACK: PING
|
||||
```
|
||||
|
||||
## Planned
|
||||
|
||||
@@ -19,18 +70,3 @@ Sensor interface running on Arduino Nano, communicating with Pi via UART.
|
||||
- Engine temperature (thermocouple/NTC)
|
||||
- Gear position indicator
|
||||
- Turn signal / high beam status
|
||||
|
||||
## Hardware
|
||||
|
||||
- **MCU**: Arduino Nano (ATmega328P)
|
||||
- **Connection**: UART to Pi GPIO (TX→RX, RX→TX, common GND)
|
||||
- **Voltage sensing**: Resistor divider scaled for 0-20V input range
|
||||
|
||||
## Protocol
|
||||
|
||||
Simple text-based for now:
|
||||
```
|
||||
V_bat: 12.45V
|
||||
```
|
||||
|
||||
Future: structured binary or JSON for multiple sensors.
|
||||
|
||||
Reference in New Issue
Block a user