Maker Pro
Maker Pro

More efficient LDR "dark" switch?

No worries Hop, enjoy your down time. I would say come back refreshed, but its looking like you will need a vacation upon your arrival - and you have all those goodies waiting to go when you get back, LOL. Pace yourself, please ;-) Who, knows, with any luck and much help from the members here, I might come closer to a solution! Keep cool!!!
 

hevans1944

Hop - AC8NS
I really like the idea of using the two analog comparators that are built-in to the 555 timer, as suggested by @Harald Kapp, to obtain hysteresis. You don't have to use the timer functionality of the 555, and in this case you aren't. The comparator inputs do require some current to function, but the CMOS version is quite small versus the current required by the "standard" 555. It is this minimum current requirement that dictates the maximum value for the timing resistor when the 555 is used as a timer or oscillator. There is a relatively large hysteresis involved here: from 1/3 Vcc to 2/3 Vcc because of the internal divider in the 555. IIRC, you can make this hysteresis smaller by using the control input to set a lower reference voltage for the internal divider.

Is it your intent to turn the load on when the LDR is sufficiently dark? Do you want to minimize the current only when the LDR is dark, or minimize the current all the time? The current will always be higher when the LDR is in brighter light because the LDR resistance will become quite small. So there will be a trade-off in providing enough current to the comparator when the LDR resistance is high (dark) versus providing more than needed when the LDR resistance is low (illuminated). It is a iron-clad fact of physics that you cannot measure resistance without expending energy to do so. A photo-diode or photo-transistor are alternatives that I like, especially a reverse-biased photo-diode, which is linear over at least six decades in its response to illumination... with the right signal conditioning. One advantage of the LDR is it responds over a huge range of intensities, albeit slowly and in a highly non-linear fashion, with hardly any signal conditioning to speak of. Some of the larger area CdS (cadmium sulfide) LDRs will even pass enough current to light up a small LED without burning out when illuminated, but you still need a current-limiting resistor for the LED! Why would anyone even want to do this? Because they can?

Years ago a friend of mine rigged a CdS cell inside a rubber boot (normally used to insulate alligator clips) and placed it over one of the lighted buttons on a desk phone in his office at work. A pair of wires led to a battery and a door-bell in his lab down the hall. When his office phone rang the button lit up, the CdS resistance went down, and the bell in the lab started ringing. He could then rush back to his office to answer the phone. I never did find out why he didn't ask for a phone in the lab. Maybe he just wanted to be able to disconnect the bell to gain a modicum of silence while he worked late into the night.
 
Last edited:
I am sure its just my misunderstanding, but the circuit Harald posted shows a 555 being used for its hysteresis for the LDR to cleanly operate. I need the IC for its timer function, I don't think it can do double duty and I can't use two in this design. The 7556 is a possibility but it doubles the price.

I would like to turn the entire circuit on when its sufficiently dark.

The last thing I came up with is this:

R1 is the LDR - the thought is that when LDR is dark, resistance is high and base current is low, therefore reset pin will be kept high as Q1 will not conduct from collector to emitter.

When LDR (R1) is light, the resistance is low and base will be saturated, bringing reset pin low, turning circuit off.
What do you think? I didn't have a chance to model it yet, but it looked promising!
Otherwise, I will continue to do this:

BangingHeadAgainstWall.gif


upload_2015-6-17_0-42-57.png


All kidding aside, I appreciate everyone's efforts and I realize that this may seem painful to some, but I am not well versed in electronics and have no formal education in such. I may come to your solutions in the end, but I will only learn by searching for myself. Thank you for your understanding!
 

hevans1944

Hop - AC8NS
Modeling is good, I guess, but you can't beat plugging in real components and applying power to see if it works. It's when it doesn't work that I would turn to modeling to perhaps find out why. When a circuit doesn't work, but the SPICE model says it should, what do you do then? You go back to basics: is it wired up the same as the SPICE model? Are the components the same as the SPICE model? Is the power source plugged in? Heh.
 
