Electronics: PID for temp control; any rule of thumb for design here?

It started out when I felt like making a little temperature controller with a Peltier which has the convenience of being able to cool or heat.

An electronics book I have gave a sketch of one, and it seemed darned simple. An integrator, differentiator, and proportional feedback path are summed and used for control. All that was needed was to select component values. Seeing if there were any guides online on component selection, I went to the web only to find really, really technical discussions. Granted, I liked their thoroughness, but it is a little over my head. Laplace transformations? Matrices? Uhh…

The principle behind them seems simple, though, so it surprises me that there isn’t some kind of more simple heuristic for picking components, for example how the time constants for the differentiator and integrator should be related (if they should at all), etc.

I am hoping to maintain the temperature of a relatively small enclosed space (think modestly-sized aquarium) only 5-10 C from ambient (in either direction), but I’d really like the oscillation to only be around 1 C if possible, though I could accept 2 C (this would require calibrating the temperature sensor which I was hoping to avoid). The original plan was using a linear temperature sensor (SOT23) for detection, and controlling the Peltier with a PWM. I have a nice tech note from TI regarding this. That’s when my boss suggested a PID for solid control. Sounded like a fun project until now.

I know there’s a few electronics guys out there. Any help with a PID, or any advice for alternatives? Or is a PID a case of overengineering this problem? Any advice would be appreciated. Whenever I’ve worked with temperature control before, I’ve used circulating water baths. A little outside my price range. And, well, it is hardly a project to buy a water bath and plug it in. :slight_smile:

It is worth noting that stability is much more important than the initial rise time. If it takes a day to get to temperature, no problem. But it should be able to lock on to that temperature given normal temperature swings in a home.

One thing to keep in mind with peltiers is the hot side gets hot, the cold side gets cold (and it’s reversable which is which just by reversing the polarity), but here’s the important thing that a lot of folks forget: Peltiers aren’t all that terribly efficient and all that inefficiency gets turned into heat too. You have to do something to get rid of the excess heat or the whole thing will heat up. I’ve seen a lot of newbies get surprised when their cold side gets hot (at which point I do mention that the hot side is still hotter, so it is working).

Anywho, entire books have been written about PIDs, and few of them are ever geared towards beginners who probably need the books the most. What you are basically dealing with here is feedback control. Your circuit is going to feed back an error signal which is proportional to the difference in the temp you want vs. the temp you got. “Proportional” is the P part of PID. The I is for integral. The integral part is just an integral of the error signal, which is kind of like adding up all of the long term errors over time, so the integral part is to take care of long term errors not handled properly by just the P part of the controller. In other words, if you set the temp of your aquarium to 28 deg C and the proportional controller always ends up shoving it up to 30 deg C, it’s the I part of the controller that’s going to keep it down to 28 in the long run. How much I signal you need probably isn’t critical, since you are looking at long term stability in a system without too many upsets, but if you don’t have enough I then you’re aquarium is going to take too long to correct for temperature offsets. The D is the derivative part of the controller, which is going to respond to fast changes. In other words, if someone dumps ice in the aquarium, the D part of the signal is going to say “hey, this is a really fast change, let’s compensate for it because the P part of the controller is too slow to respond to stuff like this.” Unless you really have someone dumping ice in your aquarium, you probably don’t need to worry too much about the D. You can probably run an effective PI controller.

If you are going to go all analog, PI or PID controllers can get a little tricky, just because op-amps tend to misbehave occasionally and you don’t want to end up with weird oscillations in your controller. If you use something like a PIC with an A/D and D/A built into the chip, you can impliment the PID digitally, which really reduces your parts count for your controller and makes it a little less squirrelly.

Temperature control? PID control? Dude, you’re singing my song. I’ve spent the better part of my life involved in control systems and temperature calibration/metrology.

First of all, you’re on the right track. PID control is the way to go. But it sounds like you need a primer. Nuts & Volts Magazine recently published an extremely good, three-part series on the subject in their January-05 through March-05 issues. It was written by Aaron Dahlen (apdahlen@hotmail.com). I highly recommend you read it before proceeding.

Secondly, I have some tips on how you should proceed. For example, it is my opinion you should be using a thermistor or semiconductor probe as a sensing element. Anyway, if you need one-on-one help, feel free to email me at magcraft@main-net.com.

Thanks for the quick replies, sorry for the late responses but I had to do some digging.

engineer_comp_geek, a PIC solution is an interesting one. I’ve wanted to get into some microcontroller tinkering for a while now, but have felt the initial costs are not warranted by what I’d get out of it. Dev kits, compilers, etc., are a bit too much of an initial investment for me at this time. But before ruling it out, I decided to look around the internet and sure enough, I found some flash PIC programming kits that were apparently reasonably priced and came with the proper program for downloading to the kit-constructed board. The prices seemed reasonable. So that is certainly an option. If you hadn’t mentioned it, I would have never known that microcontrollers are cheap enough to pursue.

Crafter_Man, thanks for the link. Unfortunately I couldn’t locate anyone around me that carried the magazine, so it looks like I’ll have to backorder it, if you think it is worth the money (looks like $5 each). Rather than hound you with a bunch of questions now, maybe I should get those before continuing, as you suggest.

erislover: The back issues would be worth it at $50 each. Seriously. I mean, think about it… how much is your boss paying you an hour? The cost of those three issues is probably equivalent to about 20 minutes of your time, yet they will probably save you at least 40 hours of trial-and-error labor.

In the January issue, Aaron Dahlen expertly explains the function of each term (P, I, and D) both quantitatively and (even more importantly) qualitatively. In the February issue he walks you through the design of a simple analog PID controller using op-amps. (A schematic is included.) In the March issue he walks you through the design of a digital PID controller using a ZILOG Encore! microcontroller. (C code is included.) All-in-all, it’s an awesome series. Definitely get it.

Well, yeah, if I could find a reason to get it for work that’d be a no-brainer. :smiley:

I’ll wait until the March issue is available through backorder and get all three. Then I’ll come hound you. :wink:

Oops, sorry. When you said, “That’s when my boss suggested a PID for solid control,” I assumed this was for your work.

At any rate, definitely get those three issues, as it’s the best and most hands-on tutorial on PID control I’ve ever come across. (Most tutorials are just full of equations.) And yes, please feel free to hound me. :wink: