I built a first quick prototype today and it works - kind of, using an ATTiny25 and my favorite yellow LED. No blinking or flashing as for now.
The prototype does just one thing. As soon as power is on, it measures the light level and adjusts the brightness of the LED accordingly. It's set up in an endless cycle:
- Reverse-bias the LED
- Wait a bit
- Measure Discharge with the ADC
- Compute brightness level
- Turn on LED for the appropriate fraction of time (maximum duty cycle 50%)
At 3V, the maximum duty cycle of 50% means that it is safe to forgo the resistor on the LED. The prototype does works in the sense that it indeed adjusts brightness correctly. My multimeter agrees:
- 670 uA without LED
- 700 uA with LED in complete darkness (i.e., LED drawing only 30uA )
- 5.7 mA in bright light (i.e., LED drawing 5mA)
There are still some limitations:
- The LED discharges a bit even in complete darkness. I will have to understand the source and nature of this discharge to make the design more robust
- Blinking and flashing modes are missing.
- The current used by the microcontroller is a bit high for my taste.
Still, I am satisfied with the first results.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.