I remember as a child listening to my younger sisters wake my parents (and one another) up in the morning.
The problem they faced was that they were awake, but being unable to tell time, they had no concept of whether or not it was OK to get out of bed. The solution they improvised was to declare at the top of their lungs that they were awake, and inquire (also at the top of their lungs) whether or not it was time to get out of bed yet.
It was a losing battle for my mother. If she said “No,” they would simply inquire again (at the same volume) half a minute later if now was it time to get out of bed?
If only one of the twins was awake before, both were awake now, and there would be no going back to sleep. For anybody.
To solve this problem, and with the help of commoditized, computerized electronics, the concept of the “safe to wake” light was introduced to the market. For a few dozen dollars, parents can get a programmable clock with lights and sounds that will indicate to children whether or not they should be sleeping using an easy-to-understand paradigm like, “If the light is red, it’s bedtime. If it’s green, you can wake up.” Fancier models include additional modes for good-morning imprisonment, like: “If the light is yellow, it’s OK to be awake, but you should read or play quietly in your room because Mommy can’t deal with you right now.”
The other day, Katie came to me with a “programming question.” She said that Simon needs a safe-to-wake light, and he has these LED nightlights in his room, and could we just… program a safe-to-wake light for him?
The answer, of course, to any “can’t we just” programming question is: “it depends.” But that’s not what I said.
“Sure we can! That’s a great idea! I think we should probably…” And so on.
If you want any kind of programmable smarts, you need a computer. The nightlights in Simon’s room, while nice to look at, do not have computers you can interface with beyond the physical switches on them.
It became clear (after collecting some requirements) that this was not going to be something we could solve by repurposing the existing electronics. The parameters of our safe-to-wake clock would need to change based on the day, Simon’s age, how well it is received, and even allow for circumstantial on-demand modifications (we need an early start today, etc.).
But just because we need custom electronics and smarts doesn’t mean there’s nothing useful in Simon’s room. Let’s see what we’re working with!
We decided that, to ease the transition, our best bet would be to “fix” our existing friend, Squishy Kitty, who already holds a place of honor in Simon’s room.
Squishy Kitty is a hollow, rubbery kitty-shell that sits on top of a rechargeable base integrated with LEDs. The base lights up Squishy Kitty from the inside, and has some smarts for allowing you to change the lighting mode: solid colors, fading between colors, off, etc.
Squishy Kitty’s base is not programmable, however, nor will it run while a power source is attached to it. As a result, we haven’t bothered to plug Squishy Kitty in for a few months, and so the story goes that Squishy Kitty is “broken.” But Squishy Kitty is, regardless of his current luminosity, still very much loved. So he remains in the room; an unlit sentinel in the night.
But lo! A new dawn approaches.
We will rebuild him!
The plan right now is to pull Squishy Kitty off of his base (pictured above) and replace it (the base) with the following components from our local MicroCenter:
- Raspberry Pi Zero W - our computer
- Pimoroni Unicorn pHAT - our LEDs
- 16GB MicroCenter microSDHC - for installing the OS
- Official Raspberry Pi Zero Case - case
The grand total for everything comes to $32.29 after taxes, which we could bring under $30 if we elect to forego the case. Cheaper than most safe-to-wake lights on the market, and much more feature-rich 🤞.
There’s something magical about programming side projects like this for yourself: Scope creep is OK, tangents are not distractions but learning opportunities, and the end product is something that’s valuable to you. You control the budget, the delivery date, and the level of quality. Sometimes that means the scope grows beyond your desire to complete the project, but in this case, the end result is pretty well-defined, and we can always iterate to add new features.
Plus, Squishy Kitty is counting on us.
In the next post, we’ll get the Raspberry Pi Zero up and running. Stay tuned!