This blog post is about a box that could dynamically dim AC bulbs via computer control. The main purpose being to react to music. I will be providing code, and some schematics, and I hope other hobbyists will find this post useful.
(If you’d like to go straight to the technical stuff, simply start at page two)
First, a brief history.
My desire to make lighting that would react to music largely began in late 2003. A Perfect Circle released their album, Thirteenth Step. Upon first listen of the song, Blue, I pictured a series of lights reacting to the music, and blue shifting upon the chorus line of “She’s turning blue.” Years passed, and in 2008, I learned about the Winamp plugin, Discolitez , a plugin that allowed Winamp to control lights connected to a computer. I decided to build the most basic 8 channel circuit that ran off an LPT Port. As the circuit only required resistors, and LEDs, I knew I was capable of building it.
I built the circuit, but to my dismay, the result was lackluster at best. While it was simple to build something like a VU meter, the function of mapping LEDs to frequency bands looked like crap. With DiscoLitez, you were given the option of setting a thresholds on the volume that would trigger an LED, but the LED was either on, or off. I also accepted that using LPT port pins to drive any load directly was not best practice.
I read about using super brights with transistors, but the non-dimmable nature of the plugin really disappointed me. I made the following video using the song “Too Young” from the Venitian Snares. I chose the song as the music rapidly cuts in and out at the beginning and works well with the non-pwm lights. You could see towards the end of the video how badly the lights looked when the thresholds were met, and held..
In the hope I could make the LEDs do more than just sit there, I began playing with the more advanced “Discolitez Pro” plugin which allowed such things as strobing the LEDS, and comparing data streams with logic gates. I wrote a “desktop,” as the configurations are known as to compensate for this. I set multiple thresholds for each band, and had those feed into a logic gate that would “AND” it with different timers. The idea was the louder a band got, the faster I’d strobe the bulb. Of course this methodology is opposite of how a PWM works. I knew that the pulsing was much too slow to have any sort of noticeable PWM, and that the software was not NEARLY powerful enough. Let alone, I wasn’t even fully introduced to the concept, yet.
The results didn’t look that bad in person, but I still wanted better results. I liked the idea of controlling hardware from an I/O port, so I went back to the LPT LEDs I had breadboarded. I connected it to a linux server, and found a program called “lptest” I could use to drive individual pins, and hence drive individual lights.
I had bought some opto-isolated solid state relays and connected one to an IO pin. I measured 13mA draw from a multimeter, which was on the edge of the Printer Port spec, but I felt was safe enough. I connected a string of Christmas lights to the SSR, and was excited by the fact I had command line control over an AC socket.
I knew I wanted to do more automation, but wanted a better way to drive hardware. Enter Microcontrollers…