I have a circuit for a consumer product (below) that I am developing that is driven by an ATTINY44V (but later by a ATTINY45 or 85). I have everything working with the hardware and my Arduino sketch which I'm programming my ATTINY via AVR programmer.
One issue remains; how do I keep the brightness of my LED "T-1 (3mm) LED" consistent over the 4 to 10 hrs that the circuit runs via the battery before it goes into daytime and recharges. The VCC varies from 3.1 volts when fully charged to about 1.9 volts when the circuit dies at 1.8V. The 45 ohm resistor in series with the LED is calculated for full VCC (3.1v).
I'd like to find a way electrically to keep the LED brightness at the same level over the VCC drop. I realize I may be able to do this in software via PWM that senses voltage over the time period that it is operating, but I'd rather find a simple electrical solution.
Simple way: use a LDO to regulate the voltage to ~2V and use appropriate resistor. As a bonus you will get decreased current consumption in the Tiny. You may even use a buck(-boost) converter.
google "constant current circuit", or find an RGB current driver for LEDs. However the low supply
voltage is going to cause problems, particularly as blue/green/white LEDs can drop 3V or so, and you
need some voltage headroom for constant current circuitry. The idea of measuring the supply voltage
and modulating PWM to the LEDs has a lot going for it.
Yes, I was thinking of limiting the VCC to 2V, since the ATTINY runs reliably down to 1.9 V ( I have brown-out protection disable and have already tested it) perhaps with a 2V zener. The LED is more like 10-12ma at 2V and is a single yellow LED so that's not a problem. The issue is that I need the 3.5V zener (or maybe 4-5V zener) to adequate charge the LIFePO4 3.2V battery in the daytime with the Solar Cell (and when ATTINY is in low power mode).
I would like to do this as cheaply as possible since this is a low-cost consumer product and every component counts.
If I can find a way to use a zener or a regulator at VCC and still charge the battery at 3.5V; perhaps isolating the charging circuit with a diode from the VCC?
Smajdalf:
Simple way: use a LDO to regulate the voltage to ~2V and use appropriate resistor. As a bonus you will get decreased current consumption in the Tiny. You may even use a buck(-boost) converter.