Custom sunrise alarm

Custom-built hardware and software to make every morning pleasant, even under ever-gray winter skies. This is how I built it: the hardware first, then the software that runs the sunrise.

Problem

In December 2023, Vilnius got 2.9 hours of sunshine in the whole month. I wanted my mornings to start with light, so I decided to build a sun.

Vilnius business district and the Neris under a heavy grey sky.
Snowy rooftops and church towers of Vilnius under a flat, hazy sky.
A snowy forest on the edge of Vilnius under a white sky, seen from above.
Vilnius. Photos by Piergiovanni Di Blasi, Aliaksei Lepik and Aleksas Stan on Unsplash.

Research foundation

  • Van de Werken et al.

    Journal of Sleep Research · 2010

    A dawn makes waking easier

    People who find mornings hard felt less sleepy after waking to a 30-minute artificial dawn.

  • Gabel et al.

    Chronobiology International · 2013

    A 250-lux dawn lifts the mood

    A dawn rising from 0 to 250 lux improved mood and well-being after short nights.

  • Partonen and Lönnqvist

    Journal of Affective Disorders · 2000

    Bright winter light helps healthy people too

    Office workers given bright light in winter had more vitality and fewer depressive symptoms.

  • Smolders, de Kort and Cluitmans

    Physiology & Behavior · 2012

    More lux, more energy

    At 1000 lux instead of 200, people felt less sleepy and more energetic.

What’s needed

Everything for the build on a table: a coil of flat black cable, a bag of lamp holders, boxes of IKEA KAJPLATS bulbs, a plug in its bag, a Home Assistant Connect ZBT-2 box, a Raspberry Pi 5, a UNI-T UT383 lux meter and a tool kit, next to a laptop and a notebook.
Raspberry Pi 5 by SimonWaldherr (CC BY 4.0) and UT383 by Mortymore (CC BY 2.0), cut out and added to my photo.

Parts

  • 15 IKEA KAJPLATS bulb, white spectrum
  • 4 IKEA KAJPLATS bulb, colour
  • 1 Flat cable with E27 lamp holders
  • 1 Rewireable plug
  • 1 Home Assistant Connect ZBT-2
  • 1 Raspberry Pi 5 with Home Assistant

Tools

  • Lux meter, UNI-T UT383
  • Tape measure
  • Utility knife
  • Screwdriver

Hardware

Step 01: Lay it out and wire the plug

I laid the cable on the floor along the walls and checked every holder with plain bulbs. Then I cut it to length and wired the plug.

  • A tape measure along the floor between a white chest of drawers and the bed, next to the black cable.
  • The string light on the floor along the bed, with plain bulbs in the holders and the plug in the wall socket.
  • My hand holding the open plug: a blue and a brown wire in the two outer terminals, under a red cord grip.

Step 02: Place it and pair the bulbs

Three strips run around the bed, each starting with a colour bulb. The ZBT-2 gives Home Assistant a Thread network, and every bulb pairs over Matter.

Rough representation

Software

Step 03: Set the target

The target is the light at my eyes, staring at the ceiling: 0.1 lux of ember red 30 minutes before the alarm, 250 lux at wake, and 703 lux of cool white 20 minutes later.

LUX AT THE PILLOW 0.1 1 10 100 1000 −30 min −20 −10 Wake +10 +20 min 1000 K 1800 K 2750 K 6000 K −30 min · 0.1 lux · 1000 K −27.5 min · 0.5 lux · 1050 K −25 min · 1.2 lux · 1090 K −22.5 min · 2.5 lux · 1200 K −20 min · 5 lux · 1300 K −17.5 min · 8 lux · 1400 K −15 min · 13 lux · 1500 K −12.5 min · 22 lux · 1650 K −10 min · 35 lux · 1800 K −8 min · 55 lux · 2000 K −6 min · 78 lux · 2200 K −5 min · 95 lux · 2300 K −4 min · 120 lux · 2400 K −3 min · 150 lux · 2500 K −2 min · 185 lux · 2600 K −1 min · 220 lux · 2700 K Wake · 250 lux · 2750 K +5 min · 300 lux · 3000 K +10 min · 400 lux · 4000 K +20 min · 703 lux · 6000 K LUX AT THE PILLOW 0.1 1 10 100 1000 −30 −20 −10 Wake +10 +20 1000 K 2750 K 6000 K −30 min · 0.1 lux · 1000 K −27.5 min · 0.5 lux · 1050 K −25 min · 1.2 lux · 1090 K −22.5 min · 2.5 lux · 1200 K −20 min · 5 lux · 1300 K −17.5 min · 8 lux · 1400 K −15 min · 13 lux · 1500 K −12.5 min · 22 lux · 1650 K −10 min · 35 lux · 1800 K −8 min · 55 lux · 2000 K −6 min · 78 lux · 2200 K −5 min · 95 lux · 2300 K −4 min · 120 lux · 2400 K −3 min · 150 lux · 2500 K −2 min · 185 lux · 2600 K −1 min · 220 lux · 2700 K Wake · 250 lux · 2750 K +5 min · 300 lux · 3000 K +10 min · 400 lux · 4000 K +20 min · 703 lux · 6000 K
Target light at the pillow
Time Light Colour temperature
30 min before 0.1 lux 1000 K
27.5 min before 0.5 lux 1050 K
25 min before 1.2 lux 1090 K
22.5 min before 2.5 lux 1200 K
20 min before 5 lux 1300 K
17.5 min before 8 lux 1400 K
15 min before 13 lux 1500 K
12.5 min before 22 lux 1650 K
10 min before 35 lux 1800 K
8 min before 55 lux 2000 K
6 min before 78 lux 2200 K
5 min before 95 lux 2300 K
4 min before 120 lux 2400 K
3 min before 150 lux 2500 K
2 min before 185 lux 2600 K
1 min before 220 lux 2700 K
At the alarm 250 lux 2750 K
5 min after 300 lux 3000 K
10 min after 400 lux 4000 K
20 min after 703 lux 6000 K
Light at the pillow on a log scale, in the colour of each moment.

Step 04: Go below 1801 K

In colour-temperature mode the colour bulbs stop at 1801 K. As a raw colour point they go lower, so I send the point where a 1000 K blackbody sits on the colour chart.

Result

The same bedroom in three panels: lit deep red, then amber, then warm white.
A compilation of three states. In real life, the change is gradual.