RC Car hack using the Microbit and Motor Driver Shield

In one of my previous posts, I showed my toy truck modified with an Arduino Uno and a motor driver. It’s a great way to make use of what is usually working condition RC toys, but are chucked away because either batteries have leaked or the remote doesn’t work anymore. Salvation army and Mary Potter Hospice shop ( NZ thrift shops) are places to visit for used RC cars (under $5). The idea is to use the chassis, motor+axle combo and wheels to save time. However, you could build one yourself with some bits of wood and an ice cream container if you wanted.

Basics of motors to begin with. A motor is what drives the car as well as steers it. They are cheap and easy to procure. Usually the cheaper RC cars all deploy a 3v motor (one to drive the back wheels and one for the steering axle). The steering motor is heavily geared at times. More expensive RC cars would use a geared motor called a servo. You would know its not your usual motor, when you see more than two wires coming out of it (servo is usually 3 and geared motors have more). When you connect a motor to a battery it will spin one way and when you flip the terminals around, it will spin the opposite way. You could connect the terminals to the motor driver whichever way you wanted as you can program it to go the right way.

Open up the RC Car. Remember, DO NOT BUY A NEW ONE (or steal your child’s favorite RC car), as most likely you will end up wrecking it. Modding it, involves undoing the body, chopping up cables, removing old electronics and refitting with Microbit. Ideally you are looking for a mid sized RC Car which will accommodate the Microbit motor driver (6.5cms by 6cms) and the Microbit on top – most likely you will have to cut a hole through the driver seat 🙂 Buggies / trucks are the best as they have space for hosting the board but other cars can be modified too. [insert pic of open car here]

You will have to modify your space accordingly to get the board in. Hot glue works just as good if you can’t get screws in. It needs to be easy to pull out if needed to use in another project.

Finding the motor cables should be relatively easy. Ensure there are no batteries in the battery compartment. The cables are usually color coded going into the battery compartment and to the motors from the electronics. (red – dead or also known as positive and black is negative). From the back of the car, identify where the motor and axle sit, trace the cables coming out of there. If you have two motors then there will be four cables, otherwise there should be just two cables coming from one motor driving both wheels [insert pic of cables]. Those cables need to go into Motor 1 port on the driver shield. Similarly with the steering, identify cables coming out from the front , isolate them from the electronics of the car and pop them in Motor 2 port.

Connect the cables coming out of the battery port into Power on the motor shield. Ensure you put black-ground, and Red-positive into the right connectors. Time to test and see if it works before you start putting everything back together.

You will need to install code separately for both the Transmitter (Microbit which will be the remote control for the car) and the receiver (Microbit on the car). Download the code for Transmitter here and Receiver here

The code (in Javascript) has been copied below if that’s more convenient. Feel free to modify as needed. I used roll to control the steering. You can also use Pitch if you like.

