Music box on Arduino

Music on Arduino
Music on Arduino 2 Picaxe collection
Music on Arduino 3 Note converter
Music box on Arduino

Music box on Arduino

I wrote a program called "music box" that includes more than 80 simple melodies. These melodies (total size about 26 KB) could be written to the Arduino memory, but I preferred to use the I2C FLASH memory of the Atmel AT24C512 (64 KB) for the melodies. This is done as follows. The electronic circuit includes an Arduino Uno, a 16*2 LCD display, 2 buttons, a buzzer and 64 KB FLASH. The circuit description can be found in the description of the educational board

1) A data file (archive) is created, which includes all the melodies and a catalog of melodies. This is done using the program songarc.bas, written in FreeBasic. The program songarc.exe sequentially reads the melody files in the header format .h and writes them to the archive songlib.dat You can compile songarc.bas using the file mak.bat (but first you need to correct the path to the compiler fbc32.exe in it). The actual creation of the archive songlib.dat is done using the command makarc.bat (You can skip this step by using the already created file songlib.dat)

2) The assembled circuit is flashed with the i2cmemerase.ino sketch. This is necessary to check the operability and clear the Atmel AT24C512 Run the program from the Arduino IDE and turn on the port monitor at 9600 Baud. Press "1(Enter)" to check the FLASH for cleanliness, if the FLASH is not clean, then you must first erase it with the "2(Enter)" command. Attention: the FLASH check and erase operations take a relatively long time - about 10-20 seconds.

3) Now you need to load the music file songlib.dat into FLASH For this you will need the sketch xmodemr.ino and the program from the Windows XP package HyperTerminal (It also works in later versions of Windows, although it is not included in the distributions). Load the sketch xmodemr.ino into Arduino, exit the IDE and run hypertrm.exe (In this case, the Arduino must be connected to the computer) To the first request HyperTerminal "Set as default ...?" answer "No". Now you should create and run a New connection with the port Arduino, speed 9600 baud without flow control. If everything is done correctly, then when connected, Arduino displays "C" once every 3 seconds. Now send the file songlib.dat via the Xmodem protocol (see fig), after successful firmware uploading hang up.

4) Finally, you need to flash the sketch melody_dkqbplay_arc.ino into the Arduino - the music box is ready! The first button selects the name of the melody, which is displayed on the display, the second button starts and stops the melody.

Sketches of the Music Box project

HyperTerminal XP Files English Version

HyperTerminal XP Files Russian Version