Each corner is a differential swerve module, where two N20 motors drive two stacked ring gears. Turn them together and the module steers. Turn them in opposite directions and the wheel drives. Both motors stay on the chassis, so a module can keep rotating forever without needing a slip ring.
System overview
I wanted to get past simulation and FEA and have something real: a drivetrain I printed, running on a board I designed. The testing section lists everything I tested on it.
The hard problems
The biggest problem is that steering and driving are coupled. Every wheel movement is a mix of two motor speeds, so one geartrain has to give a useful steering speed and a useful wheel speed at the same time (gear ratios, torque). On top of that, nothing holds the steering angle. There's no steering encoder, so the robot works out the wheel angle from motor timing plus a hall-sensor check, and the wheels drift. The simulator assumes about 3° a second. On the real robot, one wheel swung 45° in a single turn (fault log).
Then there's the fact that the gears are printed. They're 1 mm module PLA teeth, and they have to survive a jammed module with both motors stalled (tooth strength). Getting eight motors, two boards, a Pi, a LiDAR and a battery into a 352 mm chassis that's bigger than my print bed, without any wires crossing a steering joint, took a lot of iterations. And the electronics kept dying. I had four driver or board failures in two weeks before I added hard firmware limits and sorted out the wiring.
The software runs on three chips. The Pi 5 reads the LiDAR and camera, builds an obstacle map and a map of people, plans a route, and picks a driving direction by sweeping the robot’s footprint along each option. The ESP32 runs the eight motors with timed steering and checks every command against hard limits. The RP2040 holds the camera’s tilt angle using an AS5600 sensor. The red path in the drawing is the safety layer. It reads the raw LiDAR scan rather than the map, and goes straight to the motor controller.
Mechanical configuration
The robot is 352 mm across. It has four identical swerve modules in a printed clover-shaped chassis, a centre bay for the battery, controller board and Pi, a centre cap that carries the RPLIDAR C1, and a camera tilt head on one corner.
Parts list (11 assemblies)
| No. | Assembly |
|---|---|
| 1 | LiDAR |
| 2 | Centre cap P27 |
| 3 | Pi 5 + controller board |
| 4 | Electronics tray P06 |
| 5 | Battery cradle P07 |
| 6 | Frame P02 (x4) |
| 7 | Swerve module 1 |
| 8 | Swerve module 2 |
| 9 | Swerve module 3 |
| 10 | Swerve module 4 |
| 11 | Camera tilt head |
Mechanical design
I modelled the whole thing in Fusion 360. It's 139 components: 27 custom printed parts (most used several times) plus reference models of every bought part, so I could check fits and wire routes before printing anything. Every part is jointed and has a part number and version (P13 ring gear, P27 v16 centre cap), which keeps the print files, the model and this page in sync. Here's the current assembly, as of November:
Design constraints
Every wheel had to steer and drive, so it could point in any direction while rolling. I didn't want a slip ring, so both motors stay fixed to the chassis and a module can spin forever without twisting any wires. Everything also had to be printable. The robot is bigger than my bed, so the chassis comes in pieces, and every gear is 1 mm module PLA. I also wanted to be able to plug in the Pi's USB, the ESP32's USB-C and the power without taking anything apart. The targets were 1 m/s cruise, 1 m/s² acceleration and a 180° module turn in 0.3 s (design targets).
The differential swerve module
All four corners use the same module. Two large ring gears (P13) sit one above the other. Each has 112 teeth round the outside for its motor pinion and 92 teeth on its face that mesh with the axle gear. When both rings turn the same way, they carry the axle gear round without spinning it, so the module steers. When they turn opposite ways, the axle gear spins and the wheel drives.
Each motor drives its ring through a 15-tooth pinion (a 7.47 : 1 reduction), and each ring face drives the 16-tooth axle gear (a 5.75 : 1 step-up). The ratio maths, and why the reduction sits on the ring stage, is in gear ratios.
The wheel axle runs in two printed bearing brackets (P12) bolted to the swerve base (P11), so when both rings turn together the whole wheel assembly gets carried round. The stacked ring gears run on their own bearing surfaces, which you can see cut in the section below.
Parts list (13 parts)
| No. | Part |
|---|---|
| 1 | Top cover P04 |
| 2 | Inner frame P03 |
| 3 | Upper ring gear P13 |
| 4 | Lower ring gear P13 |
| 5 | Motor pinion P14 (x2) |
| 6 | N20 motors (x2) |
| 7 | Bearing brackets P12 (x2) |
| 8 | Axle gear P15 |
| 9 | Axle end cap P16 |
| 10 | Wheel, hex hub, insert, spacer P17-19 |
| 11 | Swerve base P11 |
| 12 | Hall sensor fixture P09 |
| 13 | Bottom base P01 |
A couple of details came from printing. The pinions (P14, now v5) have a ribbed D-shaped bore that grips the N20 shaft without a grub screw, and I thinned their teeth by 0.15 mm so the mesh runs freely in PLA.
Chassis
At 352 mm across, the robot is bigger than my print bed, so I split the chassis into four identical frame pieces (P02) that join at the corners, with a four-piece bottom base (P01) underneath. The inner frames (P03) have ribs, cable ledges and vents. The top covers (P04) screw down into each ring hold-down, and corner brackets (P47) tie neighbouring covers and the frame joint together so the four quarters act as one stiff part.
Centre bay
Everything electrical lives in the middle, in three printed layers. The battery cradle (P07) at the bottom has a pocket for the in-line fuse next to the LiPo. The electronics tray (P06) above it holds the Pi 5 and my controller board, and it's left open under the board so the solder joints and connectors have room. The centre cap (P27) on top holds the LiDAR in a tapered well. It has honeycomb vents on the top and sides, plus windows lined up with the Pi’s USB, the ESP32’s USB-C and the power plug.
Camera tilt head
The camera sits on a head that tilts up and down, so the robot can look at someone’s feet when they’re close and their face when they’re across the room. The joint came out of my quasi-direct-drive gripper project. I took its printed planetary gearbox, resized it (4.8 : 1 instead of 6 : 1) and turned it into this tilt joint.
Parts list (13 parts)
| No. | Part |
|---|---|
| 1 | Head mount P30 |
| 2 | N20 gear motor |
| 3 | Motor mount P32 |
| 4 | Sun gear P34 |
| 5 | Planet gears P35 (x3) |
| 6 | Housing + ring gear P31 |
| 7 | Planet carrier P33 |
| 8 | 6704 bearing |
| 9 | Camera cradle P36 |
| 10 | IMX296 camera + lens |
| 11 | Pivot pin P36b |
| 12 | AS5600 sensor |
| 13 | Tilt board + tray P43 |
An N20 gear motor drives a 15-tooth sun gear. Three 21-tooth planets roll round a 57-tooth ring printed straight into the housing, and the planet carrier is the output (tilt ratio). The motor already has its own gearbox, so this stage isn't there for torque. It slows the head down for fine control and keeps the joint stiff. The sun’s bore has small ribs that grip the motor’s D-shaft, so it doesn't need a grub screw.
Camera, pivot and mount details
The camera is a global-shutter IMX296 with a 6 mm lens, screwed into a printed cradle on four M2 standoffs. The carrier, running in a 6704 bearing, turns the cradle from one side. On the other side a printed pivot pin locks into a hex socket in the cradle and turns in a printed bore. The pin carries a small magnet right in front of an AS5600 sensor, so the head always knows its real angle (about −28° to +58°) instead of guessing from motor time like the wheels do.
A printed mount bolts the head to one corner of the chassis and holds the AS5600 board on four screws with locators, so the sensor lines up with the magnet every time. Behind it, the tilt board clips into a tray. An RP2040-Zero on the board reads the sensor and runs the motor through a TB6612 module. The firmware caps the power at 6 V so the 6 V motor can’t be overdriven again (see fault log).
Materials
Every custom part is printed in PLA, gears included. The tooth-stress check gives a safety factor of 2.5 against PLA’s strength across its layers, so the gears don't need metal inserts. The mass budget treats the printed parts as solid (100 % infill), which makes it an upper bound.
Engineering calculations and validation
Before printing anything I wanted numbers. Everything below comes from my design script, swerve_design_calcs.py, which reads the tooth counts and part volumes from the final Fusion parameters. Anything I've called assumed or nominal still needs replacing with a real measurement.
Design targets
Design targets
Every other number comes from three targets. The RPLIDAR C1 scans at 10 Hz, so at 1 m/s the robot moves 10 cm between scans. I added 1 m/s² of acceleration and a 180° module turn in 0.3 s, which works out to 100 rpm at the module.
acceleration a = 1 m/s²
steering: 180° in 0.3 s → 100 rpm module speed
Gear ratios
Both motors feed both jobs, so one geartrain has to give a sensible steering speed and a sensible wheel speed at the same time. With every gear at 1 mm module the pinion sits 63.5 mm from the ring centre. Ignoring slip and backlash, with nA and nB as the two motor speeds:
ωwheel = 0.77 · (nA − nB) / 2 ωsteer = 0.134 · (nA + nB) / 2
So the wheel turns at 0.77× motor speed and the module steers at 0.134×. I put the reduction on the ring stage because that's the stage doing the steering, and the 92 : 16 step-up brings the wheel back up to a useful speed. The catch is that any mismatch between the two motors shows up as steering, which is exactly why the wheels drift.
Mass budget and wheel load
Mass budget and wheel load
Mass sets the force needed to accelerate and the grip at each tyre. For printed parts I took the CAD volume at solid PLA density (1.24 g/cm³), so it's an upper bound. Bought parts use nominal weights: 80 g of N20 motors, 140 g of wheels, 110 g for the RPLIDAR, 130 g for a ~1500 mAh 3S LiPo, 46 g for the Pi 5, 30 g for the ESP32 and controller, and 80 g of bearings, screws and wiring.
Wwheel = m g ÷ 4 = 1.62 × 9.81 ÷ 4 = 4.0 N
That's 1.62 kg and 4.0 N per wheel, and the eight ring gears alone are about 200 g of it. Because it's an upper bound, the torque margins below are on the safe side.
| Part | Mass |
|---|---|
| Chassis (bases, frames, covers) | 431 g |
| Swerve module printed parts, x4 | 490 g |
| Centre bay (tray, battery frame, cap) | 85 g |
| Bought parts (motors, wheels, LiDAR, battery, Pi, controller, hardware) | 616 g |
| Total | 1.62 kg |
Torque and speed
The motors are 12 V N20s rated at 1600 rpm no-load, on 75 mm wheels. There's no stall torque on the datasheet, so I assumed 105 mN·m, plus a rolling resistance of 0.03 and 60 % drivetrain efficiency.
Tmotor = F r / 4 · 0.77 / 2 = 7.6 mN·m (r = 37.5 mm)
nmotor = 331 rpm (cruise) + 747 rpm (steer) = 1077 rpm
7.6 mN·m is only 7 % of the assumed stall torque (12 % with losses), so torque isn't the problem. Speed is closer: cruising and steering together need 1077 rpm, 67 % of the rated 1600 (73 % of the 1480 rpm you get on an 11.1 V pack). The odd part is that at 1 m/s the motors run at only 21 % of no-load speed, which makes PWM control coarse. I kept the 1600 rpm N20s for this build. A 600 rpm N20 I modelled would cruise at about 55 % of its speed with roughly 2.7 times the torque.
Will printed teeth survive a stall?
I didn't want the teeth to be the weak point, so I checked the worst case: a module jams and both motors stall. Using the assumed 105 mN·m stall torque, a Lewis form factor of 0.29, 7 mm face width and 1 mm module, with PLA at about 30 MPa across the layers and 50 MPa along them:
σLewis = Ft / (b m Y) = 14 / (7 · 1 · 0.29) = 6.9 MPa
SF = 30 MPa / 12 MPa (FEA peak) = 2.5
The FEA came out higher than the hand calc, at 12 MPa, because it picks up the stress concentration at the root fillet. That still leaves a safety factor of 2.5 in the weakest print direction and 4.2 along the layers. In practice the tyre gives up first anyway. At stall the wheel could push 7.3 N, but grip is only 0.8 × 4.0 = 3.2 N, so the full stall load only reaches the teeth if a module physically jams. That's why the gears are plain printed PLA with no metal inserts.
Structural FEA
Structural FEA
The bearing brackets (P12) and swerve base (P11) carry the wheel load into the chassis, so they have to survive bumps and drops. I loaded each module with 15 N, 3.8 times the static wheel load.
bearing bracket: peak 1.55 MPa, 0.008 mm deflection
swerve base: peak 0.82 MPa, 0.009 mm deflection
Both are far below what printed PLA can take, so they're overbuilt. I've left them as they are for now, but there's weight to take out later.
Tilt ratio and interference checks
Tilt head planetary ratio
The N20 already has its own gearbox, so this stage is for fine, stiff positioning rather than torque. The sun is driven, the ring is printed into the housing and the carrier is the output. It's the gripper gearbox, resized from 6 : 1:
Interference checks
I ran interference checks across the whole assembly every time a part changed. The only contacts left are deliberate ones, like screw threads in their holes and header pins in their sockets.
Electronics and control
The control system is split across three processors. The Pi 5 does perception and planning. The ESP32 on my controller board runs the eight motors and enforces the safety limits. Its command guard has a watchdog, holds long full-power pushes to 80 %, and makes every motor command time out on its own. The wheels have no steering encoders, so steering is timed, and each wheel gets re-checked against a hall sensor and magnet. Only the camera head has an absolute angle sensor (the AS5600). The Pi talks to the ESP32 over USB, and wheel angles and speeds come back over serial to the Pi’s position estimate.