I am sure its just my misunderstanding, but the circuit Harald posted shows a 555 being used for its hysteresis for the LDR to cleanly operate. I need the IC for its timer function, I don't think it can do double duty and I can't use two in this design. The 7556 is a possibility but it doubles the price.

I would like to turn the entire circuit on when its sufficiently dark.

The last thing I came up with is this:

R1 is the LDR - the thought is that when LDR is dark, resistance is high and base current is low, therefore reset pin will be kept high as Q1 will not conduct from collector to emitter.

When LDR (R1) is light, the resistance is low and base will be saturated, bringing reset pin low, turning circuit off.
What do you think? I didn't have a chance to model it yet, but it looked promising!
Otherwise, I will continue to do this:

BangingHeadAgainstWall.gif


View attachment 20524


All kidding aside, I appreciate everyone's efforts and I realize that this may seem painful to some, but I am not well versed in electronics and have no formal education in such. I may come to your solutions in the end, but I will only learn by searching for myself. Thank you for your understanding!

What circuit would you prefer to use, lets get one of them working. You also learn from good advice, that's why most of us are here. To learn and to help... so don't worry. I still forget to turn the PSU on even now :)
Adam
 
What circuit would you prefer to use, lets get one of them working. You also learn from good advice, that's why most of us are here. To learn and to help... so don't worry. I still forget to turn the PSU on even now :)
Adam
Thanks Adam - I would like to try getting post 23 working, but that was strictly from my brain and certainly no guarantee that it is sound :D:eek::p

As for Colin's circuit:

led-light-gif.20506


I gave it another go:

The only changes were: 100k pot changed to a 500k pot because the first test with 100k didnt work - i.e. no current passing through LED and the 100 ohm resistor and one led were removed for simplicity.

What was observed is that with the LDR in circuit, there is a ~0.9uA change in current passing through the LED. More current when LDR is dark.
 

hevans1944

Hop - AC8NS
What! You removed the 100 ohm current-limiting resistor in series with the LED! <cringe> What if by some miracle the second BC647 (or 2N3904) goes into saturation because you have managed to zap the base of the first transistor with major voltage?

Do this: Remove the 3 V battery. Take the LDR out of the circuit and set it aside for now. Connect the bottom of the 100 kΩ pot to the emitter of the second transistor. Put the 100 Ω resistor back in the circuit with just one LED. Re-connect the 3 V battery. Now rotate the pot from one end of its range to the other and note whether or not the LED lights up. If the LED doesn't light up, or lights only dimly, you are not providing enough base drive to the first transistor. Try reducing the fixed 1 MΩ resistor to 10 kΩ and try again.

There should now be a range of adjustment on the pot that will extinguish the LED or allow it to glow at full brightness. If the LED still doesn't come on, remove the pot and connect the 10 kΩ resistor directly between the base of the first transistor and the positive terminal of the battery. IF the LED still doesn't come on, either the transistors are open or the LED is open (or both!).

Assuming you can adjust the brightness of the LED with just the pot and the 10 kΩ resistor in the circuit, open the circuit between the bottom of the pot and the emitter of the second transistor and re-insert the LDR there. Illuminate the LDR and see if there is a pot setting that will make the LED go out. If there is, cover the LDR and see if that makes the LED come on. If by some lucky happenstance this works, you are done.

It is important to remember that with a Darlington connection, the voltage from the base of the first transistor to the emitter of the second transistor will be two forward-biased diode voltage drops, or about 1.4 volts, to turn the transistor pair on. With a 1 MΩ resistor in series with a 100 kΩ pot, the most voltage you will get on the base of the first transistor with respect to the emitter of the second transistor is about 0.3 volts from a 3 V battery. Placing the LDR in the circuit could make things better if the LDR resistance is high enough, but you are probably then "starving" the Darlington input current.

