
Disclosure: As an Amazon Associate I earn from qualifying purchases.
Four wheels, one camera, zero remote control. This car does not wait for instructions — it looks ahead with an ultrasonic sensor and decides for itself when to drive, when to stop, and when to turn. About four hours, about $151 in parts, and the moment it steers around the kitchen table on its own, the hobby clicks.
Get the full kit → jumps to the parts list. If you are starting from zero, read the starter-kit guide first. Good companions: the AI bird camera (Project 11) and the music-reactive LED strip (Project 04).
How a Car With No Remote Decides Where to Go
A self-driving car, even a kitchen-sized one, is a loop with three jobs: sense, decide, drive. The ultrasonic sensor fires a sound pulse forward and times the echo — that time is the distance to the nearest obstacle. The Python program reads the distance, picks an action, and tells the motor driver what to do, about ten times a second.
The decision itself is gloriously simple: if the road ahead is clear, drive forward. If something is closer than about 30 centimetres, stop, reverse a short distance, turn, and measure again. No map, no GPS, no plan — just a rule, repeated fast enough that it looks like thinking. That is the honest core of this build — and of every bigger robot.
The Pi never touches the motors directly: a GPIO pin gives about 16 milliamps at 3.3 volts, and a gear motor wants hundreds. So the Pi talks to a driver board, the driver talks to the motors, and a separate battery feeds the motors. Brain, muscle, separate power — that is the rule that keeps the Pi alive.
What You’ll Need
- A Raspberry Pi 4 Model B, 4 GB — ~$55 est. Enough memory for the camera stream and the driving loop. A Pi 5 works too, but it costs more.
- A 4WD robot car chassis kit — ~$28 est. Two plates, four TT gear motors, four wheels, and the screws — the whole rolling platform, geared for torque so the car crawls at a walking pace.
- An L298N motor driver board — ~$7 est. The classic dual H-bridge: two channels, one per side, with speed control. Old, inefficient, and still the right first driver.
- An HC-SR04 ultrasonic distance sensor — ~$6 est. The car’s eyes for distance. Buy the multi-pack.
- A Raspberry Pi Camera Module 3 — ~$25 est. The official 12-megapixel autofocus module, on the Pi’s CSI port. It records the drive.
- A 2-cell 18650 battery holder with switch — ~$14 est. Two 18650 cells give 7.4 volts — about 5.4 reaches the motors after the driver’s drop. Cells usually sold separately.
- A jumper wire kit, female-to-female and male-to-female — ~$6 est. Every connection in this build is a jumper wire. Get both genders in one kit.
- A 64 GB microSD card — ~$10 est. Raspberry Pi OS plus the camera recordings. Go 64 GB, not 32.
Total: ~$151 in parts, est. (November 2026). The software — Raspberry Pi OS, Python, Picamera2 — costs $0.
Step 1 — Build the Rolling Chassis (About an Hour)
Bolt the four TT motors to the lower plate, press the wheels onto the shafts until they seat, and sandwich the top plate on with the brass standoffs. Then mount the Pi on standoffs, high enough that no solder point or pin touches the metal below — a short against the chassis is the classic first-build failure, and standoffs are the prevention.
Route the motor wires up through the plate first, and keep every wire clear of the wheels — a wire that droops into a wheel wraps around the axle and stalls the motor. Mount the battery holder low and centred, the sensor on the front edge pointing straight ahead, and the camera on top looking forward. Then push the car across the floor: all four wheels should spin freely by hand.
Step 2 — Wire the Driver, the Sensor, and the Camera (About an Hour)
Wire the motors as two pairs: left on channel A, right on channel B, each pair in parallel. Each channel gets two direction pins and one enable pin — the enable pins take the PWM signal that sets speed. Polarity does not matter yet: the first test shows which side is backwards, and swapping two wires fixes it.
Power matters most. The 18650 pack connects to the L298N’s motor-power terminals and nowhere else. The Pi runs on its own supply — its USB-C adapter, or a power bank once rolling. Never power the motors from the Pi’s 5-volt pins, and never run the Pi from the L298N’s 5-volt output: its regulator spares about half an amp, and a Pi 4 with a camera wants far more. Two power sources, one shared ground wire between Pi and driver — skip it and the motors twitch, and you will spend an hour blaming the code.
One careful detail on the HC-SR04: it runs on 5 volts, and its echo pin returns 5 volts, but the Pi’s GPIO pins are 3.3-volt only. Put a voltage divider on the echo line — a 1k and a 2k resistor in series — and the sensor is safe. The camera is the easy one: ribbon into the CSI port, blue side to the board’s edge, clip locked down.
Step 3 — The Driving Loop: Sense, Decide, Steer (About Two Hours)
Flash Raspberry Pi OS with Raspberry Pi Imager, enable SSH and WiFi, and boot the Pi on the car. Then write the loop in Python: measure the distance — more than 30 centimetres, drive forward; less, stop, reverse half a second, turn, measure again. The gpiozero Robot class does most of the motor work in a few lines; the sensor reading is a dozen lines of timing. The whole program is under a hundred lines.
Test in stages. One motor the right way, then the other side, then both together with the wheels in the air. Then the sensor: hold your hand in front of it and watch the distance number fall. Only then put the car on the floor. The first drive will be clumsy — too fast into the turn, too close to the chair leg — and that is the tuning: slow the PWM, raise the stop distance, shorten the reverse. A car that creeps and turns early looks boring and works; one that charges and swerves hits things.
Start the camera recording before the drive, and the footage is the payoff: the kitchen from bumper height, the chair leg looming, the car stopping itself and turning away. That clip is the whole project in thirty seconds.
What NOT to Buy
- A Pi 5 for this job. The driving loop and camera stream are light work; a Pi 4 does them identically. A Pi 5 costs more for speed you will never notice at walking pace.
- A ready-made RC car to gut for parts. Toy steering is built for a remote, not for code: wrong motors, wrong geometry, a chassis that fights you. The bare kit is cheaper.
- A single 9-volt battery for the motors. A 9-volt sags to nothing the moment four gear motors ask for current: the car crawls, stalls, and browns out in one drive.
- A USB webcam instead of the Camera Module. A USB camera works, but it costs a port, adds latency, and burns CPU the driving loop needs.
- A second L298N “for the other two motors.” One board drives both sides. A second doubles the wiring and solves a problem you do not have.
The Total, Honestly
- Pi 4 (4 GB): ~$55 est. · 4WD chassis kit: ~$28 est. · L298N driver: ~$7 est. · HC-SR04 sensor: ~$6 est. · Camera Module 3: ~$25 est. · 18650 holder: ~$14 est. · Jumper wires: ~$6 est. · 64 GB microSD: ~$10 est.
- Total: ~$151 in parts, est. (November 2026). Already own a Pi 4 and a card? Then this is a ~$86 chassis-and-sensors project.
Build It This Weekend
Bolt the chassis, wire the driver with the motors in pairs, give the sensor its voltage divider, keep the Pi and the motors on separate power, and let the loop — sense, decide, steer — run the car. Start slow, stop early, film the first clean lap. Bench first: the chassis kit, the L298N, and the sensor.
Tomorrow’s build trades wheels for air: an indoor air-quality monitor that proves why the afternoon feels sleepy. The car is not finished either — next, a line to follow.
Where the series goes next: the AI bird camera (Project 11) shows what the same camera module does when it stays still, and the full project library holds everything built so far.