How a robot drives sideways
A normal car cannot park by driving sideways. Its wheels can only push forwards or backwards, so it has to do the parking dance. The platform in this guide can simply slide into the gap. Warehouse robots, forklifts that carry aircraft containers and many competition robots use the same trick: mecanum wheels.
One wheel: a push at 45°
Look closely at a mecanum wheel. Around its edge sit small free-spinning rollers, all tilted at 45°. Only one roller touches the floor at a time.
- Along the roller’s own axis, the roller cannot slip: the wheel grips the floor in that direction.
- Across the roller’s axis, the roller spins freely: the wheel does not push at all in that direction.
So when the motor turns the wheel, the push on the floor does not go straight forward. It goes at 45°, forward and a little to the side. One wheel alone would make the robot crab diagonally.
Four wheels: add the pushes
Each wheel gives one diagonal push. The robot moves in the direction of all four pushes added together. Adding pushes is adding vectors: put the arrows tip to tail and the arrow from the first tail to the last tip is the result. Try it:
The wheels are mounted so that the front-left and rear-right wheels push along one diagonal, and the front-right and rear-left wheels along the other. Now look at what happens:
| You want | Which way each wheel turns | Why it works |
|---|---|---|
| Forward | all four forward | the sideways parts of the pushes cancel, the forward parts add |
| Sideways left | front-left and rear-right backward, the other two forward | now the forward parts cancel and the sideways parts add |
| Spin on the spot | left side backward, right side forward | the pushes cancel as a whole, but they twist the robot |
| Diagonal | only two wheels turn | the other diagonal pair stands still |
Move the stick and watch the four wheels. The code on your robot uses exactly these four lines:
The maths, in four lines
Call the speed the robot should have forward , to the left , and its turning speed (counter-clockwise). Then each wheel’s speed is:
is the wheel radius and is how far the wheels sit from the centre (half the wheelbase plus half the track). Chapter 6 shows where every sign comes from and how the robot uses the same lines backwards to work out where it is.
What each part does
Like every robot, the platform runs the same three jobs in a loop, 50 times per second:
| Job | On this platform | Part |
|---|---|---|
| Sense | “Is something in front of me? How fast is each wheel really turning? Is the battery getting empty?” | HC-SR04 ultrasonic sensor, an encoder on each motor, a voltage divider on the battery |
| Decide | “The stick says left and a bit of turn: how fast should each wheel go?” | ESP32 DevKit running MicroPython |
| Act | turn four wheels at four different speeds | four TT gear motors, two TB6612FNG motor drivers |
You drive it from your phone: the robot makes its own Wi-Fi network and shows a joystick page in the browser. No app to install. There is also an Auto button: the robot drives on its own and slides out of the way of obstacles.
What is in this guide
- How a robot drives sideways (this chapter, free)
- Parts and where to buy them
- Printing the chassis and putting the mechanics together
- Power: the battery, the fuse and the 5 V supply, safely
- Wiring the motors, encoders and the sensor
- MicroPython, the code, and the maths behind it
- Calibration, wheel speed control and troubleshooting
- Add a camera (optional): parts, mount and flashing
- Camera: following a colour
- Camera: driving with a vision language model, safely
- Camera troubleshooting and what to build next
Chapters 8 to 10 are an optional upgrade: an ESP32-CAM on the front lets the robot follow a coloured ball or drive towards a goal you describe in words. The robot is complete without them.



