How Close Can You Get?

by Kaylact8 in Circuits > Sensors

257 Views, 0 Favorites, 0 Comments

How Close Can You Get?

IMG_6281.jpeg

Have any items you don't want someone to get to close to? Maybe a painting at a museum. Your favorite candy that you don't want your siblings to eat. Or even just a fun alarm system! If so, this project is for you!!

Supplies

  1. Adafruit Circuit Playground Bluefruit
  2. LED lightstrip
  3. Distance Sensor
  4. Battery Pack with 3 AAA
  5. Speaker
  6. Aligator Clips
  7. Laser Cutter
  8. Clear Acrylic Board
  9. 1/8 in. Wood
  10. Sand Paper
  11. Black Paint
  12. Tape
  13. Wood Glue

Making the Box

IMG_6282.jpg
IMG_6266.jpg
IMG_6279.jpg

While there may be lots of ways to make a box, I suggest going to makercase.com and selecting the box of your choice. Set the dimensions to your desired size, in my case it was 24 x 4 x 4. Download the SVG file and upload it into Adobe Illustrator. On one side, draw out 3 circles to be cut out and a small rectangle for your distance sensor to fit into. All shapes you want cut out by the laser should be in red (255, 0, 0) and should be set to 0.01mm. Next, save down this file and upload it to your laser cutting website. From there, put the wood into the laser cutter and get ready for the fun part. Adjust your design on the computer and select wood as your material then move the laser around to make sure all your shapes fit (be sure not to waste too much wood!). Once the laser is focused and set, click begin! Your laser cutter should cut out all box sides, with 3 circles on one of the faces. Next, take out the wood and replace it with some clear acrylic. Hope back onto the computer and on the same Adobe Illustrator file you saved earlier, delete the outside box shapes and just leave the circles. Save that file and put it back into the laser cutter website and select acrylic as your material this time. Click begin and have the laser cutter cut out your clear acrylic to the same size as the circle in your box built. Take some sandpaper and sand the clear acrylic to give it a foggy glass like affect.


After you have all your part laid out, take your black paint and paint the wood cutouts. Let them dry and then take your clear sanded down acrylic cutouts and place them into the wood frames (they should fit well but if not use some hot glue or tape). Next, start assembling the box, everything should snap together, but make sure to use some wood glue just in case. Glue all the pieces together besides the black side, so that you can still insert the electronics.


After the pieces are all put in at the end you can snap on the last side, but this one without glue so you can remove your pieces when you're done!

Set Up the Circuit

IMG_6338.jpg

In order to get your code working on a physical device, we want to next connect all the pieces to your circuit. You will ground the speaker (connect the ground wire to any GND and make sure the alligator clip is connected to the end of the wire from the speaker. Then, connect your audio wire to the AUDIO output (again you can use any alligator clip just make sure you connected it to the inside part of the wire from the speaker). The speaker has a battery of it's own so I did not need to provide it with a power source. Next, I connected the NeoPixel light strip to the board. It has three wires on the end of it: red, black, and white. The red goes to VOUT, black goes to GND, and white is the signal which I put at A1 (don't forget to code it as A1 as well or else it won't work!). Finally, you want to connect your distance sensor. The red clip goes to the 3.3V, black goes to GND, yellow goes to SCL/A4, and finally blue goes to SDA/A5. Once, you've connect all the wires, you're set to go! Good luck!!

Write the Code!

The most exciting part is here! I have attached a copy of my code down below that you can follow and modify as you'd like. You will also need to download sound files in .wav format. You can use any sounds you'd like, but make sure to rename them in the code to what your sounds are called in your folder! Make sure you have the neopixel and adafruit_vl53l1x libraries in your lib folder.

Downloads

Final!

Here's a quick video demo of what the final project should look like/do!