Using a DC Motor with the Microbit

Posted by

The next lesson for the Microbit is nearly finished. The lesson is how to control a small DC motor with the Microbit programmed in the Makecode block language. The circuit is pretty simple. The circuit uses a transistor,  a diode and a resistor.



The lesson starts with simply turning on and off the motor using the built-in Microbit button using the DigitalWrite block.  Next, there are instructions on how to vary the motor speed with the AnalogWrite block.



The circuit is then modified to use a knob to control the speed of the motor. The detailed lesson is here. The next lesson is adding the ability to change the direction of the motor.

The class I’m teaching will make DC motor instruments. For example:


  1. Hi, thank you for the detailed lesson. I reproduced your exact layout (all parts are facing the way you mentioned), with the exact same parts. I have the LED row light up, but motor is not moving. Any idea what could go wrong? It’s a small 3V DC motor that turns on and off fine with just a battery source.


    1. My 1st thought is always to double check the wiring. My 2nd thought is to make sure you have the correct parts. The transistor looks exactly like the temperature sensor in many kits. If you can post a picture, I’ll take a look.


  2. This is very interesting, I’m trying to build a spiderbot and wish to control two motors independantly…is this possible?


Leave a Reply to davidheld Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s