# WijiBoard Wiring Diagram This document outlines the hardware connections for the WijiBoard. ## Hardware Components - **Microcontroller**: Tenstar Robot ESP32-C3 Super Mini - **Motors**: 2× 28BYJ-48 (5V Stepper Motors) - **Motor Drivers**: 2× ULN2003 Driver Boards - **Power System**: - 4S LiPo Battery - XH-M609 Battery Low-Voltage Disconnect Module - 2× Buck Regulators (step-down converters tuned to 5V) --- ## Power Connections The system is powered by a 4S LiPo battery. To protect the battery from over-discharge, it is connected to an **XH-M609** module. The output of the XH-M609 is split into two separate **Buck Regulators**, both tuned to output 5V. 1. **Buck Regulator 1 (MCU Power)**: Dedicated to powering the ESP32-C3 Super Mini. 2. **Buck Regulator 2 (Motor Power)**: Dedicated to powering both ULN2003 driver boards to prevent voltage drops or electrical noise from affecting the MCU. > [!IMPORTANT] > **Common Ground**: You MUST connect the Ground (GND) from the ESP32 to the Ground (GND) of the ULN2003 drivers. Even though they have separate 5V power supplies, they need a common ground reference for the GPIO logic signals to work correctly. | Component | Connection | Destination | | :--- | :--- | :--- | | **4S LiPo** | `BAT+` / `BAT-` | XH-M609 `VIN+` / `VIN-` | | **XH-M609** | `VOUT+` / `VOUT-` | Split to **IN+** and **IN-** on both Buck Regulators | | **Buck 1 (MCU)** | `OUT+ (5V)` | ESP32-C3 Super Mini `5V` (used as power input) | | **Buck 1 (MCU)** | `OUT- (GND)` | ESP32-C3 Super Mini `GND` | | **Buck 2 (Motors)**| `OUT+ (5V)` | ULN2003 (M1) `+ / 5V` and ULN2003 (M2) `+ / 5V` | | **Buck 2 (Motors)**| `OUT- (GND)` | ULN2003 (M1) `- / GND` and ULN2003 (M2) `- / GND` | | **ESP32-C3 Super Mini** | `GND` | Tie to the motor ground network (Common Ground) | --- ## Motor 1 (Right Motor) Logic **Physical Location**: Right side (pivot at +12.9mm) | ESP32-C3 Super Mini Pin | ULN2003 (Motor 1) Pin | | :--- | :--- | | **GPIO 0** | `IN1` | | **GPIO 1** | `IN2` | | **GPIO 3** | `IN3` | | **GPIO 4** | `IN4` | --- ## Motor 2 (Left Motor) Logic **Physical Location**: Left side (pivot at -12.9mm) | ESP32-C3 Super Mini Pin | ULN2003 (Motor 2) Pin | | :--- | :--- | | **GPIO 5** | `IN1` | | **GPIO 6** | `IN2` | | **GPIO 7** | `IN3` | | **GPIO 10** | `IN4` | --- ## Stepper to Driver Connections Simply plug the white 5-pin JST connectors from the 28BYJ-48 motors into the corresponding white sockets on their respective ULN2003 driver boards. The connector is keyed and only fits one way. --- ## Alternative Board Pinouts The project supports multiple ESP32 variants. The main tables above show the default ESP32-C3 Super Mini. If you are using a different board, follow these logic connections: ### ESP32-S3 (e.g. DevKitC) | Motor | IN1 | IN2 | IN3 | IN4 | | :--- | :--- | :--- | :--- | :--- | | **Motor 1 (Right)** | GPIO 4 | GPIO 5 | GPIO 6 | GPIO 7 | | **Motor 2 (Left)** | GPIO 15 | GPIO 16 | GPIO 17 | GPIO 18 | ### ESP32-WROOM (e.g. NodeMCU / DevKit V1) | Motor | IN1 | IN2 | IN3 | IN4 | | :--- | :--- | :--- | :--- | :--- | | **Motor 1 (Right)** | GPIO 13 | GPIO 14 | GPIO 27 | GPIO 26 | | **Motor 2 (Left)** | GPIO 25 | GPIO 33 | GPIO 32 | GPIO 23 | ## Schematic Overview ```mermaid flowchart LR subgraph Power Delivery BATT[4S LiPo Battery] -->|14.8V| XHM609[XH-M609 Protector] XHM609 -->|14.8V| BUCK1[Buck Regulator 1] XHM609 -->|14.8V| BUCK2[Buck Regulator 2] end BUCK1 -->|5V Power| ESP[ESP32-C3 Super Mini] BUCK2 -->|5V Power| M1_Driver[ULN2003 M1] BUCK2 -->|5V Power| M2_Driver[ULN2003 M2] %% Common Ground ESP -. Common Ground .- M1_Driver ESP -. Common Ground .- M2_Driver %% Logic Signals ESP -- Pins 0,1,3,4 --> M1_Driver ESP -- Pins 5,6,7,10 --> M2_Driver %% Motors M1_Driver == 5-wire cable ==> M1[Motor 1 - Right] M2_Driver == 5-wire cable ==> M2[Motor 2 - Left] ```