Desk senses
My desk notices when I sit down. After 15 minutes of sitting, the light turns purple, the screen says Stand up! 10 squats, and my Mac says it out loud. The first time I sit down each morning, it reads me the top AI stories.
- Parts
- From my starter kit
- Board
- Arduino Uno
- Sensors
- Motion and temperature
- Builds on
- The door sign
01What it does
It notices when I sit down.
I sit for hours when I work and study, and two hours go by before I look up. So my desk keeps count. The Arduino only senses and sends one word to my Mac. The Mac does the thinking and the talking.
MOVESTANDSTILLMac
Honest note: for the video I set the timer to one minute so I didn't have to sit for 15 on camera. The real one waits 15. I haven't used it for a whole week yet, so I don't know if 15 minutes is the right time.
02Parts
Two sensors on top of the door sign.
Everything was already in my kit, so it cost me nothing. It adds two sensors to the door sign, which already has the screen and the status light.
| Part | How many | Note |
|---|---|---|
| The door sign buildUno, breadboard, 1602 screen, knob and the three status LEDs. | 1 | See that build |
| Motion sensor (PIR)Keyestudio, the one with the white dome. | 1 | Knows I'm there |
| Temperature and humidity sensor (DHT11)Keyestudio, the small blue grid. | 1 | Room check |
| Jumper wires | 6 | Three per sensor |
Three small boards in my kit look almost the same: a relay, a tilt sensor and the motion sensor. Read the name printed on the board before you plug it in.
03Wiring
Six new wires.
Keep the door sign wired as it is. The plan said pins 2 and 4, but the screen already uses those, so the motion sensor went to pin 13 and the temperature sensor to A0.
| Sensor pin | Goes to |
|---|---|
| Motion sensor VCC | The breadboard's plus line (5V) |
| Motion sensor GND | The minus line (GND) |
| Motion sensor OUT | Pin 13 It also lights the Uno's own small LED, so you can see it react. |
| Temperature sensor S | A0 |
| Temperature sensor + | The plus line (5V) |
| Temperature sensor − | The minus line (GND) |
- Say every wire out loud
Before I plugged in, Claude asked me where every wire ended and I said each one. My plus and minus wires were swapped. The cable wasn't in yet, so nothing burned.
- Touch the sensor after power
Once it's plugged in, touch the motion sensor for a second. Barely warm is normal. Hot means unplug and check the wires.
- Give it a minute
The motion sensor needs about 60 seconds after power before its readings mean anything.
- Wave at it
Open the Serial Monitor at 9600 baud and wave over the dome. You should see MOVE, and a few seconds after you stop, STILL.
04Code
The Arduino sketch.
Claude Code wrote this one, not me. It's the door sign sketch with every line kept, plus the two sensors and one new word, STAND, for purple.
// Door sign + Claude status light, one sketch, one Uno. VERSION FOR THE 16-PIN LCD (no I2C board).
// Uses the LiquidCrystal library that ships with Arduino (nothing to install).
// LCD pins -> Uno: 1 VSS GND | 2 VDD 5V | 3 V0 potentiometer middle pin | 4 RS D12 | 5 RW GND | 6 E D8
// 11 D4 D2 | 12 D5 D6 | 13 D6 D5 | 14 D7 D4 | 15 A 5V via 220 ohm | 16 K GND (pins 7-10 unused)
// LEDs (same as claude_light_3led): red D9, yellow D10, blue D11, each through 220 ohm.
// The Mac sends one line per message over USB (9600 baud):
// IDLE / WORK / WAIT / DONE / FAIL -> status light (exactly as before). WAIT, DONE and FAIL
// also put a short line on the LCD; IDLE and WORK bring the door message back.
// "top text|bottom text" -> door message, 16 characters per row.
// Desk senses: door sign + status light + PIR motion sensor, one sketch, one Uno.
// = door_sign_16pin.ino (every word unchanged) + PIR OUT on D13 + DHT11 S on A0.
// PIR: VCC -> 5V rail, GND -> GND rail, OUT -> D13 (D13 also lights the Uno's own little LED: handy).
// The Mac gets one line each time the PIR changes: "MOVE" (something moved) or "STILL" (nothing for 2 s).
// The PIR needs about 60 seconds after power-up to settle: ignore it until then.
const int PIN_PIR = 13;
int pirLast = -1;
unsigned long pirChange = 0;
void pirLoop() {
int v = digitalRead(PIN_PIR);
unsigned long now = millis();
if (v == HIGH && pirLast != HIGH) { pirLast = HIGH; Serial.println("MOVE"); }
if (v == LOW && pirLast == HIGH) { if (now - pirChange > 0) { pirLast = LOW; Serial.println("STILL"); } }
if (v != pirLast) pirChange = now;
}
// ---- DHT11 (blue grid module): S -> A0, + -> 5V rail, - -> GND rail. No library needed. ----
const int PIN_DHT = A0;
unsigned long dhtLast = 0;
unsigned int expectLevel(int level) { // microseconds the line stays at `level`; 0 = timeout
unsigned long t = micros();
while (digitalRead(PIN_DHT) == level) { if (micros() - t > 150) return 0; }
return (unsigned int)(micros() - t);
}
bool readDHT(int &t, int &h) {
byte d[5] = {0, 0, 0, 0, 0};
pinMode(PIN_DHT, OUTPUT); digitalWrite(PIN_DHT, LOW); delay(20);
digitalWrite(PIN_DHT, HIGH); delayMicroseconds(40);
pinMode(PIN_DHT, INPUT_PULLUP);
delayMicroseconds(10);
if (expectLevel(HIGH) == 0 && digitalRead(PIN_DHT) == HIGH) return false; // wait for the sensor to pull low
if (expectLevel(LOW) == 0) return false;
if (expectLevel(HIGH) == 0) return false;
for (int i = 0; i < 40; i++) {
unsigned int lo = expectLevel(LOW);
unsigned int hi = expectLevel(HIGH);
if (lo == 0 || hi == 0) return false;
d[i / 8] <<= 1;
if (hi > lo) d[i / 8] |= 1;
}
if ((byte)(d[0] + d[1] + d[2] + d[3]) != d[4]) return false;
h = d[0]; t = d[2];
return true;
}
void dhtLoop() { // every 10 s: "ROOM 23 45" = temperature C, humidity %
if (millis() - dhtLast < 10000UL) return;
dhtLast = millis();
int t, h;
if (readDHT(t, h)) { Serial.print("ROOM "); Serial.print(t); Serial.print(" "); Serial.println(h); }
else Serial.println("ROOM ?");
}
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 8, 2, 6, 5, 4); // RS, E, D4, D5, D6, D7
void showRow(uint8_t row, const String &s) {
lcd.setCursor(0, row);
for (uint8_t i = 0; i < 16; i++) lcd.write(i < s.length() ? s[i] : ' ');
}
void show(const String &top, const String &bottom) { showRow(0, top); showRow(1, bottom); }
const int PIN_R = 9, PIN_Y = 10, PIN_B = 11;
enum State { IDLE, WORK, WAIT, DONE, FAIL, STAND };
int state = IDLE;
unsigned long stateSince = 0;
String line = "";
String doorTop = "Hello Pep", doorBottom = "Door sign ready";
void setColor(int r, int y, int b) { analogWrite(PIN_R, r); analogWrite(PIN_Y, y); analogWrite(PIN_B, b); }
int triangle(unsigned long t, unsigned long periodMs) {
unsigned long p = t % periodMs, half = periodMs / 2;
if (p < half) return (int)(p * 255UL / half);
return (int)((periodMs - p) * 255UL / half);
}
void setState(int s) {
state = s;
stateSince = millis();
if (s == WAIT) show("Claude needs you", "");
else if (s == DONE) show("Claude: done", "");
else if (s == FAIL) show("Claude: error", "");
else if (s == STAND) show("Stand up!", "10 squats");
else show(doorTop, doorBottom); // IDLE or WORK: the door message
}
void handleLine(String cmd) {
cmd.trim();
int bar = cmd.indexOf('|');
if (bar >= 0) { // door message
doorTop = cmd.substring(0, bar); doorBottom = cmd.substring(bar + 1);
if (state == IDLE || state == WORK) show(doorTop, doorBottom);
Serial.println("OK DOOR");
return;
}
cmd.toUpperCase();
if (cmd == "IDLE") setState(IDLE);
else if (cmd == "WORK") setState(WORK);
else if (cmd == "WAIT") setState(WAIT);
else if (cmd == "DONE") setState(DONE);
else if (cmd == "FAIL") setState(FAIL);
else if (cmd == "STAND") setState(STAND);
else { Serial.println("?"); return; }
Serial.print("OK "); Serial.println(cmd);
}
void setup() {
pinMode(PIN_PIR, INPUT);
pinMode(PIN_R, OUTPUT); pinMode(PIN_Y, OUTPUT); pinMode(PIN_B, OUTPUT);
Serial.begin(9600);
lcd.begin(16, 2);
setColor(0, 0, 80); // power-up flash, like before
show(doorTop, doorBottom);
delay(300);
setColor(0, 0, 0);
}
void loop() {
while (Serial.available() > 0) {
char c = (char)Serial.read();
if (c == '\n') { handleLine(line); line = ""; }
else if (c != '\r' && line.length() < 36) line += c;
}
pirLoop();
dhtLoop();
unsigned long t = millis() - stateSince;
switch (state) {
case IDLE: setColor(0, 0, 0); break;
case WORK: setColor(0, 0, 10 + triangle(t, 2400) / 2); break;
case WAIT: if ((t / 300) % 2 == 0) setColor(0, 255, 0); else setColor(0, 0, 0); break;
case DONE: if (t < 8000UL) setColor(0, 0, 255); else setState(IDLE); break;
case FAIL: setColor(255, 0, 0); break;
case STAND: setColor(255, 0, 255); break; // purple = red + blue LEDs together
}
}
Every 10 seconds the sketch also sends a line like ROOM 23 45: the temperature in °C and the humidity in %. Type STAND in the Serial Monitor to see purple and the stand up message.
The Mac side. My Mac program keeps the USB port open, counts the minutes, sends STAND after 15 minutes seated and speaks the line. It's tied to my own setup, my AI news app and my desk buddy's voice, so I'm not sharing it as a file. If you build your own, ask Claude Code for a Python script that reads MOVE and STILL from the port and sends STAND back after 15 minutes of movement. On a Mac, the say command can do the talking.
05What went wrong
Three things to watch for.
- Swapped power wires. Plus on the minus line and minus on the plus line. Caught before the cable went in.
- A sensor that remembers. Every time the program restarted, the sensor still had my last movement and the desk thought I had just sat down. The fix is to ignore it for 15 seconds after a restart.
- A lost take. My volume was down, so I couldn't hear the voice.
More builds
Build another one.

Air theremin
An instrument I play without touching it. My hand picks the note, the Mac makes the sound, and Claude is my music teacher.

Lie detector
Two fingers on a plant sensor, a needle, two lights, and a separate Claude that guesses which of my answers were lies.

Door sign
A small screen that changes by itself: Good morning, Recording, Sleeping, any message I send it, and Claude needs you.
Stuck on a step? Email me with a photo of your wiring.


