Document UART as primary communication method
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
Pico Dashboard
|
Pico Dashboard
|
||||||
↓
|
↓
|
||||||
RS-485
|
UART over CAT5
|
||||||
↓
|
↓
|
||||||
ESP32 Controller
|
ESP32 Controller
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ Message Types:
|
|||||||
|
|
||||||
## Failure Handling
|
## Failure Handling
|
||||||
|
|
||||||
If RS-485 is lost:
|
If UART over CAT5 is lost:
|
||||||
- Dashboard displays warning
|
- Dashboard displays warning
|
||||||
- Last known values remain visible
|
- Last known values remain visible
|
||||||
- Relay commands fail safely
|
- Relay commands fail safely
|
||||||
|
|||||||
+24
-39
@@ -2,18 +2,18 @@
|
|||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
The first hardware version will use plain UART over CAT5 between the Pico dashboard and the ESP32 cargo controller.
|
The first hardware version will use UART over CAT5 between the Pico dashboard and the ESP32 controller.
|
||||||
|
|
||||||
UART is simpler than RS-485 and should be reliable enough for the short cable run inside the Xterra.
|
UART is simpler than RS-485 and should be reliable for the short cable run inside the Xterra.
|
||||||
|
|
||||||
RS-485 remains a fallback if UART proves unreliable.
|
RS-485 remains a future fallback if testing reveals communication issues.
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
Pico Dashboard
|
Pico Dashboard
|
||||||
↓
|
|
|
||||||
UART over CAT5
|
| UART over CAT5
|
||||||
↓
|
|
|
||||||
ESP32 Controller
|
ESP32 Controller
|
||||||
|
|
||||||
Backup:
|
Backup:
|
||||||
@@ -31,55 +31,40 @@ Ground <-> Ground
|
|||||||
## Planned Baud Rate
|
## Planned Baud Rate
|
||||||
|
|
||||||
Initial:
|
Initial:
|
||||||
115200 baud
|
115200
|
||||||
|
|
||||||
Future testing:
|
Future Options:
|
||||||
- 57600 baud if noise becomes an issue
|
- 57600
|
||||||
- 230400 baud if higher update rates are needed
|
- 230400
|
||||||
|
|
||||||
## Message Format
|
## Message Format
|
||||||
|
|
||||||
Messages will use newline-delimited JSON.
|
Newline-delimited JSON
|
||||||
|
|
||||||
Example request:
|
|
||||||
|
|
||||||
|
Request:
|
||||||
{"type":"status_request"}
|
{"type":"status_request"}
|
||||||
|
|
||||||
Example response:
|
Response:
|
||||||
|
{"type":"status_response"}
|
||||||
{"type":"status_response","data":{"battery":{"soc":82}}}
|
|
||||||
|
|
||||||
Each message ends with a newline character.
|
|
||||||
|
|
||||||
## Failure Handling
|
## Failure Handling
|
||||||
|
|
||||||
If no valid response is received within the timeout:
|
If communication is lost:
|
||||||
|
|
||||||
- Dashboard shows communication warning
|
- Dashboard shows warning
|
||||||
- Last known values remain visible
|
- Last known values remain visible
|
||||||
- Relay commands fail safely
|
- Relay commands fail safely
|
||||||
- WiFi backup may be attempted if enabled
|
- WiFi backup may be attempted
|
||||||
|
|
||||||
## Why UART First
|
## Advantages
|
||||||
|
|
||||||
Advantages:
|
|
||||||
|
|
||||||
- Fewer parts
|
- Fewer parts
|
||||||
- Easier wiring
|
|
||||||
- Easier debugging
|
- Easier debugging
|
||||||
- No direction-control pin
|
- Easier wiring
|
||||||
- No transceiver modules required
|
- No transceivers
|
||||||
- Works well over short distances
|
- No direction control
|
||||||
|
- Works well for short runs
|
||||||
|
|
||||||
## Why RS-485 Is Still Available
|
## Future RS-485 Option
|
||||||
|
|
||||||
RS-485 may be used later if UART has issues caused by:
|
If vehicle electrical noise causes issues, the transport layer can be switched to RS-485 without changing application logic.
|
||||||
|
|
||||||
- Alternator noise
|
|
||||||
- Relay switching noise
|
|
||||||
- Fridge compressor noise
|
|
||||||
- Inverter noise
|
|
||||||
- Long cable run
|
|
||||||
- Ground noise
|
|
||||||
|
|
||||||
The software should keep a transport abstraction so UART and RS-485 can be swapped without changing the application protocol.
|
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ Pico Dashboard
|
|||||||
|
|
||||||
Pico
|
Pico
|
||||||
↓
|
↓
|
||||||
RS-485
|
UART over CAT5
|
||||||
↓
|
↓
|
||||||
ESP32
|
ESP32
|
||||||
|
|
||||||
|
|||||||
+13
-6
@@ -1,5 +1,9 @@
|
|||||||
# CAT5 Pinout
|
# CAT5 Pinout
|
||||||
|
|
||||||
|
## Primary Configuration
|
||||||
|
|
||||||
|
UART over CAT5
|
||||||
|
|
||||||
Pair 1
|
Pair 1
|
||||||
Blue +5V
|
Blue +5V
|
||||||
Blue/White +5V
|
Blue/White +5V
|
||||||
@@ -9,15 +13,18 @@ Orange Ground
|
|||||||
Orange/White Ground
|
Orange/White Ground
|
||||||
|
|
||||||
Pair 3
|
Pair 3
|
||||||
Green RS-485 A
|
Green Pico TX -> ESP32 RX
|
||||||
Green/White RS-485 B
|
Green/White Pico RX <- ESP32 TX
|
||||||
|
|
||||||
Pair 4
|
Pair 4
|
||||||
Brown Ignition Sense
|
Brown Ignition Sense
|
||||||
Brown/White Spare
|
Brown/White Spare
|
||||||
|
|
||||||
Notes:
|
## Future RS-485 Conversion
|
||||||
|
|
||||||
- Use twisted pair for RS-485
|
Pair 3
|
||||||
- Double conductors for power
|
|
||||||
- Spare conductor reserved for future use
|
Green RS-485 A
|
||||||
|
Green/White RS-485 B
|
||||||
|
|
||||||
|
All other conductors remain unchanged.
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# UART CAT5 Pinout
|
||||||
|
|
||||||
|
## Pair 1
|
||||||
|
|
||||||
|
Blue +5V
|
||||||
|
Blue/White +5V
|
||||||
|
|
||||||
|
## Pair 2
|
||||||
|
|
||||||
|
Orange Ground
|
||||||
|
Orange/White Ground
|
||||||
|
|
||||||
|
## Pair 3
|
||||||
|
|
||||||
|
Green Pico TX -> ESP32 RX
|
||||||
|
Green/White Pico RX <- ESP32 TX
|
||||||
|
|
||||||
|
## Pair 4
|
||||||
|
|
||||||
|
Brown Ignition Sense
|
||||||
|
Brown/White Spare
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- Double conductors used for power
|
||||||
|
- Shared ground required
|
||||||
|
- Spare conductor reserved for future use
|
||||||
|
- Pair 3 may later be repurposed for RS-485
|
||||||
Reference in New Issue
Block a user