Author Topic: Isolated zero cross detection w/ AC mains  (Read 11011 times)

0 Members and 1 Guest are viewing this topic.

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3209
  • Country: au
Re: Isolated zero cross detection w/ AC mains
« Reply #50 on: October 17, 2019, 07:54:49 am »
To switch off the triac at the peak you would have to force commutate it, and trials are lousy at that. You can do it with an SCR but it is a bit of work. If you are interrupting current in an inductive circuit you need to have some sort of snubbing to deal with the energy in the inductance. Possibly not worth the effort.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12920
Re: Isolated zero cross detection w/ AC mains
« Reply #51 on: October 17, 2019, 12:45:47 pm »
Why would you even want to force  commutate at the peak?

TRIACs naturally commutate when the current through them falls to zero, which is when you would want to switch off an inductive load anyway to avoid a massive back-EMF 'kick' from stored energy.   Assuming an iron core inductive load, switched off at zero current, that leaves it with the residual magnetization from the previous half-cycle. 

N.B. immediately after switched off, it will *NOT* have zero volts across it as for an inductive load the current lags the voltage, so it wont reach zero current till somewhere in the half-cycle after the one you last triggered the TRIAC in.

It would be a *BAD* *THING* to switch it again at a voltage zero crossing, because with no current flowing initially it has a whole cycle to build up, to what would be more than double its normal max. flux.  This of course results in saturation and a massive surge current at switch on. Ignoring remnant magnetization, switch on at peak voltage, when the current would be zero for a perfect inductor and the flux buildup in the first half cycle is halved.

However to make sure the flux in the first half cycle OPPOSES the residual magnetization, switch on during the OPPOSITE phase half cycle to the last whole half cycle it was on for.  This can be critically important if your transformer is running right on the ragged edge of saturation, e.g. microwave oven transformers with the original primary, and if the application permits it, is good practice.  Otherwise if the application doesn't permit a delay to let it choose the half cycle, it may be advisable to move the switch-on to a little after the voltage peak.   

Edit: corrected choice of half cycle to switch on
« Last Edit: October 17, 2019, 02:56:19 pm by Ian.M »
 

Offline schmitt trigger

  • Super Contributor
  • ***
  • Posts: 2251
  • Country: mx
Re: Isolated zero cross detection w/ AC mains
« Reply #52 on: October 17, 2019, 01:31:06 pm »
Iroc;
if you choose a SSR from a reputable company (for instance Crydom) they will be very robust, and they will already have built in all the isolation and protection that you require.
Most times, all you require is an external fuse and/or a thermo-magnetic breaker. Just follow the datasheet recommendations.


The Crydom SSR example linked below has an output rating of 24 to 280 volts. If you are switching 120 volts then you have nothing to worry about.

https://www.digikey.com/product-detail/en/sensata-crydom/EZ240D5R/CC2235-ND/752094
 

Offline beduino

  • Regular Contributor
  • *
  • Posts: 137
  • Country: 00
Re: Isolated zero cross detection w/ AC mains
« Reply #53 on: October 17, 2019, 07:30:50 pm »
how are you galvanically isolating the gate driver from the SCR itself?
In my spot welder with bulky quite big transformer, I use two 2N6504 SCRs in inverse parallel with AC mosfets switch instead of optotriac MOC3020 in similar circuit shown below, so I can use eg. TLP351 optoisolated mosfet gate driver to turn AC  mosfet switch on/off powered from galvanic insulated power supply eg. small transformer.


 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12920
Re: Isolated zero cross detection w/ AC mains
« Reply #54 on: October 17, 2019, 09:03:28 pm »
Hmmm.  The 2N6504 datasheet says they only have a 50V repetitive blocking voltage rating.   I don't see how that's going to be compatible with a 240V RMS supply.
Mouser have ST branded 40A 600V TRIACs in stock at under $5 USD e.g. T4050-6PF, which is in an isolated TO3 package so can directly bolt to a grounded heatsink.  Its supposedly snubberless, so with a suitable snubber should commutate at least as well as the paired SCRs.  To maintain the 600V blocking voltage rating, I would suggest a MOC3052 random phase OptoTRIAC to trigger it.
 

