Cables & Connectors

Electronics Components

Motors & Controllers

On Sale items!

Get Professional Support

BBC Micro:bit


On sale items!


Check out our latest news to find out more about events, opportunities and partnerships.

Esmes' Electronics

Esmes' Electronics is a simple introduction to using the micro:bit written by a year 5 student.

Troys' tutorials

Learn with Troy by asking for support and, he will post a tutorial here to benefit all of our visitors. Free advice!

Feature teacher

Be inspired by some of our favorite teachers using our products.

Get professional support

Contact us now to request your own tutorial or learning resource.

This section doesn’t currently include any content. Add content to this section using the sidebar.

Image caption appears here

Add your deal, information or promotional text

Kitroniks Line Following Buggy Kit for the BBC microbit Ver 1

19 items left

Our BBC microbit controlled line following Kitronik buggy was a great draw and many of you have asked how to build your own. Now you can, thanks to this easy to follow step by step guide and our even easier kit!

Below you'll find complete step by step build instructions, We'll guide you through building our BBC microbit controlled Line Following Buggy. The buggy uses two light dependent resistors to control a line following board on the bottom of the chassis to 'follow' black lines. Two LEDs shine light from underneath the buggy down onto the floor and a pair of LDRs measure how much light is reflected. When the sensor is moved over a black line the level of reflected light decreases and the sensor sends a signal to the BBC microbit through the motor driver board. The BBC microbit then uses that information to steer back toward the line. It does this by switching off either the left motor to turn left or the right motor to turn right.

Download the PDF of this Guide:
We've also produced a PDF version of this guide that you can download below.
Download the instructions here.

Learn how to:
Build a line following buggy.
Power motors with the Motor Driver Board for the BBC microbit.

Parts List

The buggy is simple to build, all you need is a BBC microbit and our Line Following Buggy Kit. Alternatively, you can build one from scratch with the following parts:
2 x Right Angle Hobby Geared Motor.
2 x Wheel for Hobby Motor.
1 x Motor Driver Board V2 for the BBC micro:bit.
1 x Buggy Chassis.
2 x M3 12mm Pozi Pan Machine Screw.
8 x M3 6mm Machine Screw.
4 x M3 Full Width Nut.
4 x M3 20mm Plastic Spacer.
1 x Steel Ball Caster 16mm Metal Ball.
1 x 4xAA Battery Box with Switch.
1 x Line Following Board Kit.

You will also require the following equipment:
Chassis Laser Cut file (.pdf)
A small flat head screwdriver.
A Phillips screwdriver.
A computer with a spare USB port and internet access.
A USB to micro USB cable.
A BBC microbit.

Let's Get Started!
If you have the Line Following buggy kit you can proceed directly to step 1. If you've sourced all of the parts yourself, before proceeding to Step 1, you will need to cut the chassis from the Perspex sheet using the 'Chassis Laser Cut file' (see above) using a laser cutter.

Step 1 - Securing The Motors

Take the protective backing off the main chassis. Take two of the ‘T’ shape acrylic pieces, push one through the bottom of the board (the top of the board is engraved with the word top) and align the other one up the notch in the edge of the body of the buggy. Place the Motor 1 (green and white wires) between the two pieces with the motor terminals pointing toward the rounded corners of the buggy and the axle pointing outwards. Ensure that the motor is placed on the top side of the board. Push a M3 30mm Pozi Pan Machine Screw through the holes in the 'T' pieces and motor to secure it in place, and then fasten it with the M3 Full Width nut. Repeat this for Motor 2 (blue and black) on the opposite side of the buggy, then push the wheels onto the motor axles.

Step 2 - Attach the caster

To attach the caster to the buggy, on the side marked top, place the provided acrylic spacer so that it lines up with the caster holes to the rear of the board. Place the caster so that the ball pokes through to the underside of the board. Fix the caster in place using the 2 x 12mm M3 Machine Screws and 2 x M3 Full Width nuts.

Step 3 - Attach the Motor Driver Board

Attach the plastic spacers using four of the 6mm screws from underneath as shown above.

Attach the Motor Driver Board to the top of the M3 20mm Plastic Spacers using the M3 6mm Machine Screws. Make sure the terminal blocks are facing the centre of the board.

Step 4 - Connecting The Motors To The Motor Driver Board

Take the wires from the motors and connect them to the terminal blocks on the motor driver board in the following configuration:

  • Wire 1 on Motor 1 goes into the 'P12' terminal.
  • Wire 2 on Motor 1 goes into the 'P8' terminal.
  • Wire 1 on Motor 2 goes into the 'P0' terminal.
  • Wire 2 on Motor 2 goes into the 'P16' terminal.

The next task is to build the line following PCB.

Step 5 - Place Resistors

Start with the six resistors: The text on the PCB shows where R1, R2 etc go. Ensure that you put the resistors in the right place.

PCB Ref Value Colour Bands
R1, R2, R8 & R9 470Ω Yellow, Purple, Brown
 R3, R4 2.2kΩ Red, Red, Red

