Home     Contact     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS     Terms of services     Privacy policy  
   
 Home      Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science   

25 April 2011
Author: Giorgos Lazaridis
Automated Light Controller with adjustable Sensitivity and Hysteresis


The circuit assembled on a breadboard for test

I made this circuit to support the backlit of my Servo Actuated Keycode Lock project. I wanted to add backlit to the touchpad, but the LEDs should turn on only if the ambient light is not sufficient. The project runs on batteries so the current consumption is critical. The door is located in front of an East window, so there is enough light during day. Only during night the backlit is necessary.





The Circuit

Here is the schematic circuit:





The circuit is based on a Schmitt Trigger. I have publish in the past many circuits based on this brilliant building block, like this Thermostat Circuit and this PC Fan Failure Alarm. If you do not know how the Schmitt Trigger works, i suggest you follow this link to read the theory.

The IC1 (741) along with the resistors R2, R3 and r4 performs the Schmitt Trigger. Instead of a waveform, the input to the 741 comes from a voltage divider, performed by a photocell (PH1) and a potentiometer R1. This potentiometer will eventually set the sensitivity of the circuit.


This is the photocell (LDR) that i use

The output of the Schmitt Trigger is driven through a resistor (R5) to the base of the transistor amplifier. The circuit as-is, may not be able to directly drive a relay with this transistor. If you plan to use this circuit to drive higher loads than LEDs, then you may consider use more amplification stages. I only plan to power some 3-4 LEDs, so the power is enough. Each LED will have its own limiting resistor.

The circuit has a hysteresis that can be adjusted by changing R4. This hysteresis works as follows: The LEDs turn on when a specific amount of light falls on the photocell. The LEDs will remain ON as long as the luminosity is bellow this amount. When the amount of light starts to increase again and goes above this specific point, the LEDs will NOT turn off. Instead, the amount of light must go a little bit higher for the LEDs to turn off. This difference is the hysteresis. The bigger the R4 - the smaller the hysteresis and vice versa.

Any resistor between 100 Ohms and 100 KOhms can be used. But keep in mind that above 40 KOhms, the hysteresis is very small, almost none, so practically there is no meaning to make such a circuit. The point of this circuit is to have this hysteresis. The reason is very simple. Suppose that you use this circuit for security light - the LEDs must turn on when the ambient light is not sufficient. Now suppose that this circuit is outside, and the sun begins to fall. There will be a time, that the amount of light is exactly at the point that the LEDs must turn on. In an ideal world, the LEDs would turn on and remain like this. But this will not happen. Instead, the LEDs will turn on and off every time that the light slightly changes, even for a tiny amount, causing the circuit to oscillate. This is where the hysteresis comes to save the day. When the LEDs turn on, the luminosity will have to change a lot until they turn off again. So, slight light changes will be filtered.


Light falls on the photocell, the LEDs are OFF My hand drops shadow on the photocell and the LEDs are ON




Bill Of Materials
Resistors
R1Potentiometer 100 KOhm Linear Rotary 1/2W
R2Resistor 47 KOhm 1/4 Watt 5% Carbon Film 
R3Resistor 47 KOhm 1/4 Watt 5% Carbon Film 
R4Resistor 22 KOhm 1/4 Watt 5% Carbon Film 
R5Resistor 1 KOhm 1/4 Watt 5% Carbon Film 
R6Resistor 10 Ohm 1/4 Watt 5% Carbon Film 
R7Resistor 10 Ohm 1/4 Watt 5% Carbon Film 
R8Resistor 10 Ohm 1/4 Watt 5% Carbon Film 
PH1LDR 5K-500K Photocell 5x4x2mm 150 mWatt 
Transistors
Q1BC548 Switching and Applications NPN Epitaxial Transistor 
Semiconductors
IC1LM741 Operational Amplifier 
LED1-3LED 3mm white high brightness
















Comments

  Name

  Email (shall not be published)

  Website

Notify me of new posts via email


