Microbit Crawling Robot Activity

Build a 2-legged crawling robot usng a BBC Microbit.

In this activity, we will build a 2-legged crawling robot. We will attach a Microbit and Adafruit Crickit robot controller and use MakeCode blocks to code the legs to move in a lifelike manner. Then we will code the robot to respond to your touch!


This activity is suitable for kids aged 10+.

It will take approximately 2 hours to complete.

You will need our Microbit Crawling Robot Kit. You will receive this kit if you are attending the relevant Think Create Learn or Girls Into Coding event. If you want to make your own kit, see the section right at the end of this page.

See it in action

In this activity, we will build a 2-legged crawling robot. Here is a video of one in action:

Check your components

First check you have all the components.  If you are attending a Think Create Learn or Girls Into Coding event you should have been given a kit containing the following items:

BBC Microbit


Crickit Board

Crickit Board

Battery Box + 3 AA Batteries


Robot Body

The body has 2 servo motors and grey plastic connectors attached. It also as 4 white plastic bolts sticking upwards.

Warning! Do not turn the servo motors with your hands. You can easily damage them.


Robot Head




Wooden Beads (for eyes)


Spring and Bead (for tail)


Thigh Joints, with Servo Motors Attached

Warning! Do not turn the servo motors with your hands. You can easily damage them.

Thigh joints

Front Legs

Front legs

Rear Legs

Rear legs

2x M3 Plastic Nuts

Plastic nuts

7x M6 Nuts and Bolts

M6 nuts and bolts

2x M3 Metal Nuts and Bolts

M3 nuts and bolts

USB Cable

USB cable

Elastic Band

Elastic band


Parts blutak

Assembling the robot

Now, we need to assemble the robot. You can either follow the video below or follow the instructions below the video.

Insert the batteries into the battery box

Install 3 AA batteries into the battery box.  If your battery box has a cover, use it.  Some battery boxes also have a switch.


Add the antennae to the Crickit board

The Crickit board will control our motors and sensors. We will use two antennae as sensors.

Crickit antennae

Let's attach them to the Capacitative Touch area of the Crickit. Use an M3 nut and bolt to attach each one.


We will use pins 1 and 4. This is so we keep the connections apart, so they won't accidently touch each other. Antenna2

Add the battery box and Crickit to the robot body

Use a couple of blobs of Blu-tak to hold the battery box in place on the body:

Battery on body

Then place the Crickit board onto the robot body, engaging with the plastic bolts

Crickit on body

You can bend the plastic bolts a bit to help them engage.

Use two plastic nuts to hold the Crickit in place.

Retain crickit

Add the head

We will now add the head of the robot. The head holds the antennae in place.

Press the antennae wires down onto the front of the body.


Place the head over the wires:


Use 2 M6 nuts and bolts to hold the head in place:


Use some Blu-tak to hold the eyes in place:


Add the front thighs

There is a left and right thigh. These are marked L and R. Use the right one on the right side!


The thighs will be attached to the grey plastic connectors on the body. Note the position of the screw holding the grey connector to the motor.

Body thigh connectors

Place the left thigh onto the grey connector, covering the screw.

Left thigh1

Make sure the part of the thigh with the motor is pointing downwards. Secure it with an M6 nut and bolt:

Left thigh2

Repeat with the right thigh, ensuring again that you cover the screw. Notice how the wood and grey plastic are reversed on the right side.

Right thigh

Plug in the motors

You should have 4 groups of wires, one coming off each servo motor. Each group of wires is made up of 3 coloured wires.

Servo wires

These need to be attached to the Crickit board.

Locate the Servo section on the Crickit:

Servo crickit

The wires must be connected in the following order, to the correct connector on the Crickit:

Servo numbers

The wires must be connected the right way around. The yellow wire should be on the outside, aligned with the Signal label:

Servo wire alignment

Insert the rest of the wires, remembering to place them in the right order and the right way around:

Servo wire alignmen allt

The wires will be a bit of a mess at this stage. Tidy them up into a bunch:

Tidy wires 1

