How do I know when my zero crossing detector stops working? - Page 1
Forum section: electronics / beginners

author: interceptor
author_rank: Newbie
timestamp: September 11, 2024, 05:19:52 am
content: Sorry for the subject title, I really don't know how else to phrase the question.This one is a little difficult to explain, so please bear with me...So, I had a weird Idea and I wanted to try it out, but there is a slight glitch that I don't know how to solve...The basic idea is to create a low AC voltage alarm, but without using the typical R/LC filter. Meaning, I would need to analyze the sinusoidal waveform directly.The first thing I do is push the sine wave through a full wave bridge rectifier so I can look at the peaks and troughs at the same time/level.I then use a zero cross detector (H11AA1) to trigger a pair of 555's to create a pulse at the peak of the wave.This creates a "window" of the wave that defines the portion of the wave that I am interested in. Everything outside of this pulse should be ignored (I am only interested in the peaks).After that, I add a voltage reference (LM317) for use with a comparator (LM339) that represents the low voltage threshold.I attached the non-inverting pin to the voltage reference and the inverting pin to the rectified signal so that the comparator's output would go high when the signal is below the threshold.Finally, I use a logic AND gate, connected to the comparator's output and the 555's output so that the output of the AND gate only goes high if the peak of the signal is below the threshold AND it is during the pulse of the 555.This works really well until I turn off the AC signal source. The problem is, without the signal source, I lose the zero cross detector, which means I lose the pulse from the 555 timer, which means my AND gate remains low.It's not a very good low voltage alarm if no voltage is not included in the alarm...I thought maybe I could use a NOR gate and invert the input pins, but the result is the same. The output of the 555 remains high when the signal is removed, but the NOR gate needs both inputs to be low.The only other thing I can think of is to invert the output of the AND gate (or use the NOR gate) and power the circuit off of the rectified AC source, because if everything shuts off, then the alarm can't possibly high. But the whole point of this idea was to eliminate the delays caused by ripple rejection which I would then need to power the circuit.Does anyone have any ideas how to solve this rather contrived problem?Also, if you made it through all of that, thanks...

author: Andy Chee
author_rank: Super Contributor
timestamp: September 11, 2024, 05:34:29 am
content: Can you post I schematic? If the problem is what I think it is, then;I believe you might be analysing the waveform and powering your circuitry after the diode bridge. What you need to do is actually analyse the waveform before the bridge. That way you can include some beefy capacitors after the bridge to keep your circuit powered up temporarily, so it has enough time to detect AC loss before the bridge, and perform an orderly shutdown or whatever.

author: rteodor
author_rank: Frequent Contributor
timestamp: September 11, 2024, 06:22:51 am
content: So the problem is at its basis that you loose the mains triggerbase ?I could not quite understand how you use those timers ? Do you use the first one to measure time from ZC to start of the testing time gate ? And the second one to determine the length of the testing gate ?If that is the case then I would look to use first 555 to oscillate with the test gating waveform and use a second 555 to sync the first timer to the mains ZCD.Not exactly sure how to do the sync in practice but I think it can be done.

author: interceptor
author_rank: Newbie
timestamp: September 11, 2024, 07:09:55 am
content: Quote from: Andy Chee on September 11, 2024, 05:34:29 amSorry, this is just a jumbled mess on a bread board and I don't have a schematic for it at the moment.But, the circuit is powered from of a 5 volt regulator that is completely independent from the AC signal.Quote from: rteodor on September 11, 2024, 06:22:51 amThe 555's are setup as monostable one shot timers. The zero cross happens before the peak, so I needed to delay the pulse. So, the first timer is triggered off the zero cross detector and creates a delay. The output of the first 555 triggers the second 555 which creates the pulse.I think you are right though, if the zero crossing was independent of the AC signal, the peak pulses would also occur even when the signal was gone. I'm not sure how to do that either. You would have to create a pulse at the right frequency, which is easy enough, but I would also need some way to re-sync it periodically as well...

author: Phil1977
author_rank: Frequent Contributor
timestamp: September 11, 2024, 07:26:12 am
content: The best way would be to combine two alarms: E.g. One for RMS < 210V and then your peak detector.Why do you want to check a minimum peak voltage? I´d understand why to check for a min RMS voltage together with a max peak voltage - but what application relies on a min peak voltage? Just out of curiosity...

author: rteodor
author_rank: Frequent Contributor
timestamp: September 11, 2024, 08:15:19 am
content: Quote from: interceptor on September 11, 2024, 07:09:55 amI think sync can be done by using nRESET pin of the astable timer.

author: PGPG
author_rank: Frequent Contributor
timestamp: September 11, 2024, 10:57:43 am
content: Quote from: interceptor on September 11, 2024, 05:19:52 amWhen you describe your solution it looks like you want to find even one half-sine pulse that has to small amplitude but you didn't said you really want it.If you want only to find when AC is too low (not one pulse, but all of them) then why you just don't use peak detector?

author: interceptor
author_rank: Newbie
timestamp: September 11, 2024, 04:23:23 pm
content: Quote from: Phil1977 on September 11, 2024, 07:26:12 amQuote from: PGPG on September 11, 2024, 10:57:43 amUsing RMS or a typical peak detector is rather slow. Checking each peak and trough, I know the voltage is low in at most one half the period of the wave. Odds are, the voltage will go low in between peaks, so it would be faster than half a period in most circumstances. Of course, one low peak doesn't mean the next one won't be back to normal, but that is not a problem.Quote from: rteodor on September 11, 2024, 08:15:19 amThat might work (it might be tricky with the delay that is happening, but worth a try). If not, I think I could use the reset pin as a way of timing zero crosses. So if the time between zero crossing is too high the timer would be allowed to trigger.