Let me know how this works out so I don't have to find my LDR and try to duplicate your circuit. Hmmm. Have you thought about doing this with a PIC?:D
 
What! You removed the 100 ohm current-limiting resistor in series with the LED! <cringe> What if by some miracle the second BC647 (or 2N3904) goes into saturation because you have managed to zap the base of the first transistor with major voltage?
I had been doing this since the circuit was not providing much current to the LED, but good point!! New Tagline <<Hop - keeping the lights on, one LED at a time>> ;-)

Do this: Remove the 3 V battery. Take the LDR out of the circuit and set it aside for now. Connect the bottom of the 100 kΩ pot to the emitter of the second transistor. Put the 100 Ω resistor back in the circuit with just one LED. Re-connect the 3 V battery. Now rotate the pot from one end of its range to the other and note whether or not the LED lights up. If the LED doesn't light up, or lights only dimly, you are not providing enough base drive to the first transistor. Try reducing the fixed 1 MΩ resistor to 10 kΩ and try again.

With LDR out and 100k pot - circuit does not work. With 500k pot, it does work and rotates through 23.3uA to 0 with accompanied dimming. This is with a 10k resistor replacing the 1MΩ resistor.
 
It is important to remember that with a Darlington connection, the voltage from the base of the first transistor to the emitter of the second transistor will be two forward-biased diode voltage drops, or about 1.4 volts, to turn the transistor pair on. With a 1 MΩ resistor in series with a 100 kΩ pot, the most voltage you will get on the base of the first transistor with respect to the emitter of the second transistor is about 0.3 volts from a 3 V battery. Placing the LDR in the circuit could make things better if the LDR resistance is high enough, but you are probably then "starving" the Darlington input current.

Wouldn't this indicate that to accomplish what I am trying to do is mathematically impossible with the existing circuit?

With the LDR in, there is no response from the circuit - same current usage with LDR covered or illuminated.
Hmmm. Have you thought about doing this with a PIC?:D

LOL, yes, but I think this is more achievable for me right now.
 

hevans1944

Hop - AC8NS
...
With LDR out and 100k pot - circuit does not work. With 500k pot, it does work and rotates through 23.3uA to 0 with accompanied dimming. This is with a 10k resistor replacing the 1MΩ resistor.
This makes no sense at all.

With the 10 kΩ resistor connected to positive terminal of the battery, the other end of 10 kΩ resistor connected to top of potentiometer, bottom of potentiometer connected to emitter of second transistor and negative terminal of the battery, you should now have a variable voltage divider between the wiper of the potentiometer and the negative terminal of the battery. Temporarily disconnect the connection between the base of the first transistor and the potentiometer wiper. Measure the voltage between the pot wiper and the negative terminal of the battery, It should vary from 0 to approximately 3 V (the battery voltage). Do this using the 100 kΩ pot. Replace the 100 kΩ pot with the 500 kΩ pot and do it again. The results should be approximately the same.

Re-connect the wire between base of first transistor and pot wiper. The LED should light at full brightness (second transistor saturated) when the pot wiper is positioned toward the end connected to the 10 kΩ resistor. The LED should be extinguished (second transistor cut-off) when the pot wiper is positioned toward the end connected to the negative terminal of the battery. This should be true whether you use a 100 kΩ pot or a 500 kΩ pot! The Darlington-connected pair of transistors should have more than enough gain to fully saturate the second transistor when the pot voltage is greater than about 1.2 to 1.4 V. The 10 kΩ resistor limits the forward-biased base-emitter junction current to a safe value when the pot is rotated toward the maximum voltage end.

The 23.3 μA current you measure appears to be way too low. Where is this current measured? Depending on the color of the LED (and hence its forward voltage) the current drawn by the LED could be as little as 10 mA for a 2 V LED forward voltage drop, a 100 Ω current-limiting resistor, and a 3 V battery. If you are using a "coin cell" battery, you probably can get away with using the internal resistance of the battery to limit current through the LED <cringe!> but I can't recommend the practice.

