23
\$\begingroup\$

How do you change the tuning of a PID controller to deal with changing thermal properties?

The project: I am making yogurt. It cultures at 110 deg F for about half a day; you put in milk and a little starter culture and get yogurt. Save a little for a starter for the next batch and eat the rest. Easy and delicious.

The setup: I am taking a food safe container (pan with lid) placing it over a heater, adding a type k thermocouple, SSR and PID controller all wired pretty much per the reference implementation of any PID controller you care to name. This works well if I am using a crockpot (225W, approximately 3/4 gal) as both my pan and heating element, but I want to do larger batches (1 gal).

The problem: With a larger heater to thermal mass ratio (1000W hot plate and stainless steel pan instead of ceramic). There is increased instability during the later part of the cycle. The PID controller is tuned with water (milk is a little more expensive) and holds temperature within 2 deg F for the first couple hours, but as the yogurt cultures I am noticing pronounced temperature swings, and unlike using the crockpot I am seeing whey separation (presumably either due to over temp or increased condensation on the lid due to the same). I am fairly sure that the larger thermal mass was dampening the noise of the change of the thermal conductivity during the culture, but I am unsure how to proceed to more precisely control the temperature during the later stages without excessively compromising temperature regulation at the beginning.

\$\endgroup\$
  • 7
    \$\begingroup\$ +1 just for the title. I really wish I could give you an answer. \$\endgroup\$ – Roger Rowland Apr 21 '16 at 20:19
  • 1
    \$\begingroup\$ It sounds like you have your temperature sensor in the wrong place. The thermal characteristics of the culture should not be affecting it. The sensor should be outside the container, not inside it, since the whole idea is to maintain thermal equilibrium. Maybe you should include a diagram of your setup so that we can be clear about the relationships among the various elements. \$\endgroup\$ – Dave Tweed Apr 21 '16 at 20:41
  • \$\begingroup\$ @DaveTweed, For the crockpot version, Just remove the screw from the lid handle leaving a hole in the lid to insert the thermocouple, placing the thermocouple junction in the middle of the thermal mass, since the temperature of the yogurt is what I care about. plug the crockpot into the ssr. for the pan version the only change is substituting a Stainless steel pan on a hotplate, again thermocouple in center of mass. \$\endgroup\$ – hildred Apr 21 '16 at 20:56
  • 1
    \$\begingroup\$ Exactly my point. You don't care about the "center of mass", since if you can keep the outer surface at a constant temperature, the rest will take care of itself. The surface is where any heat is gained or lost. Your approach assumes that there's going to be a significant temperature gradient within the culture itself, which is exactly what you're trying to avoid. \$\endgroup\$ – Dave Tweed Apr 21 '16 at 21:10
  • 2
    \$\begingroup\$ As it has not been mentioned yet: Like all living organisms, the yoghurt cultures also generate heat which might contribute measurable temperature changes when their collective metabolism picks up. (I know the effect is noticeable with yeast in bread dough, but the same thing might happen with yoghurt.) With smaller surface to volume ratio, this disturbance to the PID controlled system might become more pronounced. \$\endgroup\$ – ndim Apr 21 '16 at 22:01
9
\$\begingroup\$

The real problem seems to be your mechanical setup, not the PID control detail. PID control may not even be what you want at all.

I'd start by putting the container of yogurt culture inside a water bath, then attempt to regulate the water bath temperature. The extra thermal mass of the water will lengthen the dominant time constant, and won't depend on what is going on inside the container much.

With a longer time constant, simple thermostat on/off temperature control should work well enough. You want the heater power to be low enough so that the water bath only changes a little, like maybe 2-4 degrees, within one time constant. Simple threshold-detecting on/off control will then work very well.

Instead of adding hysteresis to prevent rapid oscillations at the setpoint, just hold the output fixed for a short time, like 1/50 of the time constant or so.

A long time ago, I made a temperature controlled water bath for photographic film processing. The mechanical setup was one of those plastic "Rubbermade" style tubs, a fish tank pump to keep the water circulating, and a 300 W off the shelf immersion heater meant for a coffee cup. Two thermistors in series placed on opposite sides of the tub provided the temperature feedback. This was before the age of microcontrollers, so a flip-flop sampled and held the on/off signal every 64 line cycles. That controlled a relay, which switched the immersion heater on and off. It worked really well. Once it got to regulation, the temperature stayed fixed to a fraction of a degree F.

You are over-thinking this with a PID controller.

\$\endgroup\$
3
\$\begingroup\$

I imagine that your batch becomes more viscous as it ferments. The convective heat transfer becomes weaker, so overall thermal conductivity decreases.

One possible solution would be to use immersion heaters, which would be evenly distributed throughout the volume. The average distance that thermal energy would have to travel will decrease, and your setup will be less dependent on thermal conductivity.

Another possible solution is to have several sets of PID constants. The first set would be tuned for thinner raw milk. The second set would be tuned for thicker yogurt. You could switch from one set of constants to another after a fixed period of time that's know a priori.