Then use the elastic band to tie them up:

Tidy wires 2

Insert the Microbit

Now grab the Microbit. Notice that one side has LEDs:

Microbit 1

The other side has the word micro:bit:

Microbit 2

Insert the Microbit into the Crickit, with the LED side facing the left, as indicated by the wording on the Crickit:

Microbit 3

Push it all the way in:

Microbit 4

Attach the feet

There is a left and right foot:


Attach the left foot to the servo motor on the left thigh:


The foot should extend straight out from the end of the thigh:


Don't have the foot bent up or down:

No bends

Rear legs

The rear legs are just decorative and can be attached with some M6 nuts and bolts:

Rear legs


The tail is also just decorative. Use an M6 nut and bolt to attach it:


The spring just rests loosely on the bolt:


Attach the wooden bead, using a little Blu-tak if needed to hold it in place:



Start up the MakeCode editor

We will be coding use MakeCode. We can drag and drop code blocks to build up our program. Nice and easy!

Start MakeCode by clicking here.

If you want a head-start, use this version that has the on start code already done:

Start MakeCode by clicking here.

You should see the starter code open up in a browser window:


Click on the Edit button in the top right and the code editor will open up:


Take a look at the code

You will see a group of functions. These are already written for you. You don't need to touch these. These functions control the servo motors.


Add two code blocks, on start and forever. You can find these in the Basic tab on the left. These code blocks are where you will enter your code to call the functions to move the servos.


Set the initial servo angles

Standard servo motors can move 180 degrees. They cannot fully rotate. When you code them, you need to set the angle you want them to move to.

Servo angles

Let's set the intial angle for all servos to 90 degrees. This will be their "neutral" position. Once we have set the servos to their neutral position we can check that the legs of the robot are in the correct position!

Click on the Variables tab:


Select the set block (note that the name of the variable may be different to that shown):


Drop the set block into the on start block and set the variable name to currentLeftHipAngle and the value to 90:


Duplicate the set block 3 more times:


and set the other 3 servo angles as follows:


Note the set numSteps is set to 50. This tells the functions that drive the servos to move the servos in 50 steps, which gives a nice smooth movement.

Now we need to actually move the servos. For this we need to make function calls. The call blocks can be found in the Functions tab under Advanced:


Set up the following code in the on start block:


The 0 values tell the servos to now move to their default position (90 degrees).

Upload the code to the Microbit

Now we can upload this code to the Microbit to set the initial servo angles.

Plug the big end of USB cable into your computer:


Then plug the small end into the Microbit:


You should see a Microbit drive appear on your computer (which will look different if you are on a Mac or Windows PC):

Microbitdrivemac Microbitdrivewindows

Then click the Download button in the Makecode editor:

Code download

Drag the file that is downloaded (which should be called something like microbit-crawler-bot.hex) and drop it on the MICROBIT drive that should appear on your computer. If you do this right, the yellow light on the Microbit should start flashing. When this is done, the servos should move to their default positions.

Check the position of the legs

Warning! Try not to turn the servo motors with your hands. You can easily damage them.

Now check that the legs are in the correct position. First, check the hips. View the robot from the top and check that the hips are at right angles to the servo. These servos should be correct as they were calibrated for you with the kit.

Leg check1

Then place the robot on a table and view the robot from the front. The knees should be straight and touching the table:


If the feet are not straight and touching the table, remove them and adjust their position.

Make the right hip move

Now let's make the right leg move. In the existing forever block, add the following code:


Download the code and copy it onto the Microbit again. The right hip should move back and forwards.

The numbers in the call to the rightHip function determine the position of the servo motor. In the code above, position 1 is forward, position -1 is backward and position 0 is the neutral position.

Make the left hip move

Now add code to make the left hip move. Add this to the same forever loop.


Download the code and copy it onto the Microbit again.

Make the knees move

To make the knees move, you can use the call rightKnee and call leftKnee blocks:

Code15 Code16

The values passed to the functions are 1 for up, -1 for down and 0 for the neutral position.

