7 Motor Control

The micro:bit gives an out put of 3 volts but the current is very low, so it is insufficient to drive even a 3 volt motor. In fact to attempt to do so might damage the micro:bit. For motor control you will need to purchase an additional motor driver board (and battery pack) that will provide the extra current needed to power an electric motor (typically 4.5V to 6V ).


There are a growing number of boards that have been designed specifically for the micro:bit. I am currently experimenting with the Kitronik and have published my notes on this website.

This video provides a good introduction to physical computing with the micro:bit.


The diagram below illustrates how connections are made to the motor board.

For most projects it is not speed, but torque, that is needed to overcome friction and ensure more precise control.

I have chosen to use a 6 volt power supply for the motor driver board and therefore will use 6 volt motors with 200:1 gear box built in to provide the necessary torque.


MakeCode Editor script:


With the motor connected to MOTOR 1 and a 6 volt battery to POWER, the script below will start the motor when button A is pressed and stop it when button B is pressed.

With the way my motor is connected, when pin 8 is high (1 or ON) the motor turns clockwise.

With the way my motor is connected, when pin 12 is high (1 or ON) the motor turns anticlockwise.

Controlling speed:

This script is for a vehicle in which pins 0 and 16 control the left hand motor.

Pins 8 and 12 control the right hand motor.

By writing an analog value to a pin it is possible to set the speed of the motor.

1023 is the maximum speed. Any value can be set between 0 and 1023.

This script will set the right hand motor turning at maximum speed and the left hand motor turning at half speed.

For more information, follow the link below.

Technical advice:

Many thanks to Adrian Oldknow from ccite.org for the following advice. If there is time available, much of this could be given to children to discover for themselves by experimentation.

Each motor is controlled by 2 pins to go forward (1,0), back (0,1), coast (0,0) or brake (1,1). Digital pins 8 and 12 control one motor, and 0 and 16 the other. The LED display can be programmed to display an appropriate symbol (⇧⇨⇩⇦) for each of the four sections so it can be tested without the buggy. From experimentation we found that the buggy moves 30 mm in 1 second (this will depend on the motors used).

Follow this link for the complete information sheet on using the Kitronic motor board together with Touch Develop scripts.

Follow this link to Kitronic's information sheet.