Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

heater pwm regulation with triac

Status
Not open for further replies.

bmandl

Full Member level 4
Joined
Feb 26, 2010
Messages
207
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
Slovenia
Activity points
2,965
Hello,
I am on my new school project - aquarium controling device. I will be measuring ph of water with temperature compensation and I will regulate water temperature with pwm on microcontroller. Here comes the problem of me, not knowing much about triacs.
I newer worked with pwm before and I don't have basic idea, how this is done. Are there any specific calculations which must be considered before controlling triac with pwm? Does it mean, that if I put out 50% duty cycle from microcontroller, that triac will also provide 50% of power from mains to the heater? What else do I need to consider for this kind of regulation? How do I involve temperature to duty cycle - do I make it experimental (changing duty cycle, until temperature stabilize) or must be some kind of calculation made to exactly determine duty cycle for desired temperature?
This will be enough questions for now, I appreciate any answers.
 

The term pwm is potentially misleading. A triac can't be switched at will. When striggered, it stays on until the next zero crossing of mains voltage. A reasonable method will use a opto triac with zero crossing detector to control the triac and switch full sine waves. You'll vary the on/off duty cycle according to the intended heater power with a period of a few seconds.

The duty cyle value (0 - 100 percent) will be calculated by a PI controller algorithm from temperature setpoint and actual temperature.
 
  • Like
Reactions: bmandl

    bmandl

    Points: 2
    Helpful Answer Positive Rating
Ok, so what I am actually doing, isn't pwm at all. It is phase angle control if I am right? So, I don't even need pwm module in my microcontroller? I just need timer for generating delayed firing of triac. But what about zero crossing? Do I need extra pin for zero crossing detection, that microcontroller will know, when sine wave has crossed zero? How do optotriacs with zero crossing detection even work? How they know, when to fire an output? There will be a lot of mathematics to calculate delay for firing from temperature. I can't find any good explanation of this kind of controllers on the web.
 

I am making an assumption here that as you mention using a triac the heater runs on an AC supply.

You CAN use PWM but not in the normally accepted way. You would have to accept that the on/off periods of the heater were very long, at least several AC cycles long and in practical terms maybe several seconds or even minutes (< 0.01Hz). It would be analogous to watching a thermometer and flicking the power switch as the reading goes out of range. 'Conventional' PWM is used at much higher frequencies, typically in the KHz region.

It would make more sense, and certainly a more interesting project to use phase angle control. As FvM explained, when you turn a triac on it stays on, there is no way to turn it off without removing the voltage across it so you have to fire it on a per-cycle basis to get accurate control. The standard method is to detect the zero crossing point = where the AC is crossing from it's positive to negative polarity or back again. At this point any triac will turn off and unless triggered will stay off. Now you start a timer, lasting no more than 0.5 of the AC frequency, which creates a delay before sending a pulse to turn the triac on. If you want more power, you fire the triac sooner so it conducts for more of the remaining time before the next zero crossing. If you want less power, you turn it on later in the half cycle so it spend less time conducting before the zero voltage is reached again.

All you need is a thermometer probe so you can read the temperature, an algorithm to decide whether more heat is needed in if so, how much and a software timer controlled by the result. You reset the timer at each zero crossing. The zero detector design can be very simple but before advising on this, please tell us the AC voltage you are using, for example is this a 115V/230V mains AC voltage or is it stepped down with a transformer? The safest ZCD circuits use an opto-isolator to ensure the microcontroller is electrically isolated from dangerous voltage.


Brian.
 
  • Like
Reactions: bmandl

    bmandl

    Points: 2
    Helpful Answer Positive Rating
It would make more sense, and certainly a more interesting project to use phase angle control.
EMC standards (e.g. IEC 1000-3-2, Limits for harmonic current emission) demand that phase angle control is only used for applications that require it, e.g. lighting or electric tools. Heating can work well without it in most cases.
 

That's an excellent point but this is a school project and I would guess is geared more toward education than fish production! Bmandl has obviously done some research and come up with a viable, if not optimal solution and I give them credit for that.

I guess the deciding factors would be the thermal mass of the aquarium and how tolerant of temperature change it's contents are. Perhaps the way the two control methods work in different scenarios would also be useful investigation for the project and gain some extra points.

Brian.
 

@betwixt, thank you for your explanation. I see now, that pwm regulation is no good for this project. Actually, I already have a water heater with thermocontrol (mechanical), but this control varies in range of 2°C. This is way too much for fishes I guess. Heater is 220V AC. I decided to use phase angle regulation, but now I must consider how to make calculations for delay time with temperature. I guess it will be experimental (more heat needed, less delay fired and vice versa). Or do you think, I must implement PID calculations in this project just for learning? How to then connect these calculations with actual delay needed. I don't think I will have enough time for all this (need to be done till the end of January somewhere).
 

