Remote-controlled RGB mood light
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Shop by category
Shop all componentsLight tells the body it is morning. Twenty minutes before the alarm time the ring glows a dim red, then shifts through orange to warm white as it brightens, reaching full daylight at 6:30. It stays on for half an hour; the button snoozes it for a minute.
Tick anything you already have and the total updates.
Temperature-compensated real-time clock (±2 minutes a year) with a coin-cell backup, so the time survives power cuts.
Sixteen individually addressable RGB LEDs on one data wire.
Follow the colours: red is power, dark grey is ground, blue is a signal.
sunrise_alarm_lamp.inoVerify & upload in Electrolark// Sunrise wake-up lamp
// Geekobot project library · board: Arduino Nano
// Wiring diagram, parts list and build steps: Geekobot project page "sunrise-alarm-lamp"
#include <Wire.h>
#include <RTClib.h>
#include <Adafruit_NeoPixel.h>
// ---- pins ----
const uint8_t RING_PIN = 2;
const uint8_t BUTTON_PIN = 3;
RTC_DS3231 rtc;
const int RING_LEDS = 16;
Adafruit_NeoPixel ring(RING_LEDS, RING_PIN, NEO_GRB + NEO_KHZ800);
const int ALARM_HOUR = 6, ALARM_MIN = 30;
const int RAMP_MIN = 20; // light rises over the 20 minutes before the alarm
void showLevel(int pct, uint32_t color) {
int lit = constrain(pct, 0, 100) * RING_LEDS / 100;
for (int i = 0; i < RING_LEDS; i++) ring.setPixelColor(i, i < lit ? color : 0);
ring.show();
}
void sunrise(float f) { // f: 0 (dark) to 1 (full daylight)
for (int i = 0; i < RING_LEDS; i++) {
int r = (int)(255 * min(1.0f, f * 1.5f)), g = (int)(140 * f * f), bl = (int)(60 * f * f * f);
ring.setPixelColor(i, ring.Color(r, g, bl));
}
ring.setBrightness(40 + (int)(215 * f));
ring.show();
}
void setup() {
Serial.begin(115200);
if (!rtc.begin()) Serial.println(F("RTC not found"));
if (rtc.lostPower()) rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // set from the upload time
ring.begin();
ring.setBrightness(40);
ring.show();
pinMode(BUTTON_PIN, INPUT_PULLUP);
}
void loop() {
DateTime now = rtc.now();
long minsToAlarm = (ALARM_HOUR * 60L + ALARM_MIN) - (now.hour() * 60L + now.minute());
if (minsToAlarm > 0 && minsToAlarm <= RAMP_MIN) sunrise(1.0f - (minsToAlarm - 1 + (60 - now.second()) / 60.0f) / RAMP_MIN);
else if (minsToAlarm <= 0 && minsToAlarm > -30) sunrise(1.0f); // stays bright for 30 minutes
else sunrise(0);
if (digitalRead(BUTTON_PIN) == LOW) { sunrise(0); delay(60000); } // snooze the light for a minute
delay(1000);
}
The sketch above runs here on a simulated Arduino Nano. Move the sliders for the sensors and buttons it reads, and watch the Serial monitor, display and outputs change.
The coin cell is flat or missing. Some modules need the charging resistor removed when using a CR2032.
Add the 330 Ω resistor in series with DIN and share GND with the board.
The button is rotated 90°; legs on the same side are already connected. Turn it.
Open the Serial Monitor at 115200 baud and check for messages. Make sure you chose the right board and port in the Arduino IDE.
Close other programs using the serial port, try another USB cable (some are charge-only) and press reset just before uploading.
Yes. Most of the code works unchanged on an ESP32 with the ESP32 board package. Watch for 5 V modules: ESP32 pins are 3.3 V, so 5 V output signals need a resistor divider.
Use a 5 V USB phone charger or a power bank into the board's USB port.
7 parts: Nano CH340 Development Board (Soldered), DS3231 Precision RTC Module with EEPROM, WS2812 RGB LED Ring (16 LEDs), Tactile Push Button Switch, Resistor Assortment Kit (30 Values), Solderless Breadboard (830 points) and Dupont Jumper Wires (40 pcs). Tools: Digital Multimeter and Wire Stripper and Cutter. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 1–2 hours. The build on this page has 9 steps.
No. This page has the complete, tested code (sunrise_alarm_lamp.ino). Install these libraries first: RTClib and Adafruit NeoPixel.
Yes. The Run it panel under the code runs this exact sketch on a simulated board. Move the sliders or press the buttons for the sensors it reads, and the Serial monitor, display and outputs react as they will on the real build. It is a simulation, so real readings depend on your parts and wiring.
About ₹466 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.
Addressable LEDs and colour mixing; Pull-ups and debouncing; Real-time clocks and backup batteries.
Ideas that reuse this build: Alarm clock with a buzzer and Pomodoro timer. They are listed under Take it further on this page.
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Press to roll: the pips tumble and slow down before landing on a number.
Wait for the light, hit the button: how many milliseconds can you beat?
A bright 4-digit clock that keeps time through power cuts.
Learning project. Check every circuit and the datasheet of each part before you power it up.
A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.