Need to make a simple photo detector switch

Thread Starter

JohnMontgomery

Joined Jan 11, 2012
9
We have a little strobe device that flashes an LED using a 555. That part is workign fine.

But, I need to add a little photo switch that will stop the 555 (or the whole unit) from working in the dark since it then is a safety hazard (flashing gets people disoriented). I thought this would be pretty simply - just interrupt the source to the 555 - either pin 4 or 8. But then all the circuits I've seen seem to have op amps, etc., and maybe this is more complicated than i am thinking.

My thought was to have the +9V source thru a resistor to the photodiode (other photodiode leg to gnd), and simply tap off between the diode & resistor to pin 4.

Not good enuf?
 

crutschow

Joined Mar 14, 2008
34,285
The Reset input requires up to 1mA to ground to inhibit the 555 so you will likely have to add a small NPN transistor (such as a 2N2222) to amplify the photodiode signal. Since the transistor would provide an inversion you would bias the transistor base with a resistor to +9V and the photodiode from the base to ground. The transistor collector is connected to the Reset input. With that connection the photodiode turns off in the dark which biases the transistor "on" and holds the Reset input low.
 

tracecom

Joined Apr 16, 2010
3,944
You could also use an LDR in a voltage divider biasing the 2N2222, which was controlling the 555 reset pin. LDR's may be a bit slower to respond than photodiodes, however.
 
Last edited:

Thread Starter

JohnMontgomery

Joined Jan 11, 2012
9
I've been redirected a bit --- they are changing the strobe circuit to a cmos gate based design. So .... what i think i need to do now is enable/disable the voltage to Vdd (pin 14) of the IC.

I've found a circuit and laid it down as a starting point - though it seems maybe a lot of overkill to me. My biggest concern is the relay controlling the voltage to pin 14 - expensive and maybe not necessary?

Can I run the output of the optics module right into pin 14 --- or would that draw too much current? The cmos is driving the gate of a mosfet which supplies power to the strobe.

My starting point circuit is attached
 

Attachments

tracecom

Joined Apr 16, 2010
3,944
I've been redirected a bit --- they are changing the strobe circuit to a cmos gate based design. So .... what i think i need to do now is enable/disable the voltage to Vdd (pin 14) of the IC.

I've found a circuit and laid it down as a starting point - though it seems maybe a lot of overkill to me. My biggest concern is the relay controlling the voltage to pin 14 - expensive and maybe not necessary?

Can I run the output of the optics module right into pin 14 --- or would that draw too much current? The cmos is driving the gate of a mosfet which supplies power to the strobe.

My starting point circuit is attached
I'm no expert, but your circuit seems pretty complex to me. There should be something simpler that would work. All you want to do is disable the strobe when the room is dark, right? You should be able to do that with less than five transistors and a relay.

I don't see how the 4011 could draw more than 40mA max, and that's if all four outputs are fully loaded. It might be that you could actually use one of the gates on the 4011 if they're not all being used. Can you post the rest of the schematic?
 

Thread Starter

JohnMontgomery

Joined Jan 11, 2012
9
Hi Trace

The other 4 gates are being used - the engineer has it as a timer with gates feeding each other. I'm not all that familiar with it, but I know the 4011 is off base to me except for pin 14, which they want me to activate or not if daytime or not.

Think I could just use the output of the first transistor?
 

tracecom

Joined Apr 16, 2010
3,944
John,

Here is what I would try.

http://www.technologystudent.com/elec1/opamp3.htm

