Faulty zero crossing detection
Faulty zero crossing detection
(OP)
Hello,
below is my circuit for zero cross detection at 110VAC.
My pcb has 2 of these and they are connected to 2 independent AC sources.

I get a lot of faulty zero crossing events from the interrupt of the Arduino.
Below is the sampled input for 100ms.
At 19ms there is the problem. Vertical axis is 12bit ADC, horizontal time in ms.

It's a very simple circuit and I don't know why these values are not up to 4095 and down to 0:
12 168 178
13 177 189
14 218 245
15 4011 4060
16 4076 4075
17 4079 4079
19 4067 4080
20 4081 4083
21 4080 4082
22 4081 4081
23 4082 4081
24 1169 237
25 202 185
26 170 170
27 165 177
28 170 174
Any suggestions what might be the problem? Markus
below is my circuit for zero cross detection at 110VAC.
My pcb has 2 of these and they are connected to 2 independent AC sources.

I get a lot of faulty zero crossing events from the interrupt of the Arduino.
Below is the sampled input for 100ms.
At 19ms there is the problem. Vertical axis is 12bit ADC, horizontal time in ms.

It's a very simple circuit and I don't know why these values are not up to 4095 and down to 0:
12 168 178
13 177 189
14 218 245
15 4011 4060
16 4076 4075
17 4079 4079
19 4067 4080
20 4081 4083
21 4080 4082
22 4081 4081
23 4082 4081
24 1169 237
25 202 185
26 170 170
27 165 177
28 170 174
Any suggestions what might be the problem? Markus





