Introduction: Interactive Egg - Sound Reactive and Knock Reactive
I made the "Interactive Egg" as a project for school, where we had to make a concept and a prototype. The Egg responds to loud noise with bird noises and if you knock on it hard enough 3 times, it opens up for a few seconds.
It is the first electronic interactive prototype I made and since I have very basic programming knowledge and no previous experience with making more complicated arduino projects, it was a great learning experience. To make the egg I learned to use a laser cutter and also had to learn a lot about the dfplayer mini(which is not that hard, once you understand what you're reading and it works).
To give an idea of which exact module and such I've used, I've included links to the webshops that I have bought them from.
- Arduino Uno
- Sound sensor
- DFPlayer mini/Mini MP3 Player module
- Sandisk microSd card(max 32GB) with sd adapter - If you dont have a sd card reader built in your laptop or pc, you may need to borrow another pc that has one to upload you sound files or use/get a card reader that connects through USB
- 1 x Speaker - A small speaker works fine and you can use pretty much any speaker if you use a jackplug and some wires, but if you use a tiny one you might need an amplifier
- 1 x 1MΩ Resistor
- 1 x 1kΩ Resistor
- Servo (I used a towerpro MG90D Digital) - Do keep in mind that a digital servo may not work exactly the same as analog ones (mine will only turn 120 degrees at max and it seems to be very hard to fix this)
- External powersource (I used a 6 battery one with plug for the arduino and a 3 battery one for the servo)
- 5 x Male Female jumper cables (3 for sound sensor, 2 for testing the Piezo)
- At least 15 Male jumper wires - If you have to solder your own wires to the external power source for the servo, make sure to get at least 17 male jumper wires
- A breadboard for testing - (a 400 pin such as this one, is the handiest to use)
- Perfboard - This is to solder your finished circuit to, but you can also stick with breadboard if you want to reuse all your parts or can't solder them
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Connecting the Circuit
The most important thing to keep in mind when building your circuit, is that you're essentially building two entirely seperate circuits. One is connected to the Servo and another is connected to the other components. With a smaller Servo you can connect it directly, but in general it is a better idea to seperate the servo from the rest as it tends to draw a lot of current.
The components are connected to the breadboard in the way shown in the circuit diagram. The wires of the circuit with the Servo can be moved closer to the rest of the components, as long as they're not connected to the positive an negative of the other circuit(when you solder all components, moving them closer to eachother will save you a lot of space).
The 1MΩ Resistor is used in combination with Piezo. The 1kΩ Resistor is used with the dfplayer.
Potential connection issues
If at a later point the dfplayer is not showing a light when triggered, check to see if you have connected the right side of the dfplayer.
The light on the sound sensor should flicker if it has been connected well. If not, carefully turn the sensitivity screw with a small screwdriver. If a light keeps staying on, turn it back a little until you see the light flicker in response to sound.
Step 2: Programming the Arduino
This is the code I used for this project.
One thing I do regret in my code, is that I couldn't replace the delays in the sound sensor code and servo code with something else. These delays make it so that once you triggered one of the sensor nothing else will happen for about 2 seconds. A shame in my opinion, but I couldn't get a for loop, if-statement or statement with millis to work. If you have more time and help I do recommend replacing these delays with something else, as it is much better to have both sensors working at the same time and to be able to scream at the egg when it's opened and get a response.
If you want to use mp3 sound files of birds you can use this website, that has tens of thousands of files to choose from.
Tip! Once you've uploaded the right code for the dfplayer, you can plug in an extra male to male jumper wire on the GND on the unused side. You can use the loose end to tap in the holes next to it(IO1 and IO2 as seen in documentation).
A quick tap on IO1 will make the dfplayer go to the previous sound file and a long tap will lower the volume.
A quick tap on IO2 will make the dfplayer go to the next sound file and a long tap will increase the volume.
Step 3: Building the Egg
Building the egg was something I did not entirely plan out.
Included are files you can use for laser cutting the box and top part of the egg. Do watch out that the slits for the gear rack are too wide, there are slits missing in the second plate, there are no connectors for the top and second plate and that without additional support the top topples over. Another thing to keep in mind that there is no part included to hold the gear rack to the gear on the servo and no holder. Also the box in the files is very small to contain allyour parts, it is best to make a bigger box if you make this project(click here to design a box and download its files for laser cutting).
My solution for these problems was to manually make rolls(on top and bottom) that hold the gear rack and leader in place and to add parts that prevent it from toppling. I also cut holes with a small saw in the second plate, made a holder for the servo(making a hole in a piece of wood and attaching the servo with some screws and the plate to the lid with some metal and screws suffices).
As my box was very small i had to shove everything with a lot of care. However my wires were fairly short and therefore it took a lot of effort to put them away, so they wouldnt get caught on the gear rack or such. Taking long enough wires to give yourself some space to fit everything is a big recommendation.
Another small issue I got due to the space was that the back of my soldered parts touched the metal back of my speaker and thus the sound started to turn strange and such. I you do get a space problem or want to put the perf board with your soldered parts against something metal in the box, make sure to put some form of isolation in between thet two to prevents issues.
Step 4: Decorate/cover Up Your Egg
To finish up your the project make sure to cover up the top. I improvised by using a white sort of beanie or hat we had lying around and reshaped the top, so it would go with the shape of the laser cut form.
Of course there are plenty of other options and if you have something such as a old bird plushie lying around you could also put a bird or figure inside to be revealed when the egg opens.
Once you've done all this just make sure to enjoy en let others try out your work. After all, a bit of screaming against an egg never hurt nobody, especially if it even happily tweets back at you.