Connect with us

Trying to make a LDR circuit work ?

Discussion in 'General Electronics Discussion' started by Al Slitter, Jan 5, 2019.

Scroll to continue with content
  1. Al Slitter

    Al Slitter

    41
    0
    Nov 4, 2016
    Greetings everyone, I have been trying to get a basic LDR circuit working without success.
    My longer term plans are to have a night light turn on over the shop at dusk and off at dawn.
    I do not want to have and PIR system as the light will only be activated but the sun.

    I have tried several basic designs and I cannot get any of them to work , what I mean by this is that under intense light the LED stays on and does not go out. I have used a component tester and the LDR is putting out significant resistance. Does any one have an idea what might be the cause??
    I am enclosing below a image showing one of the designs that I have used and would not work.
    There is one change that I had to make and that was substituting a 2N2222 transistor in place of the BC547.


    Screenshot from 2019-01-05 08-07-04.png
     
  2. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,491
    2,833
    Jan 21, 2010
    There are a number of problems with that circuit.

    The first is that the LDR needs to have a very low resistance for the LED to switch off. In your case, I'd estimate that it would need to drop below 3.5k (assuming a 9V battery).

    The second problem is that the LED would slowly go out as the brightness increased.

    The third problem is that due to the slow switching, the transistor would get hot if it was switching a significant load.

    The fourth problem is that if you increase the 50K resistor to allow the transistor to turn off more easily, it mat not provide sufficient base drive to the transistor to allow it to turn on fully.

    Also because the voltage required to turn the transistor on is constant, changes in battery voltage would change the light level required to turn the LED on and off.

    And the sixth problem is not so much a problem but a caution that the LDR should not be able to see the LED or the circuit might operate oddly.

    I would recommend that you employ a schmitt trigger between the ldr and the transistor. this would achieve several things:
    1. The switching voltage would not be so close to the ground rail (so the resistor could have a smaller value.
    2. You would have very fast and positive switching between on and off
    3. There would be hysteresis, so once the light turns on, a significant increase in brightness would be required to switch it off again (so it would be less likely to turn on and off as the light level slowly changes.
    4. The drive to the transistor would be independent of the resistor/LDR voltage divider.
    5. Many schmitt triggers have trigger levels based on a fraction of the supply voltage, so changes in voltage would not affect the light levels when the light turns on and off.
    I would use a 40106, a hex schmitt trigger. These typically run from a voltage between 3 and 15 volts. They have 6 independent schmitt triggers in them, although you only need one. The unused inputs should be tied to ground.

    Swap the position of the LDR and the 50k resistor. Place the Schmitt trigger where the connection is from the LDR/resistor to the base of the transistor. A 1k resistor should be placed in series with the output of the schmitt triger to limit the current going to the transistor. The 40106 needs to be connected to +9V and ground to provide power to it.

    After doing this, you may need to select a different value for the 50k resistor.
     
    Tha fios agaibh and BobK like this.
  3. Audioguru

    Audioguru

    3,265
    701
    Sep 24, 2016
    My LDR measures 5.6k when the sky behind my window is very cloudy. 50k is not a standard resistor value, maybe you have 47k or 51k?. I calculated that your LED will turn off when the LDR is in sunshine.

    I suspect that you have the pins on your 2N2222 backwards since they have a different layout from the BC547. Please look at the datasheet of the 2N2222.
     

    Attached Files:

  4. AnalogKid

    AnalogKid

    2,498
    718
    Jun 10, 2015
    As above, two basic questions:

    1. What is the LDR resistance under *typical* daytime conditions?

    2. What is the LDR resistance under *typical* night time conditions?

    ak
     
    Cannonball likes this.
  5. Audioguru

    Audioguru

    3,265
    701
    Sep 24, 2016
    I think LDRs are so old and cheap that each one is different. Now the sun is low in the sky so is not very bright and I am measuring 1.6k on my LDR behind a double gazed window. Then the transistor will certainly be turned off.
    In the dark my LDR measures more than 10M (a little amount of light coming under the door) so any half decent transistor with reasonable hFE will be turned on with the 47k base resistor to +9V and driving the LED with 7mA.
     
  6. Al Slitter

    Al Slitter

    41
    0
    Nov 4, 2016
    I was very careful about this and even went so far as reversing the pin locations in case the information I had was wrong.
     
  7. Al Slitter

    Al Slitter

    41
    0
    Nov 4, 2016
    I want to thank every one for the time and effort you put into this reply especially Steve it is very much appreciated.
    I am greatfull that you where able to point out issues relating to the design as I was really questioning mu abilities on such a simple circuit.
    I want to try and start again but not with this design but first I want to describe what I am doing and what I am trying to accomplish.
    It is my hoe that you and or others will provide links of diagrams that will easily get this project completed.

    Thant you again.
     
  8. Al Slitter

    Al Slitter

    41
    0
    Nov 4, 2016
    I would like to start this plea for help again but first let me explain what I am doing and the reason for this project.
    I am in the process of setting up a small solar environment in my shop. The voltage that I will be working with is 12 Volts DC. This is simple enough but just having 12 Volts available in my shop is not enough so my thinking was to set up a small 10Watt SMD light situated above the door entrance which would come on in the evening and go out in the morning.
    This sounds like a simple project but ???
    If I can find a item that I could purchase that would do what I need that would be a simple solution.
    There are cheap modules available that provide this function as well as a PIR function, however I do not want the Infra Red portion and that needs to be eliminated. In addition there are time delays built into these devices that works against what I am trying to do.
    Here in Thailand I am able to purchase very cheaply night lights the come on in the evening and shut off automatically in the morning.
    The issue is they operate on 220 Volts AC and not on the 12 volts DC that I want to use.
    I selected the use of a 10 Watt SMD LED as my light source as if will operate at 12 Volts DC and has a rather low draw on my batteries.
    If anyone has a easy solution for meeting my requirements please let me know!

    Thank you in advance.
     
  9. Audioguru

    Audioguru

    3,265
    701
    Sep 24, 2016
    Small cheap inverters are made to be powered from a 12V car battery (or your 12V battery) and they make 220VAC at 10W to 20W which will work fine to power a night light that you can purchase. But the inverter running 24 hours all day and night might drain your 12V battery too much.
     
  10. AnalogKid

    AnalogKid

    2,498
    718
    Jun 10, 2015
    Look for solar powered yard lights, path lights, etc. Very low cost, and does exactly what you want. For indoor lighting you would have to disassemble them, mount the solar cell outside, and connect the two with wires.

    ak
     
  11. Al Slitter

    Al Slitter

    41
    0
    Nov 4, 2016
    Thank you everyone for your assistance.
    I think I found an item that will work.
    Here is an image of it:

    Relay.jpg
     
  12. AnalogKid

    AnalogKid

    2,498
    718
    Jun 10, 2015
    Please post a link to the part.

    ak
     
  13. Audioguru

    Audioguru

    3,265
    701
    Sep 24, 2016
    Why are most links to items posted on English language chat forums shown in foreign languages??
    After clicking on the English button and getting the actual product's page but not the Home page like on most other sites, I see that the product is not certified to be safe and it will probably burn down your home. I was wondering why it is not allowed to be shipped to Canada, that must be why.
     
  14. Al Slitter

    Al Slitter

    41
    0
    Nov 4, 2016
    I believe that Canada went through a mail strike and many sites blocked shipments to Canada.
     
  15. Audioguru

    Audioguru

    3,265
    701
    Sep 24, 2016
    The Canadian government ordered the striking mail workers back to work then everybody received their Christmas gifts delivered on time and no cheap Chinese uncertified product blew up waiting in a mail truck.
     
  16. AnalogKid

    AnalogKid

    2,498
    718
    Jun 10, 2015
    ***Probably*** ? ? ? That's an interesting conclusion.

    The only part handling high voltage or current is safety certified in the US, Canada, and Germany. The bottom side layout clearly conforms to UL60950 creepage and clearance distance rules, complete with internal router cuts.

    And on my system, the website came up in English.

    ak
     
    Last edited: Jan 13, 2019
  17. Audioguru

    Audioguru

    3,265
    701
    Sep 24, 2016
    My electrical utility company gave away compact fluorescent light bulbs for free to show people that they use much less power than incandescent. But many of them dripped flaming plastic because the Chinese manufacturer stole the certification label from a safe competitor so that those light bulbs were never certified to be safe. All the bad bulbs were recalled and replaced.

    Less than 10% of Canadians speak only French. To keep them, the government forces many things all across Canada to be bilingual. In Quebec where most of the French people are, everything must be only in French including traffic signs.
    I think Ali-Express thinks I am a French Canadian.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-