Author Topic: Mains zero cross detect alternatives - pic18 ZCD vs AC input optocoupler  (Read 7544 times)

0 Members and 1 Guest are viewing this topic.

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 8111
  • Country: ca
Re: Mains zero cross detect alternatives - pic18 ZCD vs AC input optocoupler
« Reply #25 on: August 13, 2020, 07:59:49 pm »
Now, if your optocoupler had a 10ua input drive current instead of a 5ma drive current, digitally cleaned on the mains side triggered at the mains crossing a <2v threshold, how narrow and accurate could you make that crossover window with even a 1 megaohm series resistor feeding that input from the mains...

No. Have you checked the max/min forward voltage spec? I am not sure you have understood how this circuit actually works.

Should I put a step down transformer in there too for some nice Australian "phase shift sauce"?
Everything will work fine.

When your ac source is above 1.5v, the mcu output side will be high.
When your ac is below 1.5v, your mcu output side will be low.

The control input is already diode clamped in both directions.
That data input tied to the mains hot and through a 330k resistor with a 100pf to 1nf cap to the GND1 where the mains neutral is connected.  That input's protection diodes will be pushed to +/-1ma max and the cap will remove any spikes during the transition.

The mains hot will also go through a 100k resistor -> 1N4007 diode -> VCC1 which has a 3.3v zener diode & 10uf cap in parallel with GND1 creating a regulated 3.3v supply capable of sustaining the required 1ma during both phases.

That's your input phase detector.
Only a +1.5v offset of error.
No transformer.

« Last Edit: August 13, 2020, 08:02:10 pm by BrianHG »
 

Offline oschonrockTopic starter

  • Regular Contributor
  • *
  • Posts: 67
  • Country: gb
Re: Mains zero cross detect alternatives - pic18 ZCD vs AC input optocoupler
« Reply #26 on: August 15, 2020, 06:58:52 pm »
Why not just tap the you 5v supply transformer's AC winding's?
Nice safe isolated 6-12vac to feed your MCU input through a series resistor.

I received a little isolation transformer in  the mail yesterday, which I had ordered just to try out just how much phase shift you get, for the benefit of others who are considering this option.

The results are not authoritative for anything except this exact transformer and the load which I applied. It may be that more suitable transformers are available which introduce less error. So YMMV, do your own measurements. But it's probably fair to say that before looking seriously at trying to zero cross detect on the LV side of a transformer that you should be aware that a significant amount of phase shift may exist and that this varies significantly with load

This is the transformer used:
Myrra 44049, Isolation Transformer, EI 30 x 10.5, 1 VA, 6V, 167 mA, 1 x 230V, PCB MOUNTED 44xxx Series
https://uk.farnell.com/myrra/44049/transformer-6v-1va/dp/1689041

I just hooked it up to 230V 50Hz  and measured mains (via HV diff probe) at the input as well as the LV output on the scope. I have no way of determining whether the HV probe introduced phase shift. I would hope not, it's a 100Mhz probe. Screenshots below.

Summary:

  • The LV output leads the HV by ~ 300uS. Or about 6 degrees of phase angle. At no load.
  • If I apply a 22Ohm resistive load (roughly rated load, a bit over actually, ooops) the phase shift reduces to only about 1.1degrees or 65us.

These are not huge figures, but the fact that they vary both with specific transformer and with load, by ~ 250us  (or 25V in the vertical, see above) means that will need calibrating out. This is a manual calibration as it cannot be estimated with pulse width averaging or similar. And then it still varies with load...

« Last Edit: August 15, 2020, 07:11:39 pm by oschonrock »
 

Offline schmitt trigger

  • Super Contributor
  • ***
  • Posts: 2344
  • Country: mx
Re: Mains zero cross detect alternatives - pic18 ZCD vs AC input optocoupler
« Reply #27 on: August 15, 2020, 07:17:48 pm »
The primary current is the *vector sum* of both the reflected load current and the core magnetization current.
The latter current is not only phase shifted but has considerable distortion.

When that current flows thru the primary winding resistance, it will cause a voltage drop which is vector subtracted from the mains applied voltage.

What you require to do is that the magnitude of the primary reflected load current to be much larger than the magnitude of the magnetization current, such that its contribution dominates.

In practical terms:
Procure yourself a small, 1 or 2 watt transformer, and load it to its full rated current with a resistor. Do not use this transformer to also obtain a rectified DC.

Of course, if you can obtain a transformer with a higher rated primary than the applied voltage, it is even better, as the flux density is reduced. I live in a 120v country and use 240v primary transformers with good results.
« Last Edit: August 15, 2020, 07:20:26 pm by schmitt trigger »
 

Offline oschonrockTopic starter

  • Regular Contributor
  • *
  • Posts: 67
  • Country: gb
Re: Mains zero cross detect alternatives - pic18 ZCD vs AC input optocoupler
« Reply #28 on: August 15, 2020, 07:20:57 pm »
The primary current is the *vector sum* of both the reflected load current and the core magnetization current.
The latter current is not only phase shifted but has considerable distortion.

When that current flows thru the primary winding resistance, it will cause a voltage drop which is vector subtracted from the mains applied voltage.

What you require to do is that the magnitude of the primary reflected load current to be much larger than the magnitude of the magnetization current, such that its contribution is very low.

