Quick Test, AVR Power Optimization, Done!

A project log for ATtiny45 EverLED

ATtiny45-based Ripoff of Ted Yapo's TritiLED

elliot-williamsElliot Williams 06/22/2017 at 10:030 Comments

Ted uses a 1 mH inductor, but I only had 0.15 mH. Ted uses a particular high-wattage LED. I had a regular "ultra" amber LED from a surplus store. Ted uses a low-power microcontroller. I had an ATtiny45. Would it blend?

The first tests were just the pulses, and sure enough the theory works just fine -- super-short pulses "charged up" the inductor and let it dump back through the LED. Alone (with 4 us pulses every 20 microseconds) it was running 4 microamps.

Adding in the ATtiny45 with busy-wait loops and no power optimization used up ~500 microamps. Well, that won't work.

Best thing to do? Turn off everything possible -- power_all_disable() from avr/power.h -- and put the pin-toggling code into an interrupt that fires off the watchdog timer. That way the ATTiny45 is sleeping in full power-down mode for 99.99375% of the time. Not a low-power chip when it's on, but who cares?

I also shortened the pulse duration down to ~1 microsecond, because it still looked bright enough to see at night, and I couldn't go any faster.

Et voila! 10 microamps (9.9, but who's counting?) running. Or about 2.5 years on a coin cell, nominally.

Could it be brighter? I presume so. Ted's research on optimal LED drive currents would be the place to go. Or I could just use longer pulses, which seem to do the trick.

Could it use less power? Maybe. I didn't particularly optimize the size of the inductor.

The FET (IRLML 6244) is pretty good for the application. Turns on and off quick at 3 V, has low on resistance. I don't think that could be significantly improved on.

And that's it. It's not refined like Ted's, but I built it and it works. I'll might play around with different LEDs or inductors, but maybe later. Right now, I just want you to know that although one can polish a simple design like this until it shines, it also works well enough with whatever you've got on hand.