Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Faulty zero crossing detection 1

Status
Not open for further replies.

SolarTrap

Computer
May 5, 2014
89
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.
URL]

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.
URL]

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
 
Replies continue below

Recommended for you

Opto-interrupters can be particularly troublesome when using plastic flags,
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
 
Your body is a good antenna for 60 Hz from the power grid. Just touch an ungrounded oscilloscope probe and you'll see how good (it won't hurt). So touching the equipment introduces another 60 Hz path to your sensor.

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:


I still have an original copy from 1994. It's handy!

Z
 
@zappedagain: so the printout is just printing interrupts that fall outside a 16-17ms delay.

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
 
As I suspected (and often see). I'd check your interrupt code to make sure it's as short as possible (you should be using no more than 10-15 cycles, just enough to set a flag, reset the interrupt, and get out), along with making sure nothing else can take control.

Dan - Owner
URL]
 
I added now 0.1uF caps at the input of the micro controller pins connected to the opto-couplers and after running it for a few hours it does not produce false interrupts any longer.
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?
 
They are about 5 inches long. The PCB runs high power DC (up to 50A) and AC thru it.
 
This is one layer of the PCB: there are 2 thin lines directly above labels Q4 Q2 Q15 Q6 Q13
They connect the opto-coupler to the chip. The big traces are AC lines and above Q4 Q2 Q15 is a big relay.

Screen_Shot_2016-03-30_at_7.52.07_AM_wuw9zu.png
 
I'm hung up on the low sense current(s) into and out of the Opto. For your 110 VAC input what "zero-cross" voltage level are you designing for? Say 10 volts. Then, at 10 volts the input current to the opto is 10/33000 = .0003 amps. The CTR at that current level looks to be about .2 so your opto output current = .0003 * .2 = .0000606 amps. Your pull up resistor is 4700 ohms. So your "pull down" volts = 4700 * .0000606 = .28 volts. That's not much for your 3.3 volt pull up voltage.

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.
 
Replace BAS32L diode; it had 75V reverse voltage only; in fist moments of voltage applied, diode may see peak voltage of 170V... and initiate a reverse conduction (small cliping) that is "stoped" by 33k resistor.
Or add 0.1microF cap paralel with opto LED.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor