Birthday Music Box With LEDs
Celebrate the birthday of someone you care about with this simple DIY music box.
I came up with an idea for this project when I saw a few videos of Arduino project which plays birthday song with piezo buzzers. This project includes a small box with a button where you can house all the components and a small cake with an LED candle, which makes your project not only more exquisite but also user-friendly.
Original code for melody is written by "Max Imagination"
Check out his video: https://youtu.be/bWzLsHpyGEM
Supplies
- Arduino Nano (FT232RL)
- Ø3mm LED (2 for each color except for 1 yellow)
- 1/4W 5% Axial resistor 221J (220Ω)
- 14x7mm Passive buzzer
- Button switch module (Button diameter < 13.5mm)
- 400 pin breadboard
- 50x50mm perfboard (Pitch: 2.54mm, Hole: 1mm)
- 9V battery
- 9V battery holder
- Ø4mm plastic straw (One you can find on a juice box)
Remember to use passive buzzers instead of active buzzers. (Active buzzers cannot produce various tones)
Total cost: Approx. 20,000₩ ($14.93, €13.73)
Connections
Connect all the components on the breadboard. You can skip this part and go to Step 3 if you are confident with your soldering skills and sure all the components are working.
Before solder resistors with LEDs, bend both legs of the LED 90º. It's better to solder resistors on anode(+, longer leg) because we're going to connect all the cathodes(-) to make a loop. Also, do not cut the leg or solder a resistor on the yellow LED, which will make it harder to stick the LED in the straw.
*I used the PIR sensor on the circuit diagram, just because they don't have any 3-pin button switch module on Tinkercad.
Below are the specifications of the LEDs I used. You can make your own choice of LEDs and resistors.
Red: 2.2V, 20mA
Green: 2.2V 20mA
Blue: 2.5~3.2V
Yellow: 2V 20mA
Upload Program
Download the code and open it on Arduino IDE. Then include the "Tone" library from the Library Manager.
Reference on the Arduino website: https://www.arduino.cc/reference/en/libraries/tone/
The code includes several functions like "__LedState", which change the output of the signal pin allocated to LED.
The "loop" function then constantly checks for the button input and plays the song if the button is pressed. 6 LEDs(R, G, B) will blink synchronized with the song, while the yellow LED on the candle stays on until the song ends.
Code preview: https://create.arduino.cc/editor/rustyspotted/1ebf491c-7c32-4e2b-bb5b-0cef23e3ff00/preview
Downloads
Solder on Perfboard
On the 50x50 perfboard, first solder Arduino Nano and buzzers, then the remaining connections. To make it more compact, make a loop with GND by connecting all the cathodes. Reference is shown on the circuit diagram above.
Print the External Parts
Print every part with 3D printer. The box consists of 4 separate parts, including "Box", "Top", "Cap" and "Cake".
"Box" accommodates most of the parts including the battery pack, perfboard, and the button switch module.
"Top" has 6 holes for red, green, and blue LEDs and another hole for the candle. This part will be attached to the "Box" part.
"Cake" is where the LED candle goes. Will be placed in the center of the "Top" part.
"Cap" is the lid of the box. Connected with the "Top" part with the hinge.
I printed the parts with PLA, infill 15%, which was not ideal for the hinge to operate firmly.
Infill above 15% for the Top and Cap part recommended.
Post-processing (Optional)
Post-processing is an optional process, when it comes to simple projects. Although, I recommend sanding down the hinge at least, which will help it operate smoothly.
Assembly
Make sure the system works fine before assembly while heating up your hot glue.
- Place the battery holder. (Where the big rectangle hole is)
- Place the board next to the battery holder.
- Connect all the wires on the button switch module and glue the module. Be careful with the alignment.
- Glue LEDs onto the "Top" part. Place them in radial form.
- Apply color to the cake miniature with your favorite method. I had acrylic colors at home and used them.
- Cut the straw to the desired length and stick the yellow LED in the straw. Remember that you should apply glue after soldering.
- Combine the candle and the cake.
- Place the cake on the "Top" part.
- Combine the lid with the box.
Enjoy! Happy birthday to your potential user.