Introduction: Josephine the Music Machine
This instructable was created in fulfillment of the project requirement of the Makecourse-Art at the University of South Florida (www.makecourse-art.com). Josephine is a mid-size MP3 player and light show machine. For Josephine we started with a 3D printed housing unit for all of our electronics. We used Maya as our program of choice, but there are a myriad of programs available that allow for this type of 3D sculpting. Our main concerns with the 3D printed housing was making sure it would fit all of our hardware as well as give us a strong foundation on which to build upon. Multiple prints needed to be made until we got the correct size, mainly to due to the trial and error involved in sizing the spaces for the LED display. Making sure we got the sizes right was as important for us as it is for our viewer. One of the important parts is being aware of the thickness of the walls and the distance of the LED display from the sides of the housing. The exterior design for Josephine comes from the materials we commonly use in our fine art sculptures. The exterior was made using chicken wire, which can be molded into any organic shape one would like to create. Once the shape had been molded we used a combination of plaster and burlap to create a surface for the frame. Hot glue was also used to allow the fur to adhere to the outer surface but still allow for any necessary alteration without permanent gluing.
Step 1: Constructing the 3D Model
The 3D Model we constructed was created in the "Autodesk Maya 2016" program. Essentially, we created a normal box with notches to facilitate future additions to the outside. The front of the box has space to display the 8x8 LED matrix clearly, while the rest of the box is hollow in order to allow our parts to fit inside. The box itself measures out to be 8" long x 4.5" wide x 3.5" high. Feel free to use these measurements as an example, or you can make your model as large or as small as you wish. Naturally, the display space at the front will be about the size of the LED matrix you intend to use, so be sure to measure your matrix and use the measurements to create your display box. As you can see in our illustrations, our box has a flat base to position the parts while the top portion of the box is cut in half. The cut allows it to be printed with a bit more ease while making it easier to take apart if you ever needed to replace or adjust any of the inside parts.
Step 2: Developing Your Circuit
In order to put all the pieces together for this device, you'll need a bit of soldering skills. Initially you need to mount the MP3 shield on to your Arduino Uno by soldering headers onto the shield then placing the MP3 shield on top of the Arduino Uno, pin-to-pin. Once the two parts are together you can start putting everything else in place.
Continue by connecting four push buttons to Analog pins 0 through 4. We need to use those pins because the MP3 shield takes up most of the normal digital pins. For your initial test you can connect the buttons to the breadboard then to the Analog pins.
The next step is to connect the audio amplifier to the MP3 shield. In order to do this, solder wires to the L and R contacts at the back of the MP3 shield. In order to have them work with the amp you'll need to solder both wires together then solder the single point to the "+" contact labeled "IN". You can then solder the "-" contact from the MP3 shield to the "- IN" point on the amp.
The next step you should take is to connect your speaker to the "OUT" portion of the audio amplifier. Simply solder one wire to the positive "+" side and one wire to the "-", then connect those to the appropriate points on the speaker. (Your speaker should have either Red and Black labeling, or + and - markers. Bear in mind, Red=+)
Once you're finished with that you can complete the wiring that will allow you to supply power to your amplifier. This part is easy. All you need to do is connect wires to the positive and ground rails on your breadboard, then solder the ends of those wires to the + and - contacts on the "PWR" side of the amplifier.
Now that you've gotten the MP3 shield situated, you can set up the LED Matrix. Solder wires to Din, Vcc, and GND, then connect Vcc to the Power Rail on the breadboard, GND to the Ground rail, and Din to pin 10 on the mp3 shield. Pin 10 and Pin 5 are the only digital pins that aren't used up by MP3 shield.
Bonus! To include a volume knob feature to your setup, solder the three points of a rotating potentiometer to the volume(VOL) section of your amp. This step is optional, but it adds another awesome feature to your setup.
To power the entire machine you can use a simple battery pack that plugs into the rear power port of the arduino or use the USB port at the back of the Arduino instead. Make sure not to forget to include all necessary holes and spaces in your 3D model to any cords and view ports in your design.
Step 3: Coding Your Music Machine
The code for this device is basically, a culmination of different example sketches that have been manipulated to fit certain specifications. Almost every piece of the control system comes with libraries that work relatively well with an Arduino and its software. The sketch is made using patterns that work with the Neopixel matrix for the light show and a string of libraries that are necessary to use the MP3 shield properly. This sketch also utilizes the interrupt service routine to process the response from the button presses. When a button is pressed, the ISR(Interrupt service routine activates and checks to see which button has been pressed. For this project we use the C bus ISR to interact with our buttons. As a button is pressed, the ISR checks to see which button was pushed, then reacts by sending the the right commands to the our setup. First, the symbol of the command that was pushed is displayed on the LEDs then the MP3 triggers the correct song to play All of these details are expressed in the code below.
It's also a good idea to go through the example codes for the MP3 shield and Neopixel grid to get a hang of how to customize the light show and songs to your liking.
In order to load songs onto the MP3 shield, you need to have a microSD card. Connect the microSD card to your computer, drag and drop the songs you wish to hear, then rename them as track00x.mp3 (x would be the number of the track in the list. Once you re-insert the the microSD card into the MP3 shield, you should be ready to play tracks. Feel free to test it out with the example code included with the MP3 shield.
The code is attached. It is important that you have them all in one sketch, one tab per file that I uploaded.
The first file is the completed, commented sketch of the system, the second file is the Function tab that states the main array setup function. The third file is simply a tab meant for placing comments to help keep track of any changes you make.
Step 4: Putting It All Together
Putting it all together is entirely up to you and the 3D model you've designed. Once you ensure that the you've made space for all of the different parts that you've included, you can fit them in what ever orientation that suits your design.