A photoresistor, also known as a photoresistor or LDR, is a light-sensitive electrical resistor. The more light falls on the photoresistor, the smaller its resistance becomes. Compared to other light-sensitive electronic components such as photodiodes, photoresistors react very slowly.
A thin layer of the photosensitive semiconductor material is applied to a ceramic substrate by sintering a powder. The electrical connections consist of two comb-like metal surfaces that are then applied and face each other. As a result, the structure of the light-sensitive layer has the shape of a meander, through which the photocurrent flows across the course. The entire assembly is provided with connecting wires and coated or encapsulated with transparent synthetic resin. Hermetically sealed metal enclosures with glass windows and glass penetrations are also common.
Photoresistors often consist of a cadmium sulfide (CdS) or cadmium selenide (CdSe) layer that has about the same colour sensitivity curve as the human eye or photographic film. Cadmium sulfide has the maximum sensitivity at a wavelength of 520 nm, and cadmium selenide at 730 nm.
---
Functions and Features of an LDR
In semiconductors suitable for LDRs, the internal photoelectric effect is not used but transitions to impurities. When a fault is ionized by the light, it acts like a doping for a few milliseconds and increases the electrical conductivity. Due to the relatively long time it takes to neutralize the fault again, you get a high sensitivity, but also a slow reaction. Due to the involvement of the impurities, the photoconduction is not only dependent on the base material but also on the microstructure and impurities. The semiconductor used does not have to be amorphous.
A few free-charge carriers, which remain even after a long period of darkening, cause a dark current. This can be reduced by lowering the temperature. Photoresistors are characterized by the following parameters:
- Dark resistance (resistance value of photoresistor in the dark), typically 1 M Ω to 100 MΩ; is only reached after several seconds of darkness
- Light resistance (resistance value of photoresistor at 1000 lx), typically 100 Ω to 2 kΩ
- Response time (time that elapses after switching on an illuminance of 1000 lux after darkness until the current reaches 65% of its specified value), typical value 1 to 3 ms
- Spectral range (material-dependent spectral sensitivity curve)
- Disadvantage: Temperature sensitivity
Circuit Diagram and Arduino Sketch
We need the following components for this project:
- Arduino Uno or similar board
- One LDR
- One LED
- One 10 K Ohm resistor
- Breadboard
- Jumper wires
You need to build the circuit like this :

Click here to open the illustration
Now, first, run this code :
1 2 3 4 5 6 7 8 9 | int LDR_Pin = A0; void setup(){ Serial.begin(9600); } void loop(){ int LDRReading = analogRead(LDR_Pin); Serial.println(LDRReading); delay(250); } |
Open the Arduino serial monitor and get values of reading in the room, in the dark and sunlight etc. Now, this is our final code for the thing we need :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | int sensorReading; void setup() { Serial.begin(9600); pinMode(13,OUTPUT); } void loop() { sensorReading=analogRead(0); if (sensorReading<1000) { digitalWrite(13,LOW); } else digitalWrite(13,HIGH); Serial.println(sensorReading); delay(500); } |
I have set the (sensorReading<1000) based on my available light’s reading on the Arduino serial monitor. The mechanism how the values are being printed is described in Arduino Analog vs digital pin.
So, for your need, (sensorReading<1000) may be lower or higher than 1000. Secondly, you can add multiple LEDs by simple modification.
In real life, we need this action for electric lights. We will need to use an Arduino relay module in place of the LED. There is no need for the extra sketch.
Proof of Concept
After following this tutorial, you will have a project in hand which will behave exactly like this video: