Project files
6 KB
Machine-translated by Robotheca from the original in Chinese (opens in a new tab). License: MIT (opens in a new tab).
Wiring Diagram Guide — Cheers No. 1 (Plug-and-Play Edition)
Document status: First edition (2026-08-11) Target audience: Users without an electronics background. Follow this guide step by step to connect the car in the "digital twin" to real motors, lights, and sensors. Principle: Use only off-the-shelf modules + breadboard + DuPont wires. No soldering, no PCB design.
0. List of Pre-Purchased Modules You Need
The off-the-shelf modules used in this guide (totaling about ¥150-250, excluding large components like motors, ESCs, and batteries):
| Module | Purpose | Reference Price |
|---|---|---|
| Breadboard (400 holes) | Circuit prototyping | ¥10 |
| Dupont wires (male-to-male / male-to-female) | Wiring | ¥10 |
| Bidirectional level shifter module (4 channels, 5 V ↔ 3.3 V) | ⚠️ Required for Raspberry Pi ↔ Arduino UART | ¥10 |
| MOS relay / high-side driver module | Control high-current lights (e.g., D2 headlight) | ¥15 |
| WS2812B RGB LED strip (1 m) | Body lighting | ¥15 |
| Hall / potentiometer pedal ×2 | Throttle / brake | ¥40-120 |
| Seat pressure sensor | Occupancy detection | ¥15 |
| Push-button switch ×6 | Headlight / mute / LED strip / horn / emergency brake / intercom | ¥10 |
| Fuse holder + 20 A fuse | ⚠️ Battery short-circuit protection | ¥10 |
| DC-DC buck converter (24 V → 5 V / 3 A) | Power supply for Raspberry Pi / Arduino | ¥15 |
⚠️ Large components such as motors, ESCs, batteries, and servos are covered in
powertrain_sizing.md.
3. Power System (Highest Priority, Safe Wiring)
Lithium battery pack 24V +BAT ──► [Fuse 20A] ──► ESC power input +
Lithium battery pack 24V -BAT ───────────────────► ESC power input -
Motor output from ESC → DC motor (swap positive/negative as needed)
ESC signal wire (white/orange) ──► Arduino D9 (throttle)
ESC power output ──► DC-DC buck converter 24V→5V ──► Raspberry Pi 5V + Arduino 5V
✅ Key Safety Points
- Fuse is placed directly next to the battery positive terminal—in case of a short circuit, the fuse will blow before the device is damaged.
- Both the Raspberry Pi and Arduino are powered by a 5V DC-DC converter—do not power them simultaneously via USB (use isolated power).
- Use thick wires for the battery circuit (to handle high motor current), and thin wires for signal lines.
2. Brain ↔ Cerebellum Communication (Raspberry Pi ↔ Arduino)
Raspberry Pi GPIO14(TXD) ──► Level Shifter L1 ──► Arduino Mega D19 (RX1)
Raspberry Pi GPIO15(RXD) ◄── Level Shifter L1 ◄─── Arduino Mega D18 (TX1)
Raspberry Pi GND ────────────► Level Shifter GND ◄─ Arduino GND (Common Ground!)
⚠️ A bidirectional level shifter module must be used: 5V from Arduino → 3.3V for Raspberry Pi direction conversion, otherwise the Raspberry Pi GPIO will be burned. ⚠️ Common ground must be connected, otherwise the serial port will not work.
3. Arduino Output Wiring (Actuators + Lights)
| Arduino Pin | Connection | Notes |
|---|---|---|
| D9 | ESC signal wire | Motor throttle |
| D10 | Servo signal wire | Steering (to be implemented, see §7) |
| D2 | Via MOSFET relay → Headlights | High-current isolation |
| D3 | Brake light (LED with resistor) | PWM brightness |
| D4 | Left turn signal (with resistor) | |
| D5 | Right turn signal (with resistor) | |
| D11 | WS2812B LED strip data line | RGB (requires NeoPixel library) |
Connect lights directly to GND through a 220Ω resistor, or use a MOSFET relay to drive headlights/LED strips.
4. Arduino Input Wiring (Sensors + Buttons)
| Arduino Pin | Connection | Notes |
|---|---|---|
| A0 | Throttle pedal (Hall/potentiometer midpoint) | 0-5V → 0-1023 |
| A1 | Brake pedal | |
| A2 | Seat pressure sensor | Seat-occupied detection |
| A3 | Battery voltage (via voltage divider A3 → GND + 10K:4.7K) | Do NOT connect 24V directly! |
| A4 | NTC thermistor (divided to 0-5V) | Battery compartment temperature |
| A5 | Current sensor output | Motor current |
| D22 | Emergency brake button (connected to GND, pull-up/down) | Highest priority |
| D23 | Mute button | |
| D24 | Headlight button | |
| D25 | LED strip button | |
| D26 | Horn button | |
| D27 | Intercom button |
⚠️ Never connect A3 directly to 24 V; use a voltage divider to bring it down to 0-5 V, otherwise the ADC will be damaged.
5. One-touch emergency stop with dual insurance (safety red line, must be implemented)
Your firmware already implements software-based emergency braking (D22 + EBRK command). To achieve hardware-level safety, add an additional layer:
Emergency stop button one side ──► Arduino D22 (software emergency stop, already implemented)
Emergency stop button other side ──► ESC enable/power enable pin (hardware direct power cut-off)
This ensures that even if the program fails, pressing the emergency stop physically cuts off power.
6. Wiring Overview Diagram (One-Sentence Version)
Battery 24V ├─►Fuse→ESC→Motor
└─►DC-DC 5V→Raspberry Pi + Arduino
Raspberry Pi[TXD/RXD]─Level Shifter→Arduino[D19/D18] ←Serial Protocol
Arduino[D9→ESC] [D10→Servo] [D2,D3,D4,D5→LEDs] [D11→LED Strip]
Arduino[A0,A1,A2,A3,A4,A5→Foot Pedal/Cushion/Voltage/Temperature/Current]
Arduino[D22-D27→Six-Key Panel]
7. ⚠️ Steering and Wheel Speed (Currently Under Development)
These two features are still placeholders/to be implemented in the firmware:
- Steering: Currently, only the
TURN(turn signal) command exists, there is noSTEER(steering execution) command. You can wire the servo to D10 for now, but the driver code needs to be added. - Wheel Speed Sensor: The
estimate_speed()function uses "throttle × gear estimation" instead of actual speed. To implement speed closed-loop control and gear speed limiting, you need to connect a Hall sensor/encoder to the Arduino and add aSTATcommand to report the actual speed.
These two features (
STEERcommand + wheel speed acquisition) are the next firmware parts I will help you write. For now, you can wire them to the corresponding pins.
8. Common Mistakes (Must Read Before Wiring)
| Error | Consequence | Prevention |
|---|---|---|
| Common ground not connected | No serial data received | Connect GND of Raspberry Pi/Arduino/level shifter together |
| 24V directly connected to Raspberry Pi | 🚨Burned out | Use only DC-DC 5V |
| A3 directly connected to 24V | ADC burned out | Must use voltage divider |
| Motor wires directly connected to GPIO | Arduino burned out | Use ESC |
| Level not converted | Raspberry Pi burned out | Must use level conversion module |
9. Checklist (Step 1: Desktop Static Verification, No One Seated)
Test in order; power on only after confirming no issues:
| # | Test | Expected Result |
|---|---|---|
| 1 | Battery → Fuse → ESC | ESC powers on with a beep |
| 2 | Level shifter connected | Raspberry Pi can see Arduino READY |
| 3 | Motor rotation | ESC signal connected to D9; Arduino output → motor spins |
| 4 | Emergency stop button | Pressed → motor stops |
| 5 | Headlights/LED strip | Controlled via web/button to turn on/off |
| 6 | Throttle pedal | A0 reading changes → motor speed adjusts |
✅ Only proceed to S2 (unmanned low-speed test drive) after all tests pass. See
powertrain_sizing.md§10.
Before wiring, please also read powertrain_sizing.md (powertrain sizing) and hardware_io_map.md (pin contract). If unsure about any wiring, ask first before proceeding.
Files by @RevolutionLA, at commit a7b0c9d, read from GitHub in your browser. Hardware license: MIT; software license: MIT. Robotheca doesn't review code: read it before running it.