Light Sensor and Darkness detector circuit using LDR and Transistor

Video Tutorial

A tutorial on How to make a Light Sensor / Darkness detector circuit on breadboard using LDR and a transistor. This circuit can be used to automatically control and turn on-off lights or any loads depending on the brightness of ambient light, by adding a relay at the output. The sensitivity a.k.a the brightness at which the circuit switches on the load can also be controlled by using a potentiometer. Watch the video above for detailed step by step instructions on how to build this circuit. Explanation of how the circuit works is also included in the video.

[Schematics for Light Sensor circuit and Dark Sensor circuit are at the end of this article]

Components Required:

  1. 1 LDR (Light Dependent Resistor or Photo-resistor) 
  2. 1 npn Transistor (I used BC547)
  3. Resistors: 470R, 1K (For Light Sensor), 47K (For Dark Sensor)
  4. Potentiometer (Only if you need adjustable sensitivity): 10K (For Light Sensor), 100K (For Dark Sensor)
  5. Breadboard
  6. Power Supply: (3-12)V
  7. Few Breadboard connectors

Explanation of Circuit's Working:

[Watch the video at the beginning of this post for better visual understanding]

The sensing component in this circuit is LDR (short form for Light Dependent Resistor or Photo-Resistor). The resistance of LDR depends on the intensity or brightness of light incident on it and the relation is of inverse proportionality. Which means that when the intensity of light increases, the LDR's resistance reduces and vice versa.

You can visually observe this effect by connecting the LDR in series with an LED and power up the circuit. Now if you reduce the brightness of ambient light, the LDR's resistance increases, resulting in lesser current flowing through the circuit (remember: more the resistance, less the current) and so you will observe that the LED's brightness reduces. Exactly the opposite happens when you increase the brightness of ambient light.

Although this LDR and LED in series circuit is the easiest to make, it has some limitations. Some of them are: you can't control the brightness at which the LED exactly turns on or off. Also, practically we would want the LED to turn on when it is dark and turn off when there's enough light. The maximum load that the circuit can drive is also limited. So for these reasons, we move on to more functional circuit using transistor.

[Take a look at the circuit diagram below]

Some transistor basics: For an npn-transistor, the emitter, collector are of n-junction and the base is of p-junction. For the transistor to turn on or to allow current to flow from collector to emitter, the voltage at the base should be above a certain threshold voltage.

We used a resistor in series with the LDR (basically a voltage divider) to convert the change in resistance of the LDR to change in voltage. This change in voltage at the common point between LDR and resistor is used the trigger the transistor by connecting it to base of the transistor.

In the Light Sensor Circuit (first diagram) when the brightness of light increases, the LDR's resistance reduces and so the voltage at the base of transistor increases (because if LDR resistance reduces, the voltage drop(gap) across the LDR, towards positive side decreases). Once this voltage increases above the required threshold voltage at the base, the LED turns on. You can now visualize what happens when you reduce the brightness of ambient light.

In the Dark Sensor Circuit (second diagram) when the LDR's resistance decreases when the intensity of light increases. So the voltage at the base of transistor increases when the brightness of light decreases, and once it gets past the minimum threshold voltage required at the base of transistor, it turns on the LED.

Circuit Diagram:

Light Sensor using LDR and Transistor circuit diagram
Darkness Sensor/Detector using LDR and Transistor circuit diagram

[Instructions on how to modify the circuit for adjustable sensitivity are in the video]

If you have any queries, post them in this project's youtube page: https://www.youtube.com/watch?v=rhySv8ePwyM