A Solid State Relay, a heater, PWM, and Zero Cross
TC
Posts: 1,019
Hello all.
I was designing a board for a TRIAC circuit, that controls 2 heating elements today. The circuit has a Zero Cross circuit that tells the prop when the AC line is at 0. I got a quote from OSHpark, and the price was a little higher than I thought. It is cheaper to get 2 SSR's from ebay (about $8USD).
I have never worked with SSR's and PWM together. So I was wondering, would it be best to use my Zero Cross circuit? Or is there a better idea?
What are your thoughts?
Thanks
TC
I was designing a board for a TRIAC circuit, that controls 2 heating elements today. The circuit has a Zero Cross circuit that tells the prop when the AC line is at 0. I got a quote from OSHpark, and the price was a little higher than I thought. It is cheaper to get 2 SSR's from ebay (about $8USD).
I have never worked with SSR's and PWM together. So I was wondering, would it be best to use my Zero Cross circuit? Or is there a better idea?
What are your thoughts?
Thanks
TC
Comments
That said, supply networks still like you to switch an even number of mains half cycles, (ie whole cycles) and to do that,some means to check whole cycles is needed.
You cannot PWM faster than the mains, and again supply networks prefer slower PWM over faster (chattering) PWM
Usually you would choose the slowest PWM scheme that the thermal inertia and system precision can support, and the best temp controls are using proportional control (think of a low-level triangle wave, superimposed on the Analog feedback.)
The slicing of that sets your slower PWM
If you want to synchronize the on/off to the AC zero crossing you can do this without making a board. The optoisolator circuit can be built by soldering the required resistors and wires directly to the opto chip and potting the assembly in epoxy.
Another way would be to use the secondary voltage from the power supply transformer and a high value resistor (100K or more for 12VAC) to one of the prop pins for detecting the zero crossing. For extra protection use clamping diodes to ground and 3.3V on the input.
The SSR I am going to buy is the "SSR-25DA" it is one of the most common SSR's on eBay. From the listings, it says it is Zero Crossing.
I have had great luck with each cycle being 1 second. With a scale of 1% to 100%. I am using the code that JonnyMac posted.
That is exactly what I was thinking I could do. I was thinking, "I have the hardware from testing and proof-of-concept why not continue using it". I figured it would be better for the prop to know when the AC line goes to 0, instead of guessing where the AC line is at.
Heaters tend to have relatively long thermal time constants. This means you can implement something similar to PWM by switching whole cycles.
The crude way would be to go from 0 to 60 cycles every second. This is a resolution of about 1.7%. Or better resolution if the time is increased.
Another is implemented using "Rate Multiplier" techniques. A hardware method is to use CD4089B Binary or CD4527B Decimal Rate Multiplier chips.
However, we have the advantage of using a Prop and can do this in software.
Here is a code snippet that shows how to implement a Rate Multiplier in software. The advantage of Rate Multiplier Type DtoA techniques is the short term effective time constant is much shorter than simple Duty Cycle control.
Duane J
Rate multipliers are very good for filtered D to A, but less ideal for power control as the supply companies can 'see' all those switching edges.
As mentioned above supply companies prefer whole cycles, and longer time-frames on switching.
I'd suggest extending the time-frame to whatever thermal swings can be tolerated.
In my example program I was assuming 60 levels of heat by activating the Zero Crossing SSR on each full cycle for a total of 60 events totaling 1 second.
Of course, one could have each event encompass 10 full cycles for a total of 10 seconds.
In actuality, when using Zero Crossing SSRs, you wouldn't actually need to synchronize with the AC waveform, especially if each event was 10 full cycles. The SSR should take care of the synchronizing.
The example program, in FemtoBasic, allows one to experiment with different power percentages and total events.
Duane J
The code I have had great luck with my TRIACS came from JonnyMac. The "ZC" is coming from a H11AA1 opto. It allows detection of zero-cross going positive-to-negative, and negative-to-positive.
I just don't know if I would over work, or screw up the SSR's. I've used SSR's before, but it was always with a simple on/off setup. I never had to worry about pulsing the SSR on/off like I would be doing.
Of course, you need to stay within the control voltage limits and power ratings of the output.
You might want to wire in a small filament lamp for the load as it is easy to see how much power is being dissipated for teststing.
I looked at Fotek SSR-25-DA spec but they don't give much in the way of control pulse timing.
This may also be useful Fotek SSR Series.
In reading JonnyMac's code it appears the 2mS pulse allows 1/2 cycle control which can essentially apply a DC component to the AC line under some circumstances.
I believe one should always strive for full cycle control to eliminate the DC component.
This should be easy to do by extending the pulse width to 12.5mS for 60Hz or 15mS for 50Hz. Actually 12.5mS should work for both 50Hz and 60Hz.
BTW, what kind and power level heater are you using? What's it for?
Duane J
-Phil
Absolutely right!
As I posted previously "You can do a pretty reasonable job of synchronizing the on/off transitions to the AC line by using the system counter. Use waitcnt to make sure the ssr is turned on/off on a multiple of 16,666uSeconds. That will ensure that the ssr is on and off for full AC cycles."
A zero crossing ssr will only turn on and off at the zero crossing point even if the on or off signal comes somewhere else in the ac cycle. That means that as long as the on and off time is a multiple of 1/60th of a second (16,666 usec) the ac power will always be applied for a whole number of cycles and then off for a whole number of cycles. Of course this works only when used with a zero crossing ssr.
I was not meaning phase control edges, I was meaning the extra edges that a rate Multiplier has, over a more usual PWM.
ie there are more on/off's in a rate Multiplier frame, than in a PWM frame
It is those rapid, and not necessary, on-offs that make Rate Multipliers a poor choice for mains power control.
Unless your mains is 50Hz....
That is only 'mostly true', as short term phase jitter, and asymmetry in SSR triggering can cause uncertainties when the edges are close to phase aligned with Zero crossing. That will happen as the phases drift over time.
A leading edge may, or may not be seen, and a trailing edge may, or may not trigger an extra half cycle.
The ideal is to phase-lock your On/of decisions, to be comfortably clear of the zero crossing points,
eg you can apply ON at 90' and remove ON at 90' (whole cycle based)
Really accurate zero cross sense is not needed, you just need to not drift over time, so quite low cost ZCD can be used.
eg a cheap AC opto coupler + rated resistor or a DC opto coupler, and Diode + rated resistor
This approach is also mains frequency variation tolerant.
IOW, let's not make the app more complicated than it has to be.
-Phil
There is no thermal reason for whole cycles, that is a 'be nice to the supply company' requirement.
DC thru transformers is a larger pain, and any electronic commercial system should really have whole-cycle control because it is so easy to do.
A hobbyist may cut corners, but why not do it properly, as the added effort is minimal.
Both valid points, however TC is in the US, so 60Hz. As for the drift/jitter, as you pointed out this is not a requirement of the project, just being nice to the power provider. In any case such drift or jitter would only result in an extra half cycle once out of many whole cycles.
There have been numerous examples of power distribution transformers being destroyed and some catching fire when heater controls have malfunctioned and running in half cycle mode.
I also don't see a reason to not use full cycle control as it is so easy to do.
We don't know what the specifications of TC's heater, but he is using a 25A SSR. This would imply a capability of 5500W.
Even if TC's heater is much smaller others might benefit from this discussion.
Even small systems can get into trouble. Say the heater is powered through a small step down transformer. Half cycling can cause the core to saturate and over heat. This is the primary reason full wave rectification is superior to half wave rectification.
Duane J
-Phil
+1
There are a lot of power supplies and other circuits out there that only use one half of the ac cycle and they do not seem to cause a problem for the power providers. Individually this may seem to be a problem but on average it tends to cancel out. Don't forget that power to homes and most businesses is provided as 220V with neutral as the center tap. even if everyone tapped the positive (or negative) half cycle the current draw on each half cycle would tend to even out.
For the heaters;
they are in a $15 Farberware (Wal-Mart) toaster oven. the top heater is rated at 120V/650W, the bottom one is rated at 120V/450W. The internal sizes are about 10" x 10" x 6".
I am making a DIY reflow oven. I want to try to have a 2% to 5% accuracy (LOT harder that I thought). I want to have the top, and bottom heater independent of each other. It would be nice to be able to shrink heat shrink, without the chance of "toasting" parts. For that example, I would be using the drip tray that came with the oven, and only use the bottom heater. Having independent heaters allows me to control the temperatures above and below the board.
The TRAIC circuit I was using came from a Treasure Chest crane machine. Here is my schematic that I copied from the motherboard of the crane machine.
The H11A1M H11AA1M was not on the motherboard, JonnyMac provided it in this post.
The temperature measurements are coming from 2 Maxim Thermocouple modules. My PID outputs a value from 0 to 100.
Put me down as the third here to question the need for phase control technique with regard to managing heaters in this context.
Maybe this is overkill, too -- but we'll never know unless somebody tries it. The negative technical speculation dripping with condescension really is making a mess of these forums....
Some people have taken an opposing point of view.
A ZC triac driver would eliminate any turn-on noise and the rest is just "positive" technical speculation - in my opinion (if that's allowed.)
You have made a slip up there - look carefully at the original post and it has a H11AA1 , which has back to back LEDS.
If you use a single opto, (cheaper and easier to find) you will need an external diode for reverse protection.
It is then not a classic Zero cross, but in this usage, that does not really matter.
The simpler Full cycle sense at the opto, also gives you the technically better full cycle switching.
( If you do want Zero cross, and std opto, then a Bridge is needed.)
You can also increase the resistor values for a signal used only for phase sync, to drop power losses.
Even 10x those values would still work fine for (whole) cycle counting and trigger decisions.
You actually do not want the decisions to be too close to voltage crossing anyway, and if you do not plan to use a schmitt, then a liberal noise filter in SW would ensure only one sense per mains cycle.
eg wait until ZCD has been low for 2~3ms, then make Count/PwM Frame decisions
As far as I can see from re-reading the posts so far no one (including TC, and TC, please correct me if I am wrong) suggested phase control. The choice of a zero crossing ssr rules out phase control in any case. I think it was the mention of zero crossing that mislead some of us into assuming that it would be using phase control. Detecting zero crossing does allow control signals to synchronize with the ac line and makes the software controlling the power to the heaters a little bit simpler .
That was just a typo, I have corrected the post. Here is the opto I bought
I have had the H11AA1 for a couple months now. What benefits would it be to buy a new part, change the working code I have right now, and start all over again?
I never said anything about phase control. If I was driving a light, or a motor, phase control would be good.
I am sorry if I have confused everyone on what I was asking for help with. I was only asking, could I change my current hardware and programing over to work with SSR's, and still keep it simple?
If you already have the Dual-Led Opto part, simply apply 'if it ain't broke, don't fix it', and stick with what works
I found some more notes on power control, some mention a flicker avoidance upper limit of 2Hz on any switching rates
(which is why rate multiplier is less than ideal here), and another I found mentioned even half cycles of ON (ie whole cycles) and odd half cycles of OFF.
The latter idea I've not seen before, but it would alternate the leading power 'edge', which could make sense with a lot of these, which is what a proper/commercial heater thermostat design needs to consider.
Have to agree 100% with that. A zero crossing pulse is nice to have even if it is not absolutely needed for this.
Understandable. Turning a 600W load on and off will make the lights in most houses flicker a bit, never mind doing the same for a 1000W - 1200W load.
Never heard of this before. Do you have a link to where you found it? Could this simply be their way of saying that whole cycles should be switched on or off?
It's a little more subtle than whole cycles for both ON and OFF, as OFF for odd half cycles, will alternate the phase of the next ON burst (which will be whole cycles).
I can see for something like an oven-top simmerstat, that could help, as you want to avoid all loads turning on on the same half cycle.
Avoiding a single precise frame time would also wander the phase of many controllers.