Electronics > Projects, Designs, and Technical Stuff
Mains zero cross detect alternatives - pic18 ZCD vs AC input optocoupler
BrianHG:
--- Quote from: oschonrock on August 13, 2020, 04:53:07 pm ---
--- Quote from: BrianHG on August 13, 2020, 02:51:13 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...
--- End quote ---
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"?
--- End quote ---
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.
oschonrock:
--- Quote from: BrianHG on August 12, 2020, 07:37:24 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.
--- End quote ---
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...
schmitt trigger:
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.
oschonrock:
--- Quote from: schmitt trigger 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 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
--- End quote ---
:-+
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...
oschonrock:
--- Quote from: BrianHG on August 13, 2020, 07:59:49 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.
--- End quote ---
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:
--- Quote from: BrianHG on August 13, 2020, 02:21:09 am ---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.
--- End quote ---
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
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version