Step 6 - Solder The IC Holder.

Solder the Integrated Circuit (IC) holder in to U1. When putting this into the board, be sure to get it the right way around. The notch on the top of the IC holder should line up with the notch on the lines marked on the PCB.

Step 7 - Solder The Potentiometer

Solder R7, the variable potentiometer, in to the PCB where it is labelled R7.

Step 8 - Solder The LDRs

Solder the two Light Dependant Resistors (or LDR's for short) into the board where it is marked R5 & R6.

Step 9 - Solder The Red LEDs

The two red LEDs are designed to point out of the back of the board so you can see them when the board is attached to the buggy. The leads of the red LED's need to be bent 90° before they are soldered in to the board where it is labelled LED3 and LED4. The flat edge of the LED matches up with the LED outline on the PCB. Make sure the LEDs are soldered in the right way around.

Step 10 - Solder The Clear LEDs

Solder in the two clear LEDs (LED1 and LED2) directly into the board. These LEDs don't need to be bent but again make sure the flat edge of the LED matches up with the LED outline on the PCB.

Step 11 - Insert The IC
Put the LM358 op amp IC into the holder labelled U1 ensuring the notch on the chip lines up with the notch on the PCB outline.

Step 12 - Line Following Connecting Wires

Strip both ends of the blue, red, yellow and black wires and then solder one end of each the directly to the PCB as follows:

  • Out 1 = Blue
  • Out 2 = Yellow
  • +v = Red
  • 0v = Black

Step 13 - Attach The Line Following Board To The Buggy

Placing the 4 x plastic Hex M-F Standoffs between the chassis and the line following board, attach the line following board to the bottom of the chassis with the red LEDs pointing out from under the front of the buggy. Use 4 x M3 screws to fix the line following board to the Standoffs and 4 x M3 Full Width Nuts to secure the chassis to the Standoffs. Feed through the four wires from the Line Following Board through the hole in the middle of the chassis of the buggy.

Step 14 - Connect The Wires To The Motor Driver Board

Connect the wires from the Line Following Board into the terminals on the Motor Driver Board for the BBC microbit as follows:

  • 'Out 1' (Blue) goes into 'INPUT2 - P2' terminal.
  • 'Out 2' (Yellow) goes into 'INPUT1 - P1' terminal.
  • '+v' (Red) goes into 'INPUT1 - 3V' terminal.
  • '0v' (Black) goes into 'GND' terminal.

Step 15 - Attach The Battery Box

Using the sticky pad, attach the battery pack to the top of the buggy chassis with the switch poking through the rectangular cut-out. Attach the red and black wires into the terminal on the Motor Driver Board for the BBC microbit labelled 'POWER'. Put the black wire in the left hand side of the terminal labelled 'BLACK' and the red wire in the right hand side of the terminal labelled 'RED'.

Step 16 - Test The Code
Download the code here:

Now, let’s try the code out! Plug your BBC microbit into a USB port and it will show up as a storage device. Simply unzip, then drag and drop the .hex file you just downloaded onto the BBC microbit. The file might not show up on the BBC microbit in the file explorer but it is there! Once the file has been transferred (the light on the BBC microbit will stop blinking rapidly) remove the BBC microbit from your computer.

Step 17 - Test The Setup
On a white board or surface mark out an oval or similar shape using black insulation tape. Make sure the track is quite thick (roughly 2cms). Or alternatively draw the line on a large piece of paper using a black marker pen.

Step 18 - Try It Out!

Insert your coded BBC microbit into the connector on the Motor Driver Board for the BBC microbit (it can be inserted either way around) and switch on the buggy (with batteries in) using the on/off switch on the bottom. Your buggy should now be working. When one of the sensors on the Line Following Board passes over the black line it will cause the buggy to turn back towards the line. The red LED’s on the Line Following Board light up when the corresponding sensor passes over the black line and can be used for visual feedback when developing and testing your own code. Note: R7 on the Line Following board is used to adjust the sensitivity of the LDR sensors. It is adjusted by turning the trimmer dial with a small flat head screwdriver. Try starting with R7 in the central position and then adjust it if needed.

Troubleshooting Guide
If the buggy doesn’t work as expected then check the following:

  • Check that the motor wires have been connected to the Motor Driver board as specified.
  • Check that the batteries are not flat.
  • Check the two power wires are connected the correct way around.
  • Check the wiring between the Motor Driver board and the Line Following board has been made as specified.

Check the bottom of the Line Following board to ensure that:

  • All holes except the 4 large 3 mm mounting holes in corners are filled with the lead of a component.
  • All these leads are soldered.
  • Pins next to each other are not soldered together.

Check the top of the Line Following board to ensure that:

  • The notch on the IC holder / IC matches the outline on the PCB.
  • The colour bands on R3 and R4 are red, red, red.
  • The flat edge on all four LEDs matches the corresponding outline on the PCB.

Download the PDF of this Guide:
We've also produced a PDF version of this guide that you can download below.
Download the caster through chassis instructions here.