In preparation for the holidays, I put together a cheesy karaoke machine for the Arduino.
The following is a quick description of how I went about things.
- OSEPP UNO R3 Plus - 30$ - here
- 4x 20mA LED Red - 3$ - here
- 4x 20mA LED Green - 3$ - here
- 8x 330 Ohm resistors - 5$ - here
- Assorted wires - 10$ - here
- Breadboard - 8$ - here
- Parllax 2x16 Serial LCD (Backlit) with Speaker - 35$ - here
I actually purchased this Arduino starter kit and supplemented it with the LCD. If you're starting from scratch, a kit like this with various resistors and wires is useful.
The layout (click to enlarge)
The 8 LEDs and 330 Ohm resistors were connected in sereis to the following pins on the device: 2,3,4,5,8,9,10,11
The screen was connected to the serial transmission pin (1) on the device.
I'm using two bread boards in this pic for debugging purposes. I could have easily fit everything on to one.
The code that controls the light show can be found on github here:
There is a Note class that represents a single note being by the parallax speaker. There is also a light controller class that allows you to set arbitrary lights on or off. If you look at AllTheStars.ino, you'll see I wrote a wrapper function called 'play' that brings it all together by playing a note, setting arbitrary text and setting a light configuration. The song that is played in the video can be found in
The hardest part was figuring out how to sync the audio with the lights and text (since there is no in built mechanism for doing this on the device). I solved this with an inelegant 25ms sleep between notes. I also don't have enough power to support all the lights and the LCD; this is why the screen brightness changes depending on how many LEDs are active. In theory, I should have powered the screen separately.
Thats it! Happy holidays everyone :)