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.

Outeach Coordinator role begins!

And so its official! The school holidays, which is a period of rest for most teachers (well, atleast some of it) was my official start to my new role at Victoria University, Wellington as the Outeach Coordinator for School of Computer Science and Engineering. My first assignment was in Samoa, a beautiful island nation in the Pacific. A country with a population of about 190,000 and with the addition of a recently connected Pacific submarine fibre cable, Samoa has a strong scope for developing its younger generation in the field of computing. A lack of existing infrastructure meant that we had to run a lot of programmes offline. Luckily, with the exception of batteries(which we preordered in an electrical shop in Samoa), we were prepared with the gear for the job.

The team comprised of five staff from Victoria, of which 3 were directly involved in setting up a wireless network at the National University of Samoa. Myself and Sue, Manager of the Engineering department were running the outreach. Prior to arrival, schools were notified to send teachers to the University where we were running the Outreach programme. We had a range of activities setup in a computer lab. Scratch was installed to run in offline mode. We had sessions to create basic movements using the drag and drop blocks and then went to some advanced lessons involving loops and variables. The teachers were amazed, especially the ones who haven’t used computers before, with the learning curve of scratch. The second activity was making some bristlebots, an easy offline activity with toothbrushes and motors. We had some issues with the high humidity when using tape as well as some batteries just wouldn’t work. The broaches using the led and coin battery provided the teachers with some food for thought to implement it in their classrooms when teaching about circuits. The MAKE Easy Electronics kit was a success too!
Next week, we went out to different schools to run the same activities with students. We soon realised how under resourced they were, with some schools having just two computers for staff to access. Teaching them about Scratch would be absolutely useless if they cannot access it once we were gone! So once again, we decided to run unplugged activities.
These two weeks have been significant in my teaching practice. I have an personal challenge for myself to be able to come up with a ‘Learning Package’ for the island of Samoa (possibly some other neighbouring islands too) which would assist teachers to get going with using the concept of unplugged activities to get into Engineering and CS.

Google Classroom update

Google Classroom Folders

For a second year in a row, Google Classroom is proving to be a highlight in delivering and managing content for my classes. It’s highly simplistic interface and effectiveness makes it a strong frontrunner in learning management systems. Ultranet on the other hand was difficult to navigate and updating information was a daily struggle. Hapara addon might be something I will eventually look at. One of the most amazing features is the marking in Classroom. You can easily use the grading feature after creating and assignment and then store the grades as an Excel sheet. Returning the grades with a score as an email is really convenient. Students are appreciating the delivery method and can easily access information when they are away(no more excuses for not completing homework). Currently the score only take whole numbers for grades ( so you cannot mark someone a 7.5). Once exported to Excel I can easily convert them to an Achieved, Merit or Excellence using a simple formula sheet template I have made.

Most grades are marked out of 10. Any students attaining a 5,6 is an Achieved, 7,8 is a Merit and 9,10 is Excellence. All of them are color coded as well so I can see instantly the results of the class and gauge the outcome based on color. I can alternatively copy the marks to Google Sheets and save the sheet( and then download it).

Desctop screenshot_googleClassroomSheetsExport

Google sheets export is really good because the averages for the class and individual exams marked are automatically output to the screen. The grading of marks and returning it to students has been simplified. They get an email from me with the grade/ comment(image below shows every assessment with grade and comment). Wonderful. Thanks Google!