Write your comments below:
BEFORE you post a comment:You are welcome to comment for corrections and suggestions on this page. But if you have questions please use the forum instead to post it. Thank you.


      

  • At 4 July 2015, 1:38:25 user JOey wrote:   [reply @ JOey]
    • Nice design! Curious as to where is all the voltage drop? VIN starts with 5V but Vout is 3.5V. Is this right? If so, any suggestions to reduce the voltage drop?

      Thanks for sharing.


  • At 29 March 2014, 13:31:34 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @arpit You need a completely different circuit. This one will not do. Work on this one:
      http://www.pcbheaven.com/circuitpages/Simple_Linear_Fan_Controller/
      Then replace the R1 with a set of resistor-LDR. Work out the values.


  • At 29 March 2014, 12:53:02 user arpit wrote:   [reply @ arpit]
    • Hi,
      I need to make a circuit to control the speed of a small dc motor(9v, the type used in toys) on the basis of light intensity. Can I use the output of this circuit to run one such motor. Do I need to make any modifications?

      Thanks in advance.


  • At 29 January 2014, 4:25:41 user Gayathri wrote:   [reply @ Gayathri]
    • Dear Friend,

      I'm in need of single phase to three phase converter using microcontroller.

      I need a help, how to start up with it.
      , but i dnt know much about electronics design n those gud stuff, i feel ur the right person to help out my dear friend. Wait for your humble reply.

      Thank you.


  • At 27 June 2013, 18:02:58 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @andrew Maybe smaller R5 (say 220 Ohms) and smaller LED resistors will do.


  • At 27 June 2013, 15:34:03 user andrew wrote:   [reply @ andrew]
    • Hello, I made this circuit and it works just fine. the only problem is the LED brightness is not at its max (50% brightness). what might be the problem? thanks.


  • At 27 June 2013, 13:36:24 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @khan Sure, you may need to change R1 though, as well as LED resistors


  • At 24 June 2013, 17:39:52 user khan wrote:   [reply @ khan]
    • can i use a different DC voltage source? a 9v or 12v battery for example.


  • At 9 April 2013, 16:48:56 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @lindiwe depends on Q1 and R5


  • At 9 April 2013, 15:32:50 user lindiwe wrote:   [reply @ lindiwe]
    • ok thanks you. and what about the second question which i would like to know the outcome you can draw about this circuit?


  • At 8 April 2013, 6:16:00 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @lindiwe there is always difference between simulation and real life. hidden parasitic capacitance and resistance are hidden in the PCB and breadboard tracks...


  • At 5 April 2013, 13:51:03 user lindiwe wrote:   [reply @ lindiwe]
    • hello i build the circuit and it works but i have a question. how whats comparison can you make concerning the simuating model and the practical model?? Lastly whats is the outcome you can make on this circuit?? thanks you


  • At 15 March 2013, 15:04:58 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @mamatha Try different values of R1


  • At 13 March 2013, 8:44:38 user mamatha wrote:   [reply @ mamatha]
    • hi...
      i did it and the led's are turning on only when the LDR is completely closed..what might be the problem??
      can i use 9v instead of 5v


  • At 11 January 2013, 10:01:14 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @Fung no problem, go ahead


  • At 9 January 2013, 9:31:33 user Fung wrote:   [reply @ Fung]
    • I used this circuit as public lighting, the output drives 3 white LEDs via a BC547 transistor while the value of R4 is 27 kohms. The circuit is still testing and I recorded the time when it lights and turns off (from 17:55 to 7:55 on the next day), the LEDs light when the LDR reaches 82 kohms while below 40 kohms to turn off.
      Since the hysteresis is quite huge, so its value is necessary to increase, if a 150 kohms resistor is used, would it produce any problems?


  • At 11 May 2012, 17:22:48 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @Greta i'm no sure if this will work as-is


  • At 11 May 2012, 16:52:49 user Greta wrote:   [reply @ Greta]
    • Hi,
      Would it be possible to supply the circuit with 10v instead and use 5v as zero for the coil as in the linked pic?

      http://i46.tinypic.com/98dkxf.png


  • At 10 May 2012, 13:07:49 user Greta wrote:   [reply @ Greta]
    • Thank you,

      I will try to make find information to solve this issue


  • At 9 May 2012, 14:01:50 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @Greta It can be done with a comparator and an one-shot (monostable) circuit, but as i told yo before this will double the circuit complexity.
      The comparator checks the transistor output. When it goes below a certain level (let's say 3 volts) the comparator output goes HIGH. This drives the one-shot circuit which sends only one pulse to your circuit.


  • At 9 May 2012, 7:53:14 user Greta wrote:   [reply @ Greta]
    • Aww, too bad. I have a coil that i momenterely need to send a few volt in reverse direction. The coil works like electro magnet moving a filter. Could it be done with a capacitor that sends short impulse when the power turns off over the coil?


  • At 8 May 2012, 19:23:53 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @Greta that would require many changes in the circuit


  • At 8 May 2012, 18:53:26 user Greta wrote:   [reply @ Greta]
    • Hi, Is it possible to reverse a small amount of voltage when it not dark. This voltage is needed to reset the device I'm powering.


  • At 21 April 2012, 11:21:57 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @Frippe better check these circuits then:
      http://www.pcbheaven.com/circuitpages/Light_Dark_Activated_Relay/


  • At 20 April 2012, 9:01:29 user Frippe wrote:   [reply @ Frippe]
    • Is there an easy way to add delay to the circuit reducing the sensitivity if objects or people passes by?


  • At 8 March 2012, 12:17:17 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @neer add a 7805 to get 5 volts from the 12 volts (for the circuit). Then replace the LEDs with a relay to get the output for your 12volts load.


  • At 8 March 2012, 10:44:14 user neer wrote:   [reply @ neer]
    • hey i wanna do this with 12v battery and also output should be 12v for to make my bike's head light automatically on and off what changes should i make in this circuit ??? help pls


  • At 18 June 2011, 9:09:30 user Kammenos wrote:   [reply @ Kammenos]
    • @Fung the problem is probably the LDR. Check if the resistance is changed with an ohmmeter. Connect your ldr to an ohmmeter and read the resistance in dark and light.


  • At 18 June 2011, 5:50:38 user Fung wrote:   [reply @ Fung]
    • I found a problem, the sensitivity of turning off a light (the output) was not high enough, nowhere I tune the 100 kohms variable resistor. For example, when the light is on, I place the LDR to a brighter place, but the light does not turn off. What can I do in order to solve this problem?


  • At 23 May 2011, 17:18:49 user Kammenos wrote:   [reply @ Kammenos]
    • @LIEF LM348N is ok


  • At 22 May 2011, 7:28:48 user LIEF wrote:   [reply @ LIEF]
    • hi :) can i ask if which of these can I use as an alternative to the LM741 since im not sure.. since these are only the OpAmp available to the store which we are about to visit to buy components.. and as well as the photocell.. can I use this..?

      PHOTOCELL (LDR)
      5mm Diameter

      this is the only LDR available in the store..

      and which of these can i use for this circuit..?
      LM324N Low-Power Quad Op Amp (DIL)
      LM324N Low-Power Quad Op Amp (SMD)
      LM3301N Quad Operational Amplifier (DIL)
      LM348N Quad 741 Op Amp (DIL)
      LM349N Quad 741 Op Amp High-Speed (DIL)
      LM358N Low-Power Dual Op Amp (DIL)
      LM3900N Quad Operational Amplifier (DIL)


      thanks for your help! :)


  • At 28 April 2011, 16:57:08 user Kammenos wrote:   [reply @ Kammenos]
    • @Fung yes you can use 324. You can also add the resistor to limit the current. It will be ok.


  • At 28 April 2011, 15:58:54 user Fung wrote:   [reply @ Fung]
    • Also, do 324 op-amps (LM324 or LM358) applicable in this circuit?

      And I think that one more fixed value resistor such as 1 kohm should be connected in series with R1, because the resistance of the LDR can be less than 500 ohms when the light intensity of the surrounding is high.


  • At 27 April 2011, 16:51:12 user Kammenos wrote:   [reply @ Kammenos]
    • @Fung yes i am talking about R4, the feedback resistor. Very big or very small values will either have NO hysteresis at all, or the hysteresis will be HUGE and the leds will never turn off.


  • At 26 April 2011, 14:17:35 user Fung wrote:   [reply @ Fung]
    • This circuit is really good for setting the public lighting system which includes delay lighting feature, i.e. after a certain time of darkness, the lights turn on.

      For the sentence "Any resistor between 100 Ohms and 100 KOhms can be used. But keep in mind that above 40 KOhms...", is this point to R4? What problems would occur if the resistance of R4 is larger than 100 kohms or smaller than 100 ohms?



    delicious
    digg
    reddit this Reddit this
    Faves



     HOT in heaven!


    NEW in heaven!



    New Theory: AC electric motor working principle



     Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS   

    Site design: Giorgos Lazaridis
    © Copyright 2008
    Please read the Terms of services and the Privacy policy