LEDs as sensors!

This project uses very simple off-the-shelf high-brightness red LEDs. The theory is that each and every LED (even the standard ones) act as capacitors when it's connected backwards, and the speed at which it discharges depends by the light it "sees". Therefore, timing the discharge one can calculate how much light was there in the first place. A quicker way is to simply calculate the voltage drop provided by the LED when it's disconnected, which is what I am doing. The two bright LEDs are alternating between forward bias (emitting), reverse bias (charging) and high impedance (discharging). The ADC is triggered shortly after putting them into hi-Z mode, and uses a 1.5 V reference generated by an LM317. MCU: ATmega8 running at 8 MHz internal oscillator); binary size: 534 bytes.
electronics atmel avr atmega8 lm317 leds photovoltaic capacitors touch control














































