This is part 6 of my reflow controller series. Let’s see if we can get the reflow grill to a stable 150°C.
It’s not trivial: this grill has a slow startup time and a very noticeable lag in its response curve. Turning on the grill and turning it off at 150° is not the way to do it, since the stored heat will lead to a huge overshoot.
The proper way to do this is to use a PID control algorithm. PID stands for Proportional Integral Derivative. It’ll be interesting to try that, but first I want to try something simpler (actually, it is still PID, but just P and D).
The idea is to try and predict where the temperature will end up when we turn the heater off. I’ve got two relevant pieces of information for my particular grill, obtained from the last few trials:
- The grill will heat up at about 2.5°C/sec once it gets up to speed.
- When turned off at that rate, it appears to overshoot by about 40°.
Let’s try something easy first. Let’s find out what the grill does when turned off at 110°. I’ve added this line to the GotData proc to do so automatically:
if {$value >= 110} { set heat 0 }
Result:
Not bad – still some overshoot, so I’m going to assume an overshoot of 50° from now on. BTW, this is not the same as keeping the oven at a preset temperature, but it’s a start. In fact… I’m going to keep this line as a permanent safety valve:
if {$value >= 265} { set heat 0 }
It’s not essential, since the grill has a mechanical temperature cut-off as well, but that way I can be sure that this code will never try to push its heater beyond 265°C. It would have avoided yesterday’s runaway failure.
To improve on this, let’s assume that the overshoot is proportional to the heat-up rate. So if we turn off the heater while it’s heating up at 1.25°C/sec, it will overshoot by 25° – it seems plausible, since that probably means the heater hasn’t been on that long yet, so there is less “stored excess heat” in the system.
Next thing to do is to track the rate of change and base heater decisions on that. I’ve added a new HeaterControl proc which decides what to do for a given target temperature:
Note that heater control is simply a matter of setting the heat variable. It controls both the remote switch and the GUI checkbox, courtesy of Tcl’s built-in variable tracing facilities. This does the actual control, in GotData:
set heat [HeaterControl $value $lastv $x $lastx]
And in the start proc, this extra code will get the ball rolling:
variable target 0
after 10000 set [namespace which -var target] 150
IOW, after 10 seconds, JeeMon will attempt to maintain the grill temperature at 150°C. Let’s try it:
Woohoo, it works! A thermostat!
The “application.tcl” source code is available here. Next step is to add a reflow temperature profile.
Any ideas on how to make it learn about the overshoot itself?
For the first version, I’m thinking of using a calibration run: heat up to 150°, then measure what happens. I hope that the response to a single step pulse like that is sufficient to get a reasonably well-tuned reflow system.
Maybe the basic shape of an oven heating is always the same with on/off control?
Maybe the way it behaves at the start says something about how much energy it stores before it reaches the sensor?
With PID, the “I” is proportional to the time that the heater is on, I think. That’s basically the amount of energy pumped into the system. I’m still exploring – trying to get some sort of intuition about PID control. Not sure I can, but it sure would help find the proper settings!
To a first order approximation, you can think of it as a thermal circuit. Pretend that the heating element is a current source. It isn’t, it’s a heat source, and the heat it flows into the oven is measured in Watts. The hotplate/oven itself is a capacitor – and in fact “heat capacity” is the engineering term for its value, and the usual units are Joule/Kelvin. There’s a given thermal resistance between the oven and ambient – measured in Watts per Kelvin. If there are more significant components, add them in, with their heat capacities and thermal resistances. (Use the ‘ground’ symbol for the ambient temperature.)
You wind up with a network of thermal resistances, heat capacities, and heat sources. You solve it with Ohm’s and Kirchoff’s laws the same way you do an electrical circuit.
(Hey, Kevin, greetings – nice to hear from you!)
Thanks, that helps a lot. I knew this from heat sink calculations, but it hadn’t occurred to me that it’s indeed all about “flow of heat” with sources and drains. Difference with a heat sink under constant load, is that I’m using on/off control to make the oven follow a preset temperature profile over a couple of minutes.
The challenge here will be to find a simple way to (self-) calibrate this circuit anywhere, so it can be used for reflow with whatever people decide to use: grills, mini ovens, skillets. The temperature control need not be precise – only detail is that a step from 180°C to 250°C shouldn’t overshoot by too much. The slow ramp up to that point can be used to try and “balance” heat flow in the system, so that both the oven and the PCB are in a fairly stable and reproducible state when they reach 180°. There’s a follow post w.r.t. reflow profiles coming up tomorrow.
Follow-up: maybe that’s the way to do it: hunt for 180°. Then use a step and measure overshoot. Fall back and stabilize again at 180°, and try an improved step time. Until the 180-to-250 step works well enough? It’s very empirical, but I’m not sure real PID control is going to be worth aiming for, since that requires proper tuning – from what I’ve seen and tried, that’s the hard part.