For this year’s Winter Solstice project, I made a “SleepLight” for Clara. She’s not very good at reading time on conventional clocks, but it seemed useful for her to be able to tell when it’s bedtime and getting-up time, and how long there is till the next significant time. Hence this diurnal clock slash night light.

I must also confess that I really like arrays of LEDs, so one motivation was just to do something with one of them. This project uses a 5x7 array of two-color LEDs, red and green.

Designing a PCB to hold the LED array and the controlling circuitry was simple. Not so simple that I didn’t make a stupid mistake, though. But not such a stupid mistake that I couldn’t fix it by adding some simple jumpers and changing the design of the small daughterboard that would hold the radio.

Radio? Yes, since my DimBot already uses a time signal broadcast throughout the house, along with the wakeup time, it was trivial to add a bedtime parameter and rely on that existing UI and radios to tell the SleepLight what to do (and when). This brings the number of always-on XBee radio modules in our house to 7.

I wanted the LED module to hang on the wall in a pretty small box, so space constraints led me to move the XBee onto a daughterboard. This proved quite useful for prototyping as well as adapting XBees to either 3V or 5V systems, and also made the main board flexible enough to use on future projects (stay tuned).


When plugged in, the unit lights all LEDs in each color, consecutively, for one second each, then connects to the radio. While waiting for a time signal from the network, it plays “snake” - bouncing a pixel off of the “walls” of the display, keeping a trail of pixels, and periodically changing the snake’s color.

Once the time signal is received, the SleepLight displays it as follows:

  • At bedtime, all pixels are lit red;

  • At wake-up time, all pixels are lit green; and

  • In between, one pixel is removed periodically at the correct rate to ensure that the last pixel will disappear just before all pixels are lit for the next time.

In addition, one pixel is called the “free pixel.” When there’s enough space (blank pixels), the free pixel plays “pong” by moving around the display and bouncing off the walls.

The above image shows Clara’s animals inspecting the SleepLight at a little more than halfway through the day, with the free pixel bouncing around above three remaining rows of lit pixels.

Design documents

Meh. Let me know if you’re curious.


It was immediately apparent when we installed the SleepLight that it caused a lot of noise on the baby monitor. Investigation revealed that it was caused by the switching power supply, a canned wall-wart-style supply that I think was putting audio-frequency noise onto the mains circuit in the room, which was then picked up by the transmitter and broadcast. Installing a ~20-year old power filter module from my junk box between the wall wart and the mains outlet reduced the noise substantially.

Another issue is that when my computer is off, and no longer broadcasting an authoritative time signal (synchronized periodically with well-known Internet time servers), the SleepLight is supposed to get a backup signal from the DimBot, which now keeps quite accurate time by itself. This backup signal doesn’t seem to be getting through, so the SleepLight’s inaccurate clock drifts as much as a half hour in a single day. So for now, I’m just leaving the computer on until I get a chance to diagnose that.



I forgot to add - the project was a complete success as far as its goals. Clara now comes in to our room in the morning triumphantly saying “My SleepLight is all green!”, she bounds up the stairs to see if it’s all red yet at bedtime and is equally pleased when it is, and she has added the word ‘pixel’ to her vocabulary. (I have always called her ‘my pixel’; now she’s also ‘my free pixel.’)