Can you add these blocks in the right place to make the knees move at the right time? Do the right knee first. When do you want to put the knee down and when do you want to pull the knee up?

Once you have done the right knee, try the left knee

How did you get on? There are many ways to sequence the leg movements, but here is one way you could use (note the code is all in the same forever block):


Sensing the antenna

The antennae are connected to the capacitative touch sensor inputs on the Crickit board. This means they are sensitive to touch. We just need to write some code!

Locate the Crickit tab on the left:


You will see the Touch code block:


You will also see the NeoPixel code block:


Use these blocks to write some code to change the colour of the neopixel light on the Crickit board when the antennae are touched. Create a new forever block (you can find it in the Basic tab) and add the following code:


Let's call this the sensor forever block (to distinguish it from the motor forever block we created at the start). Note that we are using touch sensors 1 for the right antenna and 4 for the left antenna.

Upload the code to the Microbit. Touch the antennae. You should see the neopixel change colour. If it doesn't change, you may need to change the sensitivity. Change the value 600 to some other value. Something between 400 and 800 should work. You may need to experiment.

Changing direction when the antenna is touched

We can get our bot to behave like a real creature when it is touched. You can get it to move taway from the side being touched. To do this we need to connect the antenna sensing code with the movement code. We will create two new variables called rightMovement and leftMovement. These control whether the left and right side legs move or not.

Make the new variables


Then set them both to 1 in the on start:


Make another variable called touched. This will indicate whether the antennae were touched and also count how long the robot will move away from the touched side. Change the sensor forever block to set the new variables as follows:


This code sets rightMovement on and leftMovement off when the right antenna is touched, and does the opposite when the left antenna is touched. The touched variable indicates that an antenna is touched and is set to a count.

Now, change the motor forever block so that the left and right legs are only moved if the leftMovement and rightMovement variables indicate they should. We also reduce the touched count by 1 each time a leg moves so that eventually both legs will start moving again.


When you have finished coding, your code should look like this, with one on start block and two forever blocks:

Finished code

Upload the code to the Microbit again. Your robot should now respond when the antennae are touched.


If you complete the above, why not give the following a try. I won't provide the solutions because it's good to challenge yourself. The struggle will help you learn!

Try making changes to the way the robot moves. Change the order of the calls to the functions that move the limbs.

You can change the speed of the movements. The pause 1000 blocks wait 1000 milliseconds, or 1 second, between each limb movement. Reduce this value to make the robot move quicker.

You could use a variable to set the value once and use it in all the pause blocks. This way, when you want to change the speed you just need to change one code block.

Can you get the robot to move backwards?

Make the Kit

If you want to make your own version of the kit, read on.

The electronic components can all be purchased easily, but the body needs some components to be made. I've used a laser cutter to cut out the wooden parts, and 3D printed a couple of adapters to make the hip joints. You can improvise!

But for those of you who have access to the right equipment, I'll share my models here:

Laser cutter file for wooden body

I cut these in 6mm poplar. Cut the red lines first, then the black lines.


Laser cutter file for the head and back legs

I cut these in 3mm poplar. Again, cut the red lines first, then the black lines.

Head and back legs

3D printer file for hip joints

These work with the Tower Pro servo motors I use and my Prusa Mark III printer. I've built supports into the design. Just break the holes out afterwards (or carefully drill them out with a 6mm drill bit, making sure you clamp the piece securely).

Hip Joint

Purchasing the electronics

I recommend PiHut or Pimoroni or Kitronik for purchasing electronics for digital making. Here are some links for the parts from PiHut:

Adafruit Crickit (the Microbit one)
Battery holder with 2.1mm plug
4x TowerPro SG92 Servo motors
USB cable

Purchasing the fastenings

You can improvise with fastenings, but here are some links where you can buy them.

M6 20mm bolts
M6 nuts
M3 plastic bolts
M3 plastic nuts
M3 10mm bolts
M3 nut

For tiny screws which can be used to connect servo horns to wood, I recommend Model Fixings. The MF-ST63s are perfect for this purpose.