Introduction: LED As Light Sensor !!!

About: I am a Programmer, Hacker, Maker and Technology enthusiast.
Hello friends in this instructable I am going to share how I found out that LEDs can sense Light. I know it sounds strange but it actually is true. I came to know about it as I was experimenting with arduino and sensors. I knew that IR leds can be used to sense IR light when used in reverse biased. So I tried using a normal LED to measure light and it worked !

I know it is not as sensitive as the LDRs and Photodiodes but still it is fun to try it out and we get to learn something which is never bad...

I have also made a light sensitive switch using this LED as sensor.

Step 1: Gathering Components.

I have provided the links of required products, cheap price and good sellers, you can also find products on ebay but I don't trust it much.

  1. Arduino .
    Link for US
    Link for Europe ( UNO in my case, you can use any one you have)
  2. Breadboard.
    Link for US
    Link for Europe
  3. LEDs.
    Link for US
    Link for Europe (any LEDs work. we need 2 . one for sensor , other as indicator.)
  4. 100 ohm resistor.
    Link for US
    Link for Europe

All the components can be bought from
That's all we need.

Step 2: Making Connections.

* First place the LED (Sensor) in the breadboard.

Note:- LED works different in Forward and Reverse bias. In Forward biased mode ie. Anode to pin A0 and Cathode to GND. the LED gives High values in Light and Low values in Dark. and vice versa in Reverse bias.

* Once the LED is placed in breadboard, Connect its one pin to A0 (analog pin) of Arduino. and connect its other pin to GND pin of Arduino.

* Now place another LED on breadboard and connect a 100 ohm resistor to its Anode. Connect a wire from the resistor to pin 13 on Arduino (digital pin). Connect the Cathode of LED to GND of Arduino.

(The sensor LED seems black but I have just wrapped black tape around it)
When all the connections are done , next step is to upload the code.

Step 3: Writing and Uploading Code.

For uploading code in Arduino we need an IDE , Arduino has its own free IDE you can visit to download it.

Once You have set up the arduino IDE you can start writing code. refer the code given below to make the Arduino sensor :

I have uploaded two codes one for sensing the Light , second to make a light dependent switch using the LED as sensor. In the second code you will find a conditional statement " if( value > 100)" here the value 100 is set because my led works on that value, I have noticed different LEDs have different sensitivity levels so before making the switch circuit you will have to note the values of the LED in light and in dark. You can see the results in Serial Monitor. Refer the picture above to start serial monitor .

First open the first code and upload the code to arduino , now open Serial monitor and note the values in dark and value after light is applied. these values can be used to trigger the switch .

eg: If in dark the value is 100-150 and in light it is 50-100. then the LED on pin 13 can be turned on by editing the if statement as "if(value > 100 ) { digitalWrite(led,HIGH);}". now the LED will turn on when in Dark and if the greater than ">" is replaced with less than "<" then the LED will turn on in light.

Lights Contest 2017

Participated in the
Lights Contest 2017