Electronics > Projects, Designs, and Technical Stuff

Mains zero cross detect alternatives - pic18 ZCD vs AC input optocoupler

<< < (4/7) > >>

BrianHG:
Use the other guys circuit this way you don't need to engineer anything.
There is more than 1 way to skin a cat.

I would use this part: ISO7310CDR.
The data input side has only a 10ua input current while it only requires a supply current of 1ma.

Now, you should be able to work out on you own how to wire this guy up and with what components.  If not, just use the other guys circuit.

oschonrock:

--- Quote from: BrianHG on August 12, 2020, 11:44:00 pm ---Use the other guys circuit this way you don't need to engineer anything.
There is more than 1 way to skin a cat.

I would use this part: ISO7310CDR.
The data input side has only a 10ua input current while it only requires a supply current of 1ma.

Now, you should be able to work out on you own how to wire this guy up and with what components.  If not, just use the other guys circuit.

--- End quote ---

The issue is not the optocoupler. Throwing a different part number out there, doesn't solve the issue.

Anyway, I am quite happy with the solution I engineered already, thanks.


BrianHG:

--- Quote from: oschonrock on August 13, 2020, 12:25:18 am ---
--- Quote from: BrianHG on August 12, 2020, 11:44:00 pm ---Use the other guys circuit this way you don't need to engineer anything.
There is more than 1 way to skin a cat.

I would use this part: ISO7310CDR.
The data input side has only a 10ua input current while it only requires a supply current of 1ma.

Now, you should be able to work out on you own how to wire this guy up and with what components.  If not, just use the other guys circuit.

--- End quote ---

The issue is not the optocoupler. Throwing a different part number out there, doesn't solve the issue.

Anyway, I am quite happy with the solution I engineered already, thanks.

--- End quote ---

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.  Working with mains can be very dangerous, potentially lethal and it is usually frowned upon any of us offering guidance with such projects here at EEVBloog.

David Hess:
How accurate does your phase measurement need to be?  The power line is pretty noisy making an exact zero crossing measurement difficult but does it need to be better than a simple optocoupler can deliver?

For a really accurate zero crossing measurement, the noise needs to be removed however sharp filters will create phase errors themselves.  High performance designs phase lock a clean oscillator to the power line allowing the loop filter to remove the noise without creating phase error but I think that is way overkill for your application.

oschonrock:
Thank you David.


--- Quote from: David Hess on August 13, 2020, 03:48:17 am ---How accurate does your phase measurement need to be?  The power line is pretty noisy making an exact zero crossing measurement difficult but does it need to be better than a simple optocoupler can deliver?

--- End quote ---

You are right about the noise. Particularly since I am introducing more of it by switching up to 10A mid cycle with MOSFETs. -- see project link at top.

I don't need extreme accuracy. Lets, for the sake of the thread, estimate the required accuracy (I already did this).

A 50Hz 230VAC RMS line has an equation of V(t) = Asin(wt) , where   

A=sqrt(2) * 230 =  325V and
w (angular frequency omega) = 2 * pi * frequency = 314.159 rad/s

Its slope equation (ie first derivative) will be V'(t) = Awcos(wt)

At very small angles, wt ~ 0 => cos(wt) ~ 1. So the slope is just V'(0) = Aw ~ 100kV/s  (confirmed on the scope for those who prefer that).   Note that 110V 60Hz is obviously slower => easier (20% higher w but only half the A).

If, during trailing edge dimming, for example, (mode2 see original project link at top) I want to turn on the MOSFET pair at the crossover, then I would like to do it, when the line voltage is less than, say,  Vswitch, because this will help reduce EMI, inrush currents for capacitive loads etc.

So my timing for firing the MOSFET, needs to have the following accuracy (I am not going to worry about small, known, constant offsets here, like time for the MOSFET to fire or time for the MCU to process the interrupt):

Lets shoot for Vswitch =< 10V as a first goal, ie fire MOSFET when mains voltage is less than 10V, How close to the true zero cross do we need to be in time?

dt = 10 / 100000 = 0.1ms or 100us.

My current method with the AC optocoupler gets me a pulse width of ~ 800us (using Schmitt trigger inputs on the pic), but the key is that this is very stable. ie it is almost symmetrical and of nearly constant width and of very consistent shape (ie any slight asymmetry is nearly constant). The standard deviation of the width at 50% of peak is < 10us, as measured on scope over half an hour.

The first estimate of the true zero cross is at 50% of the width after the leading edge. This gets me to within ~100us of the zero cross. It turns out, I am firing consistently late. However, I have already met my goal of 10V Vswitch - again confirmed on scope. It's not right on zero due to the slight asymmetry in the pulse and the Schmitt trigger levels.  If I use the knowledge I have of the asymmetry,  and pick a time ~40% through the (pic detected!) pulse, I can get within ~ 10us (the random error in my signal).

There are any number of circuits / devices which could give a narrower pulse. The issue is that a narrower pulse, by definition, is detecting a smaller mains voltage, and that smaller mains voltage will be more subject to noise (see below). So actually using a device that triggers repeatably and symmetrically at a higher voltage, and then halving its pulse width, is not a bad approach.

For my application, there doesn't seem to be much point aiming for more accuracy than I have (unless I get it "for free", see below). If I can get within 5V of zero cross (ie about 50us) that would be more than enough, because any EMI will be completely swamped by what happens when I turn the MOSFET off again when the mains are at 325V and 10A is flowing! Plus for "mode3" (see original project link at top), which is switching the sine wave at 10kHz+, it almost doesn't matter at all.


--- Quote from: David Hess on August 13, 2020, 03:48:17 am ---For a really accurate zero crossing measurement, the noise needs to be removed however sharp filters will create phase errors themselves.

--- End quote ---

Spot on, yes, filtering is a double edged sword. Similar to step-down transformers. They introduce new delays / phase shifts.


--- Quote from: David Hess on August 13, 2020, 03:48:17 am --- High performance designs phase lock a clean oscillator to the power line allowing the loop filter to remove the noise without creating phase error but I think that is way overkill for your application.

--- End quote ---

Hadn't seen that, so thank you, but yes, agree that sounds like overkill.

So why this thread? This thread was not about designing a hyper accurate zero cross detector. This post was to clarify whether I can simplify my design, and get more accuracy, lower power consumption and software convenience for free, by using already existing, specialised circuitry in the form of the pic18 built in ZCD peripheral.

We established the answer in the first reply: No, not safely. Which is what I thought. I just wasn't clear why Microchip bothered at all, and the answer is: If you can let your MCU float then it's OK. I can't, so that's not an option for me.

Case closed?


Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod