PhotoCar Raspberry Pi Zero Bluetooth Integration (v2)
Simple Architecture
The Pi should not be part of the high-current drive circuit. It should receive battery power only through a DC-DC buck converter and should talk to the Cytron board through three low-current signal wires.
- Motor lead identification. The drive motor is a wiper-style gear motor with a multi-pin harness (possible park switch/speed taps) plus two thick armature leads. Find the two leads that actually drive the motor; do not connect the park-switch harness to the MD25HV.
- The existing "30A 8-86VDC" module. Trace its input and output before reusing it. It may be a DC-DC converter, soft-start/inrush limiter, or switch — it is almost certainly not a charger. With a clean single-battery rebuild you may not need it at all; leave it out unless you confirm a purpose.
Complete Parts List
This list is intentionally conservative. It includes the small wiring and mounting parts that usually get missed.
Reuse From The Existing Car
| Part | Qty | Use | Notes |
|---|---|---|---|
| Cytron MD25HV motor driver | 1 visible | Motor power stage | Keep its existing motor and battery screw-terminal wiring if it already runs the motor correctly. |
| OVONIC X1 Ultra charger, XT60 leads, and power distribution | existing | Charging and wiring | The charger supports LiFe 1-6S, so it charges the new 4S LiFePO4 pack. Reuse the XT60 connectors and distribution hardware. The old 4S LiPo packs are retired from this build (keep them for other RC use). |
| 12 VDC gear motor and existing motor connector | existing | Drive motor | Leave motor wiring as heavy current wiring. Do not move motor current into small GPIO harnesses. |
| Enclosure, cable glands/pass-throughs, Wago-style lever connectors, wire loom | existing | Mounting and service wiring | Reuse where practical. Add strain relief where wires leave the box. |
Buy / Add
| Part | Qty | Minimum spec | Why it is needed |
|---|---|---|---|
| 4S LiFePO4 battery pack | 1 | 12.8 V nominal (14.6 V full), 10 Ah, with balance lead; BMS rated ≥20 A continuous discharge, or a bare RC LiFePO4 with high C-rating | Main power. 12.8 V matches the 12 V motor; 10 Ah keeps the ~6 A motor near 0.6C with stall headroom. Get XT60 (or adapt to the existing leads). |
| Raspberry Pi Zero 2 WH, or Raspberry Pi Zero 2 W plus soldered 40-pin male header | 1 | Bluetooth/BLE onboard, 40-pin header available | Zero 2 W is the better current choice. WH saves soldering. A Zero W/WH also works but has less CPU headroom. |
| microSD card | 1 | 16-32 GB, reputable brand | Raspberry Pi OS and control program. |
| 5 V DC-DC buck converter | 1 | Input range covering at least 8-20 V; output 5.1 V; 3 A or higher | Powers the Pi from the 12.8 V battery (max ~14.6 V). Any common 8-30 V module (LM2596, MP1584, etc.) works. Do not rely on the MD25HV 5VO output for the Pi. |
| Inline fuse holder and fuse for Pi branch | 1 | ATO/ATC, mini blade, or similar; 2 A fuse to start | Protects the small electronics branch if the buck converter or Pi wiring shorts. |
| Panel or inline power switch for Pi branch | 1 | Rated above battery voltage and branch current | Lets the Pi be powered down separately from the motor system for service. |
| Pre-crimped female 1-pin Dupont/JST-style leads | 20-40 | 22-26 AWG, 2.54 mm compatible for Pi header side | User preference: each conductor starts as a pre-crimped 1-pin lead, then gets loaded into housings. |
| 2.54 mm connector housings | assortment | 1x2, 1x3, 1x4, 2x2, 2x3, plus spare 1x1 | Build keyed groups from single leads: one Pi power plug, one motor-control plug, and optional camera/status plugs. |
| 2-position lever connectors or small terminal block | 2-4 | Rated for the branch current | Cleanly taps battery positive/negative into the buck input and gives service points. |
| 18 AWG red/black wire | 6-10 ft | Stranded copper | Battery branch to fuse, switch, and buck input. |
| 20-22 AWG red/black wire | 3-6 ft | Stranded copper | Buck 5 V output to Pi power connector. |
| 22-26 AWG signal wire or pre-crimp leads | 3-6 ft | Blue/yellow/green/black preferred | PWM, DIR, GND, and optional status signals. |
| Ferrules or fork/spade terminals for screw terminals | as needed | Match wire gauge and terminal style | Prevents loose strands at buck converter, terminal blocks, and power taps. |
| Heat shrink tubing | assortment | 2:1 or 3:1, small and medium sizes | Insulates splices, labels connector tails, and reinforces harness exits. |
| Adhesive cable tie mounts and small zip ties | 10-20 | Indoor electronics grade | Strain relief and separation between power wiring and signal wiring. |
| Plastic standoffs, M2.5 screws/nuts, or adhesive Pi mount | 1 set | Non-conductive mounting preferred | Mounts Pi above the enclosure floor so solder joints cannot short on debris or hardware. |
| Labels: heat-shrink labels, tape flags, or paint marker | 1 set | Readable after installation | Label both ends of every new connector: PI-PWR, MOTOR-A-CTRL, BUCK-IN. |
| Multimeter | 1 | DC voltage and continuity | Required for checking buck output before connecting the Pi. |
Optional PhotoCar Add-ons
| Part | Qty | Use | Include when |
|---|---|---|---|
| Raspberry Pi Camera Module plus Zero camera ribbon cable | 1 | Photos/video | Needed if the car should capture images. The Pi Zero uses the small CSI connector, so get the Zero-style cable. |
| USB OTG adapter or micro-USB hub | 1 | Setup/service | Useful for keyboard, USB serial, or Wi-Fi/Bluetooth debugging. |
| Low-voltage buzzer or LED status module | 1 | Status feedback | Use through a resistor or transistor driver. Do not power high-current indicators from GPIO directly. |
Budget Amazon Parts List
Prices below are budget target prices for Amazon US searches on June 4, 2026. Amazon prices and sellers move constantly, so verify the live price, shipping, reviews, and delivery date before ordering. Prefer listings shipped by Amazon or a reputable electronics seller for the Raspberry Pi itself.
Minimum Cart
| Amazon search / part | Qty | Target price | Budget pick notes |
|---|---|---|---|
| 4S LiFePO4 12.8 V 10 Ah pack (with balance lead) | 1 | $35-60 | The main battery. Confirm it is 4S LiFePO4 (12.8 V), has a balance/JST-XH lead for the OVONIC charger, and a BMS rated ≥20 A continuous (or a bare RC LiFePO4 with high C-rating). Add an XT60 pigtail if it does not match the existing lead. |
| Raspberry Pi Zero 2 WH | 1 | $28-40 | Best simple choice because the 40-pin header is already soldered. If Zero 2 WH is overpriced, buy Zero 2 W plus a 40-pin header, but only if you are comfortable soldering. |
| 32 GB microSD card | 1 | $5-8 | SanDisk, Samsung, Kingston, or Micro Center house brand are fine. Avoid the absolute cheapest no-name card. |
| 5 V 3 A adjustable buck converter (LM2596 or MP1584) | 1 pack | $7-12 | The 12.8 V LiFePO4 bus peaks at ~14.6 V, so any common 8-30 V module works (LM2596 and MP1584 are both fine). A 2-pack or 5-pack is cheaper per module. Set output to 5.1 V before connecting the Pi. |
| Inline mini blade fuse holder plus 2 A fuses | 1 pack | $6-10 | Many packs include 14 AWG pigtails and assorted fuses. Use a 2 A fuse for the Pi branch first; keep larger included fuses for other projects. |
| 12 V DC inline or panel rocker switch | 1 | $5-8 | Use for the Pi electronics branch. It does not need to switch motor current, only the fused buck converter branch. |
| 2.54 mm Dupont pre-crimped wire and housing kit | 1 kit | $11-18 | Look for a kit that includes individual pre-crimped female leads plus 1P, 2P, 3P, and 4P housings. This is the key kit for the requested connector style. |
| Lever connector assortment | 1 small pack | $8-13 | Only buy if the existing Wago-style connectors are not enough. Get 2-port and 3-port connectors rated for stranded wire. |
| 18 AWG red/black stranded wire | 1 roll pair | $9-14 | For the battery-to-fuse-to-buck input branch. Silicone wire is nicer but PVC hookup wire is cheaper and fine inside the enclosure. |
| 22 AWG stranded hookup wire assortment | 1 kit | $8-12 | Useful for signal extensions, labels by color, and optional LED/button wiring. The pre-crimp kit may cover this if its leads are long enough. |
| Heat shrink tubing assortment | 1 kit | $6-9 | Use at connector exits, splices, and label flags. Adhesive-lined is better for strain relief but costs more. |
| Adhesive cable tie mounts and small zip ties | 1 pack | $6-10 | For harness routing. Clean the plastic enclosure with alcohol before sticking mounts down. |
| M2.5 nylon standoff kit | 1 kit | $6-9 | Mount the Pi above the enclosure floor. Nylon is preferred because it will not short anything if hardware loosens. |
| Estimated minimum Amazon total | $129-206 | Includes the new 4S LiFePO4 pack. Assumes you already have the motor driver, charger, enclosure, main motor wiring, and basic tools. |
Tools And Consumables To Buy Only If Missing
| Amazon search / part | Target price | When to buy |
|---|---|---|
| Basic digital multimeter | $10-18 | Required if you do not already have one. You must verify buck output before connecting the Pi. |
| Wire stripper/cutter | $7-12 | Buy if you only have scissors or a knife. Clean stripped ends matter for screw terminals and lever connectors. |
| Ferrule crimping tool kit | $16-25 | Optional but good for buck converter screw terminals. Skip if you will use lever connectors and already have clean stranded-wire terminations. |
| Cable labels or label maker tape | $5-12 | Buy if you do not have masking tape and a marker. Label both ends of every new connector. |
Optional PhotoCar Add-ons
| Amazon search / part | Target price | Why it is optional |
|---|---|---|
| Raspberry Pi camera module plus Zero camera ribbon | $15-35 | Needed only if the car must capture photos/video. Make sure the ribbon cable is the narrow Pi Zero CSI cable. |
| Micro-USB OTG adapter | $4-7 | Useful for setup and rescue access. Not needed once Bluetooth/network setup is stable. |
| GPIO LED module or low-current status LED kit | $5-9 | Useful for boot/control status. Keep it low current and use a resistor or module designed for GPIO. |
GPIO And Connector Plan
Use BCM numbering in software and physical pin numbers for building the connector. The chosen pins avoid reserved ID pins and use GPIO18 for PWM because it has a common hardware PWM function.
Recommended Pi Header Assignments
| Signal | BCM GPIO | Physical pin | Wire color |
|---|---|---|---|
| Motor A PWM | GPIO18 | 12 | Blue |
| Motor A DIR | GPIO23 | 16 | Green |
| Signal GND | GND | 14 | Black |
| Pi 5 V power | 5 V | 2 and/or 4 | Red |
| Pi power ground | GND | 6 and/or 9 | Black |
| Optional status LED | GPIO24 | 18 | Yellow |
Housing Groups Built From 1-Pin Pre-Crimps
| Connector | Housing | Loaded pins |
|---|---|---|
J1 PI-PWR |
1x4 female housing on the Pi header's right column | Physical pin 2 = 5 V, pin 4 = 5 V, pin 6 = GND, pin 8 = empty orientation cavity. This avoids spanning both GPIO rows with a small power plug. |
J2 MOTOR-A-CTRL |
1x4 female housing on the Pi header's right column | Physical pin 10 = empty orientation cavity, pin 12 = PWM, pin 14 = GND, pin 16 = DIR. The empty pin 10 cavity helps prevent accidental offset insertion. |
J3 BUCK-IN |
1x2 lever/terminal connector | Battery branch positive after fuse/switch, battery negative. |
J4 AUX |
1x3 female housing | 3.3 V, GPIO24, GND for an optional low-current LED board or button. Do not connect this to 5 V devices. |
J1 PI-PWR plug can put 5 V onto a GPIO pin and kill the Pi. Prefer keyed/polarized housings (JST-XH or similar) for the power plug. If you must use Dupont, put a paint mark on pin 1, use matching heat-shrink labels, leave one intentionally empty cavity, and before plugging into the Pi use a multimeter to confirm 5 V and GND land on the correct cavities. Avoid a 2x2 housing directly on the Pi header unless it is part of a keyed adapter, because it can accidentally span the wrong row.
Detailed Wiring Plan
Power Wiring
- Disconnect all batteries before changing wiring.
- Choose a battery positive/negative tap point after the existing main switch/fuse if available. The Pi should turn off when the car is made safe, unless you intentionally want a separate electronics service mode.
- Run 18 AWG red from the positive tap to a 2 A inline fuse, then to the Pi branch switch, then to buck converter VIN+.
- Run 18 AWG black from the battery negative/common ground bus to buck converter VIN-.
- Double-check VIN polarity before energizing. Most buck modules have no reverse-polarity protection; a reversed input can destroy the module instantly. Adding a series Schottky diode or a polarity-protection MOSFET on the buck input is cheap insurance.
- Set the buck converter output to 5.1 V with a multimeter before plugging in the Pi. Set it under the actual battery voltage you will use, not on a bench 12 V supply, so the output holds at full pack voltage.
- Run buck VOUT+ to Pi physical pins 2 and 4, and buck VOUT- to Pi physical pin 6 using the
J1 PI-PWRhousing. Leave the physical pin 8 cavity empty as an orientation cue. - Mount the buck converter away from loose motor wiring and leave air space around it.
Signal Wiring
- Confirm the motor's two armature leads first. The wiper motor's multi-pin connector may include a park-switch or speed tap; only the two main drive leads belong on the MD25HV motor output. If the existing two-wire drive already works, leave that wiring alone.
- Run Pi physical pin 12 / GPIO18 to the MD25HV green screw terminal
PWMposition. - Run Pi physical pin 16 / GPIO23 to the MD25HV
DIRposition. - Run Pi physical pin 14 / GND to the MD25HV
GNDposition. This common ground is required so the driver can interpret the Pi's PWM and direction voltage. Keep this signal ground separate from the high-current motor return path; do not route motor current through the Pi GND wire. - Do not connect MD25HV
5VOto the Pi's 5 V pin when the buck converter is installed. The MD25HV 5 V output is limited to about 250 mA — fine for tiny logic/reference loads but not enough for a Pi Zero 2 W and accessories. - Route the signal harness along the enclosure wall, not across battery terminals or motor screw terminals.
- If signal wires must cross motor wires, cross at roughly 90 degrees and keep the run short.
Wire Gauge And Connector Rules
| Circuit | Recommended wire | Connector style | Concern |
|---|---|---|---|
| Main battery to MD25HV and motor | Keep existing heavy wire if it is intact; otherwise size for motor current, typically 12-14 AWG for short runs in this build class | Existing XT60, screw terminals, insulated crimp terminals | High current, heat, loose strands, vibration, and accidental shorts. |
| Battery branch to buck input | 18 AWG stranded | Inline fuse, switch, ferrules/terminal block | Must be fused near the tap point because it is fed by a large battery. |
| Buck output to Pi | 20-22 AWG stranded | 1x4 right-column housing at Pi; screw/ferrule at buck | Voltage drop and connector looseness. Keep short and mechanically supported. |
| Pi GPIO to MD25HV | 22-26 AWG pre-crimp leads | 1x4 housing at Pi side; individual Dupont or screw terminal/ferrule at driver side as needed | Noise pickup, reversed connector, no common ground. |
Assembly Steps
1. Bench-test the Pi before installing it
Install Raspberry Pi OS Lite and enable Bluetooth.
Pair the controller or phone while on USB bench power.
Test GPIO output with LEDs or a meter before touching the car wiring.
2. Mount the Pi and buck converter
Vacuum debris from the enclosure before mounting electronics.
Mount the Pi with standoffs or an insulated carrier plate.
Place the buck converter close enough to keep 5 V leads short.
3. Add the fused buck branch
Install the fuse close to the battery tap, not next to the Pi.
Verify buck input polarity before connecting batteries.
Set buck output to 5.1 V before plugging into J1 PI-PWR.
4. Build the GPIO harness from 1-pin pre-crimp leads
Insert pre-crimped leads into the housing in the same order as the wiring table.
Use the spare cavity as a visual orientation cue.
Label the harness before plugging it into the Pi.
5. Connect to the MD25HV control pins only
Use the MD25HV green 4-position control screw terminal (GND, 5VO, PWM, DIR), not the heavy motor screw terminals.
Keep the existing motor screw-terminal wiring intact.
After plugging in, check continuity from Pi GND to MD25HV GND.
Plain Checklist
- Bench-test Pi OS, Bluetooth pairing, and GPIO output.
- Disconnect all batteries and verify zero voltage before working inside the car.
- Mount the Pi on non-conductive standoffs and mount the buck converter nearby.
- Add a fused, switched battery branch to the buck converter input.
- Set buck output to 5.1 V with a multimeter.
- Build
J1 PI-PWRandJ2 MOTOR-A-CTRLfrom individual 1-pin pre-crimped leads. - Connect Pi GPIO18 to MD25HV PWM, GPIO23 to DIR, and Pi GND to MD25HV GND.
- Tie and label every harness so nothing can rub on screw terminals, XT60 plugs, motor shafts, or enclosure edges.
- Power the Pi branch with the MD25HV disconnected or motor disabled first. Confirm the Pi boots cleanly.
- Reconnect motor power and test at very low PWM duty cycle with the car lifted so wheels cannot drive away.
Software Control Notes
The simplest software design is a small Python service: Bluetooth input sets a target speed and direction, and the service outputs PWM on GPIO18 (1-20 kHz) plus direction on GPIO23. Add a command timeout so the motor stops if Bluetooth drops.
On boot, set PWM duty cycle to 0 before enabling any movement. On Bluetooth disconnect, command PWM to 0. On program crash, use a systemd restart policy but keep the default GPIO state safe.
Run motor tests with the car lifted and limit PWM to 10-20% until direction, braking, and stop behavior are confirmed.
Motor Logic
| Pi output | MD25HV meaning | Build note |
|---|---|---|
| PWM low / 0% duty | Brake/stop | Use this as fail-safe output. |
| PWM active, DIR low | Forward, depending on motor polarity | If physical direction is backward, swap motor terminals or invert DIR in software. |
| PWM active, DIR high | Backward, depending on motor polarity | Test slowly with wheels off the ground. |
Final Inspection Before Driving
Main pack fuse present close to the battery output, Pi branch 2 A fuse close to its tap, buck output verified at 5.1 V, buck input polarity confirmed (reverse-polarity protection if added), an accessible hardware main disconnect/e-stop, no exposed positive terminals, battery wires cannot pull loose, and charger wiring kept separate from runtime Pi power.
GPIO connector orientation marked, no 5 V on signal pins, Pi ground and MD25HV ground common, spare connector cavities labeled.
Pi is mounted on standoffs, harnesses have service loops, wires are tied away from motor shafts and enclosure edges, lid can close without pinching wires.
Troubleshooting
| Symptom | Likely cause | Check |
|---|---|---|
| Pi will not boot from car power | Buck output wrong, fuse open, voltage sag, reversed connector | Measure 5.1 V at the Pi connector before plugging in. Check fuse and polarity. |
| Motor does not respond but Pi runs | No common ground, wrong MD25HV input pin, PWM not running | Continuity from Pi GND to MD25HV GND; meter GPIO18 while commanding speed. |
| Motor runs opposite direction | Motor polarity or DIR convention reversed | Invert DIR in software or swap MD25HV motor outputs MA/MB. |
| Pi reboots when motor starts | Buck converter sag/noise, shared weak connector, power branch too close to motor wiring | Shorten 5 V leads, use a higher quality 5 V 3 A buck, improve ground and routing, keep signal/power separated. |
| Bluetooth disconnects inside enclosure | Antenna blocked by battery/wire bundles or noisy power | Move Pi so the antenna end is not buried under battery leads; test with lid open and closed. |
Sources Checked
- Raspberry Pi hardware documentation: 40-pin GPIO header, 3.3 V GPIO behavior, and warning not to connect motors directly to GPIO.
- Raspberry Pi Zero 2 W product brief: Bluetooth 4.2/BLE, 40-pin GPIO footprint, dimensions, and 5 V DC 2.5 A input power guidance.
- Cytron MD25HV product page: 25 A 7-58 V high-voltage DC motor driver.
- Cytron MD25HV datasheet mirror: PWM/DIR pin functions, 5 V output limit, logic thresholds, truth table, and protection behavior.