Projects / Desk busy light

Desk busy light

Beginner1 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANO19.7 mA

    Wire the two LEDs

    Green to D5 and red to D6, each through 220 ohms to GND.

  2. NANO

    Wire the button

    D2 and GND.

  3. NANO

    Upload the sketch

    The green light comes on.

  4. NANO

    Press the button

    The light turns red.

  5. NANO

    Press again

    The red light flashes slowly for a meeting.

  6. NANO

    Hold the button for a second

    The light dims, and again to brighten it.

  7. NANO

    Wait out the meeting

    It returns to green after 30 minutes.

In short

How do you build a desk busy light?

A small light on your desk shows if you are free or busy, or in a meeting, changed with one button, with a timer that turns it back to green after a set time. A simple way to tell the family or classmates when not to interrupt. You need Arduino Nano, LED 5 mm red, LED 5 mm green, Resistor 220 Ω × 2, Tactile push button 6 mm, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
7

Parts list

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

Wiring

FromToWhy
Green LED long legNano D5 through a 220 ohm resistor, short leg to GNDFree
Red LED long legNano D6 through a 220 ohm resistor, short leg to GNDBusy, or flashing for a meeting
ButtonNano D2 and GNDTap to change status, hold to dim

Code

The light has three states in a small state machine. Green means free, steady red means busy, and slowly flashing red means you are in a meeting. A short press moves to the next state, and a press of a second or more switches between bright and dim, which is useful in the evening. The meeting state ends by itself after 30 minutes, so you never forget to turn the light back to green. Change MEETING_MS to suit your day. Both LEDs are on PWM pins, so brightness is set with analogWrite. Each LED has its own 220 ohm resistor to protect it. The sketch tells the status over the serial monitor too, which helps when testing. A real amber light needs a yellow LED, which you can add on D9 as a fourth state if you like. Mount the light on a small card sign, on your desk or on the back of a chair, where people can see it. It is only a courtesy signal and not a security or safety device.

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 uint8_t BTN = 2;
const uint8_t GREEN = 5;           // PWM pins, so the light can be dimmed
const uint8_t RED = 6;

const unsigned long MEETING_MS = 30UL * 60UL * 1000UL;   // meeting ends by itself after 30 minutes

enum Status { FREE, BUSY, MEETING };
Status status = FREE;
bool dim = false;
bool prevDown = false;
unsigned long pressedAt = 0;
unsigned long meetingStart = 0;
bool longHandled = false;

void show() {
  uint8_t level = dim ? 25 : 200;
  unsigned long now = millis();
  if (status == FREE) {
    analogWrite(GREEN, level);
    analogWrite(RED, 0);
  } else if (status == BUSY) {
    analogWrite(GREEN, 0);
    analogWrite(RED, level);
  } else {                                           // meeting: red flashes slowly
    analogWrite(GREEN, 0);
    analogWrite(RED, ((now / 600) % 2) ? level : 0);
  }
}

void setup() {
  pinMode(BTN, INPUT_PULLUP);
  pinMode(GREEN, OUTPUT);
  pinMode(RED, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  unsigned long now = millis();
  bool down = (digitalRead(BTN) == LOW);

  if (down && !prevDown) { pressedAt = now; longHandled = false; }
  if (down && !longHandled && now - pressedAt > 1000) {      // long press toggles dimming
    dim = !dim;
    longHandled = true;
  }
  if (!down && prevDown && !longHandled && now - pressedAt > 30) {   // short press changes status
    status = (Status)((status + 1) % 3);
    if (status == MEETING) meetingStart = now;
    Serial.println(status == FREE ? F("Free") : status == BUSY ? F("Busy") : F("In a meeting"));
  }
  prevDown = down;

  if (status == MEETING && now - meetingStart > MEETING_MS) {    // back to free automatically
    status = FREE;
    Serial.println(F("Meeting over: free"));
  }
  show();
  delay(10);
}

Test checklist

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

CheckExpected
Power-upGreen steady
First pressRed steady
Second pressRed flashing
Third pressBack to green
Long pressDim and bright swap

If it does not work

A light stays dark

Check its direction and its 220 ohm resistor.

Both lights are dim

Check the long press did not set dim mode.

Button does nothing

Check it goes to D2 and GND.

Status skips

Check the button is across the breadboard gap and not bouncing.

Meeting never ends

Check MEETING_MS in the code.

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

Ask Lark AI

Common questions

What parts do I need for the desk busy light?

Arduino Nano, LED 5 mm red, LED 5 mm green, Resistor 220 Ω × 2, Tactile push button 6 mm, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).

How long does the desk busy light take to build?

About 60 minutes for a beginner maker, in 7 steps.

How do I know the desk busy light works?

Power-up: Green steady. First press: Red steady. Second press: Red flashing.

A light stays dark: what should I check?

Check its direction and its 220 ohm resistor.

Both lights are dim: what should I check?

Check the long press did not set dim mode.

Button does nothing: what should I check?

Check it goes to D2 and GND.

Status skips: what should I check?

Check the button is across the breadboard gap and not bouncing.