Light sensor, LDR

The light sensor is also called a light-dependent resistor (LDR) or photocell. It is connected to Arduino pin A0. analogRead measures the voltage at the pin. You will get a value between 0 and 1023 (where 0 equals ground and 1023 equals +5 volts).

Changing the type of lamps and ambient light will give a bit of variation in your readings. In many cases a covered sensor equals about 500 and an exposed sensor is around 800. So under those circumstances an ON / OFF threshold-value of about 700 would be fine.

 

 

Light sensor


 

 

Code