Is software PID necessary?

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

utopeya

Active Member
Joined
May 15, 2010
Messages
27
Reaction score
1
Location
Providence
So I'm programming my arduino for my eHERMS, and I'm trying to figure out whether I need to use the PID library to maintain my HLT temperature.

I'd like to know what the arguments are against programming it to do something like this:
1. Turn HLT off when (target temp. + 0.2) is reached
2. Turn HLT on when temp. drops below (target temp. - 0.2)

Will I get problematic temperature oscillation if I do it this way?

I just get the feeling that the PID is going to cause some programming pain, especially since I'm trying to make the arduino do several things at once.

Thoughts?
 
So I'm programming my arduino for my eHERMS, and I'm trying to figure out whether I need to use the PID library to maintain my HLT temperature.

I'd like to know what the arguments are against programming it to do something like this:
1. Turn HLT off when (target temp. + 0.2) is reached
2. Turn HLT on when temp. drops below (target temp. - 0.2)

Will I get problematic temperature oscillation if I do it this way?

I just get the feeling that the PID is going to cause some programming pain, especially since I'm trying to make the arduino do several things at once.

Thoughts?

The easy solution is to buy a Brewtroller where the software is already written. It is Sanguino based.
 
Doing hysteretic control like you've proposed will cause the temperature to oscillate, but it absolutely shouldn't be a problem. In fact, I suspect that many people using a generic PID are getting larger oscillations than this because they haven't got the time constants set up correctly.

Moreover, depending on the resolution of your ADC, you could have an oscillation just because of the quantization error introduced in converting the temperature signal to a digital value. For example, if your LSB is 0.5degC, unless your system is noiseless (it's not) and your set point is precisely on a bit boundary, you will get an oscillation between the two neighboring values, meaning that you have no more temperature certainty than you would with a hysteretic controller that just looks at the output of a comparator with a half degree hysteresis band.

My 12gal cooler HLT is direct heated with a 2kW electric element with a +-0.5degC hysteresis band, and once it's at temperature the element and circulating pump only turn on once every ten minutes or so. I'm pretty sure I'm still a much bigger source of error than my controller is. :)
 
Thanks, guys.

Sawdustguy: the problem with that solution is that it would require me to buy a Brewtroller. I'm having fun with my arduino, plus I'm broke.

Kwantam: that's the kind of information i was looking for. Looks like I'll be doing hysteretic control, at least until I get bored and decide to dive into the arduino's PID libraries. (I'm not sure about quantization error--my probe is a OneWire, which plugs into a digital IO pin. Honestly, I have very little idea how it actually works.)
 
(I'm not sure about quantization error--my probe is a OneWire, which plugs into a digital IO pin. Honestly, I have very little idea how it actually works.)

According to the datasheet, the DS18S20's LSB corresponds to 0.5degC steps, so I wouldn't fret that you're adding much additional error with a hysteresis band of about that size.

(At least, I assume that's the sensor you're using.)

I generally use the LM335 temperature sensor and set my temperature reference with a potentiometer, then just use one of the comparators on my microcontroller (I've used both the PIC16F628 and the C8051F410, just because I happened to have them lying around; the latter is pretty overpowered for this, though). My UI (a multimeter, heh) is admittedly clunky, but it lets me throw together a new temperature controller out of $5 worth of spare parts in 10 minutes any time I need one.

In principle, one could do this with nothing but the temp sensor and a comparator, but it's nice to be able to make arbitrarily intelligent debouncers and add things like a switch lockout time when controlling a fridge.
 
utopeya,

From a controls standpoint, with a system that responds as slowly as a RIMS / eHERMS / eHLT, you're really not gaining a whole lot by using PID over basic on/off control. The hysteresis will essentially just protect your relay from continually turning on and off (and the various problems associated with that).

I also agree with kwantam that your on-off control approach with 0.2 deg of hysteresis will probably produce less oscillation than most people's complicated PID controllers. Unless they have rigorously tuned the controller, chances are that it's essentially behaving like an on-off device as well.

I'm nearly done putting together an eHLT that's going to be controlled in a very similar way. I'll be using my own PIC based control board instead of an arduino, but I'll be doing on-off control as well. Let me know how yours turns out.
 
kwantam,

I've used an MCP9700A to give me feedback for my fridge controller for a couple of years now, but I've been hesitant to use it in my actual brewing process. It's available in the same basic packages at the LM335, and that has been part that is holding me up. How did you pot the sensor so that you felt comfortable sticking it in your HLT?

For brewing and for my electric smoker I've typically used thermocouples and a MAX6675 thermocouple to SPI converter. It does cold-junction compensation and spits out the 12-bit temp value with 0.25 deg accuracy. If I had a good way to integrate a TO-92 package, it would be a whole heck of a lot easier to use an analog line for feedback.
 
bblack7489,

I'm using the TO-92 packaged device entirely potted in non-toxic epoxy. To be extra careful, PTFE insulation on the wire is food safe and will withstand much higher temperatures than I'm using here. I've also used standard PVC insulated wire for temperature sensors in non-potable hot water baths; it'll certainly take the temperature, the only issue is if you're worried about leeching.

I always put the potted temp sensor in boiling water for 10-15 minutes before using it.
 
For all you guys that are in Austin:
I am thinking about starting my Arduino build as well. Any takers on hanging out and taking a look at some builds while drinking beer?
 
I would typically be up for it, but I'm traveling for work over the next few weeks and am stupidly busy with the crap that goes along with that.

Regardless, keep me posted if you end up meeting up with people.
 
I think that without the PID software you would get overshoots like crazy.

You'll get oscillations due to the delay in the system, but the nature of the hot water heater element / large volume of water system means that you won't actually get much overshoot. If your sensor is fast enough (which is typically a valid assumption since we're talking about digital temperature sensors of some sort) and if your water is stirred sufficiently the temperature will almost completely stop rising as soon as you turn off the heat.
 
Run the system manually and use a notebook or datalogger for a few batches that you consider to be fairly average in grain bill and mash thickness. Use that empirical data to derive some setpoints for your heating element with respect to desired temperature. No need to get overly complex unless that's your thing.
 
Since this thread has reappeared, I can update with my experience. On the couple of batches I've brewed with my system (my band is set at +-0.2F), I get oscillations of about +-.5F, and when I'm initially heating, I overshoot by maybe a degree or so, but everything settles into place fairly quickly.
 
Since this thread has reappeared, I can update with my experience. On the couple of batches I've brewed with my system (my band is set at +-0.2F), I get oscillations of about +-.5F, and when I'm initially heating, I overshoot by maybe a degree or so, but everything settles into place fairly quickly.

Is that with an on-off, hysteresis control or did you end up using the PID library? Also, what sensor are you using?
 
To get true pid control you need a variable output, something like pwm control for electric heating or a vane type valve to control air cfm for the air/gas mixture. With on/off control the pid algorithm becomes a proportional controller, the integral and derivative values have nothing to act on.
 
IMHO if the process take more than a couple minutes to reach setpoint the integral windup will either have to be limited or the sample time will have to be set to a long interval between samples if you hope to get it to work. For the slow response situations, simple on/off control or proportional control is more than adequate given the hysteresis of the sensors and process response times. In simple terms, a Love or Ranco controller will work well for HLT and MLT control, an PID controller is not going to improve the control significantly because of long response times.
 
Back
Top