Difficulty Level = 6 [What’s this?]
This is a mood lamp I build using 16 LEDs of different colors and small glass vials. The square bottoms of the vials look a lot like glass block, and the glass diffuses and scatters the light in beautiful ways. The software shows random patterns of light and the brightness of each LED can vary — they aren’t simply “on” or “off”.
The Arduino code is pretty complex because it implements PWM (pulse-width modulation) for all 16 LEDs. The Arduino board only has 5 PWM-capable pins, so providing PWM for all 16 pins is accomplished purely in the code. The lamp randomly displays different lighting patterns and can be really mesmerizing. Ok, I know you want to see it in action, so here it is (note that the music is just in the background — the lights are not reacting to it):
The base of the lamp is a piece of plexiglass about 5 inches square, and all of the wiring is on the underside of the plexi. Each of the 16 LEDs goes into a small socket made from two pins of a female header. I used sockets instead of soldering the LEDs directly so that I could rearrange the colors any way I like.