A Light to Find your Way


These are just a fun and helpful little circuit. Similar to "throwie" style LED toys, it's meant to be easy to attach to various surfaces via a strong magnet. The goal is something that you can stick to furniture, door frames, or railings to help you find your way around at night. It started simply enough, just a resistor, battery, and LED:

These are OK but run out of batteries too fast.

Yes! Over-optimization time!


The naive approach of just resistor + battery + LED worked, but would run out of batteries in ~6 months. That was much too short, remembering to replace that many batteries is a pain.

So, where are our avoidable power losses? The resistive losses, obviously. But does the light need to be on all the time? A blinking light attracts more attention, and if that's annoying, we can use persistence of vision to make it look like its on all the time, when it's not.

What about combining high peak brightness with persistence of vision to make a light that appears brighter than it really is?

Turns out we can accomplish all that by adding a microcontroller, and removing the resistor.

The standard LED equation we're taught in high school or as undergraduates is mildly inaccurate. When you remove the resistor from the equation, and apply a voltage exceeding the voltage drop of the LED, current does not in fact go to infinity and destroy the Universe. It's a nonlinear function -- there's a relationship between the voltage over the threshold and the transfer of current on the LED datasheets. So if you apply such a voltage for a very brief time (microseconds), the instantaneous current might be too high, but tolerable for such a short time without damage. This technique exactly matches our needs!

Enter the Attiny10, one of my favorite microcontrollers.

Truly, we Live in an Age of Wonders


This task is perfect for one of my favorite microcontrollers -- the Attiny10. It has four I/O, very low power operation, is pretty fast, costs only USD 0.36 in bulk, and is half the size of a grain of rice. Remarkable! Impossible! Wonderful!

I set the watchdog timer (WDT) to repeatedly generate interrupts. Then, just turn on the LED for a few microseconds using some NOP (no-operation). It's too short a time to bother turning on a proper hardware timer. Then turn off the LED, and try to sleep forever (it will be interrupted by the WDT over and over again though).

Using the WDT as an off-label system timer is something I do a lot. It's supposed to be used to avoid system lock up, e.g. being frozen or stuck in a reboot loop. However, it has the useful property of being able to wake the system from the deepest sleep modes.

A tradeoff is that it consumes power (single digit microamperes). This means that I could build an external WDT-like function for lower-power operation (some nanoamperes) if low power operation is really important. However, in this case it would increase the cost of these things too much. This is good enough, and good enough equals perfect.

You can tile a lot of these onto a single PCB order.

Did the Optimization Matter?


The first prototype ran for 3 years off a single CR2032 battery. It's clearly visible in the dark, but not annoying or too visible during the day.

It blinks softly, like a little guiding star.

An OK success! I make these and hand them out to people I know with older parents, so they don't bump into furniture or fall at night.

I even use them myself, to avoid hitting my head on doorframes at night (I live in a comically tiny old Asian house). It definitely beats wearing a helmet all the time!