This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)
Step 1: Hardware
- Arduino Mega
- Arduino IDE 1.0.5
- Elechouse MP3 shield V1.3
- IR Sensor
- IR remote
- Remote and sensor I used that is compatible to my code
- SD card
- 2 MAX 7219s and 2 LED matrices
- 1 W, 8 ohm speaker 50 mm in diameter (0.5W will also work)
- jumper cables
- micro-servo motor
- 2 red LEDs 3mm in diameter
- 100-200 ohm resistor
- 6V power supply
- Plasti Dip, soldering Iron, wire cutter/stripper, portable power bank, dremel (optional but very useful)
Step 2: Software
- For this project you will need the Arduino IDE 1.0.5. The 1.0.6 version will not work because new updated library in the IDE interferes with the MP3 library.
- Extract the LedControl, IRremote, and MP3 libraries in your Arduino libraries folder before opening the Arduino IDE.
- Open the code file final7_2 in the Arduino IDE and then upload it to Arduino Mega. MAKE SURE MP3 SHIELD IS NOT CONNECTED WHILE UPLOADING THE CODE.
- Code Overview-The global byte variables are values that the LedControl library uses to print out pattern on the LED matrices with the use of the printByte(byte character) function. Once we get to our main void loop we can see that we instantly activate the IR receiver. The only way the device is activated is by pressing 1 on the remote. This sets turns the LEDJ eyes on, summons the LEDS with the use of the servo library to control the servo motor, plays the first song and sets the flag equal to 1. Flag = 1 enables all the other input on the device, and the activates the analog input 8 to monitor the voltage across the speaker. This voltage will ultimately determine what is printed on the LED matrices. By pressing button 8 on the remote we set flag =2. By setting flag = 2 we simply switch pattern styles on the LED matrices to vertical pattern, the higher the voltage from the speaker, the higher LEDs will light up. By pressing button 9 on the remote we switch back to the initial setting where the LED matrices give a flashing pattern that sync to the music. And of course we have our other MP3 functions like next, previous, volume up and down, random, cycle, play, and pause. Finally we can turn off the device, we call the servo down function to bring LEDJ back in the box, deactivate analog read 8 and all inputs by setting flag=0, and turn off LEDJ eyes off.
Step 3: 3D Print Parts
The 3 STL files are the only parts you will need for the completion of this project. Printing these parts in ABS gave me a smooth finish, but ended up warping the parts. PLA on the other hand, resulted in rough edges and surfaces, but firm and straight parts. I ultimately chose PLA. I sanded the parts, and then spray painted them. (Plasti Dip worked great)
The way I designed the box is to house the micro servo right under the top surface. The circular hole in the front is designed for a 50 mm speaker. The 2 holes on each side of the speaker are for the 2 LED matrices. The small hole right under the speaker is intended for the IR receiver. On the inside of the box at the bottom there is a small tab that will keep the Arduino Mega in place. As for the lid, it is designed to fit a USB cable through it in order to power the Arduino Mega.
Step 4: Circuit Assembly
- Connect MAX7219, using the leads closest to the chip, to Arduino Mega. Use the digital pin 24 for DIN, digital pin 26 for CS, digital pin 28 for CLK, 5V pin for VCC, and GND for GND.To connect the second MAX7219, connect the output of the first one to the input of second with their respective pins. (DIN to DIN, CLK to CLK... and so on)
- Connect MP3 shield to Arduino Mega. Easiest way to do it is by aligning the 5V (VCC) pins and then press the headers together. Connect speaker to L+ and L- pins or R+ and R- on the MP3 shield. Connect a jumper wire from analog pin 8 on the Arduino Mega to the positive terminal of speaker.
- Connect the signal pin of your IR receiver to digital pin 32 on the Arduino Mega. I found it most convenient to use the 5V pin on the MP3 shield to power the IR receiver. I also used the GND pin on the MP3 shield to ground the receiver.
- Use external 6V supply to power and ground the micro servo. Connect the signal pin of the micro servo to digital pin 41 on the Arduino Mega. Then create a common ground with the Arduino Mega and the external 6V supply.
- Assemble a small resistor, between 100 to 200 ohms (I used 110 ohms), and the 2 red 3mm LEDs in series. Plug in resistor end to digital pin 40, and the other end to ground pin on the Arduino Mega.
- Your circuit should now be fully functional.
Step 5: 3D Parts Assembly
- For the DJ8 part you will need to drill 2 small holes in the front, about 4 to 5 mm away from the bottom. Using a Dremel, carefully drill holes corresponding to the extremities of the servo arm.
- Mount micro servo in the built-in servo mount of the box, box7 part, so that the servo rotates in the direction of the longest side of the gap that is located on the adjacent surface. This step is crucial because if the servo is mounted the opposite way, the DJ8 part will not fit through the gap. (Notice that this gap is not centered intentionally since servo only has 180 degrees of rotational range)
- Once you figure out the functional way of mounting the servo, drill small holes on the servo mount to lock the servo in there.
- Mount 2 red LEDs in the eyes of the LEDJ, DJ8 part.
- Mount speaker in the center circular hole of the box.
- Mount IR receiver in small hole under the speaker hole.
- Mount LED matrices. The second LED matrix is upside down because I found most convenient in fitting it into the box. Keep in mind that the side closest to chip is the "bottom", and the opposite side is the "top".
Step 6: Upload Songs
- Make sure you have deleted everything of your SD card.
- Upload any MP3 song files to SD card.
- Rename each file to track001, track002,... and so on. Otherwise, the MP3 shield will not recognize it.
- Eject SD card.
Step 7: Completion
- Insert SD card in MP3.
- Connect Arduino Mega to computer or portable power bank.
Attached is a list of the commands and their corresponding buttons.