\$\endgroup\$
  • \$\begingroup\$ Yes the viscosity increases, and your reasoning in the first paragraph matches mine. I will look at immersion heaters. but your third paragraph is where you have my interest, Where would I find a COTS pid controller with multiple constants? I am familiar with omega, and aubner, and somewhat familiar with honeywell. as far as I know none of them can do this. OS pid being open source is a possibility, but at the moment I cannot recommend it as it has serious issues (I am working on it). secondly and more importantly how would the constants differ? (this is my core question.) \$\endgroup\$ – hildred Apr 21 '16 at 22:11
  • 1
    \$\begingroup\$ Off-hand, I'm not aware of a COTS that can store two sets of constants in one controller. But here are some ideas. (1st idea) Some Omega controllers have a communications port (serial, ethernet), and you could update the constants from a computer. (2nd idea) You could use 2 separate controllers (with different constants). The temperature sensor is connected to both controllers at all time. The heater is connected only to one controller at a time. (3rd idea) I've heard about controllers that continuously self-tune themselves. Such controller could adjust to a drift in thermal conductivity. \$\endgroup\$ – Nick Alexeev Apr 21 '16 at 22:27
  • 1
    \$\begingroup\$ Alternatively, put the temperature sensor at the bottom of the pot. Or add a mechanical stirrer to keep the temperature uniform (probably not a good idea if your yoghurt gets real thick, I know). \$\endgroup\$ – WhatRoughBeast Apr 21 '16 at 22:46
  • \$\begingroup\$ @WhatRoughBeast, the problem is, if you stir the yogurt won't thicken. \$\endgroup\$ – The Photon Apr 21 '16 at 22:56
  • 1
    \$\begingroup\$ @ThePhoton - Per this video youtube.com/watch?v=LAZR1CUcLb0 and youtube.com/watch?v=daBustjm0lo (about 4:15 you can see the stirrer) yoghurt can be made using a stirrer to keep the temperature uniform. At any rate, a better idea would be to make a stirred water bath for the fermentation container. \$\endgroup\$ – WhatRoughBeast Apr 21 '16 at 23:29
1
\$\begingroup\$

Since the thread has already ventured away from PID in using the electrical energy to make yogurt, I thought I might suggest another approach...

Put the milk and starter in your crockpot and turn it on high. When the temperature of the mixture gets to 160 degrees F, take the pot out of the crock pot and put the lid on it. Without delay, wrap the pot with a towel or two, and put it inside your best beverage cooler.

"You are over-thinking this with a PID controller" (Olin Lathrup, above) and with multiple controllers (and their overhead circuitry), immersion heaters, or COTS (me, here).

If you absolutely must have an EE footprint on the process, you can design a temperature detector that detects 160 degrees Fahrenheit and causes beeps or buzzes.

\$\endgroup\$
0
\$\begingroup\$

I might be a bit late to the game here, but I was looking something up and came across this thread. I make yogurt using this - no water bath required:

https://github.com/CapnBry/HeaterMeter/wiki

which I put together myself (but he now also sells them; it's all open-source). The original intent was to control a bbq, but I've found it works perfectly for sous vide, and also for yogurt. I control the dumbest Crock Pot there is (Off, Low, High), and have a lid with a hole in it; you can get them at Sears etc if yours doesn't already have one.

I use the probe he recommends, but also have a second independent probe just for peace of mind! I leave the setup running for ten hours, then pour the yogurt/whey mix into a colander lined with regular paper towel and let it drain. The drain time varies, and you can stop draining when you have reached the desired consistency.

Just to give a full rundown of the process:

1) pour 1 gallon of milk into a large stock pot, and slowly bring it up to 170F on the stove, let it sit at that temperature for 5-10 minutes

2) turn on the oven and put the Crock Pot bowl in, to warm up to about 230F, just to kill any bugs (kinda optional, sometimes I'm lazy but have never had a bad batch yet)

3) cool the stock pot in the sink by floating it in cold water, until temperature reaches 100F

4) pull the Crock Pot bowl out of the oven and place it in the Crock Pot, let it cool off but turn the PID controller and the Crock Pot on (Low)

5) into the sterilized milk, whisk in about half of a small pot of Greek Yogurt (I prefer Chobani, but pretty much any live-culture yogurt will do and it's fun to experiment, Fage is good)

6) pour the whole lot into the Crock Pot (I have a Crock Pot that magically accepts 1 gallon - funny how that works!)

7) Put lid on, insert probes, let it run for 10hrs

8) get all geeky with the webserver in the HeaterMeter! (don't worry about the actual numbers in the image - there's a good reason they're different from what I've mentioned, too much detail to go into here)

9) when ready, drain yogurt as described above (liquid whey is great for bread making in a machine, BTW)

10) put in little containers, refrigerate, eat!

I hope this helps someone somewhere enjoy using high tech to make the most basic food - I certainly enjoy it!

Web page for geeking about how a PID controller makes yogurt!

\$\endgroup\$

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.