Wednesday, 18 July 2012

Using an LED as a light sensor

We are working on Power Control Systems now. So we were sitting in the library and we started talking about solar panels and how they worked.

It was around this point that I remembered Jolyon's habit of using things backwards - like using a loud speaker as a microphone and using a 12v transformer to create 240V from a chopped 12V supply...

And I remembered reading about using an LED back to front to act as a light sensor. So I rigged up this  little circuit as a quick demo right there in the library....
LED as a sensor

A few lines of code and it was up and running........

Pretty simple eh?

I just used my iPhone as a light source using Torchlight - one of the many free apps that use the phone's LED... and the results were pretty astounding.....

This must be one of the most simple Arduino circuits and it works because when light hits the PN junction of the LED it generates a SMALL voltage that you can read on the analog input pin.

Because the voltage is so small, we need to add upp a large number of cycles to ensure that our reading is not from random noise.


  1. Here's how to cut your electric bill by 75%:

    Want to know how to easily produce all of the green energy you could ever want right at home?

    And you’ll be able to make your home completely immune from power outages, blackouts, and energy grid failures
    so even if everyone else in your area (or even the whole country) loses power…you won’t.


  2. There's a chance you are eligible for a new government solar rebate program.
    Click here and find out if you qualify now!