The first version of the controller worked pretty well and had just a couple small things I wanted to improve on. It should be an easy upgrade, right? Well, my friends, welcome to a journey down feature creep road.
My primary gripe was that the Attiny10, although tiny, doesn't have an on-board EEPROM to save the last LED mode that was used. No worries, we can upgrade to the Attiny85 just fine.
Just move some things around the board to make room, and we're good to go, right?
Well, now that we have an Attiny85, we might as well use all PWM outputs so the controller can do RGB. Just throw a couple more mosfets in there.
While we're at it, programming via the ISP isn't super convenient and it's completely inaccessible when the device is wrapped in shrink tubing (my cheap/compact enclosure to keep everything together). The board already has a USB port for charging the battery, why not use it to programmed the attiny? Micronucleus is a pretty well trodden USB bootloader for the attiny range, just wire up the USB port to the Attiny85 and we should be good to go, right?
Not so fast! Unfortunately, micronucleus needs a minimum of 12 Mhz to work and the Attiny85 datasheet says it needs at least 4.5V to run more than 10Mhz -- we're not going to get that directly from a single lithium cell.
That's fine, we'll just add boost converter to raise the voltage to 5V 1A. We'll also need to add a couple simple schottky diodes to keep the battery and USB voltage from each other.
And now we have:
- Attiny85 - microcontroller
- 3 mosfets for LEDs
- PAM2401 - boost converter
- MCP73831T - lithium cell charger
- And all the accompanying components.
Here we go, what could possibly go wrong?