Coronavirus EXTER-MI-NATION With Micro:bit and Daleks

This is a second project in series on coronavirus protection from TinkerGen. You can find the first article here. We firmly believe that with humanity’s collective efforts, current epidemic will soon come to an end. But even after COVID-19 has passed we should remain vigilant and keep the good habits we (hopefully) developed during these tough times. The previous article was focused on using Micro:bit to pay more attention to us unconsciously touching our faces and by doing that prevent the spread of germs. In this article we’ll design and build a simple, yet powerful weapon against microbes – a little device, that we can use to measure the amount of time we spend washing our hands.

Supplies:

Bitmaker Lite

1/8″ (3mm) plywood for the case

Two M4 * 8 + 5 single head copper columns
Two M4 nuts

Two M4 * 8 Hexagon socket head cap screws

Two R480 white nylon rivet

Two M2 * 15 double-pass aluminum columns

Two M2 * 8 mechanical screws

Step 1: Case Assembly

Download the .dxf files from Thingverse, then cut them from 1/8″ (3mm) plywood. The case has self-locking design, but you might need to apply a little bit of glue when assembling the box. Use two M4 * 8 + 5 single head copper columns, two M4 nut and two M4 * 8 Hexagon socket head cap screws to attach Grove Ultrasonic Ranger to case inner wall. On the opposite side of case, attach the servo with 2 M2 * 15 double-pass aluminum columns. Use two M2 * 8 mechanical tooth screw to install plastic servo arm on the arrow. Connect Ultrasonic Ranger and Servo to BitMaker Lite and then fix it inside the case with two R480 white nylon rivet. Attach the arrow to servo and put both top and bottom covers on. The assembly is finished, let’s code now!

Step 2: Makecode Program

I made two versions of the code for this project: an easier one, done with Microsoft Makecode, a graphical programming environment and a more difficult one, written in Micropython – that one also features Dalek voice, synthesized with Micro:bit speech module. We’re going to start with a simpler program.

Before you start writing code, you need to add BitMaker lite extension to Makecode. Consult on how to do it here.

Inside of on start block, we clear the screen, set the two variables, start_time and stage to 0, set servo angle to 90 and wait 500 ms before we start the main loop code. Code logic inside the main loop is fairly simple – first of all, regardless if there are hands detected or not, if stage is 0, we set the servo to 90 degrees, it’s a default state.

If we detect there is an object at distance closer than 10 cm from our device (we’ll assume that it is person’s hands), then we perform a check if 1 second has passed since last time we moved to a next stage. 1 second time is set for debugging purposes, actually it is supposed to closer to 4 seconds (according to CDC recommendations, fairly good duration for washing hands is 20 seconds, we have 5 stages, so 20/5=4). Every time 1 second has passed since we advanced to a stage, if the hands are still detected in proximity of device, we advance to next stage, reset the timer and play a melody. We also set digital pin1 to LOW, so PWM generation for sound wouldn’t interfere with servo – if you don’t do that, you will notice servo will start acting crazy when music is playing. This is a known limitation of Micro:bit.

Then for every stage we set the servo angle in a succession of if blocks. Finally, if no hands are detected(distance from device is larger than 10 cm), and stage is not 0 – meaning the user has interrupted washing hands prematurely, we play a sad sound and set stage back to 0.

if you’re having problems with code, you can download the .hex file at our GitHub repository for this project.

Step 3: Micropython Program

If you like coding and would welcome a little challenge, then making the same project in Micropython might be more interesting for you. Besides, this version is more fun!

Micropython version main code follows the same logic. One major difference here is that we cannot directly use Ultrasonic Ranger or Servo – there is no standard modules in Micro:bit micropython firmware for these. So, we will put this Servo class in our code and use slightly modified Grove Ultrasonic Ranger Python code for distance measurement. A better way would be to create two standalone .py files and import them as modules – one for Servo class, the other for Ultrasonic ranger. But we’ll keep everything in one place, for the sake of simplicity.

The other key difference is use of speech module, which allows us to synthesize familiar Dalek voice 🙂 We use the parameters from this documentation for speech module to make voice that sounds like Dalek voice.

Go to this project’s GitHub repository to download full Micropython code.

Step 4: Make It Your Own

We have built an interesting a useful project with Micro:bit and Bitmaker Lite extension, that can be both purely educational project and really can find use in household bathroom to remind people to wash their hands more thoroughly. Of course, the experimentation and improvement doesn’t stop here – you can think of ways to make the case and setup sturdier and more suitable for use in public schools or kindergartens. Or you can connect external speaker to increase the volume.

The possibilities are endless and implementing your own ideas in hardware and software is the soul of Maker movement. If you come up with some new and interesting ways to improve this project, please do share in the comments below. Also, Bitmaker Lite comes with an online course you can access at TinkerGen’s online course platform, https://make2learn.tinkergen.com/ for free!

For more information on Bitmaker Lite and other hardware for makers and STEM educators, visit our website, https://tinkergen.com/ and subscribe to our newsletter.

Source: Coronavirus EXTER-MI-NATION With Micro:bit and Daleks


About The Author

Muhammad Bilal

I am a highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top