Designing lampion

This writeup documents (in depth) what I have learned and the decisions made during the design and manufacturing process of lampion, a tiny solar harvesting (faint) ever light.
It’s a small cosmetics box containing a LED that turns on at night forever, even when kept indoors as long as there is some natural light during the day.
Disclaimer: things may be wildly incorrect here, so act accordingly (or even better, let me know so we can all learn).

Inspiration

I came across Ted Yapo’s TritiLED project and probably read the project log entries 5 times before I started understanding what I was reading, and then I decided to make my own. I went straight into designing a board using a STM32L0 which is what I had experience with (and in my spare MCUs drawer) and I basically failed - could not reflow solder the thing, or could not program it, not sure.
Then I forgot about it and moved on to other projects more within my reach.
I eventually stumbled upon a remake of Ted’s project using a ATtiny85. At the same time I was exploring ways to harvest indoor light to power super low power projects, and I found Armalamp and other projects from bobricius. I decided to try and combine the two and it looks like I will manage this time.

Requirements

Must haves:

  • produces light which is bright enough to easily see at night
  • manufacturable
  • not too expensive (total costs not more than £10 a pop in a small-ish production run)
  • should survive several days in total darkness, and basically forever under realistic natural light conditions
  • fits in a 3g cosmetic jar (⌀ 29.5mm, height 16mm)
  • I should learn new things in the process, and spend my time/energy on what I enjoy doing

Nice to have:

  • no lithium-based battery (because shipping is a pain)
  • no over-reliance on a miracle magical part or IC

Oh, and the most important: done is better than perfect. Too easy to never finish hobby projects like this one.

Hardware design

The overall idea is to:
(1) use photodioes to harvest ambient light
(2) charge up some form of energy storage
(3) use that to power a MCU
(4) which generates brief pulses to light up a LED
(5) and use the famous trick of charging an inductor and letting that light up a flyback LED to reach higher light intensity per W than when directly under-powering the LED - read Ted Yapo’s notes if you’re confused here

Microcontroller

The original TritiLED uses a low power PIC, Everled uses a ATtiny85, and I had STM32L0s around so I tried that first. Long story short, I did not manage to make it work. Between soldering it manually (a UFQFPN-20 package - 0.5mm pitch) and having a cheap connector to program/debug it, I never made it work.
Besides, low power modes on ARM are a massive pain to get to work, resume from low power modes was slow, and frankly a fully Cortex-M0+ and 32bit was way overkill for what I needed: a periodic wakeup every ~20ms or so to pulse a high signal for ~1us before going back to sleep. And maybe read the voltage produced by the photodiodes once in a while.
So I went with ATtiny85s I also had lying around and got working. The low power modes and watchdog timer configuration and related interrupt handling are MUCH simpler - the program is about 10 lines of actual code only.
The ATtiny85 is not exactly a low power microcontroller, but it does spend the overwhelming majority of its time asleep, during which it consumes ~4uA. It’s not perfect (see current/power budget explained later in the doc), but it’s a good start.

ATtiny95 power down current draw

I program it using the good old avr-gcc + avr-objcopy + avrdude combo and an Arduino Uno as a programmer, and voilà.

LED and inductor

Here I only validated what had been done previously by Ted Yapo and picked a small 0603 bright green led (525nm), the Kingbright APTD1608LZGCK.
APTD1608LZGCK

I picked a small (1007 package or 1.8mm x 2.5mm) 470uH inductor: TAIYO YUDEN LB2518T471K
enter image description here

Photodiodes

The choice of photodiodes, energy storage...

Read more »