Peltier PWM Temperature Control: First Light

Without much tuning at all the Peltier module holds the MOSFET-under-test block within the ±1 °C deadband for heating to 30 °C:

Bringup Test - Igain 0.01
Bringup Test - Igain 0.01

And it’s pretty close for cooling to 10 °C:

Bringup Test - Cool - Igain 0.01
Bringup Test - Cool - Igain 0.01

The PWM and Integral traces refer to the right-hand Y axis scale, the rest to the left. The total elapsed time is a bit under 3 minutes, but it’s measured in samples because I’m not going to bother with a formal timebase for this thing.

The Basement Laboratory is around 14 °C right now, so cooling isn’t all that much of a problem.

The code doesn’t really run a PI loop: it switches from P control outside the deadband to I control inside, preloading the integral accumulator to maintain the PWM value at the inbound switchover. That sidesteps the whole integral windup problem, which seems like a Good Idea, but a quick test at 50 °C says the P control may not have enough moxie to reach the deadband and the I control seems overenthusiastic.

More fiddling is definitely in order.

So far, the machinery looks like this:

rDS Tester - Peltier Tests
rDS Tester - Peltier Tests

The aluminum block toward the rear holds the MOSFET and the thermistor atop the Peltier module, all stuck on the black CPU cooler with the fan on the bottom. The various heatsinks are obviously scrounged from the heap and are much too large; some fine tuning is in order now that the temperature’s nailed down.

9 thoughts on “Peltier PWM Temperature Control: First Light

    1. Real tuning requires math and measurements I can’t justify, but a simple hack job works well enough.

      With that in mind, this loop is, mmmm, suboptimal; tomorrow I’ll show one that works better.

  1. That looks suspiciously similar to the temp curves one gets from a bang-bang servo.

    If I’m reading the graphs correctly, the I term isn’t reacting to the changing error as one would expect. So it seems to be all P and no I in the control room.

    Did you try the usual approach to empirical tuning: start with P only and increase P until the system just starts to oscillate? Once you have this critical gain determined, it’s relatively easy to add I (and D, if you want) — especially if you can print out their respective contributions to the control signal as you have done.

    Can’t wait to see tomorrow’s results, in any case.

    1. +1 Hexley
      This is usually how I tune loops for industrial controllers. It is REALLY helpful to trend out the P,I,and D terms with the PV, SP, and output.

      I start with P like hexley says, adjust the I gain until the overshooting oscillations diminish to the set point over 1.5 – 3 cycles and then tune up the D gain until it stops over shooting. Once tuned up windup shouldn’t be a concern.

      Reading your reply to George it sounds like you may have already worked something out :)

    2. the I term isn’t reacting to the changing error as one would expect

      Yeah, I was trying to be clever with this one and added some internal logic: it almost worked, but I had to stop trying to be so mumble clever and just let the PI loop do its work.

      What those results show, however, is that the overall response is fairly slow, which means that bang-bang control is pretty nearly all it really needs: full throttle until it’s near the deadband, then turn on the PI loop.

    1. That probably produces a coherent set of coefficients, rather than the oddly biased assortment that you’d (well, I’d) get by just fiddling around. They may not be optimal, but they’re close enough for most purposes.

      After I get everything else running & the columns written, I should take another pass at this mess…

Comments are closed.