Introduction: Music Box for Kids

"Grandfather ... songs, songs ...", something like this is what granddaughters meet me every evening when I come home from work. This project was conceived as a musical toy with elements of tactile learning. Listening to music, you can click on the buttons, turn on the multi-colored lights (and what is the color?), Twist what is spinning, click the switches ... And while the grandfather is drinking tea ...

Arduino itself poorly synthesizes music. However, there are so-called shields with which you can play music files of quite decent quality. In this project I applied the DFPlayer mini shield. It uses a micro SD card as a carrier. With just three buttons, we can control playback: forward, backward and - to the beginning.
Children love to press the buttons, so I put on the front panel a few more buttons, switches, LEDs in general, which came to hand at that moment to make it more interesting.

Step 1: Components & Tools

Components:

Arduino UNO

Adapter (6 - 12)VDC, (0.5 - 1)A for Arduino

DFPlayer mini

https://www.aliexpress.com/item/TF-Card-U-Disk-Min...

Speaker 8Ohm, 1W

micro SD card, class 8-11

LMS1587IS-3.3

PCB heatsink

Capacitor 100uF, 16V

3 x 1P Pushbutton switch momentary

UP-6135 (Option) not shown in the diagram

https://www.distrelec.biz/en/led-panel-meter-199-m...

5 x Rocker switch (on-on)

DC micromotor (Option)

Antivandal Pushbutton (Option)

Potentiometer

5 x RED LED 5mm

5 x GREEN LED 5mm

5 x YELLOW LED 5mm

5 x BLUE LED 5 mm

20 x Res 330 Ohm

2 x Res 560 Ohm

1 x Res 51K

Wires

Plastic Enclosure

Tools:

Soldering station (Soldering Iron), solder wire, flux

Wire cutter, tweezers, screwdriver, drill, files, glue gun

Step 2: Electric Circuit

The scheme was drawn using the Easy Eda environment. The musical part is shown at the top of the diagram. Everything else is made of improvised means. Here you can add all that you want, just to fit in the dimensions.

The MP3 module supports up to 25,500 fragments of phrases, signals or melodies. All audio files can be divided into groups of 255 songs. You can choose one of 30 volume levels and one of 6 equalizer modes (Normal/Pop/Rock/Jazz/Classic/Base). Audio file formats: MP3, WAV, WMA.

The module is connected to Arduino via UART (Serial). For work it is enough to connect only the Vcc, GND, RX, TX, SPK1, SPK2 lines. Using all other pins is optional.

Link for many information for DFPlayer mini:

https://www.dfrobot.com/wiki/index.php/DFPlayer_Mi...

Step 3: Assembly & Circuit Wiring

Now we have a scheme, a list of elements, and the most laborious work begins - installation. Here the main thing - to find the housing of a suitable size. We drill, customize, install elements. We connect the wires according to the scheme. Where required - we solder. We check everything thoroughly.

Step 4: Simple Sketch

To work with the DFPlayer mini module, you need to install the DFPlayer_Mini_Mp3.h library:

https://github.com/DFRobot/DFRobotDFPlayerMini/arc...

The third digital input of the Arduino is connected to the Busy output of the MP3 module. The controller analyzes the state of this output and, if it has switched to the HIGH state (track is over), the next track starts. Otherwise, the playback of the track will stop, and for us it is important that the music continues track by track. The SoftwareSerial library is also installed here so that you can change the Arduino firmware as needed without touching the installation.

https://github.com/PaulStoffregen/SoftwareSerial

Step 5: Audio Files

Mini MP3 Player can recognize cards up to 32G and FAT16, FAT32 file system.

Format the SD card and create an “MP3” folder on it. Next, you need to record your mp3 songs in this folder and give them the names "0001****.mp3", "0002****.mp3", "0003****.mp3", etc. Important: it is necessary to copy already renamed files to the SD, and not to rename them on the SD card.

Insert the card into the slot and enjoy!