Micro:bitMakeCodePythonBuilders

Programmable car: Micro:bit and 2 servo wheels

Build a small car from cardboard, two 360° servos and the Kitronik Simple Servo board, then program it in MakeCode.

QR code to this pageScan to open
Parts: Micro:bit, Simple Servo board, two 360 degree servos, two wheels, three AA batteries, cardboard, a skid, rubber bands and tape, USB cable

Most parts are cheap or come from the recycling box. Check the servos: they must be 360° (continuous rotation), for example FS90R. A normal 180° servo stops after half a turn and cannot drive a wheel.

This is not a first project: you should already know how to make a MakeCode program and download it to a Micro:bit.

Top view of the car: servos at the front corners, wheels outside, board lying flat behind them, skid under the back
The board with the Micro:bit: Servo 1 plug on the left header goes to the left wheel, Servo 2 plug on the right header goes to the right wheel

Each servo plug has three wires. The darkest wire (brown or black) goes on Ground, at the top of the header. Switch the board OFF while you plug in wires.

Four small cars: forward, backward, spin left, spin right, with arrows showing which way each wheel rolls The car seen from behind: Servo 1 faces left, Servo 2 faces right

Try it before you build: set the two servo blocks and watch what the car does. Scroll to zoom, drag to move. Tick Real servos to see why a real car never drives perfectly straight.

Open the simulator in a new tab

5Program it

The step-by-step tutorial opens in MakeCode with the Simple Servo blocks already loaded. MakeCode shows the same program as Blocks or as Python: switch with the buttons at the top of the editor.

The blocks you need

In MakeCode, add the extension first: Extensions, search Simple Servo. Its blocks appear in the green Servo drawer.

set servo 1 to turn counter-clockwise ▾ at 50 % speed
Makes a wheel turn. Servo 1 is the left wheel, servo 2 the right wheel.
stop servo 1
Stops a wheel. Use it for both servos when the car should stand still.
pause (ms) 2000
How long the car keeps driving before the next block. 1000 ms is one second.
function forward
Put the two servo blocks for one move into a function, then call it by name: forward, spin_right, stop_car.

Key tips

Start the MakeCode tutorial

The finished program is here too. Try it yourself first; if you are really stuck, ask your teacher for the code.

Next step, real Python: servo_car.py does the same in MicroPython, the Python that runs on the Micro:bit itself. Open it in python.microbit.org and download it to the Micro:bit.

6Challenges

Done already? Try these, and test each idea in the simulator first.

Four challenges: drive a square, drive a figure of eight, radio remote with a second Micro:bit, drive straight with unequal servos

Poster to print (PDF)