(It's the light activated alerter.)

Even though it shows a 9V power, it will work fine on 12V. I think you can just connect the power pin of the CD4011 to the emitter of the 2n2222, and connect the grounds together. When the lights are on, the CD4011 will have power.

Maybe some of the forum members here with more expertise will share an opinion.
 
Last edited:

Thread Starter

JohnMontgomery

Joined Jan 11, 2012
9
Thanks, Trace! Looks a lot less complicated.

Could you please take a look at the attached layout. I don't know if this should be an NPN or PNP phototransistor - I picked an NPN for no good reason. I'm also not sure if the resistor values are correct for the 12V supply voltage ....

John
 

Attachments

tracecom

Joined Apr 16, 2010
3,944
The first thing is that your schematic shows a phototransistor, but the example I posted uses a LCR (light controlled resistor). They are not interchangeable. If you are going to use a phototransistor, you need a different circuit.

In addition, I would definitely not connect pin 8 to ground. The datasheet says NC and I would not connect anything to it, although it may not matter. As far as connecting the offset null pins 1 and 5 to ground, I don't know about that. Did you just do that or did some document say that was to be done? I would have left them unconnected.
 
Last edited:

Thread Starter

JohnMontgomery

Joined Jan 11, 2012
9
Here is a revised layout. Pins 1,5 & 8 are now free floating. Also, the variable resistor is broken up into a 50K fixed (below the junction) and a 50k trim (above) .... that OK? Still don't know if the resistor values are correct for the higher input voltage (12V vs 9V in the example). Also - the LCR light/dark resistances seem to vary all over the map depending on which one you select. Are these values still correct for the one i picked (NSL-06S53)? Sorry if these are all dumb questions ...
 

Attachments

tracecom

Joined Apr 16, 2010
3,944
The resistance of the NSL-06S53 should be 20M or more when it's dark, and 100k or less when it's light. Remove it from the circuit, and measure the resistance in the dark and in the light and post the results.

Remove R7. Wire the wiper of R8 to pin 2. Wire one side of R8 to +12V. Wire the other side of R8 to ground.

The whole idea is that you have two voltage dividers. One is composed of the LDR and the fixed resistor (R6) and the other is composed of R8 alone. When the voltage on pin 2 is appreciably higher than the voltage on pin 3, pin 6 goes low. You use R6 to adjust the voltage on pin 2 so that it is appreciably higher than pin 3 when the LDR is dark.
 
Last edited:

tracecom

Joined Apr 16, 2010
3,944
John,

I decided to breadboard this, and now have it working as expected. I don't actually have an LDR, so I am having to simulate one with a pot, but the results should be repeatable with a real LDR.

Are you actually breadboarding, and if so, how is it working?
 
Last edited:

Thread Starter

JohnMontgomery

Joined Jan 11, 2012
9
Hi again Trace.

Nothing to do tonight so i spent a little time reading up on LCRs and op amps used as a comparator.

Think I understand how to set the resistance values - is this correct:

The LCR has a dark resistance of 20Mohm and resistance in light of between 20 & 100 Kohm. For the comparator to function as you suggest, I need the threshold voltage somewhere between the light & dark resistance of the LCR - say, for example, 200Kohm.

Is that correct?
 

tracecom

Joined Apr 16, 2010
3,944
Hi again Trace.

Nothing to do tonight so i spent a little time reading up on LCRs and op amps used as a comparator.

Think I understand how to set the resistance values - is this correct:

The LCR has a dark resistance of 20Mohm and resistance in light of between 20 & 100 Kohm. For the comparator to function as you suggest, I need the threshold voltage somewhere between the light & dark resistance of the LCR - say, for example, 200Kohm.

Is that correct?
It is more correct to think in terms of voltage rather than resistance. The actual resistance of the pot doesn't really matter; what matters is the resulting voltage at the wiper. For example, a 5k pot would work just as well as the 50k you show in your schematic; in fact, essentially any pot would work because it's just a voltage divider.

Is your circuit built and working as you wanted?
 

Thread Starter

JohnMontgomery

Joined Jan 11, 2012
9
Hi again Tace

I want to first thank you so much (!!!) for your help and time and encouragement. Really, really appreciate it!

Didn't realize there was a 'second page' to these comments and so only now saw the last several of your posts.

Won't have the parts in hand to breadboard for a few days - will get right on it.

Think I understand what you are saying about the voltages presented to pins 2 vs 3 in the comparator. I was thinking of the trimmer as a potentiometer, not using the 3rd leg, but instead using it to adjust the resistance above the comp. input versus the fixed resistance below it. I guess just using the trimmer by itself - to at once change the 'above' and 'below' resistances - and thus the voltage at the pin - does the same and is a lot simpler. I guess I don't need very much accuracy at all since the LCR has such a huge swing in light vs. dark resistance. Is that right?

Anyway - will get right back to you as soon as I get parts assembled. And, again, Trace, THANK YOU!

John
 

tracecom

Joined Apr 16, 2010
3,944
Hi again Tace

I want to first thank you so much (!!!) for your help and time and encouragement. Really, really appreciate it!

Didn't realize there was a 'second page' to these comments and so only now saw the last several of your posts.

Won't have the parts in hand to breadboard for a few days - will get right on it.

Think I understand what you are saying about the voltages presented to pins 2 vs 3 in the comparator. I was thinking of the trimmer as a potentiometer, not using the 3rd leg, but instead using it to adjust the resistance above the comp. input versus the fixed resistance below it. I guess just using the trimmer by itself - to at once change the 'above' and 'below' resistances - and thus the voltage at the pin - does the same and is a lot simpler. I guess I don't need very much accuracy at all since the LCR has such a huge swing in light vs. dark resistance. Is that right?

Anyway - will get right back to you as soon as I get parts assembled. And, again, Trace, THANK YOU!

John
You are welcome, and you are correct in what you say above.

I have breadboarded the circuit and a photo is attached. As you can see, the wiper of the pot is connected through the yellow wire to pin 2 of the LM741, and the junction of the LDR and the fixed resistor is connected to pin 3.

Notice that I am using a fixed resistor of only 2.2k; a 100k worked, but in order to have the pot near the center of its range, I changed the 100k to the 2.2k. Depending upon the exact lighting you have available and the LDR you use, you may have to select a different resistor value, but as you already know, the value is not critical.

Also notice that I have a resistor and a yellow LED connected between output pin 6 of the op-amp and ground. That is just an easy way to see whether pin 6 is high or low. The red LED just shows that I have power to the breadboard.

The 100k resistor from pin 6 to pin 3 is a feedback resistor to keep the op-amp from "jittering" when the light is very close to the setpoint. You probably won't need it.

I think that the output from the op-amp will be sufficient to power the CD4011, but if not, a resistor and an NPN BJT can be added to do the job.

Good luck.

ETA: The black wire from ground to row 24 is left over from another circuit and serves no purpose here.
 

Attachments

Thread Starter

JohnMontgomery

Joined Jan 11, 2012
9
Geesh! THANKS, Trace! Can't believe you did all you have done to help!

Got all your suggestions - the photo helped - and will let you know as soon as I have my own breadboard done.

John
 

Thread Starter

JohnMontgomery

Joined Jan 11, 2012
9
My breadboard (copied exactly from yours) WORKS!

THANKS, Trace! Gonna now solder together a hard version and see if they approve. Can't thank you enough!

as a ps: I got a functional diagram of the flasher circuit (uses a CD4011), and thought it might be a good chance to learn how to use Spice (since i have no idea how or why the flasher works). Got the basic layout done and figured out how to load the library, but have not yet gotten a simulation to run even on a simple single NAND gate. You don't happen, by any chance, know how Spice works, do you?
 

crutschow

Joined Mar 14, 2008
34,285
..............
as a ps: I got a functional diagram of the flasher circuit (uses a CD4011), and thought it might be a good chance to learn how to use Spice (since i have no idea how or why the flasher works). Got the basic layout done and figured out how to load the library, but have not yet gotten a simulation to run even on a simple single NAND gate. You don't happen, by any chance, know how Spice works, do you?
Spice is a general analog circuit simulation program that uses matrix-type iterative mathematical calculations to determine the voltages at all the circuit nodes at any instant in time. Hundreds of these calculations are performed to show the dynamic circuit response over a time period. This, of course, would take days/weeks/months to do by hand, but a computer can do it in a few seconds.

Sometimes these equations blow up (fail to converge) due to difficulties in calculating a voltage value and you may need to vary some of the simulation parameters to help it reach a solution.

What Spice program are you using? Many on this forum use the free program from Linear Technology, LTspice.

What type of errors do you get? Post the circuit and simulation file, if you can.
 

tracecom

Joined Apr 16, 2010
3,944
My breadboard (copied exactly from yours) WORKS!

THANKS, Trace! Gonna now solder together a hard version and see if they approve. Can't thank you enough!

as a ps: I got a functional diagram of the flasher circuit (uses a CD4011), and thought it might be a good chance to learn how to use Spice (since i have no idea how or why the flasher works). Got the basic layout done and figured out how to load the library, but have not yet gotten a simulation to run even on a simple single NAND gate. You don't happen, by any chance, know how Spice works, do you?
Good for you, but no, I don't know how to use a simulator of any kind. That's why I breadboard everything before I build it.
 
Top