Music PlayBox - ITTT
Introduction: Music PlayBox - ITTT
HKU Assignment
Welcome to my "If This Then That" Project.
For this project I made a simple music box where you can play several chords of instruments. You can choose which instrument you want to play (piano/guitar) and which chord you want to play per button.
In this instructable I will show you my concept, iterations and a short reflection. I will also share an electronic scheme and the code with explanation.
Supplies
* Arduino Uno R3
* Small Sized Powerbank
* Laser Cutted 3mm MDF Box (MakerCase.com)
* 1k Ohm Resistor
* YX5200 DFPlayer Mini MP3 Module
* TCA9548A I2C Multiplexer
* 2 x 8 cm Experiment Print (Islands)
* Jumper Cables
* 20 cm Tinned Cables
* 3 x 0.96 Inch OLED 128 x 64 pixels I2C Display
* 1602 LCD I2C Display
* Small Wooden Planks
* 3W 40mm Speaker
* Rotary Encoder KY-040
* 3x Mini Pressure Switch
* Piano Hinge
* Screws / Bolts / Nails
Step 1: Concept
For me brainstorming always takes way too long, so I wanted to make it easy for me this time. The first thing I decided was what purpose it has. I wanted to make something that solves a common problem. In this case the problem that learning an instrument can be quite difficult and that it potentially scares people away from making music. If I could solve this problem by simply making a tool/device that makes it easy to make music, it could mean a lot for those people.
With this purpose I also figured that I really wanted to make something that plays music. Thus making the brainstorming a lot easier and more focused for me. And so I started drawing something that makes it easy for people to play any chord with any instrument they want. The result is a device that has in this case four display. Three for displaying the chords and one for displaying the instrument. The music would be played through a small speaker and you can play the chords with the buttons under the displays.
The device has to be easy-to-view so that people don't get confused. Meaning that the amount of buttons has to be limited, only the essential should be present, in this case a volume switch, buttons to change the instrument and an on/off switch.
Step 2: Working With an LCD Display
The LCD Display is an important component of the device. It shows important information such as the volume and instrument. That's why it was important for me to get familiar with it. I've set up a simple system, where you have to enter a pattern with a keypad. 485
The display gives you feedback on whether it's correct or incorrect.
Step 3: The MP3 Module
Boy oh boy... What a drama was this little thing. At first for a very long time it would never work, it would always give me the error to check the connection or sd card, not knowing that using an usb extender doesn't work well with the serial communication of the arduino... So after a while I figured, let's try if it works if I connect the arduino to the usb port directly and all of the sudden I got sound. After that I started figuring out how to make it work with buttons and play from different folders.
Step 4: Triple OLED Displays
The OLED Displays can also be considered as one of the most essential components of this device. To make it easy for myself I first connected one display. This was easy to set up following a few tutorials, but this quickly changed when I wanted to connect two more displays. After a lot of reading I found that two displays were no problem, because you could change the address of one, so that they are individually controllable. But whenever you need more than two of the same displays, things start to get tricky... The most simple solution was to get a multiplexer. After connecting that to the arduino I was able to connect up to eight displays.
Everything went well in the begining with all three of them displaying some simple centered text. But after I added more functionality to my device things started to get weird. Suddenly one of the displays started to not display anything anymore, and sometimes it did display something. After a lot of rewriting code and debugging my teacher finally found the solution. I was running out of SRAM that my displays needed. So after optimizing the code by changing ints to int8_t and writing serial prints to the flash memory, things started working again! Yay.
Step 5: Laser Cut Design
After everything was working I had to make a design for the case. 611