This is a project that I did for a class that used an Arduino microcomputer and nearly whatever you could think of. This round I made a sort of MP3 player that worked with an infrared remote and an RGB LED to change the colors while you listen to the song. (disclaimer: initially it was going to go through three different songs and three different colors that sort of matched the mood of the song but…coding…not a programmer… I'm sure this has happened to other people too.) So without further ado...
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: The Stuff...
Some stuff that I've used…
1. an Arduino Uno. I got mine from the class that I had. You can get them from sites like sparkfun and there's also a a set that you can get from RadioShack; I believe it's sold as a starter set.
2. an MP3 shield from sparkfun.com (https://www.sparkfun.com/products/10628). Before you start take a look at the links they have on the page. There's one that shows you how to address the shield. Another link (the one you'll probably need the most) shows you how to go through the songs at your own pace rather than just shuffling through the songs.
3. header pins (https://www.sparkfun.com/products/11239). Depending on how well you solder or work with things like this in general there are different header pins you can use. I started with the ones in the link. But then I needed a breadboard (for the LED) too so i got pins like this (https://www.sparkfun.com/products/10007). I got mine from RadioShack though in a set called a Make Kit for Arduino that had pins and breadboards and things like that. Made it easier to stack everything on top of each other.
4. RGB LED. I got mine from RadioShack. They aren't too expensive. The only cautionary tale with LEDs is to know which kind you're using. I"m using a common anode (meaning that the power is on one leg of the LED. The project that I originally was inspired by used a common cathode (one leg for ground). The project that I was looking at is pretty similar to mine as far as attaching the LED so I'll leave a link for reference. (https://www.instructables.com/id/Twitter-Mood-Light...
5. 220 ohm resistors (this project you'll only need one and it'll be on the longest leg of the LED. 220's are better for the color.
6. an infrared receiver. Another thing I got from RadioShack; completely inexpensive. The sensor works with almost any remote. But be warned. Different remotes (though they might all be infrared) have different frequencies so some of them won't work as well as another one. I used an old boom box remote lying around.
7. Solder…wire…jumper wires… and then patience. A lot of patience. Because coding. The building isn't awful. It's the coding.
Step 2: The Hardware...
So the first thing to do is solder the pins for the MP3 shield. DON'T attach it to the arduino before soldering. (I'm sure people know this but just a friendly reminder. You'll find the pins you'll need to use for the MP3 to work on the sparkfun.com. Just to be careful I soldered nearly everything except for pin 3 and 4 because they're for midi.
The IR receiver has pins on ground 5v and pin A5. In the code A5 is used as a switch to go from song to song. So as long as the signal pin is on A5 you'll be able to press any button on your remote and it will play through the music you chose.
The LED is on pin A3 A4 5 and ground. The third photo is the LED breadboarded with the stackable header pins. Easier to work with. Also it keeps from having a floating breadboard above the project and trying to have somewhere to put it.
Forgot the mention: the speaker I used was a regular iHome speaker. It's rechargeable so you can stick everything in the same container. Along with the power I also forgot the mention. It's a battery pack that holds 6 AA batteries and has a barrel connector.
Step 3: The Code...
So the code… In a nutshell (before it gets to be too much) pins A0 A1 and A2 are the pins that the songs are accessed from. The original code allows you to also add MP3s to pins A3 and A4 also. I just didn't use them because I only wanted to use a couple of songs. I did some research as far as music and color theory and how they affect a person emotionally and I figured three was a good enough number to stick to.
For those who want a minute to breathe… Try the blink code first to make sure you light connection works. It's located in the examples section in the arduino sketchbook page. Then if you want to make sure your music works use the MP3 code as it is from sparkfun.com.
Issue with the code… I may (or may not) have mentioned that the code was supposed to change the song and the light at the same time so that the lights and the music would convey the same emotion. What happened with this code is that it plays the first song but the lights go through all three colors. Then it stops the code and you'll have to restart the arduino to get the code to start over and get the colors to come back on. But I will say that it makes for an interesting MP3 player and you get to choose your own colors.
Step 4: …and Finished.
For a cool finish good enough to be called a center piece or light fixture get a glass container and put everything in it. If you want to keep everyone from seeing all the hardware on the inside you can get spray paint (I got mine from walmart) specifically to frost glass. It just takes one or two coats of spray and dries within about ten minutes give or take. The LED looks a lot better in the dark but its really bright and looks pretty cool; fun at parties.