I designed from scratch an analog PID controller to mantain a temperature selected in the range of 60 to 80ºC with a room temp say = 20ºC. The "plant" is a simple 4R7 5 W resistor heated by a PWM-controlled current (100% to 0% range).

For any given setpoint, say 67ºC, I know that room temp is lower, so, if heat is not supplied, the cold source (room) will be pulling the temperature continuously down.

My question: where should I "center" my PWM duty cycle excursion?

  1. If $V_{err}$ = 0, DC = 50%? I heat the resistor with more or less current, pivoting on $V_{err}$ =0

  2. For $V_{err}$ =0, DC = 0% (minimum or null current)? I heat the resistor with a varying current only if Verr is positive

Option 2) seems somewhat reasonable to me, but, at the same time, I see that I am just controlling the heating side of this. Do I leave the room alone doing the cooling with no current supplied by me?

  • $\begingroup$ What do you mean by PWM duty cycle excursion? Also, a simple diagram of the two situations you describe would make this question much more clear. $\endgroup$ – Chris Mueller Oct 21 '15 at 21:12
  • $\begingroup$ With respect to cooling it's quite typical that a PID controller will only control adding energy to the system rather than adding and removing. For example most motor control PID controllers will only control voltage to the motor rather than also operating a brake when speed is overshot. $\endgroup$ – Myles Oct 21 '15 at 22:08
  • $\begingroup$ Hi Myles, I am not asking if adding or removing but adding more / adding less for option 1 or, in option 2, adding when needed and let the system to cool by itself. $\endgroup$ – atferrari Oct 21 '15 at 22:18
  • $\begingroup$ For excursion I meant "variation" of the duty cyccle. $\endgroup$ – atferrari Oct 21 '15 at 22:20
  • $\begingroup$ I don't follow what the alternative is to "let the system to cool by itself"/"Do I leave the room alone doing the cooling with no current supplied by me?". If you overshoot your desired temperature what other than the room would do the cooling? In a typical PID controller you would initiate action not just if Verr is positive but also if it is negative but rising too rapidly (the D portion of PID covers this). $\endgroup$ – Myles Oct 22 '15 at 14:59

You seem to be ignoring the I term, since you ask about "centering". You can think of the I term as automatically providing the centering value, although thinking of "centering" will probably lead to other misconceptions in the first place.

You also say this is all done with analog electronics. Carefully store your circuit in some archival packaging, and maybe you can find a museum that wants it. Then go back and do it right with a microcontroller. That way you can tweak the parameters much more simply, see what's going on and log the internal state of the PID controller more easily, and possibly apply non-linear techniques as appropriate.

That all said, have you looked at the really simple and obvious thermostat control scheme. That will have some output ripple, but since you've given no spec on accuracy, we don't know at this point that it's not sufficient.

| improve this answer | |

More details about the design of your PID controller would be helpful. Is this a purchased unit or one you programmed yourself on specific hardware? Assuming your PID controller is functioning correctly and that your temperature input it calibrated; it will eventually converge. Tuning and triggering based on PWM instead of discrete on/off will just affect the time it takes to converge. I am not familiar with your Verr term; if this is your feedback error; zero error should equal zero output once the PID stabilizes.

It sounds like your heating source is under powered for the task at hand. This could be why your setpoint is always higher than room temp. Your controlled input(your resistive heater) must be greater than your loss at the target temperature(maybe 100W at 67C). Im not sure what "room" constitutes in your question, but in a small 20ft x 20ft insulated room, a 5 watt resistor can be on 24 hours a day and make little difference in the temperature. If you instead hook up a relay (may require modifying your algorithm to be discrete) and a 500+ watt heater, the PID now has excess heating capacity and can do its job by regulating the duty cycle.

PWM is probably overkill for a simple application like room heating; as it typically does not have lots of dynamic loading. Once your heating source is sized correctly you can use power mosfets to accomplish this if necessary. If you attempt this on a forced convection heating device, make sure to leave the fan motor on non-PWM power.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.