Automatic Night Lamp using LDR

Automatic Night Lamp using LDR

Automatic night lamp as the name suggests is for turning ON and OFF the lamp automatically without the need of human interventions. It senses the light intensity from surroundings and find whether its day or night. And it automatically turns ON when the surrounding is dark and it turns OFF when it receives light from surroundings. A sensor called LDR is used to detect the light intensity. This project finds wide outdoor applications in streets, gardens and public places where it finds difficulty to appoint a person to operate the lights.

Components Required

  • Light Dependent Resistor (LDR)
  • LM358 Op-Amp
  • Resistor 22KΩ
  • Resistor 10KΩ
  • Preset 10KΩ
  • BC547 transistor
  • 1N4148 diode
  • 12V Relay

Circuit Diagram

Automatic Night Lamp - Circuit Diagram
Automatic Night Lamp – Circuit Diagram

Working

The main part of this circuit is the light dependent resistor (LDR). It is a sensor which is a particular kind of resistor whose resistance decreases when exposed to light. Likewise it offers high resistance in dark. The resistance value changes from few 100 ohms to mega ohm range. The LDR is placed in a potential divider network. So voltage across LDR changes with intensity of light. Voltage across the LDR is given to the positive terminal of a comparator. Now a reference voltage is required to compare with the voltage across LDR. That reference voltage is made by using the pot or preset. So this preset can be used to adjust the sensitivity of the circuit. Next is the comparator made using LM358 op-amp which compares the voltage levels at its two inputs and gives output accordingly. If the voltage at positive terminal is greater, the output will be high and if the voltage at negative terminal is greater, the output will be low. That is if it is dark, resistance across LDR is high, so voltage drop across the LDR is high and voltage at positive terminal will be greater than the reference voltage. Therefore output of comparator will be high. The output of comparator is given to a transistor wired as a switch. Since enough voltage appears across the base emitter junction, the transistor conducts and current passes through the relay coils. So relay switches its contact and the bulb glows. Bulb is connected to the NO (Normally Open) pin of relay as it should be off when the relay coils are not energized. If the output of comparator is low, then transistor will be in OFF stage. So no current flows through the relay and bulb remains in OFF stage.

Automatic Night Lamp Working Animation
Automatic Night Lamp Working Animation

You can choose a voltage between 3 to 32V for powering this circuit depending of the relay coil voltage. I choose 12V since 12V relays are very common in the market.

Note : You should keep the LDR in such a way that light from lamp L1 (connected to this circuit) will not fall on it.


Power Supply

I prefer to use a capacitor dropper power supply. I used the following circuit for that, it is a 12V, 40mA supply. Please read the article, Transformerless Capacitor Power Supply for more details about it.

Transformerless Capacitor Power Supply 12V 40mA
Transformerless Capacitor Power Supply 12V 40mA

Video

Share this post

  • Cleaver circuit using comparator for definite high output and clever power
    supply direct from AC, i wonder so many talented indians are there still we import 90% electronics from CHINA !!

  • I assembled the above circuit. It is working fine. But, while switching, the relay is chattering on off light is flickering very fast at the set level. As suggested by Mr. Marksh (April 13, 2017) I connected firstly 560 K resistor between pin 1 and 3 of lm 358. As still the chatter is continuing, I changed it to 1 M. But still the chatter is taking place for few second but with slow on off of the light. I request you to please suggest me for the further course of action to be taken by me. Thanks before hand. VG KRISHNA, HYDERABAD.

  • plz tell me,the working when we have to use ic 741 as a comparator in automatic night lamp & when we have to use transistor as a switch tell me its range in active as well as saturation region ???

  • HI! PLEASE HELP ME I WANT THIS KIND OF PROJECT FOR MY FINALS IN MY ELCTRONICS SUBJECT AND I WANT PUT A MORNING ALARM. BUT THE PROBLEM IS IT MUST NOT USE AN IC BUT ALL AUTOMATIC NIGHT LAMP WITH MORNING ALARM CIRCUIT USE AN IC. ARE THERE ANY AUTOMATIC NIGHT LAMP WITH MORNING ALARM CIRCUIT THAT DOES NOT USE AN IC?? PLEASE HELP. THANK YOU

  • It’s simple, just reverse connection between relay and lamp. (NO to NC / NC to NO)

  • Please check the position of LDR and Resistor R1. Also check whether you connected inverting and non-inverting terminal of the opamp correctly.

  • My project is working opposite
    When its bright the lamp is on and when there is dark then the lamp is off

  • i am using 684 pf , 400 v capacitor..and i got 9.54 output voltage in multimeter.. for that i m using 6v relay bt my circuit is not working.. relay is not working and bulb is not glowing… what i have to do now? pls ans asap .. 🙂

  • i am using 684 pf , 400v capacitor instead of 680 nf, 400v capacitor, have to change anaything of circuit??

  • Yes, but you do not need R2, Q1, D1 or RL1. Use a 1k and LED in series between the output (pin 1) of the LM358 and the Ground rail.

  • Add a high value resistor (between 100k and 1M) between the output (pin 1) and the non-inverting input (pin 3) of the LM358. This will create some hysteresis in the circuit and the switching then should not flicker. Try experimenting with different values of resistors. The higher the resistor value, the reduction in hysteresis.

  • The common of the relay is connected to the live of the mains. The neutral of the mains is connected to the bulb then to the Normally Open (NO) side of the relay. The relay and this side of the circuit MUST BE isolated from from the rest of the circuit to avoid electrocution.

  • The circuit needs a high value resistor between the output and the non-inverting input of the LM358 to create some amount of hysteresis otherwise the relay will chatter at the threshold of switching. Try putting a resistor value of between 100k and 1M. The higher the resistor value will reduce the the hysteresis.

  • i have connected the circuit on the bread board.
    but, bulb is glowing always irrespective of the darkness around.
    suggest some solution for this.

  • Can i use 12v led in series with this.instead of a normal 230 bulb.and what will i change from the power supply?
    Tnx…

  • In the evening during the conducting time light is blinking. How can I reduce this?


  • >