Inspiration

I am a huge fan of music boxes; there’s a certain sense of both awe and tranquility upon opening one up and listening to the tune inside. Sadly, however, music boxes almost never come with the ability to hold multiple tunes in the same box. I wanted to build a hack to address this issue.

On the other hand, my brother loves 8-bit music. He thinks it’s super nostalgic and reminds him of those carefree days when he played the classic GBA games as a kid. He wanted to build a hack that takes him back to the good old days.

The Do-Re-Mi hackathon was the perfect opportunity to create a unique project that blended our interests together with the powers of hardware and music. Many tireless hours later, we present to you the Musuino Box (intended pronunciation Muse + Wii + No).

What it does

The Musuino Box is an ultra-compact, remote controlled, 8-bit music box with adjustable volume, adjustable song tempo, reactive LED lighting, five pre-installed songs (ranging from Take on Me to the Legend of Zelda theme), and an intuitive system to easily add your own songs with just a bit (or maybe 8) of music theory.

However, don't let the simple and compact appearance of the Musuino Box fool you! There's actually 800 lines of grueling C++ code and a variety of hardware components powering this bad boy.

How we built it

At the core of the Musuino Box is an Arduino Uno with its almighty ATMEGA328P microcontroller. In order to make the design more compact, we installed a prototyping shield on top of the Arduino. The circuit itself consists of three main components. Firstly, sound is produced from a piezo buzzer connected in series to a potentiometer. By adjusting the potentiometer knob, one can increase or decrease the resistance and thus adjust the volume of the buzzer. This allowed us to adjust the annoying piezo buzzer into an elegant and clean 8-bit sound producer. The second component was the IR receiver, which allowed for remote control of the Musuino Box. By pressing buttons on a remote connected to an IR transmitter, one can command the Musuino Box to play a variety of songs that come pre-installed on it. The third component was the LED lighting of the Musuino Box. The LED changes color to match the theme of the song being played, and also reactively changes color based on the note in the startup tune played upon powering on the Box. The entire device is powered by a 9V battery underneath the apparatus.

We used the Arduino pitches library in order to match the corresponding frequencies for each musical note. In order to create an easily editable interface for others to create music, we decided to put each song in a separate array that consists of the note, followed by the type of note (whole, half, quarter, eighth, etc.). Tempo is also adjustable with a separate tempo variable. One can simply take some sheet music on the internet, and transcribe it to the Arduino in about an hour or so.

Challenges we ran into

We ran into massive problems when it came to storage of the songs in memory. When we stored the songs on the Musuino box, we had to store the song as an array of notes, which we defined in the beginning of the program. However, the Arduino (with it's absolutely insane computing capabilities) has a whopping 2048 bytes of data available for variable storage. We could barely store half of Fur Elise with that kind of memory.

In order to overcome this problem, we decided to use some sneaky C++ syntax to store the songs as part of the Arduino's program memory (which luckily it has 32000 bytes of). However, this required the usage of additional advanced functions in order to call data from the program's memory, which was tricky to implement. Eventually we were able to solve this problem, and use only about half of the Arduino program storage space for all 5 songs.

Another problem we faced was resolving conflicts between the library used for tone production and the library used for the IR receiver. After about an hour of searching through the library files, we found out that both the libraries were using the same timer, so we had to manually go in and change the code. Luckily, we were able to resolve the issue with no further problems.

Accomplishments that we’re proud of

We’re super proud that we were able to pull this project off given the time constraints and our inexperience with the libraries used in this platform. It was tricky to store 5 songs in the limited local variable storage space on the Arduino, but through creativity we were able to adapt to the challenge and create code to store the songs as a part of the program memory. Additionally, we’ve never had to manually go in and edit a library to resolve conflict issues, and we’re proud of the fact that we were able to go in and resolve this issue. This will be a super valuable experience in future hackathons.

What we learned

This was our second Arduino focused project, so the hardware is still somewhat new to us, but we were able to further our understanding of hardware through this project. We learned a lot about memory allocation in the Arduino, and how to creatively overcome limitations. This was our first time working with IR modules, so learning how to send and receive data over IR was also a super valuable experience for us.

What's next for the Musuino Box

The Musuino Box, while fully complete and functional, definitely has room for further improvements. One thing we really want to do is create a web application where musically minded users can create their own songs through music theory methods, and our web app can return the output code for the user to upload to their Arduino. This would make creating music for the Musuino Box much easier and more intuitive.

Perhaps we could even use a more advanced Arduino device with internet capabilities to pull songs from a database that users could upload their own songs to, enabling everyone to easily share their creations!

Built With

Share this project:

Updates