Ron - I have your circuit printed and ready. After wrestling practice tonight it is on like Donkey Kong!!!!!!@Coach - Any comments on post 118?
I was afraid you had missed it.Ron - I have your circuit printed and ready. After wrestling practice tonight it is on like Donkey Kong!!!!!!
I come bringing news ... but not good news! I changed my circuit per your hysteresis circuit and this is what I saw:Here is a circuit I would like you to try. It has hysteresis, which causes the comparator to ignore non-monotonic changes in resistance when the LDR goes from light to dark and vice-versa, up to a point. If the fluctuations are too large, the circuit will still put out spurious pulses during light transitions.
In the attached circuit, when the LDR is illuminated, the voltage Vldr will be somewhere between 2.8V and 5.4V, depending on the amount of illumination (this is using your 300k and 800k measurements). The threshold at this time will be Vth(hi)=8.9V, because the comparator output is high.
When the LDR goes dark, Vldr=10V. This is considerably above Vth(hi), so the comparator output will go low, causing the threshold voltage to change to Vth(lo)=6.5V. When the LDR is next illuminated, the voltage will have to go below 6.5V before the output can again go high, which, of course, makes the threshold go back to 8.9V.
Another way of looking at it:
When the LDR resistance starts low and is rising, the comparator will switch when Vldr=Vth(hi). This will happen when the LDR resistance rises to about 2.9Meg.
When the LDR resistance starts high and is falling, the comparator will switch when Vldr=Vth(lo). This will happen when the LDR resistance falls to about 1.2Meg.
Therefore, variations in LDR resistance between 1.2Meg and 2.9Meg, up or down, will cause no change in the comparator output. Without hysteresis, changes in LDR resistance which cause the LDR voltage to cross the threshold multiple times during light transitions will cause spurious clock transitions.
If you use multiple LDRs and comparators, you will need a separate reference divider (R2, R3, R6) for each comparator, due to the feedback.
I have to say that I am not comfortable running the LDR at such low illumination levels. I seem to recall that it takes a long time for the LDR resistance to reach its final value, and I am concerned about consistency between units. You might need selected resistors R2, R3, and R6 for each comparator.
Let's play a game of pretend.Are you sure you didn't get the 339 input pins swapped?
Glad that worked out OK for you!With your circuit, even though the 555 isn't needed for bounce now, could I still use it for a timed siren response? If I can and I have it set for say 3 seconds, would the counter still record counts if the kids blocked the laser during the siren?
Excellent!Let's play a game of pretend.
Let's pretend I just read your question about swapping pins.
And then let's pretend I was like "D'oh, forgot to even look at that, I was just changing/adding resistors - double checking locations!"
So, since we are pretending, let's say I went and switched the input pins and tested the circuit again.
I am not saying that is what happened, BUT if it did happen that way - I would come back and report your hystersis circuit is GOLD BABY, PURE GOLD!
THANK YOU!!!!!!
With your circuit, even though the 555 isn't needed for bounce now, could I still use it for a timed siren response? If I can and I have it set for say 3 seconds, would the counter still record counts if the kids blocked the laser during the siren?
OK Ron, I am not saying this is as good as that guy on the news that paid $1100 for a storage unit and scored 500K in coins and gold, but let me tell you, it is really coming together.Excellent!
I have another suggestion for the siren: If the laser is blocked for longer than the siren timeout, the siren will sound until the laser is unblocked. This is because you have (I assume) the 339 connected directly to pin 2 on the 555.
If you want to limit the siren to the RC timeout value, do it as in the attachment. This differentiates the trigger, so it will be gone long before the 555 times out.
NOTE THAT R1 HAS BEEN CHANGED TO 2.7K.
This is to minimize the effect of loading by the 555 circuit.
Keep in mind that, in this circuit, the counter only advances when the LDR makes a transition from below 1.2Megs to above 2.9Megs. This is because the counter advances on negative TRANSITIONS (remember that the comparator inverts). If the laser is interrupted, and the counter advances, she could walk the entire length of the beam, keeping it blocked, and the counter would never trigger again. You should really have an LED monitoring the clock input (maybe you do?), to see if it is remaining low after the transition.When the LDR resistance starts low and is rising, the comparator will switch when Vldr=Vth(hi). This will happen when the LDR resistance rises to about 2.9Meg.
When the LDR resistance starts high and is falling, the comparator will switch when Vldr=Vth(lo). This will happen when the LDR resistance falls to about 1.2Meg.
Funny you should mention the option of blocking and walking through! She tried to do her best Jedi light blocking moves to do that exact thing! That feature if actually ok - on several different levels. First, it would be obvious if someone was trying to be a cheater to do that on a regular round. Second, if the kids get too good at the regular course, I can switch it up and MAKE them try to get through by blocking the lasers!Going back to what I said in post 118: Keep in mind that, in this circuit, the counter only advances when the LDR makes a transition from below 1.2Megs to above 2.9Megs. This is because the counter advances on negative TRANSITIONS (remember that the comparator inverts). If the laser is interrupted, and the counter advances, she could walk the entire length of the beam, keeping it blocked, and the counter would never trigger again. You should really have an LED monitoring the clock input (maybe you do?), to see if it is remaining low after the transition.
Honestly, this is NOT a huge problem. After some more thought, it may even be caused a bit by the fact I am still using 1 laser for the entire course. In the final version, each laser will be stronger, where now after the first 4, the rest start dimming (maybe dirty mirrors as well). I would hate to have you spend more time on a more complicated circuit when you have helped so much on this and it working. I will look into the option you mentioned and see what happens. Make no mistake, I am not going to far from what I have now - I don't want to screw something up!You can play around with the hysteresis by changing R6 to a 100k resistor in series with a 1Meg pot, but you won't be able to change the actual mean threshold voltage (the average of the upper and lower thresholds). We could probably design a more sophisticated circuit which has independent control of threshold "center" voltage and hysteresis, but it would require more parts, and some more design work.
Holy out of my league Batman! That would be very cool, but remember, I am a NOOB!!!!!Could always make different/"cheater" alarm go off if the output of the 339 was held low for over 5 seconds and add 100-ish to the score. (Add another 555...)
Hmmm .... I may be able to do that ... Thanks for the link!Also, that scope is now $40, in case you were making a Christmas list, there's a new link.
Again - some of this sounds WAY over my head!!!!! I really think I can make the current one work. You guys that KNOW what you are doing can make REALLY cool stuff! Lucky dogs!--ETA: While I am editing, move some things over from anti-tamper burglar alarms. Something like a spinning disc in front of the laser emitter that has a couple slots, 180 degrees apart. The motor would spin fast enough that the beam would look solid, but it would be a train of pulses. Then add in a missing pulse detector between your comparators and counter (yeah, another 555 project), but it would prevent somebody from standing still and blocking it. When the pulse stream stops, alarm goes off as long as beam is blocked or 5 seconds, whichever is less.
FIRST, I guess we can get this one going, and you can add the other stuff later, after Santa Arrives. Without a scope, you wouldn't be able to tell if the LDR is reacting fast enough for the pulses, and would have to ... ahem.. start over, with phototransistors.
ETA2: On second thought, you wouldn't need to change much at all. Just change the alarm timer to continually go off (re-trigger) as long as the light is blocked.