Introduction: How to Make a Social Distance Detector
With 2020 coming to an end, I thought it would be nice to say goodbye with a tutorial that is just so 2020. I give you, the Social Distance Detector. With this device, you'll be able to social distance with technology and leave the worries behind. This device can be made fairly cheap with basic components and home materials.
- Five (5) Male to Male Jumper Wires https://www.adafruit.com/product/758
- Eight (8) Male to Female Jumper Wires https://www.adafruit.com/product/826
- Elegoo Uno R3 https://www.elegoo.com/products/elegoo-uno-r3-boar...
- Bread Board https://www.adafruit.com/product/239 (You can use any size bread board, just keep in mine that this tutorial is for the full size)
- Buzzer 5V https://www.adafruit.com/product/1536
- 9V Battery https://www.walmart.com/ip/Eveready-Super-Heavy-Du...
- Red LED https://www.parts-express.com/red-flashing-5mm-led...
- Ultrasonic Distance Sensor https://www.adafruit.com/product/4007
- 220Ω Resistor https://www.adafruit.com/product/2780
- DC Power Supply Snap-On Connector https://www.adafruit.com/product/80
- Foam Core Board https://www.michaels.com/elmers-black-core-foam-bo... (you can use any color, I used black)
- Loaded Hot Glue Gun https://www.michaels.com/adtech-corded-cool-tool-k...
- X-Acto Knife https://www.michaels.com/couteau-de-pr%C3%A9cision...
- Medium Grit Sandpaper (Optional) https://www.walmart.com/ip/3M-Aluminum-Oxide-Sand...
In total, you can get everything here for around $50-$60
Step 1: Assembling the Circuit
- Start by placing a jump wire on the breadboard as shown (I am using rail 18).
- Connect the other end of this wire to the GND pin on the Arduino as shown.
- Next, add the 220Ω Resistor onto the breadboard in the same rail as your first jumper wire as shown.
- Next, take another jumper wire and add it from a connection point below the resistor to a pin further down on the breadboard. I am using a pin in rail 23.
- Next, take a third jumper wire and connect it to a pin in the same rail as the jumper wire you just added.
- Connect the end of this new jumper wire to the negative (-) side of the LED (this is denoted with a larger metal piece inside the LED bulb and usually a shorter leg on the LED as well).
- Take another jumper wire and connect it to another pin in the same row as the wire you just connected. I put min in rail 25.
- Connect the end of this wire to positive (+) side of the LED (denoted by a smaller metal piece inside the LED bulb and a longer leg).
- Next, take another jumper wire and insert it into a pin in the same rail as the wire you just did (mine is rail 25) and plug in the other end of this wire into the GND of the Arduino as shown. You have officially completed your LED connection!
- Next, take a Male to Female (M-F) wire and place it on the positive end of the buzzer and connect it to the (2) pin on the Arduino.
- Take another M-F wire and connect it to the negative (-) side of the buzzer and connect the other end to the GND pin of the Arduino as shown. You have successfully completed the buzzer connection!
- Take a M-F wire and connect it to the GND of the distance sensor. The other end will be connected to the GND of the Arduino as shown.
- Take another M-F wire and connect it to the Echo on the distance sensor and connect the other end to pin 3 on the Arduino.
- Take another M-F wire and connect it to the Trig on the distance sensor and connect the other end to pin 4 on the Arduino.
- Take a fourth M-F wire and connect it to the VCC on the distance sensor and connect the other end to the 5V pin on the Arduino. You have officially completed the connection to the distance sensor!
- Take the DC power supply snap connector and connect it to the 9V battery.
- Plug the DC cable into the power supply on the Arduino.
- Your connections should be complete!
Step 2: Uploading the Code
Click the link to download the code for the Social Distance Detector using the Arduino Application. Once the code is downloaded, use the USB cable to upload the code from your computer to the Arduino.
Step 3: Testing Your Connection
This is an important step in the process. Here, you will ensure that you have created a successful connection.
Once the code is uploaded to your Arduino, if the distance sensor is less than 6 feet away from something, the LED should light up and the buzzer should go off. If this does not happen, check your connection. It could be something as simple as a wire being off by a pin or something coming loose.
This is the place where you should double check all of these things to ensure that you have a solid connection.
Make sure that when you are 6 feet from something, the LED goes off and the buzzer sounds. Also check that when you are not 6 feet away from something, the LED does not turn on and the buzzer does not sound.
Step 4: Creating the Housing Template
TIP: I highly recommend at this point to unplug your battery from the Arduino. This way it will not go off each time you get less than 6 feet away from something while you are moving it around frequently.
For these next few steps, we are going to be making a housing for the components. This makes it much easier to handle and easier on the eye, too!
First, Place the bread board onto the foam core board and use a pencil or marker to create the template around the bread board. Give yourself about 1/32 inch (the width of the foam core board) extra on the short sides of the bread board to allow space for gluing on the ends.
In total, the dimensions for the housing box are as follows:
Side A) 6.75 in. L x 2.5 in. H
Side B) 6.75 in. L x 2.5 in. H
End A) 2.5 in. L x 1.75 in. H
End B) 2.5 in L x 1.75 in. H
Top) 7 in. L x 3 in. W
Bottom) 6.75 in L x 2.5 in. W
Really, you can use whatever dimensions fit best for you. If you used a smaller arduino or smaller bread board, you should make your dimensions smaller to create a more compact final design. Just ensure that you will be able to fit all of your wires inside the housing and that there is enough space so that the wires sticking out of the bread board have some space.
Step 5: Cutting Out the Housing
Use the X-Acto knife to cut out the template you made for yourself. It is best to do this on carpet or a designated cutting surface so that you do not accidentally cut up your counter or table.
Once you have cut all of the pieces out, you should have 6 planes that will later be assembled.
Step 6: Tracing the Ultrasonic Distance Sensor Cutouts
Next we are going to make holes in the housing for the distance sensor to poke through.
Place the Ultrasonic Distance Sensor on one of the ends that you cut out and trace it with your pencil.
Step 7: Cutting Out the Sensor
Use the X-Acto knife to cut out the tracing you made of the sensor.
Tip: use the X-Acto knife in a controlled twisting motion or a small piece of medium sandpaper to buff out the rough edges.
Make sure the Ultrasonic Distance Sensor fits in the housing and set this aside.
Step 8: Cutting Out the LED
Next, we are going to make a hole in the top of the housing for the LED to shine through.
You can also trace this one too if you want to be more exact, but I found that just popping a hole through the foam core board with your pencil works well as long as you do not push the pencil too far and make it too wide.
Test it out and make sure that the LED fits in the hole.
Be careful not to force it as you could bend or break a wire.
You want it to be snug so that it doesn't fall out.
Step 9: Cutting Out the Buzzer
Next, we are going to cut out the hole for the buzzer so that it will be audible when the detector goes off.
As before, trace the buzzer and cut it out with the X-Acto knife and clean up the rough areas.
Ensure that the buzzer fits in the hole.
Step 10: Assemble the Base and Sides of the Housing
Next, we will start assembling the housing for the detector.
Start by placing the base of the housing on the desk and centering the bread board on it.
Use the hot glue gun to glue the two ends onto the base of the housing.
Be careful not to accidentally get glue on any components while doing these next steps.
Step 11: Assemble the Sides of the Housing
Use hot glue to affix the sides of the housing to the base.
Place all the components within the housing and make sure they are in a good position so that there's not too much shifting around and also so that everything has enough space.
Step 12: Scoring the Top (optional But Recommended)
At this point, we are going to lightly score the INSIDE of the top so that there is a flap on the housing that allows you to get inside to unhook or replace the battery.
This step is optional but is highly recommended as it is the best way to turn off the detector completely, ensure you don't waste your battery, and also easily change the battery if it dies.
Step 13: Assembling the Top of the Housing
Finally, use hot glue to attach the top to the rest of the housing.
Once dry, you may use the sandpaper to buff the edges and make them smoother.
If you had any excess glue leak out of the seams, use the sandpaper to smooth it out or the X-Acto knife to cut it off.
Step 14: Testing It Out
Now it's time to test out your Social Distance Detector!
Here, I used a wall to demonstrate how it turns on when I get closer than 6 feet and turns off when I pull away further than 6 feet.
Step 15: Start Social Distancing!
You have officially made a Social Distance Detector!
This is only a prototype and unfortunately the Ultrasonic Distance Sensor cannot yet tell the difference between a wall and a human, but I think it's a start. It's really fun to walk around with and definitely a conversation starter. Just remember to keep your distance!
Participated in the
Battery Powered Contest