Perfboard prototype
Before ordering a PCB, I proved one module on a hand-wired perfboard. It had an ESP32, one TB6612FNG driver, both motors for the module and the hall input, laid out hole by hole so the pin mapping matched the final PCB. The test firmware runs the motors at 20 kHz PWM (above hearing, so there's no whine), ramps the speed up instead of jumping (to full duty over 250 ms), stores calibration in flash and takes test commands over USB serial. The mixing function below is the core of it. After three bring-up faults the module drove and steered on command, which proved the differential drive worked on real hardware.
MixingsetModule
void setModule(int m, float drive, float steer) {
// same sign on both rings = module spins in place
// opposite signs = wheel drives, module stays pointed
setMotorPct(2 * m, drive + steer);
setMotorPct(2 * m + 1, -drive + steer);
}
Each module is two motors. Same number on both rings and it steers. Equal and opposite and the wheel just drives.
Perfboard layout and wiring photos
Custom PCBs
Hand-wiring four drivers would have meant two stacked perfboards and dozens of solder links, so I designed a controller PCB in KiCad instead. It's 33 × 88 mm and two layers, with the ESP32, four TB6612FNG drivers for the eight motors, JST-PH sockets for the motors and hall sensors, and a 12 V input with bulk decoupling. I autorouted it with Freerouting, added ground pours and a motor-power pour, and checked every net against the firmware pin map. It passes DRC with zero errors and zero unconnected nets, and the USB port lines up with the slot in the printed cap. PCBWay made it with the drivers and passives already assembled, and I soldered on the sockets and plugs. I'm now designing a brushless successor, the Swerve HAT v3 (next board).
- Board
- 33 × 88 mm, 2 layers
- Motor drivers
- 4 TB6612FNG, 8 channels
- Controller
- ESP32 on headers
- Design checks
- 0 DRC errors, 0 unconnected
Full copper layers, both sides, and the bay render
Here's each board as raytraced in KiCad’s 3D viewer, next to the real thing. The tilt-head board carries an RP2040-Zero and a TB6612FNG module for the camera.
Software and autonomous navigation
Finding people runs on the real robot. The navigation tuning and the 200-room RL comparison come from my simulator, and I’ve also run the RL policy on the real robot.
Finding people
The camera tells the robot which direction a person is in, and the LiDAR tells it how far away the nearest thing is in that direction.
When it’s told to find people, the robot turns on the spot while a YOLO11n detector runs on the Pi 5 at about 17 frames a second. Each detection is a box in the picture. The lens model turns the box centre into a direction relative to the robot, and the LiDAR scan gives the distance along that direction. That point goes onto the live map as a person. It took a few fixes to get right (one person kept turning into several, see the fault log).
The five things I changed to stop it seeing ghosts
First, a sighting has to last. Someone only counts as found after about 0.7 s of pictures (12 frames at 17 fps), so one bad frame can't add a person. A new detection also joins an existing person if it's close on the map, or within 9° and at a similar distance, which fixed one person turning into several.
The edges of a wide lens bend too much to trust, so anyone more than 52° off the lens axis is ignored until the robot has turned towards them. To make the angle maths hold up, the camera measures its own lens. While the robot turns, it checks how far the picture slides for each degree of turn (the LiDAR gives the true angle), in the middle and near the edges. That gives a two-number lens model that works for normal, wide and fisheye lenses, so I can swap the lens without breaking anything.
The last fix was for people standing close. If the box is cut off at the top and bottom, the person is close, so a LiDAR hit far behind them (the wall) isn't taken as their distance.
Low obstacles from camera depth, in simulation
The camera also watches the floor for low obstacles the LiDAR’s scan plane misses (a shoe, a cable, a toy). A small depth network, MiDaS, estimates distance from a single frame. It works in the simulator, but on the real robot it's still the LiDAR safety layer that stops it.
Navigation tuning in simulation
To tune the driving without wearing out the robot, I built a simulator that copies its flaws: wheels that drift 3° a second, steering that's timed rather than measured, and stops to re-check each wheel on its magnet. The real driving code runs against it unchanged. Here are 42 point-to-point trips across three simulated rooms, before and after a round of tuning:
| Measure | Before | After |
|---|---|---|
| Average time per trip | 34.3 s | 30.0 s (12.5 % faster) |
| Average miss at the goal | 7.4 cm | 4.1 cm |
| Worst miss at the goal | 11.7 cm | 8.5 cm |
| Stops to re-check a wheel (about 5 s each) | 118 | 70 |
| Collisions | 0 | 0 |
Every change also has to pass 18 behaviour scenarios in the simulator (doorways, a 50 cm corridor, a U-shaped dead end, a person walking across, the LiDAR unplugged mid-drive). All the results are in the results section.
Hand-written planner vs reinforcement learning
Could a learned driver beat my hand-written planner? I trained a PPO policy in simulation and ran both through 200 random rooms behind the same safety layer.
| Planner | RL policy | |
|---|---|---|
| Reached the goal | 94 % | 84.5 % |
| Median time to goal (rooms both finished) | 8.5 s | 7.6 s |
| Rooms where it passed closer than 3 cm | 0 | 31 |
| Collisions | 0 | 0 |
The policy is about 11 % faster when both succeed, but it reaches the goal less often and cut within 3 cm of something in 31 rooms, so the hand-written planner stays in charge.
Training setup, example rooms and reasoning
I trained the policy with PPO, running 4,096 simulated robots at once for 131 million steps, which took roughly half an hour on a Hugging Face GPU. The simulator randomised rooms, wheel lag, slip, LiDAR noise and command delay so it couldn’t overfit one world. The policy sees 72 LiDAR ranges plus the goal, and outputs the same velocity command as the planner. Then both drove 200 random simulated rooms behind the same safety layer:
The policy is about 11 % faster when both succeed, but it reaches the goal less often and in 31 rooms it cut within 3 cm of something. The planner never came closer than 39 mm. I've since run the policy on the real robot as well, and it worked.
Prototyping and iteration
Most parts went through several versions once they met the real world, and two weeks of testing turned up ten real faults. I found them on the robot with a multimeter, screen recordings and the robot’s own logs.
Mechanical redesigns
| Part | Change | Why |
|---|---|---|
| Module fixtures | Two internal fixtures became three, plus an internal rail | The first print locked up as the bottom ring caught the top one, and motor wires could get pulled into the mesh |
| Motor pinion P14, v2 to v5 | Teeth thinned 0.15 mm, open top, ribbed D-bore with a lead-in | A freer mesh in PLA, and a grip on the motor shaft with no grub screw |
| Centre cap P27, v8 to v16 | 15 mm taller, wider walls, LiDAR well, honeycomb vents, port windows, stronger screw strip | The wiring didn't fit, the Pi needed air, and I wanted to plug in without opening it |
| Top cover P04, v3 | Screws into the ring hold-down | The covers needed to be tied to the structure, not just resting on it |
| Electronics tray P06 v8, battery cradle P07 v4 | Open under the controller board, fuse pocket, a fifth screw | Room for solder joints and the fuse, and a stiffer stack |
| Camera cradle P36, v5 to v7 | Refitted for the IMX296, screw holes turned 60° with 4 mm driver holes | A screwdriver couldn't reach the original screws |
| Pivot pin P36b, v3 to v6 | 7.6 mm journal and a pocket for a round 5 × 2 mm magnet | To use the magnet I had for the angle sensor |
| Tilt board tray P43, v6 | Clips and solid pins instead of screws | Quicker to assemble and nothing to strip |
Perfboard bring-up
Getting the single-module perfboard running meant chasing three faults: a USB-C power quirk, a solder bridge on the serial pins, and a resistor across the driver’s signal pins.
Fault log: what broke, and how I fixed it
The robot had ten faults in its first two weeks of testing. These three taught me the most:
15 Nov · It slid instead of turning
This is the mechanism’s core weakness. Nothing locks a differential swerve wheel’s angle, and this fix shaped how the robot turns.
- Symptom
- The first real people search stopped with “it slid 35 cm instead of turning”. Wheel 2 had swung 45° off.
- Cause
- Turning on the spot scrubs the tyres round a tight circle, and nothing holds a differential swerve wheel’s angle except the balance of its two motors.
- Fix
- The robot re-sets the wheels on their magnets during the turn (or as soon as the LiDAR sees it slide 6 cm) and learns a small steering correction for each wheel.
- Result
- Later turns need fewer stops.
13 Nov · The tilt motor driver smoked
A rating mismatch between the motor, battery and driver. The firmware now enforces the limit.
- Symptom
- During the first tilt-head tests the driver on the tilt board smoked and took the RP2040 with it.
- Cause
- The tilt motor is a 3 to 6 V N20, but my test scripts could push it at up to 100 % of a 12.6 V battery, and a stalled motor at double its voltage pulls more than the TB6612’s 1.2 A.
- Fix
- I added a hard 6 V cap in the head’s firmware (power limited to 6 ÷ battery volts, whatever is asked for), a soft start and a stall stop, and retired the uncapped test scripts.
18 Nov · It rebooted whenever a wheel passed its magnet
The pattern gave it away. Three sensors caused it and one didn’t, which pointed to one header row.
- Symptom
- The ESP32 restarted each time hall sensors 1, 3 or 4 saw a magnet, but never sensor 2.
- Cause
- A solder blob joined the ESP32’s reset pin to the hall-3 input on the header row next to it.
- Fix
- I found the blob and removed it.
- Result
- The restarts stopped.
Seven more faults, in date order
15 Nov · …and the replacement died toomultimeter diagnosis
- Symptom
- The head stopped moving both ways.
- Diagnosis
- With a multimeter, I found the battery, the supply at the driver and the control signals were all there, but nothing reached the motor plug.
- Cause
- The driver’s output stage was dead after many stalls at the 6 V limit.
- Fix
- I cut the stall stop to 0.4 s, added a 4 s cool-down between retries, made it give up after three stops, and fitted a replacement tilt board.
- Result
- I bench-tested the replacement from the Pi and recalibrated it on 21 Nov.
15 Nov · One person, seven peoplelens self-measure
- Symptom
- The live map listed seven people when only I was in the room.
- Diagnosis
- The camera picture showed the ceiling, a fan and a window at once.
- Cause
- The lens was far wider than the 45° the code assumed, so every frame put me in a different direction.
- Fix
- The camera now measures its own lens while the robot turns, using the LiDAR’s turn angle as the reference. A person has to be seen for 0.7 s before they count, and nearby sightings merge.
16 Nov · The motor drivers burned on the controller boardfirmware v7.4 limits
- Symptom
- During setup after a rebuild, the drivers on the main board burned out, which meant a new board and a new ESP32.
- Cause
- Most likely the ESP32 sat low enough to touch the drivers. Going through the firmware, I also found that a motor command with no time limit ran forever, and nothing limited a stalled motor at full power.
- Fix
- Firmware v7.4. Every motor command now ends by itself (30 s at most), long full-power pushes are held to 80 %, and the Pi stops when the wheels push but the LiDAR shows no movement.
19 Nov · Stuck beside a box for two minutessix causes in the code
- Symptom
- In a screen recording, 1.4 m from me, it kept stopping to re-check wheels that were only 7 to 9° out, and the planned route flipped between scans.
- Cause
- Six causes in the code, including a wheel re-check due every 4 s and a route planner that counted the stops for wheel checks as “not making progress”.
- Fix
- The robot now trusts the LiDAR’s position fix between checks, holds a direction while it’s still clear, stops counting wheel stops as lost time, and gives up after 45 s with no progress to try another side.
19 Nov · A flat battery that looked like a software buglow-battery note
- Symptom
- The next run went back and forth and gave up. The wheels pushed 35 cm but the robot only moved 7.
- Cause
- Nothing was wrong in the code. The battery was nearly flat.
- Fix
- The robot now notices when it makes under 55 % of the speed it should and says the battery is probably low.
19 Nov · The ESP32 didn’t start at power-onUSB restart
- Symptom
- “No ESP32 found”, even with only the ESP32 plugged in. Pressing its reset button brought it back.
- Fix
- The robot tool now restarts the ESP32 over USB, captures its start-up message and says exactly what’s wrong instead of guessing.
22 Nov · A dead hall socket, then a shortnew board
- Symptom
- Hall socket 4 stopped working (the sensor was fine in another socket).
- Diagnosis
- Its 5 V pin had no continuity, so the track was broken.
- What went wrong next
- My workaround moved the sensor to pin D15, but that pin is read at boot, so flashing failed. Later, a jumper near the 3V3 and GND header pins shorted them. The board scorched and two ESP32s died.
- Fix
- A new board and the original firmware.
- Lesson
- Measure resistance both ways before refitting an ESP32, and keep wires well away from the power pins.
Physical testing and results
Tested on the robot
- All four modules driving and steering after the PCB build
- Eight-step self-calibration (clips below)
- Turning on the spot, scanning with the camera, marking each person on a live map and driving to them round furniture (video at the top)
- Firmware command limits (v7.4) and the LiDAR safety layer
- The RL policy driving the real robot (planner vs RL)
- YOLO11n person detection at about 17 frames a second on the Pi 5
- Camera tilt range about −28° to +58°, read from the AS5600
- One module on the perfboard, before the PCB (perfboard)
- Steering repeatability ±1.2°, 65 min battery runtime, 32 °C motors, 1.7 kg payload (results)
In simulation
- Navigation tuning, 42 point-to-point trips (navigation results)
- 18 behaviour scenarios
- 24 random cluttered rooms with a realistic base (below)
- Planner vs RL comparison over 200 rooms (planner vs RL)
- Camera depth estimate for low obstacles (depth estimate)
Build and calibration on the real robot
With the PCB done, I printed and assembled the rest: four modules, the chassis, the centre bay with the Pi 5, the battery and the LiDAR, and the camera on its tilting head with its own RP2040 board. A robot that steers by timing has to be measured before it can drive, so the robot tool on the Pi walks through eight setup steps: motor and hall checks, steering direction, homing each wheel on its magnet, timing how fast each module steers, drive balance, floor checks with the LiDAR, and calibrating the tilt head. The clips below are from 18 and 21 November, filmed on my phone and sped up.
Uncut run, real time
- Footage
- Unedited phone video, 78 s at normal speed, 18 Nov
- What happens
- The robot turns on the spot, then drives across the living room. Partway through, someone walks past the camera and a box appears on the floor.
- Why it’s here
- The clip at the top of the page is sped up 3×. This one shows the real pace with no cuts.
- Status
- Tested on the robot
Performance results
Hardware measurements come first, then navigation results from my simulator (which copies the real base’s flaws: wheel drift, timed steering, magnet re-checks, LiDAR noise, wheel slip), then the design calculations.
| Measure | Result | Source |
|---|---|---|
| Steering repeatability at the magnet | ±1.2° | Measured on the robot |
| Wheel drift between magnet checks | 5.1° | Measured on the robot |
| Battery runtime | 65 min average | Measured on the robot |
| Motor temperature | 32 °C after a full run (about 7 min, including the start-up calibration) | Measured on the robot |
| Payload | 1.7 kg, adding weight until the robot’s agility and movement visibly changed | Measured on the robot |
| Point-to-point trips reaching the goal | 42 / 42, 0 collisions | Simulation, 3 rooms |
| Positioning accuracy at the goal | 4.1 cm average miss, 8.5 cm worst | Simulation, tuned planner (navigation results) |
| Average time per trip | 30.0 s | Simulation, tuned planner |
| Average progress speed | 0.16 m/s, with 61 % of the time driving and 33 % steering | Simulation, 42 trips |
| Random cluttered rooms, realistic base | 18 / 24 reached the goal, 0 collisions, closest pass 65 mm | Simulation stress test (lag, 8 % slip, LiDAR smear) |
| Behaviour scenarios | 18 / 18 passed | Simulation |
| Success rate over 200 random rooms | 94 % planner, 84.5 % RL policy | Simulation (planner vs RL) |
| Cruise speed | 1 m/s design target, 4.84 m/s at motor no-load speed | Design calculation (design targets, torque) |
Conclusion and future development
Two months ago, all I had was one module turning on a perfboard. Now there’s a whole robot that calibrates itself, finds people and drives to them round furniture, with a LiDAR safety layer underneath that can stop the motors whatever the planner says.
Next I want to bring the camera’s depth estimate onto the robot for low obstacles the LiDAR can’t see, and build a Mk2 with brushless motors and a payload deck, starting with the new board below.
Next board: Swerve HAT v3 (brushless)
The Mk2 moves to brushless motors, so I’ve started the next PCB: a Raspberry Pi 5 HAT with eight three-phase brushless drivers and an encoder port for every motor, run by two ESP32-S3s. It’s still a draft. All 285 parts are placed, and routing is next.
- Format
- Pi 5 HAT 85 × 112 mm, 4 layers
- Motor drivers
- 8 DRV8313 three-phase
- Current sense
- 0.1 Ω per driver
- Controllers
- 2 ESP32-S3-WROOM-1
- Feedback
- 8 encoder ports, 4 hall inputs
- Sensing
- INA226 power monitor, MPU-6500 IMU
- Power in
- 3S via XT30, 15 A fuse, TVS
- Status
- Placed not yet routed
| v1 (on the robot) | v3 (in design) | |
|---|---|---|
| Motors | 8 brushed N20s | 8 brushless, with encoders |
| Drivers | 4 × TB6612FNG (2 channels each) | 8 × DRV8313 with current sense |
| Controller | 1 × ESP32 | 2 × ESP32-S3 |
| Board | 33 × 88 mm, 2 layers | 85 × 112 mm, 4 layers, mounts on the Pi 5 |
| Power | 12 V input, bulk decoupling | XT30 battery input, 15 A fuse, TVS, power monitoring |
| Status | Built and driving | Parts placed, routing next |
Placement drawing (copper pads and silkscreen)
How I used Claude
I wrote the code for this robot in tandem with Claude (Anthropic). I gave it my handwritten calculations and my original Python scripts, and set up a Claude skill to translate them into much more efficient, robust code. I then checked the code over myself. I modelled every part myself in Fusion, and Claude also helped check the PCBs.
The idea, the design decisions, the printing and assembly, the soldering, every test on the real robot and the measurements were mine.



