For this build we are making a wall-mounted vanity mirror with about a 2000K to 8000K color temperature range. White LEDs are available in this range but they typically achieve the color temperature target using special composition and density of phosphor materials. To build a variable color-temperature we need to use an RGB LED strip and employ calibrated control of each channel.
Here are the components we need:
- DK Hardware Pivot-N-Vue mirror
- SparkFun LED strip COM-12021
- JIRVY Led Aluminum Channel with White Diffuser
- FQP30N06L MOSFETs
- Arduino Uno
The software on the Arduino Uno takes input intensity and color temperature data from potentiometers and then computes three RGB channel intensities. Each intensity value maps to a ATmega PWM register that is connected to a MOSFET gate. The MOSFET FQP30N06L is a perfect complement to the Arduino because it enables the 5V outputs of the ATmega328P to switch up to 60V and 30A (wow!). In this design the SparkFun LED strip uses a 12V power supply operating around 600 mA and is well within in the limit.
As far as the color temperature formula it came from trial and error as well as user testing. Here’s the formula I used:
virtual void set_color_temperature(int kelvin) { float k = (float)kelvin; R = 255; G = (k - 1000.) / 9000. * 165. + 75.; B = (k - 1000.) / 9000. * 60. + 5.; }
Basically we always want the red to be at full blast. Then we vary the blue and green in about a 1:2 ratio, starting from the lowest temperature where blue is at 2% power and green is at 30% power. Your mileage may vary!