- Sheet of 6mm wood, which will be used to make a 10x10x10cm box. Make sure you have enough.
- Glue/nails/screws to put the box together.
- Arduino Uno (Complete with breadboard, wiring, LED's)
- HC-SR4 sensor for arduino
- Access to basic tools
- Access to a 3D printer (optional)
- Spraypaint (optional)
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Step 1: Creating the Box
The box will be 10x10x10 centimeters. I used a boxmaker tool to create a template that will go into a lasercutter. This is the most precise way of cutting the sides for the box. I have included the PDF of the box, i suggest you use it if you have access to a lasercutter.
I will 3D print a lid for my box so i threw one side away. If you don't have access to a 3D printer, keep it.
So now you should have either 5 or 6 pieces of wood (depending on whether or not you will 3D print a lid)
Because my box is made using a boxmaker tool, the edges will have puzzle-like shapes. And because i am not using a piece of wood as a lid for the box, i will need to flatten those edges. I used a sanding machine to do so.
After that i spraypainted the panels black. This is optional ofcourse.
Step 2: Step 2: 3D Printing a Lid
Remember, if you chose to use a wooden panel as a lid, you can skip this step.
I have included a file which can be used to 3D print a lid for the box. My design is fairly standard. You can add all sorts of decorations to the lid if you want. Just remember that it should be 10 by 10 centimeters.
After printing the lid I realised i needed holes in the lid to place my LED's in. I had to drill the holes afterwards, which kinda ruined it. If you want the holes for LED's, let the 3D printer do that for you, it will look much better.
Step 3: Step 3: Drilling Some Holes for the Sensor
The sensor will need to fit through the panel in order to check if there is something inside. We will need to drill two holes, each 16mm in diameter and they should be 9mm apart. Obviously, the best place for these holes is near the bottom, in the middle of a side.
Step 4: Step 4: Putting the Box Together
Right, so now we have ourselves a box. Five wooden sides, one of them with two holes for a sensor, and in my case a 3D printed lid. Time to put the wooden sides together. I used glue for this as this is the best solution when using a boxmaker. If you didn't use the boxmaker, you could use nails or screws. Remember, the wood is only 6mm thick, so be careful.
Step 5: Step 5: Attach the Lid
Using the hinge and some screws, attach the lid to the box
Step 6: Step 6: Programming the Arduino
We want the sensor to check for distance. When the sensor is mounted through the holes, it will have a steady value if there are no items in the box, the red LED will light up. When there's an item in the box, the distance the sensor can read gets significantly smaller and the green LED lights up. This is when you will know there is something inside.
The sensor returns a certain value. If you divide this value by 58.2, the value will be the amount of centimeters between the sensor and the first object it sees.
Step 7: Step 7: Hooking Up the Arduino
Now it's time for the final part, hooking up the arduino, sensor and LED's.
- Green led
- + goes to Arduino port 4
- - goes to Arduino GND
- + goes to Arduino port 3
- - goes to Arduino GND
- VCC goes to Arduino 5V
- GND goes to Arduino GND
- Echo goes to Arduino port 7
- Trig goes to Arduino port 8
For more consistent sensor results, put a small resistance (1k) between HC-SR4 Trig and GND.