diff --git a/docs/wiring.md b/docs/wiring.md index 6d2535c..2d888dd 100644 --- a/docs/wiring.md +++ b/docs/wiring.md @@ -1,63 +1,451 @@ -# Wiring Overview +# Wiring -## House Battery Power Distribution +This document describes the current planned wiring for the Overland Controller install. -House Battery Positive -├── 5A Fuse → ESP32 Controller -├── 3A Fuse → 12V→5V Buck Converter -├── 30A Fuse → Fridge Relay -└── 30A Fuse → Starlink Relay +The current system uses: -House Battery Negative -├── ESP32 Ground -├── Buck Converter Ground -├── Relay Grounds -└── Sensor Grounds +- ESP32 2-relay controller board +- Raspberry Pi Pico 2 W dashboard +- CAT5/CAT6 cable between rear controller and dash +- 12V-to-5V buck converter in the dash enclosure +- DS18B20 temperature sensors +- JBD/Xiaoxiang BMS over BLE +- External automotive relays for high-current loads -## Dashboard Power +--- -12V House Battery -↓ -Buck Converter (5V) -↓ -CAT5 Cable -↓ -Pico Dashboard +## Current ESP32 Relay Board -## Communications +Board markings: -Pico -↓ -UART over CAT5 -↓ -ESP32 + ESP32_Relay_X2 -Backup: -WiFi +Relay contact terminals: -## Relay Control + NO1 COM1 NC1 NO2 COM2 NC2 -ESP32 Relay Output -↓ -Bosch Relay Coil +Power terminal: -Bosch Relay Contacts -↓ -Fridge / Starlink / Future Loads + VCC GND 5V -No high-current loads pass through the ESP32 relay board. +UART/programming header: -## Temperature Sensors + IO0 GND GND RX TX 5V -Single DS18B20 Bus +Firmware relay mapping: -Sensors: -- Fridge Zone 1 -- Fridge Zone 2 -- Rear Seat Area -- Outside Air + relay_1 = GPIO16 + relay_2 = GPIO17 -Future: -- Battery Compartment -- Cabin Air -- Water Tank +--- + +## System Power Overview + +Plain text diagram: + + House Battery + + | + +---- Main fuse / distribution + | + +---- 2A fuse --------------------> ESP32 relay board VCC + | + +---- 1A or 2A fuse --------------> CAT5 blue pair to dash +12V + | + +---- Load fuse ------------------> Automotive relay #1 pin 30 + | + +---- Load fuse ------------------> Automotive relay #2 pin 30 + + House Battery - + | + +---------------------------------> Common ground bus + | + +--> ESP32 relay board GND + +--> CAT5 green pair to dash GND + +--> Automotive relay coil grounds + +--> Load grounds + +Notes: + +- Fuse every positive feed. +- Keep all grounds common. +- Do not run high-current loads directly through the ESP32 relay board. +- Use the ESP32 relay board to trigger automotive relays. + +--- + +## ESP32 Board Power + +Use the bottom-right power terminal: + + VCC GND 5V + +Recommended wiring: + + House battery + + | + +-- 2A fuse + | + +---> ESP32 VCC + + House battery - + | + +---> ESP32 GND + +Leave the ESP32 board 5V terminal unused unless verified for your exact board/power setup. + +--- + +## Pico Dashboard Power Over CAT5 + +The dash Pico should be powered from a buck converter inside the dash enclosure. + +Rear compartment: + + House battery + + | + +-- 1A or 2A fuse + | + +---> CAT5 blue/white + blue conductors + + House battery - + | + +---> CAT5 green/white + green conductors + +Dash enclosure: + + CAT5 blue pair +12V + | + +---> Buck converter IN+ + + CAT5 green pair GND + | + +---> Buck converter IN- + + Buck converter OUT+ 5V + | + +---> Pico VSYS + + Buck converter OUT- GND + | + +---> Pico GND + +Important: + +- Do not connect 5V to Pico 3V3. +- Use Pico VSYS for 5V input. +- Keep ESP32 GND and Pico GND connected through the CAT5 ground pair. + +--- + +## CAT5 / CAT6 Cable Plan + +Recommended CAT5/CAT6 wiring between the rear ESP32 controller and dash Pico: + + Orange/White ESP32 TX ---> Pico GP1 RX + Orange ESP32 RX <--- Pico GP0 TX + + Green/White Ground + Green Ground + + Blue/White +12V fused dash feed + Blue +12V fused dash feed + + Brown/White Spare + Brown Spare + +Notes: + +- Use two conductors for +12V. +- Use two conductors for ground. +- UART requires shared ground. +- Brown pair is reserved for future expansion. + +--- + +## Pico 2 W UART Pins + +Recommended Pico UART pins: + + Pico GP0 = UART0 TX + Pico GP1 = UART0 RX + +Connection: + + ESP32 TX ---> Pico GP1 RX + ESP32 RX <--- Pico GP0 TX + ESP32 GND ---> Pico GND + +Do not connect ESP32 5V to Pico unless intentionally using it as a power source. + +Current plan is to power Pico from local dash buck converter instead. + +--- + +## ESP32 UART Header + +The ESP32 relay board exposes a 6-pin header: + + IO0 GND GND RX TX 5V + +Use: + + TX ---> Pico GP1 RX + RX <--- Pico GP0 TX + GND ---> Pico GND + +Do not use IO0 for dashboard wiring. + +Do not use 5V for dashboard power in the current design. + +--- + +## DS18B20 Temperature Sensor Bus + +Recommended ESP32 GPIO: + + GPIO4 + +All DS18B20 sensors share one 1-Wire data bus. + +Plain text diagram: + + ESP32 3.3V + | + +---- 4.7k pull-up resistor + | + ESP32 GPIO4 --------------------+---- DS18B20 Sensor 1 data + | + +---- DS18B20 Sensor 2 data + | + +---- DS18B20 Sensor 3 data + | + +---- DS18B20 Sensor 4 data + | + +---- Additional sensors up to temp_8 + + ESP32 3.3V -------------------------- DS18B20 red wires + ESP32 GND -------------------------- DS18B20 black wires + ESP32 GPIO4 ------------------------- DS18B20 data wires + +Typical waterproof DS18B20 wiring: + + Red = 3.3V + Black = GND + Yellow = Data + +Important: + +- A 4.7k resistor is required between 3.3V and data. +- One pull-up resistor is used for the whole bus. +- Do not use one resistor per sensor. +- Long leads may need clean splices and good grounding. + +--- + +## BMS Connection + +The JBD/Xiaoxiang BMS is wireless. + +Connection: + + ESP32 <---- BLE ----> JBD/Xiaoxiang BMS + +No physical BMS data wiring is currently required. + +The BMS Bluetooth address is stored in controller configuration. + +--- + +## Relay Control Strategy + +The onboard ESP32 relays should trigger automotive relays. + +They should not directly power large vehicle loads. + +Recommended pattern: + + ESP32 onboard relay + | + +-- switches automotive relay coil + | + +-- automotive relay switches load power + +This keeps high current off the ESP32 board. + +--- + +## Relay 1 Automotive Relay Wiring + +Example installation-specific name: + + relay_1 = Starlink + +ESP32 board contact terminals: + + COM1 + NO1 + +Automotive relay wiring: + + House battery + + | + +-- load fuse + | + +---> Automotive relay pin 30 + + Automotive relay pin 87 + | + +---> Load positive + + Load negative + | + +---> Ground bus + + Automotive relay pin 85 + | + +---> Ground bus + + Automotive relay pin 86 + | + +---> Switched positive from ESP32 relay COM1/NO1 circuit + +ESP32 relay contact wiring concept: + + Fused low-current +12V + | + +---> ESP32 relay COM1 + + ESP32 relay NO1 + | + +---> Automotive relay pin 86 + +When relay_1 turns on, COM1 connects to NO1 and energizes the automotive relay coil. + +--- + +## Relay 2 Automotive Relay Wiring + +Example installation-specific name: + + relay_2 = Fridge + +ESP32 board contact terminals: + + COM2 + NO2 + +Automotive relay wiring: + + House battery + + | + +-- load fuse + | + +---> Automotive relay pin 30 + + Automotive relay pin 87 + | + +---> Load positive + + Load negative + | + +---> Ground bus + + Automotive relay pin 85 + | + +---> Ground bus + + Automotive relay pin 86 + | + +---> Switched positive from ESP32 relay COM2/NO2 circuit + +ESP32 relay contact wiring concept: + + Fused low-current +12V + | + +---> ESP32 relay COM2 + + ESP32 relay NO2 + | + +---> Automotive relay pin 86 + +When relay_2 turns on, COM2 connects to NO2 and energizes the automotive relay coil. + +--- + +## Automotive Relay Pin Reference + +Common Bosch-style relay pins: + + 30 = Common load power input + 87 = Normally open load output + 87a = Normally closed output, if present + 85 = Coil side + 86 = Coil side + +Recommended use: + + 30 = fused battery positive + 87 = load positive + 85 = ground + 86 = switched positive from ESP32 relay board + +--- + +## Future Reserved Inputs + +Do not wire these yet unless firmware support has been added. + +Recommended reservations: + + GPIO34 = Ignition sense input + GPIO35 = House battery voltage sense input + +Reason: + +- GPIO34 and GPIO35 are input-only. +- Input-only pins are appropriate for sensing. +- They are not appropriate for relay outputs. + +Important: + +Never connect vehicle 12V directly to an ESP32 GPIO. + +Use a voltage divider or proper interface circuit. + +--- + +## Current Version 1 Wiring Summary + +Current required physical wiring: + + ESP32 board VCC/GND from fused house battery power + + ESP32 TX/RX/GND to Pico over CAT5 + + 12V fused dash feed and ground to Pico dash enclosure over CAT5 + + Dash buck converter 12V to 5V + + Buck 5V to Pico VSYS + + ESP32 GPIO4 to DS18B20 1-Wire bus + + 4.7k pull-up from GPIO4 data bus to 3.3V + + ESP32 relay COM/NO contacts to automotive relay coils + + Automotive relays to actual high-current loads + + ESP32 BLE to JBD/Xiaoxiang BMS + +--- + +## Safety Notes + +- Fuse every positive feed. +- Use proper wire gauge for each load. +- Keep high-current wiring separate from signal wiring where possible. +- Use common ground between ESP32, Pico, buck converter, relays, sensors, and battery. +- Do not connect 12V directly to any ESP32 or Pico GPIO. +- Do not power high-current loads directly through the ESP32 relay board. +- Test relay behavior with a multimeter before connecting expensive loads.