Birthday Music Box With LEDs

by San Lee in Circuits > Arduino

1726 Views, 18 Favorites, 0 Comments

Birthday Music Box With LEDs

DIY Arduino Birthday Music Box
DIY Arduino birthday music box showcase

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

스크린샷 2023-08-21 오전 12.59.28.png
스크린샷 2023-08-21 오전 12.59.49.png
스크린샷 2023-08-21 오전 1.00.10.png
스크린샷 2023-08-21 오전 1.00.25.png
스크린샷 2023-08-21 오전 1.00.37.png
스크린샷 2023-08-21 오전 1.00.47.png
스크린샷 2023-08-21 오전 1.00.54.png
`0NC6MNDL~HPRBIG`A)H.png
스크린샷 2023-08-21 오전 1.01.03.png
  • 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

스크린샷 2023-08-21 오전 1.44.10.png
스크린샷 2023-08-21 오전 6.01.08.png

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

화면 캡처 2023-08-20 121433.jpg

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

IMG_2311.jpeg
IMG_2310.jpeg
스크린샷 2023-08-21 오전 6.05.03.png

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

box1.png
iso3.png
iso2.png
iso1.png

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)

스크린샷 2023-08-21 오전 5.36.17.png

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

스크린샷 2023-08-21 오전 3.28.56.png
스크린샷 2023-08-21 오전 3.29.35.png
IMG_2344.jpeg
IMG_2345.jpeg
IMG_2346.jpeg
스크린샷 2023-08-21 오전 3.30.52.png
스크린샷 2023-08-21 오전 3.26.37.png
IMG_2362.jpeg

Make sure the system works fine before assembly while heating up your hot glue.

  1. Place the battery holder. (Where the big rectangle hole is)
  2. Place the board next to the battery holder.
  3. Connect all the wires on the button switch module and glue the module. Be careful with the alignment.
  4. Glue LEDs onto the "Top" part. Place them in radial form.
  5. Apply color to the cake miniature with your favorite method. I had acrylic colors at home and used them.
  6. Cut the straw to the desired length and stick the yellow LED in the straw. Remember that you should apply glue after soldering.
  7. Combine the candle and the cake.
  8. Place the cake on the "Top" part.
  9. Combine the lid with the box.


Enjoy! Happy birthday to your potential user.