@betwixt, thank you for your explanation. I see now, that pwm regulation is no good for this project. Actually, I already have a water heater with thermocontrol (mechanical), but this control varies in range of 2°C. This is way too much for fishes I guess. Heater is 220V AC. I decided to use phase angle regulation, but now I must consider how to make calculations for delay time with temperature. I guess it will be experimental (more heat needed, less delay fired and vice versa). Or do you think, I must implement PID calculations in this project just for learning? How to then connect these calculations with actual delay needed. I don't think I will have enough time for all this (need to be done till the end of January somewhere).


Try these links, i believe you will get a lot of good information, they helped me a lot in the past.

**broken link removed**

http://www.embeddedrelated.com/showarticle/121.php


http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/

http://bestune.50megs.com/typeABC.htm

Enjoy the reading

Simão
 

Thank you, I will read all of it. Then I should go to the library for some more info.
 

PID will work best but you need to know the heat characteristics of the aquarium to make accurate calculations. I think your choice comes down to two methods:

1. the thermostat control method, basically what you already tried with the mechanical system but using a more accurate electronic temperature probe. You can still turn the heater completely on or completely off as it does now but you should be able to make the switching point far more accurate, maybe within 0.5 degrees or less. For the switching you could use a triac either off or conducting full cycle, no need for phase control at all.

2. you could use a proportional control, using PID routines if you like but a simple "if it's cold add more heat" method would probably work equally well. This method would use phase control and rather than applying full heat in bursts, would apply only enough heat to stabilize the temperature. It's more complicated but also more of a challenge.

Brian.
 

Hi,

You can readily achieve a 0.1 deg C accuracy in an aquarium using a simple NTC sensor or most other sensors like DS18B20.

No need for PWM, just a simple zero cross opto coupler /triac driver
https://www.farnell.com/datasheets/1639837.pdf

The wattage of the heater needs a little consideration as does the delay time between between the on /off cycles, consider 1 minute as a starting point. ( quiet dependant on the ambient temperature)
 

Ok, everything good. I readed all the links you posted and I get the picture of PID now. I understand now, how I will get P, I and D terms and then sum of them. But what to do now with this numerical value? How to associate now this with power of heater needed or delay time needed for triac to fire?
Also I am wondering is there any way to analytically determine the Kp, Ki and Kd gains because I don't know what gain to take in the beginning of the tuning to set the parameters. If I understand correctly, I will first have to make the controler with just P term involved and then read temperature of the water and changing Kp gain and driving TRIAC to get P term optimal (with temperature oscillating in sinusoidal form), then determine the rest of two termins (I and D) with Ziegler–Nichols method. But this method requires me to make the whole project before even test it :) and I will have to cool the water several times before calibrate it.
How would I make mathematical model of aquarium and associate this with PID equation to calculate everything?
 

I am still confused about setting parameters. Can someone please tell me, if I am on the right way or not. I must make the P controller first (implement it with microcontroller and build whole circuit) to determine other two gains (for I and D term)? Then I must find proper P term to make temperature oscillating in sinusoidal way? If I live on the right planet and understand this right, I will have to try 9999999999999...different gains and watch temperature for hours (it changes really slowly). I would be very grateful if someone lights up my brain on this one, please.
 

If I live on the right planet and understand this right, I will have to try 9999999999999...different gains and watch temperature for hours

Apparently you live on the planet of unrealistic assumptions.

If you apply Ziegler-Nicols closed loop tuning method, it would be sufficient to try a number of discrete gain steps to find the "ultimate gain". But I agree that tuning can be a bit time consuming for slow processes.

There's however a second Ziegler-Nicols open loop tuning method which derives the optimal controller parameters from the control process step response. A variant that's often used by simple autotune algorithms operates the controller with infinite gain (on-off control) and observes the time lag and slope of process value.
 

Hello guys!

I am designing my zero cross detector for generating pulses for where to triger delay for Triac. I found some circuit on the web and I modified it a bit (I just added a npn transistor on the output). I simulated this circuit in Spice and I get quite good results. Zero crossing output is default low, so it is generating high pulses. I will use Timer1 as a counter on PIC, for zero cross detection. For Timer1 as a counter is sensing positive fronts, that means, that pulse will be detected, when output of zero cross detector reaches 2V (information from datasheet, page 175). That gives me a negative delay of about 0.5ms (with negative I mean premature signal). I saved graph from Spice, for better explanation. Can someone please confirm or overrule my theory?
Thank you all

 

You can make it simpler - omit both transistors, feed the bridge directly to the opto-coupler LED and take the output either directly from the opto transistor with a pull-up resistor, or, connect the opto transistor collector to supply and take the output from the emitter and add a pull-down resistor.

Brian.
 

For now, I just need to know, if my assuptions are right (about premature pulsing)?

EDIT: Besides, your variant would be much more slower and much less dinamic (voltage on output would go from just a bit below 2V and to 5V), therefore harder to distinguish between 1 and 0.
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top