In practical terms:
Procure yourself a small, 1 or 2 watt transformer, and load it to its full rated current with a resistor. Do not use this transformer to also obtain a rectified DC.

Of course, if you can obtain a transformer with a higher rated primary than the applied voltage, it is even better. I live in a 120v country and use 240v primary transformers with good results. By


 :-+

Yup spot on! As per link above to the stackexchange answer which has the full transformer equivalence model, so you can do the maths -- get your complex number calculator out. Luckily I still have mine from Uni days -- or just use spice and friends 

Personally, I would not do this for zero cross detect. Just a whole bunch of unknowns / variables and a bunch of heavy copper and iron, which I have to keep warm, for nought.... . Even for the "ideal case" of a "fully, resistively loaded 1VA transformer" above, I am still getting 50us of shift which I know nothing about when sensing on LV side. So this is purely additive with the detection errors. Just less accurate...
« Last Edit: August 15, 2020, 07:37:04 pm by oschonrock »
 

Offline oschonrockTopic starter

  • Regular Contributor
  • *
  • Posts: 67
  • Country: gb
Re: Mains zero cross detect alternatives - pic18 ZCD vs AC input optocoupler
« Reply #29 on: August 15, 2020, 08:03:10 pm »

When your ac source is above 1.5v, the mcu output side will be high.
When your ac is below 1.5v, your mcu output side will be low.


Now we can see what you are suggesting is basically one of these "sub 10 component trigger circuits". 

And therein lies the problem.  Why is no one else triggering at 1.5V? Everyone goes for about 10V+ and a pulse width between 100us and 1ms and takes the mid point. Why?

David Hess put it very simply above. The mains are noisy. If you put a super low voltage triggering and super fast optocoupler in there. It may well trigger multiple times..all over the place. Then you need to LP filter that....blah blah. I haven't drawn up your proposed circuit, but just from following the words it sounds like this would trigger on positive cycle only? Ie I only get one edge. So no pulse width averaging? Maybe not needed but given the spread but given the noise issue, might have allowed some safety reject logic...again, more complications.

Basically the AC optocoupler is very very simple, robust, resilient and plenty accurate  enough for my application, with minimum component count. YMMV

And just to be clear and honest Brian. I stopped listening to you, when you became insulting:

If you are working with mains voltage and do not understand why the '10ua input current while it only requires a supply current of 1ma' capability of the part I mentioned is useful when designing a mains crossover detection circuit and the number of ways this can be used and be useful compared to using any optocoupler, you better be very careful with what you are working on. 

You have made multiple incorrect and poorly thought through suggestions on this thread. So please think about who you talk down to....

As we say in England

Respectfully yours
« Last Edit: August 15, 2020, 08:11:28 pm by oschonrock »
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 8111
  • Country: ca
Re: Mains zero cross detect alternatives - pic18 ZCD vs AC input optocoupler
« Reply #30 on: August 15, 2020, 09:05:37 pm »

When your ac source is above 1.5v, the mcu output side will be high.
When your ac is below 1.5v, your mcu output side will be low.


Now we can see what you are suggesting is basically one of these "sub 10 component trigger circuits". 

And therein lies the problem.  Why is no one else triggering at 1.5V? Everyone goes for about 10V+ and a pulse width between 100us and 1ms and takes the mid point. Why?

David Hess put it very simply above. The mains are noisy. If you put a super low voltage triggering and super fast optocoupler in there. It may well trigger multiple times..all over the place. Then you need to LP filter that....blah blah. I haven't drawn up your proposed circuit, but just from following the words it sounds like this would trigger on positive cycle only? Ie I only get one edge. So no pulse width averaging? Maybe not needed but given the spread but given the noise issue, might have allowed some safety reject logic...again, more complications.


The AC optocoupler turns on and off an LED based on current in the LED, not voltage.  It works by the voltage going though a resistor illuminating the LED strong enough for a 'transfer' to the detector side of the optocoupler.  This only shows a small window opening while the LED doesn't have enough current to shine bright enough to drive the photo-transistor.  This also doesn't tell you the current AC phase which might be useful.

The opto-isolator part and connection example I recommended goes high when the AC phase goes effectively above 1v into the positive, and goes low when the AC phase goes below 1v down into the negative.  The optional 100pf cap will do a little cleaning, but I cannot imagine the design messing up or getting noisy as this is so close to the 0 transition point, really bad noise from loads like light dimmers and switching supplies occur above or below this voltage window where it is too late on the digital output transition has already taken place.

Make no mistake, instead of the data isolator, you can use a RE1C002UN or SSM3K35AMFV (mosfet 1vgs switch on) or equivilant small signal mosfet & diode protection clams on it's gate input & using it's Drain to drive a normal optocoupler's led & you would get similar results.

You would still need a RE1C002UN or SSM3K35AMFV (mosfet 1vgs switch on) , 6N137 or equiv, 1N4007 diode, a 5v zener diode, a 22k resistor for powering the zener, a 470k resistor to drive the gate, a 1k ohm resistor to drive the optocoupler LED at ~4ma, 1 47uf 6.3-16v cap, a BAT54S double diode for gate clamp protection, and an optional 100-1000pf cap for the AC line filter tied to gate & GND.  That's 9 components.

All components are bottom end cheap ones.

The data isolator part count is 6 components, however, the data isolators cost much more alone than the 9 components listed above.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf