For this project, we used two relatively new components on circuito.io:
The hall effect sensor reacts to a magnetic field. In order to activate it, there needs to be a change the magnetic field around it. So as you’ve probably guessed we used a magnet. The magnet is placed on the lid of the gift box.
Every time the lid is opened, the hall effect sensor is activated, and gives out a signal for the screen and the piezo speaker to play their turn. Here's a nice explanation about hall effect sensors and how they work.
In this magic circuito link we pre-selected the components we used in the project. After clicking generate, you’ll see all the parts you need, including peripherals such as resistors, capacitors, etc.
Note that with circuito.io you create many different combinations for this project with the components you have available.
Here are just a few other combinations we thought of for this project:
- Replace the piezo speaker with an LED
- Replace the hall effect sensor with an Ultrasonic range finder
- Replace the wall power adapter with a 9V battery
- Replace the Nokia screen with an LCD 16x2
If you clicked Generate on the magic link above and scrolled down in the reply, you’ll reach the wiring scheme. Follow the step-by-step guide that will show you exactly how to put together your electronics. It may look complicated, but if you follow the guide one step at a time, it's really simple!
If you scroll down once again in the circuito.io reply, you’ll reach the code section. In this section you’ll have to download the code from circuito.io and extract it to your computer.
Afterwards, you’ll need to open the code with Arduino IDE and upload it to your Arduino.
the code from circuito.io is a sample code. It integrates all the components and their libraries. This code will help you test that your wiring is correct.
Once you’re done with this part, you can copy-paste the code at the end of this tutorial into the firmware.ino tab in the code you got from circuito.io.
Inside the code you’ll see comments that explain each part and function of it, so you can make changes to the values for example, you can change the tune that plays when the box opens, or the pixel-art that appears. Don’t forget to upload the new code to your Arduino once you’re done.
You’re doing great! Now we’ll move on to making the gift box
The box we made is a combination of 3D printed parts and PVC cardboard but you can really go wild here and use different materials to give it a totally different look.
For example you can use wood and glass, you can make the box bigger or smaller, decorate it, make it round, make it in any color you want. It’s really up to you.
If you want to make a box like ours, you have the .STL files right here for download.
Once you have all the parts ready, it’s time to put everything together.
- Place the Arduino with the shield inside the box.
- Glue the magnet onto the box lid.
- Thread a flexible steel wire to connect the lid and the body of the box
Let us know if you made one by clicking "I made this" or send us pics and videos of your project on our facebook page.