Instructables user Deba16 — who you may recall from his DIY wireless home security system — has discovered an innovative way to transform ordinary mason jars into color-changing mood lamps using ATtiny85 microcontrollers (MCUs).
Aside from the tinyAVR MCUs, Deba168’s project utilizes RGB LED lights, an 8-pin DIP socket, a coin cell battery, some resistors, a slide switch, and a few other components to piece it all together.
The DIY lamp works by sensing the lighting condition of a room. Once off, complete darkness will trigger the RGB LEDs to begin slowly fading through a series of colors.
“The ATtiny85 only had 2 PWM pins. But to change the color of a RGB LED, we needed 3 PWM pins. This limitation was overcome by using software PWM. This means that you can fade in and out of all 3 colors using any of the pins on the ATtiny. The software PWM works by setting the pin HIGH and then LOW at different rates so that the LED looks like it’s dimming. This is called Persistence of Vision, or POV. The LED blinks so rapidly that the human eye can’t detect that it is flashing at all, and it sees instead that the LED appears to be dimming.”
Want to create a mason jar lamp of your own? Find a step-by-step breakdown of the build here.