I really do not understand why your results were different using the 500 kΩ versus the 100 kΩ potentiometers. Unfortunately I cannot reproduce your results because I don't have the same components here in Virginia Beach. I will try it out when I get back to Dayton next week. Some things you should check in the meantime: make sure the Darlington connections are correct. It is quite common to have one of the transistors installed backwards. Make sure the transistors are actually working. You should be able to light up your LED by touching just the bottom of the 10 kΩ resistor to the base of each transistor. Disconnect the pot from the circuit so you have just the 10 kΩ resistor, with one end connected to the positive battery terminal, and the other end connected to one of the two bases.

BTW, the PIC10F206 will run just fine from the 3 V battery and has a spiffy two-input comparator you can use to set the "trip point" of the LDR. I will see if I can gin one up for you when I get back to Dayton.:cool:

Hop
 
Temporarily disconnect the connection between the base of the first transistor and the potentiometer wiper. Measure the voltage between the pot wiper and the negative terminal of the battery, It should vary from 0 to approximately 3 V (the battery voltage). Do this using the 100 kΩ pot.

0.4v-1.7v with 100k pot - checked the resistance of the pot and it seems to be fine sweeping from 1.4-ohm to 10k - wierd

0.22mV-2.95v with 500k pot
 

hevans1944

Hop - AC8NS
0.4v-1.7v with 100k pot - checked the resistance of the pot and it seems to be fine sweeping from 1.4-ohm to 10k - wierd

0.22mV-2.95v with 500k pot
Yikes! That 100 kΩ pot is loading the hell out of your 3 V battery. Something wrong there. Is it possible you have the pot wired wrong? As a rheostat instead of as a potentiometer, perhaps? When you say "it seems to be fine sweeping from 1.4-ohm to 10k" what does that mean? It's a 100 kΩ pot. Where does the 10k come into play?
 
Yikes! That 100 kΩ pot is loading the hell out of your 3 V battery. Something wrong there. Is it possible you have the pot wired wrong? As a rheostat instead of as a potentiometer, perhaps? When you say "it seems to be fine sweeping from 1.4-ohm to 10k" what does that mean? It's a 100 kΩ pot. Where does the 10k come into play?
I forgot!! I had swapped the 100k out with a 10k yesterday when I was fiddling with it - sorry about that :oops::eek::D
 
Ok I am getting a bit lost now. Can you just recap where you are now as far as it working, and what resistor values you are using.
Adam
The 1M resistor was replaced with a 10k resistor (brown-black-black-red - I write this to check myself, Adam not you - I am befuddled by a simple analog voltage divider right now! :mad::oops:)

The LDR is in place and the pot is a 104 100k with center tap between LDR and 100k resistor. 100k resistor going to Vcc. Pot shows smooth transition of resistance across spectrum. In circuit, voltage ranges from .124V-.68v while LDR is illuminated. When dark it rises to 2.1 (continues to climb extremely slowly).

led-light-gif.20506
 
With the 10 kΩ resistor connected to positive terminal of the battery, the other end of 10 kΩ resistor connected to top of potentiometer, bottom of potentiometer connected to emitter of second transistor and negative terminal of the battery, you should now have a variable voltage divider between the wiper of the potentiometer and the negative terminal of the battery. Temporarily disconnect the connection between the base of the first transistor and the potentiometer wiper. Measure the voltage between the pot wiper and the negative terminal of the battery, It should vary from 0 to approximately 3 V (the battery voltage). Do this using the 100 kΩ pot. Replace the 100 kΩ pot with the 500 kΩ pot and do it again. The results should be approximately the same.

Ok, repeating these instructions with the LDR removed - I get a correct voltage divider - each pot 100k and 500k give 0-2.9v swings. I must have miswired the first run.
 
Top