Social Distancing Sensor With Micro:Bit and Hummingbird Kit

by Cana Yao in Circuits > Microcontrollers

1303 Views, 5 Favorites, 0 Comments

Social Distancing Sensor With Micro:Bit and Hummingbird Kit

FGC2VIJKUIDRJ8M.jpeg

If, in the past two years since the beginning of COVID-19, you’ve been to any place with lots of people, you’ve probably noticed that following social distancing protocols is a lot easier said than done. People drift too close to each other while talking, and don’t even realize it. People seem to have different perceptions of “six feet.” Sometimes, it’s hard to back away from people—I have crashed into a wall once when trying to maintain good distance from a friend who just wouldn’t take the hint! As a middle school student, I’ve noticed that a few problems in particular make it hard to stay six (or three) feet apart:

  1. Blind Spots: Truth is, you can’t see behind you. If I’m standing in line, I don’t necessarily realize that somebody is standing five feet behind me instead of six. noticed that sometimes, people forget to social distance with the people behind them.
  2. Inattentional-Blind Spots: This is not just a reference to the famed “gorilla test,” this is actually a real issue when it comes to social-distancing! It’s not that most people don’t want to stay distanced—it’s just that they don’t always realize! If you’re in the middle of an exciting conversation with a friend you haven’t seen since lockdown, it can be easy to forget to stay six feet apart.
  3. Distance Perception: It’s really hard to know exactly what six feet is. Arm spans? An alligator? The length of a basketball player lying down in between you and everyone around you? The length of a fully grown black rat snake? Anything but the metric system!? Six feet to me seems more like eight feet, which seems more like three feet to my friend. It’s hard!

Using the Micro:Bit, Hummingbird kit, and BirdBlox app, I decided to try to solve these problems and make social distancing easier (and more hi-tech). I wanted my device to be able to sense exact distance and send a friendly reminder to the user if COVID-19 protocols are not being followed. I wanted my device to be portable—even wearable, like a backpack—and easy to use in various situations.

So, I decided to make the SDS, or Social Distance Sensor.

The SDS is a device designed to sense if somebody is getting too close using the distance sensor, think relying on block code, and act by reminding the wearer and those around them to social distance, using LED lights. Check out this video to see the SDS in action.

Supplies

07306AB9-ADAB-46A5-89B1-9A0DA0F72101.jpeg

Image 1: Materials

To create the SDS, I used:

  1. Micro:Bit
  2. Video tutorials for BirdBlox
  3. Hot Glue Gun
  4. Double Sided Tape
  5. Duct Tape
  6. Medium-sized cardboard box with a hinged lid that looks like this. I used a spare Sindoh filament box, dimensions 8x8x3 in.
  7. Some kind of straps (from an old tote bag, etc. Straps like tie-down straps that have clips are recommended, but optional.)
  8. Scissors and/or an x-acto knife
  9. Parts from the HummingBird Kit:
  10. Distance Sensor
  11. Hummingbird
  12. Battery Block
  13. Red, Yellow, Green LEDs
  14. Position Servo
  15. Small Wheel; 2 Tri-color LEDs; BirdBlox App for iPad (block coding)

Preparing the Box

C840ECB5-151D-4494-AEF6-87D95AFED76F.jpeg

Image 2: Setup of Box

For this step, you will need: scissors and/or an x-acto knife, double sided tape, your cardboard box, and the Hummingbird with the battery pack and Micro:bit.

  1. First, open the lid of your box and place it on a table, hinge-side facing left. Cut a hole in the left “wall” of the box, as shown in Image 1. Later, you will put your wires for the LED lights through this hole.
  2. Then, cut a flap in the right “wall” (Image 2). This will be where your wires fo the distance sensor and servo pass through. Do NOT cut off the flap, as the servo will be placed on top of it.
  3. Next, connect your micro:bit to the Hummingbird. It should snap into place. If you need help, check the BirdBrain tutorial.
  4. Using double sided tape, secure your Hummingbird to the inside of the box.
  5. Install the BirdBlox app on your iPad. You will later need this to write the block code for your SDS. This “Set-Up” tutorial videos from the BirdBrain tech site will show you how to install it.
  6. Then, plug in the battery box and put it beside the Hummingbird.

Great! Now you’re ready to start your build.

Attaching Distance Sensor to Servo

1A346346-92EF-444B-AF42-1AE7FE1B946B.jpeg
5169F710-51B6-4458-AE7C-899A75130E98.jpeg
78C59E67-1C12-4BA5-B363-5957D495C5BC.jpeg
98F2AED0-424B-4DB5-AC08-8BCB9B7019FA.jpeg
A9CC78AF-5304-4B08-B6C9-D45B31FAD880.jpeg

Image 3: Sensor Limitation; Image 4: Solution; Image 5: Wheel; Image 6: Tape