RE: Faulty zero crossing detection
Maybe try them with clean commercial AC to see if they work better.
RE: Faulty zero crossing detection
blue = utility power
red = inverter
RE: Faulty zero crossing detection
Could be you are violating the A2D set-up times on your readings. You don't make it clear but I am
supposing that the graph above is via your Arduino. If so, can you look at it with a stand-alone
scope to confirm where the issue is?
Keith Cress
kcress - http://www.flaminsystems.com
RE: Faulty zero crossing detection
Dan - Owner
http://www.Hi-TecDesigns.com
RE: Faulty zero crossing detection
void record() { unsigned long ms = millis(); for(int i =0 ; i < MAX_RECORD; i++) { inT[i] = millis() - ms; inA[i] = analogRead(cityACPin); inB[i] = analogRead(inverterACPin); inV[i] = analogRead(battVPin); delay(1); } }I assume the signal is a real sine wave but I cannot measure all at the same time.
If the circuit is correct then I don't know what the problem is. Maybe the supply voltage?
RE: Faulty zero crossing detection
re you sure that you are not just counting the cycles of the 110 Volts, AC?
Bill
--------------------
"Why not the best?"
Jimmy Carter
RE: Faulty zero crossing detection
Scope it and save yourself a shred of sanity.
Dan - Owner
http://www.Hi-TecDesigns.com
RE: Faulty zero crossing detection
Many diode-based circuits are based on full-wave rectification, rather than half-wave. This makes the zero crossing time window much clearer, and the actual zero-crossing can be more accurately inferred. An alternate solution is http://www.circuitstoday.com/zero-crossing-detecto... which is op-amp based. While there are diodes in the circuit, their purpose is clamping, rather than rectification. There are a bunch of circuits here: http://sound.westhost.com/appnotes/an005.htm
TTFN
I can do absolutely anything. I'm an expert!
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers
RE: Faulty zero crossing detection
RE: Faulty zero crossing detection
I don't own a scope but I think I can build one with another arduino.
I am not sure I understand the question "re you sure that you are not just counting the cycles of the 110 Volts, AC?"
@MacGyverS2000:
@BrianE22:
Will try to scope them as mentioned above. I also ordered fresh parts from Mouser to make a 'clean' detector on a breadboard with the same configuration as on the PCB.
@IRstuff:
I am trying to detect 2 things:
1) is there an AC signal on one or on both of my inputs
2) are the 2 AC signals in sync
The PC817 is half wave so the detection should be easy.
RE: Faulty zero crossing detection
TTFN
I can do absolutely anything. I'm an expert!
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers
RE: Faulty zero crossing detection
Keith Cress
kcress - http://www.flaminsystems.com
RE: Faulty zero crossing detection
Bill
--------------------
"Why not the best?"
Jimmy Carter
RE: Faulty zero crossing detection
Besides that I got the fresh parts and did setup a testbed on a breadboard and was playing with the resistors. First playing with the input side:
and the with the pullup on the output side:
What I notice is that beginning with 4.7k I am no longer getting a straight line at the top. If that is all then it would be a cheap fix,
RE: Faulty zero crossing detection
electronic device. Their gain can be range over hundreds of percent between devices.
You can dial in the resistor(s) for one and have those same resistors be completely
wrong for the next.
Often there are 'screened bins' of devices that are measured and put in lots.
Depending on what you need it may behoove you to pay the extra to get screened
parts that are all more closely matched.
Keith Cress
kcress - http://www.flaminsystems.com
RE: Faulty zero crossing detection
RE: Faulty zero crossing detection
Notice the two columns "Current Transfer Ratio"?
Min and Max?
(compare at the same 1mA)
Notice how some part numbers have a minimum of 20%
and a maximum of 300%. Those can freak your resistor
values. You often want to spec a part that has the narrowest range.
That's just an example parts, that of course, DKY has no stock of
but it demonstrates my point.
Keith Cress
kcress - http://www.flaminsystems.com
RE: Faulty zero crossing detection
Dan - Owner
http://www.Hi-TecDesigns.com
RE: Faulty zero crossing detection
them instead of other choices.
Keith Cress
kcress - http://www.flaminsystems.com
RE: Faulty zero crossing detection
which can be opaque to some lots, and transparent to the next lot of the same part number.
I long ago took to using metal flags, or metal foil overlays on the flags.
Mike Halloran
Pembroke Pines, FL, USA
RE: Faulty zero crossing detection
http://solar-trap.com/wp-content/uploads/2016/03/MZFT5156.mov
RE: Faulty zero crossing detection
Are you not triggering off 60 Hz from the 110 VAC in the video as you are showing sub-Hertz events?
Are you holding something in your hand? Is that the 'white cable' you refer to?
Does this stop if the laptop is running on battery?
You might want to buy this and read Chapter 10:
http://www.emiguru.com/index.php?option=com_conten...
I still have an original copy from 1994. It's handy!
Z
RE: Faulty zero crossing detection
I finally got the scope functional! In the new video below I have the serial printout under the scope. The waves in the scope look perfectly fine and I have no explanation why I am getting irregular interrupts. There are 2 waves visible in the scope, the lower is 'city' the upper 'inverter'
Video
here are some values from the serial printout in the video. the first column shows the ms delay between 2 irregular interrupts printouts and the last column is the time measured between two interrupts in the ISR:
3460 city 7
6 city 7
6 city 10
7 city 10
this means:
3460ms nothing irregular happening, then an irregular interrupt within 7ms,
then 6 ms nothing happening, then an irregular interrupt within 7ms
then 6 ms nothing happening, then an irregular interrupt within 10ms
then 7 ms nothing happening, then an irregular interrupt within 10ms
here some more data points:
2456 city 0
6 city 0
6 city 0
7 city 0
6 city 0
6 city 0
3091 city 6
7 city 6
6 city 10
7 city 10
5 city 10
2153 city 0
6 city 0
6 city 0
289 city 0
6 city 0
7 city 0
211 city 7
6 city 10
6 city 10
7 city 10
13261 city 7
6 city 7
6 city 10
7 city 10
6 city 10
26270 inv 0
6 inv 0
6 inv 0
2798 inv 0
6 inv 0
6 inv 0
7993 city 6
6 city 6
6 city 10
6 city 10
7 city 10
5000 city 0
6 city 0
6 city 0
3380 city 7
6 city 7
7 city 10
6 city 10
2507 city 0
7 city 0
6 city 0
2671 city 0
6 city 0
567 city 7
6 city 10
6 city 10
6 city 10
2292 city 0
6 city 0
3481 city 6
6 city 6
7 city 10
6 city 10
2006 city 0
6 city 0
7 city 0
6553 city 0
7 city 0
3123 city 0
7 city 0
6 city 0
596 city 6
6 city 10
7 city 10
6 city 10
37303 inv 0
7 inv 0
6 inv 0
2219 city 0
6 city 0
6 city 0
207 city 0
6 city 0
6 city 0
256 city 0
7 city 0
6 city 0
6 city 0
6 city 0
2772 city 0
6 city 0
6 city 0
3727 inv 0
7 inv 0
6 inv 0
594 city 6
6 city 6
6 city 10
7 city 10
6 city 10
2200 city 0
6 city 0
6 city 0
6335 city 0
9079 inv 0
7 city 0
7 inv 0
7 city 0
208 city 0
6 city 0
131 city 7
6 city 7
7 city 10
6 city 10
1749 inv 0
6 inv 0
6 inv 0
2374 city 0
6 city 0
6 city 0
146 city 7
7 city 10
6 city 10
6 city 10
1385 inv 0
7 inv 0
6 inv 0
395 city 6
6 city 6
7 city 10
6 city 10
415 city 7
6 city 7
6 city 10
7 city 10
RE: Faulty zero crossing detection
Dan - Owner
http://www.Hi-TecDesigns.com
RE: Faulty zero crossing detection
I tried this weeks back directly at the opto-couplers but that did not have the same impact. So maybe the long traces between the opto-coupler and the controller where picking up EMI?
RE: Faulty zero crossing detection
Dan - Owner
http://www.Hi-TecDesigns.com
RE: Faulty zero crossing detection
RE: Faulty zero crossing detection
Dan - Owner
http://www.Hi-TecDesigns.com
RE: Faulty zero crossing detection
They connect the opto-coupler to the chip. The big traces are AC lines and above Q4 Q2 Q15 is a big relay.
RE: Faulty zero crossing detection
I'm guessing I'm missing something here? If the currents are really that low then you would be more susceptible to noise I'd think.
RE: Faulty zero crossing detection
RE: Faulty zero crossing detection
Or add 0.1microF cap paralel with opto LED.