Offline iroc86Topic starter

  • Regular Contributor
  • *
  • Posts: 148
  • Country: us
Re: Isolated zero cross detection w/ AC mains
« Reply #55 on: October 17, 2019, 11:44:39 pm »
To switch off the triac at the peak you would have to force commutate it, and trials are lousy at that. ...

Gotcha! I had read about forced commutation and it did seem like a bit of work. Going to Ian.M's comment about this...

Why would you even want to force  commutate at the peak?

It was based on the idea of switching on equal half-cycles from a few posts up. I figured that if we switched the transformer on at a peak, we'd want to switch off at a peak n periods into the future. Maybe I was confusing half-cycles with periodic symmetry? What you say about back-EMF and residual magnetization at zero current makes sense, though. This is what I was originally thinking:



So, based on your description of switching above, would the ideal transformer switching waveform look something like the following? This would minimize inrush current at t=0, minimize back-EMF at shutoff, and support the triac's natural tendency to stop conducting at a zero cross. Or am I still confusing things? :P



if you choose a SSR from a reputable company (for instance Crydom) they will be very robust, and they will already have built in all the isolation and protection that you require.

Sorry, I should have clarified my question--I actually meant on the zero cross detector itself, not the SSR/SCR/triac. Most of the circuit designs we discussed here just run mains voltage straight through a few high-value resistors into the optocoupler. Would it be necessary to include some input protection on the front end of the detector, or would that be overkill for a 120-240 VAC application? It's not like a multimeter with CAT ratings, but that's just where my mind went since we're dealing with dirty AC and the potential for all sorts of surges and spikes.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12920
Re: Isolated zero cross detection w/ AC mains
« Reply #56 on: October 17, 2019, 11:59:40 pm »
Re: second diagram in reply#55,
Not quite.  Remember the current lags the voltage in an inductor, so depending on the load resistance on the secondary side which 'reflects' to the primary scaled by the square of the turns ratio, the primary resistance and the primary inductance, it will reach zero current and commutate anywhere between the voltage zero crossing after the last firing pulse and the voltage peak of the next half cycle.  If you add a trace for the primary current to your plot,  you'll get a better idea of what's going on.
 

Offline beduino

  • Regular Contributor
  • *
  • Posts: 137
  • Country: 00
Re: Isolated zero cross detection w/ AC mains
« Reply #57 on: October 18, 2019, 05:19:44 pm »
Hmmm.  The 2N6504 datasheet says they only have a 50V repetitive blocking voltage rating.   I don't see how that's going to be compatible with a 240V RMS supply.
Nope, eg. Freescale Semiconductor (2N6509) datasheet says:
"SCRs 25 AMPERES RMS 50 thru 800 VOLTS".
I've 800V SCRs for sure, since no magic smoke so far  ;)
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7112
  • Country: ca
Re: Isolated zero cross detection w/ AC mains
« Reply #58 on: October 18, 2019, 08:31:25 pm »
Many firmware examples (i.e. Atmel app note) do not debounce the zero-cross signal. They just make an interrupt based on every zero cross (falling) edge.
This is not good if turning on the transformer makes a glitch on mains (due to inrush) and you get extra zero-cross falsely detected.

The best systems, for 3-phase power phase control have a software PLL where the MCU synchronizes a timer to mains, so mains noise does not cause a retrigger or upset.
After detecting a zero-cross, you would not expect another seen in under a 1/2 cycle time.

Instead of counting AC cycles, you can just use a timer with multiples of mains frequency. Trigger on a zero-cross and make a pulse for n*1/50Hz duration.
 