The SDS relies heavily on the distance sensor—after all, it is the social distance sensor. But a sensor sitting at the top of a backpack can only sense in one direction—directly in front of it. This would severely limit how much the wearer would be reminded to social distance with people to their left and right (Image 3). To fix this, I decided to attach the sensor to a position servo which would spin it around (Image 4). Here is how to do attach the servo to the sensor.

  1. Choose the servo that says position, not rotation, because a rotation servo will spin the sensor around in circles, causing the wires to get tangled, and also causing the sensor to sense the back of the wearer. Take the small, black wheel out of the plastic bag (Image 5). It should snap into place.
  2. Then, cut off a piece of the popsicle stick, making it about as long as the distance sensor.
  3. Take off the wheel. Using hot glue, secure the piece of popsicle stick onto the wheel. Then, snap the wheel back onto the servo.
  4. Using double sided tape, stick the bottom of the distance sensor to the popsicle stick, and wrap a pipe cleaner around the sensor and stick a couple of times to secure further. DO NOT cover the mesh “eyes” of the distance sensor when attaching your pipe cleaner.
  5. Use double sided tape to secure the sensor to the flap, as shown in Image 6.

At the end of this step, you should have something that looks like Image 4. Now you are ready to plug in your sensor, servo, and single-color red yellow green LEDs.

Wiring Sensor, Servo, and RYG LEDs

F8A02AA9-E20E-4D43-9D7F-DE70366A2D4B.jpeg

Image 7: Wiring

  1. Wire the LEDs the same way, pushing down the square button as needed. Wire the green LED in the LED 1 port, with the green under “S” and the black under “-”. Wire the yellow LED in the LED 2 port with yellow under “S” and black under “-”. Finally, wire the red LED in LED 3 by putting the red under “S,” and the black wire with… you guessed it: “-”. See Image 7 and/or check this tutorial video for help. Then, thread the LEDs though the hole in the box so that the wires are connected but the lights are not in the box.
  2. Leaving the distance sensor and servo outside of the box, open the flap and put the wires from the sensor inside the box. Wire the distance sensor to Sensor 1, which is labeled on the Hummingbird. Make sure it is under Sensor 1, as that is how we will be coding later on. Hold down the blue square button corresponding with “S,” and then put the yellow wire in the hole next to that square. Repeat this for the red wire which corresponds with “+”, and the white wire which goes with “-”.
  3. Finally, thread the wire from the rotation servo through the flap and into the box. To wire this you do not need to push down any buttons, just plug the wire into the Hummingbird Servo port 1. Make sure your black wire corresponds to the negative symbol and the red wire goes with the plus sign.

Once you’re done, the inside of the box should look something like Image 7. Now, you’re ready to make the wristband to hold the LEDs.

Making the Wristband

06B148BE-508E-413E-814F-A8A5A463ED07.jpeg
C499A5D7-F2BF-42B7-940E-00AEB579D091.jpeg
FAAD7BC7-40A7-45F3-A08D-677445B0896A.jpeg
AF978A4F-0A4B-4785-B063-3581EFBF2610.jpeg
28152B70-7C94-4B6E-B3D6-E856569E4206.gif

Image 8: Length of Strip; Image 9: Holes; Image 10: Lights; Image 11: Pipe Cleaner; Image 12 (gif) Tightening the Band

Now, we have the setup for the sensor to know when somebody is not social distancing. But that alone will not make any difference—the user needs a visible reminder. For this, I decided to use red, yellow, and green LED lights. The red light will light up if someone is within 3 feet of the sensor, the yellow will light up if someone is between 3-6 feet, and the green light will turn on if someone is over 6 feet away. I decided to put the lights on a wristband. This is how I made it:

  1. Cut a strip of duct tape a little shorter than the measure around your wrist (Image 8)
  2. Fold the duct tape vertically along the center, sticky side in.
  3. Cut a hole on each end of the duct tape strip, and three holes close to each other in the center, as shown in Image 9.
  4. Put the LED lights through the three holes in the center, making sure they all face the same side, as shown in Image 10.
  5. Take a pipe cleaner and tie one end of it to one side of the duct tape strip by looping it through the hole and twisting it. Put the other end through the opposite hole. Pull on that end of the pipe cleaner until it is a little bigger than your wrist, and trim off excess.
  6. Now, you can use that side of the pipe cleaner to loosen and tighten your wristband, as shown in Image 11. Twist the pipe cleaner to “lock” the wristband in place.

Coding Distance Sensor and RYG LEDs

13F8EBAB-621E-4DF2-BBA1-ACD088D7CD85.jpeg
FECB1787-6D0F-4D84-8772-D4DCACEDAABE.jpeg

Now, it’s time to code everything that you have so far.

  1. Open up the BirdBlox app, create a new project, and pair your device, as shown in the earlier tutorial videos.
  2. Image 12 shows my code for the servo—this tells the servo when and how to move the distance sensor.
  3. Image 13 shows my code for the distance sensor and red, yellow, and green LEDs. Note that the “200” represents approximately 6 feet according to my testing. The “100” represents 3 feet. The units should be in cm, but my sensor in particular was a little bit off so I rounded up. You are welcome to do your own testing following this video.
  4. Run through your code so far. The lights should change colors as you walk closer to the distance sensor, and the distance sensor should rotate to the left and right.

