Projects / Warm-to-cool desk lamp

Warm-to-cool desk lamp

Intermediate2 hGuided buildReviewed

Build it step by step

0 of 6 done
  1. NANOIRLZ4418.0 mA

    Wire one strip

    Drive the warm strip with its MOSFET, gate resistor and pull-down.

  2. NANO18.0 mA

    Add the second strip

    Repeat for the cool strip on D6.

  3. NANO

    Add the knobs

    Wire both potentiometers.

  4. NANO18.0 mA

    Test the mix

    Turn the colour knob from warm to cool at a fixed brightness.

  5. NANO

    Compare the light

    Use a phone colour-temperature app to check the range.

  6. NANO18.0 mA

    Mount

    Fix the strips side by side on an aluminium channel with a diffuser.

In short

How do you build a warm-to-cool desk lamp?

Two LED strips, warm and cool white, mix to any colour temperature with one knob and brightness with another. You need Arduino Nano, MOSFET IRLZ44N × 2, 12 V LED strip warm white (5 m, 2835), Potentiometer 10 kΩ × 2, 12 V 2 A DC adapter, Resistor 220 Ω × 2 and Resistor 10 kΩ × 2. It takes 6 steps and about 120 minutes.

Level
Intermediate
Time
About 120 min
Parts
7

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
12 V adapter +Both strips' + wire and Nano VIN12 V supply
12 V adapter -MOSFET sources and Nano GNDCommon ground
Warm strip -MOSFET 1 drainSwitched side
Cool strip -MOSFET 2 drainSwitched side
Nano D5220 Ω resistor then MOSFET 1 gate, 10 kΩ gate to GNDWarm PWM
Nano D6220 Ω resistor then MOSFET 2 gate, 10 kΩ gate to GNDCool PWM
Potentiometer A outer pinsNano 5V and GND, wiper to A0Colour temperature
Potentiometer B outer pinsNano 5V and GND, wiper to A1Brightness

Code

Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). No libraries needed. Cut each strip to 0.5 m to 1 m at the marked cut lines, one warm white and one cool white, so the two together draw well under the adapter's 2 A. Feeding the Nano from VIN with 12 V works but its regulator gets warm; for a long-running lamp use an LM2596 module set to 5.0 V into the Nano's 5V pin. The default PWM is about 490 Hz and may show flicker on a phone camera.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

const byte WARM = 5, COOL = 6;
const byte KNOB_COLOUR = A0, KNOB_BRIGHT = A1;

void setup() {
  pinMode(WARM, OUTPUT);
  pinMode(COOL, OUTPUT);
}

void loop() {
  float mix = analogRead(KNOB_COLOUR) / 1023.0;      // 0 warm, 1 cool
  float bright = analogRead(KNOB_BRIGHT) / 1023.0;   // 0 off, 1 full
  // Share the total light between the strips so the brightness stays about constant as you mix
  float warm = bright * (1.0 - mix);
  float cool = bright * mix;
  // Square the values so the knob feels natural, since the eye sees brightness on a curve
  analogWrite(WARM, (int)(warm * warm * 255 + 0.5));
  analogWrite(COOL, (int)(cool * cool * 255 + 0.5));
  delay(10);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Colour knob at one endOnly warm strip lit
Colour knob in the middleBoth strips at half
Colour knob at the other endOnly cool strip lit
Brightness knobDims both together

If it does not work

Both strips glow when off

Gate pull-down resistor missing.

Strip flickers

Check the 12 V connections and that the grounds are common.

One strip is always dim

Check the MOSFET orientation and the gate resistor.

Nano gets hot

Feed it from a 5 V buck converter instead of VIN.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the warm-to-cool desk lamp?

Arduino Nano, MOSFET IRLZ44N × 2, 12 V LED strip warm white (5 m, 2835), Potentiometer 10 kΩ × 2, 12 V 2 A DC adapter, Resistor 220 Ω × 2 and Resistor 10 kΩ × 2.

How long does the warm-to-cool desk lamp take to build?

About 120 minutes for a intermediate maker, in 6 steps.

How do I know the warm-to-cool desk lamp works?

Colour knob at one end: Only warm strip lit. Colour knob in the middle: Both strips at half. Colour knob at the other end: Only cool strip lit.

Both strips glow when off: what should I check?

Gate pull-down resistor missing.

Strip flickers: what should I check?

Check the 12 V connections and that the grounds are common.

One strip is always dim: what should I check?

Check the MOSFET orientation and the gate resistor.

Nano gets hot: what should I check?

Feed it from a 5 V buck converter instead of VIN.