Offline TimNJ

  • Super Contributor
  • ***
  • Posts: 1665
  • Country: us
Re: Isolated zero cross detection w/ AC mains
« Reply #59 on: October 18, 2019, 09:01:01 pm »
OP here. Lots of good info in this thread, but much of the discussion has been related to beduino's project since he popped in (which is great to have an active circuit to discuss). I'd like to pull back a little and see if anyone can help answer some of my questions above. We've touched on these concepts, but not directly. Any thoughts? ;)

I'd like to introduce another topic: safety and suppression. How might some of these designs better accommodate unexpected AC spikes or the wrong input voltage? MOVs, fuses...?

...to balance the positive and negative AC cycles, how might we switch off the triac at a peak?

As of yesterday, I started designing a peak-firing inrush current tester for switch-mode power supplies. When testing inrush current, the worst case is taken at the peak of the line, so this is similar to your thought.

This discussion here has brought up many good ideas. Just a few thoughts that might apply to you, though I'm not completely sure.

1.) Consider keeping the main sensing/firing circuitry non-isolated, while using an isolated human interface. There may be some difficult to predict/correct errors associated with sensing via a step-down transformer. (Phase shift mostly, though maybe it's not that bad.)

2.) My first idea for a peak-firing circuit is the following:

  • Rectifiers + high voltage resistor divider chain
  • Envelope detector  + filter to create a DC voltage based on the line voltage. The DC level follows the input voltage. If 100VAC, the DC voltage might be 5V. If 230VAC, the DC voltage might be 12V. This way it works irrespective on line voltage.
  • With a comparator, compare the stepped-down, half-wave rectified (pulsating DC) signal to the DC level above. When the pulsating DC passes through the DC level, the AC wave is at its peak. If you want to sense both positive and negative peaks, use full wave rectified.
  • D-flip flop (I think) to accept user input to stop. Flip-flop only goes low once a peak signal is detected.
  • Isolated user interface (trigger, knobs, buttons) can possibly be implemented with optocouplers. Bias current/voltage for the optocouplers can be derived from a low power isolated power supply. Can probably use a tiny isolated 100KHz push-pull converter, maybe something like SN6501.
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3209
  • Country: au
Re: Isolated zero cross detection w/ AC mains
« Reply #60 on: October 19, 2019, 02:23:59 am »
Or what about just stick a reduced version of the AC voltage through an op amp integrator to phase shift it by 90 deg and then to a normal zero crossing detector. Bonus is the integrator would function as a low pass filter, stopping any noise pulses getting through and causing false triggering.

Or even easier still, just shove the raw AC through an RC network that would reduce the waveform to signal level, give very nearly 90 deg delay, and filter out noise, and then to the ZCD. What’s not to like about that?
 
The following users thanked this post: TimNJ

Offline TimNJ

  • Super Contributor
  • ***
  • Posts: 1665
  • Country: us
Re: Isolated zero cross detection w/ AC mains
« Reply #61 on: October 19, 2019, 03:52:15 am »
Or what about just stick a reduced version of the AC voltage through an op amp integrator to phase shift it by 90 deg and then to a normal zero crossing detector. Bonus is the integrator would function as a low pass filter, stopping any noise pulses getting through and causing false triggering.

Or even easier still, just shove the raw AC through an RC network that would reduce the waveform to signal level, give very nearly 90 deg delay, and filter out noise, and then to the ZCD. What’s not to like about that?

Sounds good too.
 

Offline beduino

  • Regular Contributor
  • *
  • Posts: 137
  • Country: 00
Re: Isolated zero cross detection w/ AC mains
« Reply #62 on: October 19, 2019, 06:58:55 pm »
The best systems, for 3-phase power phase control have a software PLL where the MCU synchronizes a timer to mains, so mains noise does not cause a retrigger or upset.

