Originally posted on instructables: https://www.instructables.com/id/Coronavirus-Stop-the-Spread-With-Microbit/
During the toughest times human ingenuity shines the most. From January 2020 COVID-19 pandemic engulfed the world. COVID-19 is spread by air droplets and fomites. Fomites, simply speaking are inanimate things, such as furniture, clothes, door handles, etc. Virus from infected person can stay on surfaces for as long as 9 days. So, one of the most important ways we can prevent COVID-19 spread (apart from social distancing) is making sure we wash our hands often and avoid touching our face. According to statistics, humans touch their face 16 times an hour on average. It is a habit many of us have and we don’t even notice it most of the time. So, in this article we will quickly make a convenient device that can remind us that we should avoid touching our face right before we do it. If we are stuck at home, you’ll relieve yourself from boredom for an hour or two 🙂
Step 1: Assemble BitWear
BitWear is a low-cost compact accessory for micro:bit users to make fun wearable gadgets.
There is a vibration motor, a buzzer and an addressable RGB LED on board, all designed for your fun wearable projects. The board also allows you to turn off the motor and pixels with switches so you can use the touch pins or the breakout holes for other uses.
The assembly takes less than 5 minutes and really easy even for primary school students. You can consult the video above for assembly instructions.
Step 2: Coding
We will use Microsoft’s Makecode to compose a simple yet useful program for our little Micro:bit wearable gadget. Our goal is to make it vibrate/show a scary coronavirus image when user touches his/her face. How can we know when user touches the face? Well, we can record the accelerometer reading in the specified position (hand near face) and then after accounting for some variations compare it with accelerometer reading now. If there’s a match, we sound the alarm.
Let’s start by enumerating the steps in the algorithm:
- When button A is pressed, we show an image on the screen to notify user about measurement success and record accelerometer y-value in the list pos1. We record the original value and also all the values in range +/- 10. You can change that number to increase/decrease sensitivity.
- We compare elements of the pos1 list to actual real-time values output by accelerometer and if there is a match we either a)turn on vibration motor for 500 ms b)show scary face on LED matrix, depending on the value of “silent” variable.
- When button B pressed, if variable silent is 0 (vibration motor mode), then we set it to 1. Otherwise we set it to 0. This way we can switch between vibration/LED screen mode.
And this is it really. Have a look at the demonstration video on how to use it and you’re good to go.
Here’s a copy of the code
Step 3: Improving
There are some improvements to code that can be made. You could take accelerometer measurement immediately after reset and then use A button to tweak the sensitivity for example. Or add some sound effects. Or add remote monitoring with Bluetooth. Or add counter to see how many times you touched/wanted to touch your face within specified period of time.
All these things are yours to code and make! If you do think and implement some interesting features, share in the comments below.
For more Micro:bit accessories and other hardware for makers and STEM educators, visit our official website.