Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PID heating suitable ?

Not open for further replies.


Well-Known Member

Am using a micro to control the heating of a greenhouse and propagator.

With simple relay on/off and using a fan heater the greenhouse can be kept at quiet a constant temperature, but for a large propagator we chose to use a 180w tubular heater ( with overhead fan) which does work, though the temperature does drop another degree C before it outputs enough heat , but once at the set temperature and power removed it continues to release its stored heat and can cause the temperature to climb a couple of degrees C.

This gives up to 3deg C fluctuation which we would like to improve upon, but wondered if PID control would overcome this type of under and over heating ?

Ideally a 200 to 250w 230v mains fan heater would be the tool of choice but nothing at a sensible price around, everything geared of 1 or 2 kw room heaters.

It sounds like your heater has a large thermal mass. Maybe a different approach might work.
I recently made a biltong dryer and used **broken link removed** combined with**broken link removed** as heaters. Five of these were used to give 250W worth of heating. Power (12V) was provided by a **broken link removed**.
The advantage of this is that the heaters can be controlled with a mosfet switched by the micro. A 1mS to 1S pwm period would give you 1000 steps.
PID would help and the integral term will eventually provide all the current to maintain the correct temperature.

PID would certainly work, but a standard home thermostat may do the job just as well. Domestic thermostats have a small built in adjustable heating element, called a heat anticipator which compensates for the thermal time constant of the heating source. It should be possible to set up one of these thermostats to regulate the temperature to within a quarter degree Celsius.
You could program the micro with a PID algorithm to control the heater and reduce the fluctuations.
You might also want to consider a Fuzzy Logic algorithm, which can perform a similar function but may be simpler to understand and program.
If your heater is electric (not fuel or gas fired), an approach that worked for me is to start reducing the power as you reach your set point.

As an example (and the values are fictitious), let's say that you would like to keep the temperature at 20C.
At 18C, you are at full power.
At 19C you throttle down to 2/3 power.
At 19.5C you throttle down to 1/3 of the power.
At 20C you cut-off completely.

The throttling down could be done with phase control, or preferably with integral-cycle control, to eliminate EMI.
Schmitt, what you are describing is PID without the ID. I.E. just proportional, If PID is implemented the integral term will grow until the temperature stays steady.

I will be implementing this myself in the next couple of months as I'm building an incubator for my daughter (to hatch chickens). I'll be using the 12V resistor system I described above.

PID is implemented the integral term will grow until the temperature stays steady.

The "I" term tends to make the setpoint and measured value agree. In an analog controller, the power supply rails become limits. When you implement PID in software, you have to prevent "reset wind up". There is no point for the I term to get bigger that 100%, so you just clamp it there, otherwise the recovery time can get very long.

"D" or the derivative term tends to prevent overshoot.

The P or is the gain of the system. As P gets bigger the control either gets tighter or the system will tend to oscillate.

A very simple explanation is here:


One of the other issues is just how are you controlling the power. This is where things get really tricky. We can talk about bang-bang control which typically gives you lots of overshoot. We can control the number of power line cycles on and off. This tends to reduce RFI. 5 on, 5 off is 50%. if you really want finer control, the phase angle firing is used, It's somewhat better to have 0 to 100% be proportional to V^2 and not V. For a heater, (V^2)/R is proportional to power and usually R is relatively constant except for a light bulb. In that case, the 0-100% gizmo is matched to a Tungsten load. These are some of the finer points. R vs T is incorporated into the power controlling device.

I've done a fair bit with PID. Where I worked and before my time, "they" used a controller that operated into variacs to control 30 V custom tantalum heaters and had analog meters to measure some repeatability of V and I. I said enough of this nonsense and we then used a DC power supply. One thing it lacked was the ability to measure power directly, but unlike the phase angle fired system, power was power and not just used to check the process reproducibility.

We had to change to some sort of non-proprietary control like 0-5 V, 4-20 mA, 0-20 mA anyway because of obsolescence.

We did some cool stuff with PID. In one case, I had an environmental chamber that had it's own temperature controller but we wanted to control the temperature of a sample within the chamber, so my -100 to +100 % was the +-10 degree proportional band around a constantly changing setpoint. e.g. 100% meant you set the setpoint of the chamber controller to the measured value of the chamber plus 10 degrees.
Very interesting, the PID theory.
Thanks for the link PID for dummies. Some people have the uncanny ability to distill a complex subject to simple to grasp sentences. A true gift indeed!

a little of-topic, but nevertheless interesting topic related to control theory, which I read in a scientific journal many moons ago:
Butterflies are perhaps the slowest flying insects. With its bright coloring, they make an attractive target for predators. And with no stingers or barbs, they are essentially defenseless.

So how do butterflies protect themselves? Its flight pattern is absolutely chaotic. This makes it very difficult for predators with a linear control attack method to prey on them.

The journal went to discuss non-linear algorithms that could be used to improve the chances to home on a butterfly. The math was well above my knowledge, so I can't really recall it. Even then the success rate wasn't 100%.

That is the reason for the brute-force approach to catching butterflies: a net with a cross section area dozens of times larger than the butterfly.
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips