Introduction: DIY Micro:bit Educational Mobile Robot V2

About: From research in the field of computer vision, with many exciting subjects such as augmented reality, 3D reconstruction, autonomous robotics and deep learning, I progressively made my way to another passion wh…

I like the micro:bit for a few reasons: it gives me the possibility as a teacher to have my students program either in makecode or in python. Compared to arduino I also really like that it comes with already integrated sensors and actuators, which allows me to get my students started on some interesting activities without having to introduce anything else in the system at first.

However there has been one problem: I've been willing to get my students working on mobile robotics activities, but I never manage to get a robotic kit that satisfied me. Among the affordable ones, some of them like the bit:buggy (or bit:ring) come with a board that gives access only to 3 pins of the GPIO and run on AAA batteries. Some of them have DC motors with very inadequate reduction ratios like the bit:buggy. I never really found what I wanted, so I ended up getting some pieces to design a minimalist mobile robot most people could build.

This instructable will show you how to build this minimalist mobile robot which holds the following advantages: it gives access to all the GPIO of the micro:bit, it allows to deal with 5V and 3.3V sensors and actuators easily, the battery is rechargeable, the robot can move fast and slow. One last advantage I find in this setup is that I can reuse all its parts easily in other robotics projects (for instance did use them to do a mobile robot based on raspberry pi). One disadvantage though is that for simplicity I equipped it with servo motors that do not allow for accurate movements.

Step 1: Getting the Parts

To build this robot you will need a micro:bit, of course, and:

  • A battery shield and a 18650 lithium battery* (link here and here),
  • An extension board to easily get access to the GPIO** (link here),
  • 2x 360 continuous rotation "servo" motors, (link here)
  • 2x wheels and rubber (link here),
  • An ultrasound sensor (HC-SR04P link here),
  • 2x line tracking modules (TCRT5000 with analog output link here),
  • 10x Female-female wires(link here),
  • M2 Screws, bolts and spacers box (link here) and 8mm M2 long screws (link here),
  • 3mm thick MDF wood sheet about 30x30cm (your favorite hardware store),
  • A 12mm ball (link here),

All this for a total cost of about 20$...

* You can find a nice review of this sort of battery shield here, presenting both the advantages and limitations. To summarise, the board gives a stable 5V up to 1.5A, it takes care of the battery management, however when the battery is in it is never really off so the battery gets emptied if you don't remove it after use or if you don't hack the shield.

** I've been testing many extension board in different robotics projects, and most of the time I end up disassembling my old projects to get back this board. It has several advantages. Among them I like that it can be powered with 6 to 12V or usb port, that it gives access to many VCC and GND headers, that it allows to choose 5V or 3.3V for VCC and that there are three additional 3.3V and 5V headers.

Step 2: Designing the Chassis

To design the chassis I used Tinkercad. As a user I would say that it is free and very simple and accessible CAD software. As a teacher I would add that it allows me to invite all my students in a virtual classroom without them needing an account, I can monitor their progress...

Thanks to all of those advantages, I can have my students not only work on programming a mobile robot, but I can also get them to work on the design of the robot beforehand. What I tested was to introduce them to programming the micro:bit, to the interface with sensors and actuators, to mobile robotics with a mobile robot without distance sensor, and then to ask them to create a design including a distance sensor. It worked great.

You can find attached the .svg file to laser cut in the 3mm thick MDF wood.

Step 3: Assemble

To assemble it I would recommend to follow those steps:

  1. Mount the servo motors on the side pieces (use the 8mm M2 screws),
  2. Mount the battery shield with 5mm spacers under the central wooden piece (with the nylon bits),
  3. Mount the line tracker modules on the lower front part, the ultrasound sensor on the adequate piece, and mount the line tracker piece with the ultrasound piece,
  4. Mount the universal wheel,
  5. Mount all the wooden pieces together,
  6. Plug the wires on the motors and sensors and get them through the holes of the central piece,
  7. Mount the extension board using the spacers,
  8. Mount the wheels and rubbers.

You are almost ready to program. We only need to plug the wires to the extension board beforehand.

Step 4: Plugging the Battery, Motors and Sensors to the Micro:bit.

As micro:bit works with 3.3V, it is not safe to provide 5V on its inputs. Therefore the most important thing to take care of here is to not power the ultrasound sensor and ground sensors with 5V but with 3.3V. Other than that, if you plan on using the ground sensor as analog inputs then following the information provided here, your only choice is to use pin0, pin1 or pin2 to keep the display fully functional. That leaves you with still quite a lot of freedom.

My choice was to plug the left motor on pin12, the right one on pin13, the trigger of the HC-SR04 on pin14, the echo on pin15, the left ground sensor on pin0 and the right one on pin1. Finally I power the servo motors with 5V. To keep things neat I used 5V for VCC to be able to plug my servo motors directly on the extension board, and powering the 3 sensors with the 3x3.3V male headers.

Step 5: Program a Line Tracker and an Obstacle Avoidant Robot

Here are the programs I used to get this robot to follow a line (more exactly the edge between a black and a white region) and to avoid obstacles (stay 12cm away from an obstacle with a proportional control law). Just change the extension to .py.

Step 6: Going Further

I hope this instructable will help you save a bit of time and money searching for a simple base to get further into using the micro:bit in robotics applications. Based on this robot there is of course many more programming activities to do. Among them, I like the activities to learn about control laws which are the following:

  • Program the robot to do the line tracking using a line printed with a gradient as in the joint pdf and a proportional control law (the rotation speed of the robot will be defined to be proportional to the error between the desired ground intensity and the measured one)
  • Program the robot so that when someone moves it, it direct himself back in the same direction it started (using the compas and on-off or proportional control law)
  • Program the robot to get up any slope using it's accelerometer and an on-off or proportional control law,
  • Program the robot to be radio controlled using another micro:bit and the radio communication (I would recommend using the accelerometer, the students usually love it: accelerometer_x for rotation and accelerometer_y for forward displacement)
  • Program the robot to do obstacle avoidance: set a direction using the compas or a slope, and set obstacles using black tape that the robot do not have the right to cross.

To add more complexity without much more hardware it is also possible to mount the ultrasound sensor on a servo motor. This way you could for instance program the robot to move in one direction and avoid real obstacles (unlike the previous proposition of activity where the black tape is not a real obstacle...).