author: PGPG
author_rank: Frequent Contributor
timestamp: September 11, 2024, 05:20:22 pm
content: Quote from: interceptor on September 11, 2024, 04:23:23 pmImagine peak detector D+RC with such values that between peaks voltage at RC drops to 1/2 of peak and you have comparator set to little lower. It can very fast detect AC voltage drop.If the voltage will be lower but at the same time frequency made 2 times higher this method will fail but I think you not assume frequency changes.

author: interceptor
author_rank: Newbie
timestamp: September 11, 2024, 07:10:08 pm
content: Quote from: PGPG on September 11, 2024, 05:20:22 pmYes, I think I see what you are saying. In stead of using the the RC filter to remove the ripple, I could keep the peaks and just remove the part that goes to zero. Then if the bottom portion of my wave drops below the threshold, then I know there was a voltage dip. And since that bottom portion of the wave has the same frequency as the peak, the detection time should be very similar.I like it, but figuring out the formula to calculate the value of the low point would take me a while though...

author: PGPG
author_rank: Frequent Contributor
timestamp: September 11, 2024, 11:14:53 pm
content: You can also compare your original signal with the DC level just under the peaks getting pulses for each peak.Then these pulses can reset time delay flip-flop. Time constant set to little more then time between pulses. One peak to low and there will be no reset and flip flop changes state.I'm just looking for as simple solution as possible.

author: ledtester
author_rank: Super Contributor
timestamp: September 11, 2024, 11:31:54 pm
content: Quote from: interceptor on September 11, 2024, 07:10:08 pmIf you had a variac you could determine the voltage level experimentally.

author: interceptor
author_rank: Newbie
timestamp: September 12, 2024, 06:29:19 am
content: Quote from: PGPG on September 11, 2024, 11:14:53 pmI don't understand what you mean with the flip flop.I did test it though, and as long as the threshold is really close to the bottom of the waveform, it is just as fast I could hope for.Interestingly though, when the threshold is a fair bit below the bottom of the waveform, it is quite slow.At a 6.4v threshold, I was seeing average times of just 30% of the period with a max time of 50% of the period.On the other hand, at a 4.5v threshold, I was seeing average times of 78% of the period with a max time of 100% of the period, which is a little slower than what I was hoping for.I'm still working on the math, but this formula seems really close for calculating the ripple:$$V_{ripple(pp)}=\frac{V_{in} / R_{l}}{f * c}$$To calculate the set point for the threshold, I think this works:$$V_{thresh}=V_{desired Threshold}*\sqrt{2} - V_{ripple(pp)}$$I'm not convinced this is correct, so I will need to do some more testing...Quote from: ledtester on September 11, 2024, 11:31:54 pmYeah, it is on my wish list along with a function generator.For now, I found a sine wave generator I can build using a LM741 op amp which should do for now.

author: PGPG
author_rank: Frequent Contributor
timestamp: September 12, 2024, 09:33:45 am
content: Quote from: interceptor on September 12, 2024, 06:29:19 amThe problem is that I don't know how perfectly name it in English. I think any device that changes state (and remembers it) between two states can be named flip flop.Do RS flip-flop, D flip-flop, JK flip-flop are wrong names? They not just change their state to opposite but do it conditionally.So time delay with possibility of time being reset (starts be measured from beginning) before that time was finished I just called time delay flip flop.It is not important haw it is named.Comparing peaks with DC value just gives you pulses when voltage is enough high and no pulses when it is too low.How you change these information (pulses present / pulses absent) into 0/1 and how you name something doing it is less important.Quote from: interceptor on September 12, 2024, 06:29:19 amWhen you discharge capacitor with R discharging is being slower and slower. You can make it faster if you will be discharging capacitor not by R but by current source.

author: interceptor
author_rank: Newbie
timestamp: September 12, 2024, 06:35:35 pm
content: Quote from: PGPG on September 12, 2024, 09:33:45 amSorry. The name is correct, I just didn't understand how I would use it, but your additional explanation makes that clear. That would be a simpler solution, thanks.Quote from: PGPG on September 12, 2024, 09:33:45 amThis makes sense too, thanks. I will experiment with this as well.

author: xvr
author_rank: Frequent Contributor
timestamp: September 12, 2024, 06:55:23 pm
content: QuoteYou need here not trigger, but Retriggerable Monostable Multivibrator like SN74LVC1G123.Its timing RC network should be set to slightly more than 10ms (period of AC after diode bridge).Input should be feed from comparator with threshold set near desired high voltage of AC (after transformer and diode bridge, of cause)

author: MathWizard
author_rank: Super Contributor
timestamp: September 12, 2024, 10:09:47 pm
content: Another easy way to get to get some pulses just above or below 0V or about a Vbe drop anyways, is like this circuit. It works with a center-tapped transformer. For a single winding, I'd try a NPN and PNP, they could be made to do the same (maybe add something extra to get 2 positive pulses or which ever you want or either phase with any trans.).But yeah if there's no AC, that won't help but anyways, I like that circuit. But if there's another voltage source, then some logic gates/etc should sense the lack of higher voltages.