Yep, I do something similar in my spotwelder MCU - mains ZC statistics are made, than when we need fire welding pulse train, ZC sensing ISR is disabled and this way we have more spare MPU cycles for other tasks like for example sensing current using galvanic insulated Hall effect sensor, manage pulses power, etc.

BTW: That is interesting if there are any AC mains power grid standards like for example accuracy of clean mains 50Hz/60Hz period?
 

Offline schmitt trigger

  • Super Contributor
  • ***
  • Posts: 2251
  • Country: mx
Re: Isolated zero cross detection w/ AC mains
« Reply #63 on: October 19, 2019, 11:34:29 pm »
You will be interested in the following:

http://fnetpublic.utk.edu/index.html
 

Offline beduino

  • Regular Contributor
  • *
  • Posts: 137
  • Country: 00
Re: Isolated zero cross detection w/ AC mains
« Reply #64 on: October 21, 2019, 08:17:19 pm »
I've already found functional specyfication of power grid in my country in europe and one of those documents mention among others that
average frequency mesured within 10 seconds in mains contact should be in the ranges:
1. 50 Hz ± 1% (49,5 Hz - 50,5 Hz) during 99,5% of the week
2. 50 Hz ± 4% /-6% (47 Hz - 52 Hz) during 100% of the week.

This might help detect inrush disturbances in ZC crossing software I believe in, since when looked at realtime country mains grid frequency data available on web site, this frequency does changes now and is something between: 49.990Hz - 50.020Hz at depends on actual demand of power in grid as I know.
That is interesting  :o
« Last Edit: October 21, 2019, 08:20:23 pm by beduino »
 

Offline iroc86Topic starter

  • Regular Contributor
  • *
  • Posts: 148
  • Country: us
Re: Isolated zero cross detection w/ AC mains
« Reply #65 on: October 23, 2019, 12:01:17 am »
Re: second diagram in reply#55,
Not quite.  Remember the current lags the voltage in an inductor, so depending on the load resistance on the secondary side which 'reflects' to the primary scaled by the square of the turns ratio, the primary resistance and the primary inductance, it will reach zero current and commutate anywhere between the voltage zero crossing after the last firing pulse and the voltage peak of the next half cycle.  If you add a trace for the primary current to your plot,  you'll get a better idea of what's going on.

Okay, I think I got it... so the behavior would be something like this? The "region" being based on the variability of transformer design with respect to primary and secondary interaction.


 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12920
Re: Isolated zero cross detection w/ AC mains
« Reply #66 on: October 23, 2019, 01:11:50 pm »
Again not quite, as the current waveform  is phase shifted from the voltage by an amount that depends on the ratio of the load resistance to the load inductance.  0 deg for pure resistance, 90 deg lag for pure inductance.  Therefore the red line is the LIMIT for the current phaseshift and the actual current waveform will have a phaseshift in-between the voltage and the red line.  As you are building a spot welder the load is largely resistive when its working OK, so I would expect a large phase shift between making good welds and if there is poor contact with the work.

Assuming you stop the gate firing pulses well before the end of the previous voltage half-cycle, the commutation time limits will be as you sketched, and the actual commutation point will be where the actual current waveform crosses zero, within that time range.


« Last Edit: October 23, 2019, 01:19:21 pm by Ian.M »
 

Offline iroc86Topic starter

  • Regular Contributor
  • *
  • Posts: 148
  • Country: us
Re: Isolated zero cross detection w/ AC mains
« Reply #67 on: October 26, 2019, 01:39:54 pm »
Again not quite, as the current waveform  is phase shifted from the voltage by an amount that depends on the ratio of the load resistance to the load inductance.

Gotcha. I think that's how I was understanding it, but my image maybe wasn't the most clear way of depicting it :o. I probably should have blurred the red current waveform from 0-90 degree phase shift to show that it could fall anywhere in that range based on the specific characteristics of the circuit.