If it works, you are ready to move onto the next step: adding straps to make the SDS wearable!

Adding Straps

A1C42A3B-5B16-49FD-8363-B572480DC718.jpeg
6B20FA1F-8B78-4F27-997A-8C3B177CB6BE.jpeg
396E4F0D-7AE7-4D95-83CD-0D83DB4907A2.jpeg

Image 14: Hole on Right of Box P; Image 15: Right Strap Clipped into Box; Image 16: Finished Straps

Right now, the SDS is just a box. Our next step will turn it into a portable backpack by attaching straps

  1. First, cut two holes on the left and right sides of the top of the box, as shown in Image 14. Make them about the length of the strap clips. Thy should be on the side of the box that is not connected to a hinge. Check Image 15 for a better view—these holes are what the straps will clip onto. If your straps do not have hot glue, do not cut these holes, just hot glue the straps to the box (without gluing the lid closed).
  2. Clip the straps onto the box (Image 15). These help to keep the box closed. Then, hold the back face of the box (the face opposite of the lid) to your back, and measure out approximately how long the straps should be for you to comfortably wear the box on your back. Cut one strap, and cut the other strap to match.
  3. Put the box back down and use hot glue and/or duct tape to secure the newly cut ends of the straps to the bottom of the box.

Your final strap design should look similar to Image 16 on both sides. To open the box, unclip the straps. Great! Now you’re ready to decorate your SDS!

Decorations

ED4B6184-828B-4859-AFA4-E7CCCF6DB659.jpeg
0746101F-C297-4A9B-82EB-4E7F895123D7.jpeg

Image 17: Decoration; Image 18: Printable LogoI don’t want to wear a cardboard box that has holes on the side (from my mistakes with cutting) and says “Sindoh 3-D Printer” on it. So, I decided to decorate it.

  1. I drew an SDS logo in Autodesk Sketchbook, printed it, cut it out, and glued it to the lid face of the box, as shown in Image 17. You can draw your own design or use the picture from Image 18. Using hot glue, I made a border around the logo.
  2. To cover up the text and holes on the side, I used duct tape and made patterns.
  3. What creative decoration ideas do you have? Let me know in the comments :)

You’re done with making a sensor that moves, detects social distance, and reminds the wearer. Yay! But do you remember what I said in the introduction? Sometimes, just reminding me to stay distanced isn’t enough. It would be nice to have a reminder for those around me… So, I made a display on the outside of the backpack that reminds the wearers using Tricolor LED lights.

Adding Tri-LEDs (Optional)

204375DA-499D-4CFB-86A9-4C4EEF838186.jpeg
85E3EF87-8196-4E82-9620-BD2935D7A248.jpeg
4222B28E-9E0F-4636-9FC6-84DD13E97CA8.jpeg

Image 19: Wiring Tri-LEDs; Image 20: Holes in Box; Image 21: Tri-LEDs!

To add your Tricolor-LED lights:

  1. First wire them into TRI-LED ports 1 and 2, making sure R corresponds with red, G corresponds with green, and so on, as shown in Image 19.
  2. Next, poke two holes on the front side of the backpack. If you used my SDS logo, the holes should be on the left and right sides (don’t cut the logo!). Label the holes, as shown in Image 20. Because there are only two lights, you will have a light for < 3 feet, and a light for >3 feet <6feet.
  3. Wire the LED from port 1 into the left side (3-6 feet) and the LED from port 2 into the right side (<3 feet). You should have something that looks like Image 21.

Now you’re ready to code!

Coding Tri-LEDs (Optional)

6AC45096-A887-4A75-9978-0C62658B117B.jpeg

Image 22: Tri-LED Code

Image 22 includes my code for the Tri-LEDs. I added to the previous code for the regular LEDs. I highlighted this new code with yellow arrows. Feel free to play around with the color percentages for the Tri-LEDs—they’re fun!

Congratulations!

6DA332E6-6642-4659-897B-93F6B5B494A3.jpeg
BCF621E7-D9DB-4843-8736-58913364794B.jpeg
E579983D-D9FB-4D57-96ED-1C3CA19928D0.jpeg

Image 23: Final Code; Image 24: Final Wiring; Image 25: Final Project—Yay!

There are some limitations to the SDS, the most obvious of which include:

  1. It will sometimes send a false alert if it detects an inanimate object nearby. You can see this in my final video. Thanks to the wall nearby, the LED lights sometimes lit up when Eric was far away. Getting the device to only sense certain things (in my case, people) is something that could be cool to improve on in the future. I don’t want to social distance with a whiteboard!
  2. Wearing a cardboard box on your back gets uncomfortable—and it doesn’t look like a back pack. In the future I could improve the visual design. 

If you want a challenge, take a look at the SDS and see what you can improve :)

You did it! Enjoy your SDS (and this video of my SDS).


Many thanks to:

  • Mr. Schaefer for introducing me to the micro:bit and Hummingbird in STEAM by Design class
  • Eric C. and Noah P. for helping me take videos and photos
  • BBC and Birdbrain for making all of this cool technology
  • And a big thank you to Instructables :)