//RCTransmitter Code - goes to the remote
let roll = 0
let steering = 0
let throttle = 0
basic.forever(function () {
    throttle = 0
    if (input.buttonIsPressed(Button.A)) {
        throttle = 100
    } else if (input.buttonIsPressed(Button.B)) {
        throttle = -100
    radio.sendValue("throttle", throttle)
    steering = 0
    roll = input.rotation(Rotation.Roll)
    if (roll > 45) {
        steering = 100
    } else if (roll < -45) {
        steering = -100
    } else if (roll == 0) {
        steering = 0
    radio.sendValue("steering", steering)
//RC ReceiverCode - goes into the Microbit on the car

radio.onReceivedValue(function (name, value) {
    led.toggle(0, 0)
    if (name == "throttle") {
        if (value > 0) {
            kitronik_motor_driver.motorOn(kitronik_motor_driver.Motors.Motor1, kitronik_motor_driver.MotorDirection.Reverse, 100)
        } else if (value < 0) {
            kitronik_motor_driver.motorOn(kitronik_motor_driver.Motors.Motor1, kitronik_motor_driver.MotorDirection.Forward, 100)
        } else {
    } else if (name == "steering") {
        if (value >= 100) {
            kitronik_motor_driver.motorOn(kitronik_motor_driver.Motors.Motor2, kitronik_motor_driver.MotorDirection.Reverse, 80)
        } else if (value <= -100) {
            kitronik_motor_driver.motorOn(kitronik_motor_driver.Motors.Motor2, kitronik_motor_driver.MotorDirection.Forward, 80)
        } else if (value == 0) {

After you transfer the code separately to each microbit, you are ready to test. Press buttons A and B on the remote individually then tilt the remote. If the remote is flat (parallel) to ground with LED’s facing up, then the roll is zero. When titled to left or right, it will accordingly rotate the steering. It might need tweaking and that’s where you will have to play with the code. I can’t give you all the answers either. I modified the code from here

Troubleshooting: Hardware – 1) If motors spinning in opposite direction of what you want it to do, change the values in the code.

2) If motors do not spin at all, try giving the motor direct power from batteries and see if they spin. If they still don’t unfortunately you have to replace the motor. (Check) Batteries, they die fairly quickly on the motor driver so I recommend rechargeables for long use.

Software – 1) Radio connects directly and there is no switch unless you add one, which means the minute you put your batteries in, it will start steering unless your remote is straight upwards ( its programmed to start steering when the remote is rotated side to side ). You can modify that by changing how you would like it to be steered ( maybe add more buttons and connect them to pins on the microbit).

The next awesome mod would be to wire up LED lights on the car connected to the pin outs on the Microbit.

Please feel free to contact me if you come across any issues with the tutorial and I can try provide some support.

Micro:bit and Kitronik Buggy kit – User review

At $22 for a Micro:bit which has a Bluetooth, Accelerometer and capacitive touch sensors, I wouldn’t, for a moment, doubt its usefulness in a class as a learning resource. The web-based OS isn’t too bad either as you can program using the block based system or using JavaScript. As it’s a web-based OS, you need to create the program, download it to your computer and then transfer it to the Micro:bit, which shows up as a folder in your My Computer panel (Windows). The short USB micro cable can be a pain if all your front ports are in use but you can get USB extension cables for that purpose.

The assembled Buggy kit with Micro:Bit
The assembled Buggy kit with Micro:Bit

As a practical activity to go alongside the programming, I decided to get the Kitronik buggy kits. These kits are available via Learning Developments NZ for $44.95 NZD (please check latest pricing for correct guide). They are laser cut acrylic pieces that come along with a servo shield and 2 continuous rotation servos. The servos do need to be calibrated prior to installation and can sometimes behave erratically, which means you have to unscrew a few bits before you can reach them.

It took me just under 1.5 hrs to complete the construction ( using the manual and all its practical examples prior to the build, but I was probably slow as I was analyzing it too much and wasting time on YouTube as usual). It probably, in reality, takes about 20-30 mins to put the kit together. Apart from a few cons, I think it’s a good little buggy to have in the class. If you are teaching programming, you could have a number of challenges especially using the onboard arrays. We created a simple obstacle course in class that had student chairs and desks as obstacles and the robots had to make their way around it. Combine with creating an algorithm and flowchart and you can extend their computational thinking skills.

Cons: 1) Nuts are too small to handle and they don’t come with a screwdriver. So, if construction is the intended activity, please ensure you have a bunch of small magnetic Philips head screwdrivers (and possibly a small flat head as well to hold the nut in place, if your fingers are big). I wouldn’t recommend the construction activity with smaller kids.

2) Fine tuning the servo calibration can sometimes be required after assembly so be prepared to pull it apart after installation.

3) Phone app isn’t the most user friendly yet. A lot of bugs especially connecting to the device. Alternatively, there might be other developers who have made apps for the Microbit.

On the whole, I feel they are a good little kit to have in class. Aimed mainly at your primary and intermediate students, and as an introduction to computational thinking course, these nifty little buggies’ can do the job.