BBC micro:bits are great! They are easy to program, they're packed with features like Bluetooth and an accelerometer and they're inexpensive.
Wouldn't it be great to be able to build a robot car that costs next to NOTHING? This project is inspired by the desire for elementary school students to be able to build robots using a minimum of parts and wherever possible, use recycled materials. It takes very little time and encourages students to learn coding, some engineering and to use their craft skills. There's no cutting or drilling with power tools and no soldering. The primary building materials are a FACIAL TISSUE box (ex. 'Kleenex') and a bit of box cardboard. It can be completed in a few days of class time.
You'll learn some electronics, basic micro:bit coding and how to use the accelerometer and Bluetooth features of micro:bit.
So let's get started!
Step 1: Parts List
Item Cost Quantity
Tissue box free 1
Box cardboard (corrugated) free 2 pieces that fit in the bottom of the box for stiffening.
Solid core wire minimal Enough for the wiring for the project
BBC micro:bit retail 2 - one for transmitter, one for the car controller
micro:bit GPIO Edge Connector $6 to 15 US 1
Geared Motor /wheel $3 US each 2
Mini breadboard $0.75 US 1
9Volt Battery clip $0.25 US 1
SN754410NE Motor Chip $0.40 US 1
Ping Pong Ball minimal 1
Ball caster (optional) $1.20 US 1 - can use half a ping pong ball or marble instead
Two-sided foam tape $2 at dollar store 1roll - for mounting the motors to the base
White glue You've probably already got some
A small utility knife
Hot Glue Gun (optional)
Paper clip or compass for piercing small holes in the tissue box
Rotary cutting tool(optional) or razor saw to cut the ping pong ball in half.
Step 2: Robot Construction
Place the tissue box on the corrugated cardboard sheet so the long side of the box is in line with the ridges of the cardboard. Trace the base of the tissue box on the cardboard. You'll need two pieces. Carefully cut out the pieces with the knife and ruler. You should trim them so they will fit flat inside the box.Carefully open one end of the tissue box to test fit the cardboard sheets.
Use white glue or carpenter's glue to glue one piece of the cardboard to the inside base of the box. Put some heavy objects like batteries inside the box to weigh down the cardboard so it will fasten securely to the box. Let it dry.
Before we go further, you may wish to solder short lengths of solid-core wire onto your motor wires and 9 volt battery clip wires. Then cover the joints with heat shrink tubing. It will make it easy to insert these wires into the breadboard. I know I said, "No soldering", but hey, this IS electronics!
Now start laying out the parts on the other piece of cardboard as shown. Try to mount the breadboard towards the end that will be the rear of the car so the micro:bit and edge connector fit. For consistency, the red-rail of the board is at the top of the pictures. It's recommended you orient yours the same way for ease of assembly.
Hot glue is great for attaching the breadboard. Then you can easily remove it if you want to use it for another project. DO NOT USE THE TWO SIDED TAPE on the bottom of the breadboard. It holds the metal connections inside the breadboard. If you pull it away, it'll wreck the breadboard.
Step 4: Attach the Micro:bit Edge Connector
Now attach the edge connector to the breadboard as shown with the connector pointing to the front of the robot. The pins should straddle the trough(ravine) that runs along the middle of the breadboard.
Step 5: Install the SN754410NE Motor Control Chip
Carefully install the SN754410NE motor chip on the breadboard. The small notch should be pointed towards the edge connector.
Step 6: Wire the Motor Chip
If you look down on the motor chip from above, with the notch on the right, the pins on top are numbered 1 to 8 from right to left and then the pins on the bottom are numbered from 9 to 16 on the bottom. An explanation of how the motor chip works will be provided at the end of this project.Use small lengths of wire to join,
Pin 1 to the red rail
Pin 8 to the red rail
Pin 9 to the red rail
Pin 16 to the red rail
Use a short length of wire to join the edge connector ground to the blue rail of the breadboard.Use a small length of wire to join the top-side blue rail to pin 4 OR 5 of the motor chip. It's the chip's GROUND point and you only need to ground the chip with one wire.
Step 7: Wire Motor Directional Pins
We are using micro:Bit pins 13,14,15 and 16 for two reasons. First, they're all together on the board for convenient wiring. Secondly, they are not used for other purposes by the micro:Bit so you won't be disabling features like the LED array should you wish to use it in your final design. A link to the pin wiring assignments is at the end of this project for your future reference.
Join edge connector pin 13 to pin 7 on the motor chip.
Join edge connector pin 14 to pin 2 on the motor chip.
Join edge connector pin 15 to pin 10 on the motor chip. (the yellow wires in the picture)
Join edge connector pin 16 to pin 15 on the motor chip.
Join the red rail on one side of the breadboard to the red rail on the other side with a length of wire. Join the blue rail on one side of the breadboard to the blue rail on the other side with a length of wire. These wires carry voltage to both sides of the circuit and ground source to both sides of the circuit.
Step 8: Wire the Motors
Put the green(black) wire of the left-hand (top in the diagram) motor to pin 3 on the motor chip.
Put the red wire of the left-hand motor to pin 6 on the motor chip.
Put the red wire of the right-hand motor to pin 14 on the motor chip.
Put the green(black) wire of the right-hand motor to pin 11 on the motor chip.
Step 9: Attach the 9 Volt Battery Clip
The 9 volt battery will power both the motors and the motor control chip.
Attach the black wire of the 9 volt battery clip to the ground rail of the breadboard.
Attach the red wire of the 9 volt battery clip to pin 16 of the motor chip.
Your wiring is done!
Take a few minutes to double-check your work. It may save some cooked batteries or worse, CIRCUITS, if you catch the errors and correct them before powering up the car.
Step 10: Wiring Diagram
The wiring diagram is provided here for you to check your wiring so far.
Step 11: Coding the Micro:bit Transmitter and Micro:bit Receiver/Robot Control
We're going to use one micro:bit as our remote control and a second micro:bit as the receiver/robot controller.
In the transmitter, we'll use the accelerometer to measure the forward/backward tilt of the micro:Bit to make the car go forwards or backwards or stop. We'll use the A and B buttons to modify forward/backward to include left/right turning.
It's assumed that you're familiar with using makeCode blocks to program a micro:bit. The code blocks are provided here with explanations of what each block does.
As the code blocks picture files are quite large, just download those two files and you can follow the comments to build the blocks.Just follow the fully commented code blocks documents to create your own micro:bit hex files OR you may just download the transmitter code and receiver code if you wish and install them directly.
Step 12: Final Assembly - Pre-install Test and Ping Pong Ball Installation
After you've uploaded your codeBlocks to the transmitter and robot-control micro:bits, plug the robot-receiver micro:bit into the edge-connector and turn it on. Turn on the transmitter and try to drive the car just by moving the transmitter and pressing the A and B buttons. If all works, proceed. if not, go back through your wiring and check your connections. Are your batteries all okay?
Carefully cut a ping-pong ball in half. Invert the box and then hot glue the half-ball to the underside of the box. This is your 'third wheel'. If you want a better solution, buy the steel ball caster mentioned in the parts list and mount it with hot glue or use wire poked through the bottom of the box.
Step 13: Motor Fitting and Installation
Now let's mount the motors to the base and box.
One at a time, orient each motor so that the small circular protrusion is facing outwards.
Then on the BOTTOM of each motor, put a piece of two-sided tape.
Insert the component board into the tissue box.
Next, rotate the motor so the little circular protrusion is facing outwards.
Then, PRESS the back of the motor against the side of the box so a small dimple appears on the outside. If you put your thumb on the outside of the box and press against the axle, you'll get a deeper dimple that's easy to see.
Use a small knife to cut out the dimple. This will be where the axle exits the box.
Next, press the motor against the side of the box AGAIN so that the small circular protrusion makes a dimple.
Cut out this dimple as well.
If you've got your receiver micro:Bit programmed, install it in the edge connector and attach the battery pack (with the power switch off. Slide the cardboard base with all the components carefully into the tissue box.
Step 14: Mount the Motors to the Cardboard Base
Remove the backing from the two-sided tape and press each motor down to secure them against the base of your component board.
Insert a compass or un-bent paper clip into the two screw holes in each motor and push outwards to pierce the box.
Now cut two pieces of solid-core wire, each about 8 cm long. Bend like a 'U' shape and feed the wire ends into the motors from the outside. Twist them to secure the motors against the sides of the tissue box.
Step 15: Final Connections and Let's Drive!
The 9 volt battery now sits between the motors.
The negative wire plugs into a blue ground rail and the red wire plugs into Pin 16 of the motor control chip.
If you like, you could use a male/female Dupont-type wire to allow the connecting/disconnecting of the 9V battery from the circuit when not in use.
Plug the male end of the Dupont wire into Pin 16 on the motor chip and leave the female end free. Then you just plug the red 9 volt wire into the female end of the Dupont wire and your robot is energized.
Attach the wheels to your robot and you're done!
If you wish to decorate your robot as the school bus, the artwork has been provided as a file here. For best results, print the artwork on glossy photo paper. Superglue works well for attaching the artwork to the box. I used Gorilla-brand Gel-style superglue and worked great! There are lots of theme ideas here. School bus, fire truck, RV, delivery van. Your imagination is your guide!
Once you've built this robot, you could experiment with folded corrugated cardboard to make different style chassis.Now turn on the micro:bits, attach the 9 volt battery and start driving your bus/car!
I hope you found this project enjoyable and a nice introduction to robotics with micro:bits!
Gord Payne (Newmarket, Ontario Canada)
Step 16: School Bus Artwork
Step 17: Frequently Asked Questions
Why aren't you using an L293D or L298 Motor Controller IC?
The micro:bit is a 3 volt logic level device. It cannot supply the 5 volts necessary to activate an L293D or L298. The SN754410NE also requires 5 to 7 volts to activate, but the chip's design is robust enough to handle a Vcc of 9 volts. So we use the 9 volt battery to power both the motor chip and the motors. Thanks to Learning Developments for this insight. Having said this, it may be possible to come across an L293D that can activate on 3V, but it's not compliant to the original design specification for the chip.
Where can I learn more about the SN754410NE Motor Controller IC?
Check out this lesson based on the L293D. The SN754410NE has the identical pin arrangement and works the same way.
My motors run the reverse to the instructions. How do I fix it?
Just swap the wires on your motors to the opposite pins. Red to pin x and Black to pin y becomes Red to pin y and Black to pin x.
How can I cut a ping pong ball in half?
You can use a rotary cutting tool or a small hobbyist saw (like X-acto) to carefully cut the ball.
Why are the reverse direction pin values the opposite of the forward pin values?
We hard-wired the enable pins on the motor chip permanently HIGH so that we use two fewer pins on the micro:Bit. As a result, the way we do reverse requires us to do 1023 minus value to get the desired speeds. Hence full speed 1023 in forward needs to be 1023 minus 1023 (ie. 0) to get full speed in reverse.
Why are we using pins 13,14,15 and 16 for the motor control pins? Couldn't we use lower numbered pins?
Yes you can. However you'll see from this pinout diagram, that different pins serve other purposes on the micro:bit. For example, the LED array on the micro:bit uses pins 3,4,6,7,9 and 10. So if you want to also access the LED array, you can't use the pins shared by the array. Using those pins deactivates the LED array.
Why should I delete the LED display commands from my busReceiver code?
Turning ON/OFF LEDs takes processing time and it slows down the responsiveness of your transmitter and receiver. Leave the LED display commands in your code if you wish.
This is an entry in the
Arduino Contest 2019