So, back to the earlier discussion about turning on the transformer, it sounds like the ideal "on" point would not necessarily be at the voltage peak, but rather at the current zero crossing point according to the actual phase shift characteristics of the load and transformer? I think this is what beduino was describing in his circuit in Reply #44 with being able to adjust the offset time.
 

Offline beduino

  • Regular Contributor
  • *
  • Posts: 137
  • Country: 00
Re: Isolated zero cross detection w/ AC mains
« Reply #68 on: October 26, 2019, 05:27:10 pm »
So, back to the earlier discussion about turning on the transformer, it sounds like the ideal "on" point would not necessarily be at the voltage peak, but rather at the current zero crossing point according to the actual phase shift characteristics of the load and transformer? I think this is what beduino was describing in his circuit in Reply #44 with being able to adjust the offset time.
Nope, by offset time I mean between voltage peak maximum and next zero crossing, which is for 50Hz mains with T=20ms period T/4=5ms time span, but to ensure to do not triger thyristor in the case zero crossing missing, my idea is to limit this offset time to predicted 1ms before next ZC, so in reality for example by adjusting potentiometer between 0%-100% offset time will be in my case 0ms-4ms from voltage peak and additionally I'm able detect to fire pulse train from the same polarity since I can ditinguish which part of T/2 we are while I've sense positive/negative AC.

Maybe, It is more visible in my post #47, when we do offset lets say half of T/4 lets say 2.5ms offset.
In my software potentiometer will be used to choose spot weding program rather than set this offset directly, while sometimes we would like to do some kind of preheat or other things depending on what we spot weld, so MPU will be programmed to change those offsets in real time within e few seconds spot weld time in fully automated way.
I'll heve some real data soon, since now I'm working on redesigning mechanics of spot welder to make it ready for testing new software.
 

Offline iroc86Topic starter

  • Regular Contributor
  • *
  • Posts: 148
  • Country: us
Re: Isolated zero cross detection w/ AC mains
« Reply #69 on: October 29, 2019, 01:23:37 am »
Nope, by offset time I mean between voltage peak maximum and next zero crossing ...

So, kinda like the way a triac dimmer switch works with incandescent bulbs? You'd be outputting a clipped wave based on the starting offset time. This is a little different than the welder design I've been thinking about, where the user would select n number of full 60 Hz cycles to apply to the work piece.
 

Offline beduino

  • Regular Contributor
  • *
  • Posts: 137
  • Country: 00
Re: Isolated zero cross detection w/ AC mains
« Reply #70 on: October 30, 2019, 08:23:27 pm »
This is a little different than the welder design I've been thinking about, where the user would select n number of full 60 Hz cycles to apply to the work piece.
Depending on spot welder program choosen maybe I'll also apply full 50Hz cycles when more power needed, but I will always start welding somewhere close to mains peak voltage  and the same +/- period.
I'm not expert in this field, but based on very usefull documents mentioned in this thread about inrush currents in the case of inductive load this is a way I'd like to drive my spot welder transformer, which so big, that I consider liguid cooling on its secondary made of copper pipes instead of wires.
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3209
  • Country: au
Re: Isolated zero cross detection w/ AC mains
« Reply #71 on: October 30, 2019, 08:42:13 pm »
Just thinking about it, seeing a spot welding transformer is meant for a specific purpose, not simply on continuously like most transformers, but dotted on and off, you would think that they would be wound for double the nominal voltage so that there would be no inrush current from saturation. They would then be able to tolerate a full half cycle of input voltage with the core magnetising beginning from zero instead of opposite polarity maximum and therefore not saturating when turned on at the voltage zero crossing. Seeing they are used that way they should be designed that way.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12920
Re: Isolated zero cross detection w/ AC mains
« Reply #72 on: October 31, 2019, 01:01:51 am »
Why would you do that, which is more expensive in copper and iron, when its relatively simple to avoid saturation at no extra cost if there's a MCU controlling the pulse timing?    It may have made sense back in the days of mechanical timers, but it certainly doesn't in the 21st century.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf