25

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.

hildred
  • 852
  • 1
  • 7
  • 17
  • 8
    +1 just for the title. I really wish I could give you an answer. – Roger Rowland Apr 21 '16 at 20:19
  • 1
    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. – Dave Tweed Apr 21 '16 at 20:41
  • @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. – hildred Apr 21 '16 at 20:56
  • 1
    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. – Dave Tweed Apr 21 '16 at 21:10
  • @DaveTweed, Which surface? most of the heat is lost from the top and all of the heat is gained from the bottom, and since I am gaining and loosing temperature there will be a difference between the surface temperature and the center of mass which is the temperature which actually affects the growth of the culture. – hildred Apr 21 '16 at 21:18
  • If you can't maintain all surfaces at essentially the same temperature (insulation will help), then pick the surface that's being heated. Have you researched this at all? A quick Google search turned up [this site](http://www.salad-in-a-jar.com/recipes-with-yogurt/more-than-six-ways-to-incubate-yogurt-without-a-yogurt-maker), which seems to have several good ideas on the topic. It seems to me that you're over-thinking this. Rather than throwing a lot of technology at it, just provide better insulation! – Dave Tweed Apr 21 '16 at 21:38
  • @DaveTweed, Other than the proofing oven method (which my cousin uses), all methods that you linked to are annoying. Heating pads are not calibrated on their packaging requiring several tries to get working smoothly, my grandmother's favorite method of top of the water heater does not work on energy efficient units, the cooler is fairly involved. and most of those methods are not exactly repeatable. PID on a crockpot works every time, perfectly with less than ten man minutes per batch (assuming an oven timer that will go to 11:59). I have probably thirty 'recipes' for small batch. Cont ... – hildred Apr 21 '16 at 21:57
  • ... Cont. What I cannot find is any discussion on large batches or continuous process. Only half of this is practical in that I eat the yogurt. I also want to learn how to do large scale process control. – hildred Apr 21 '16 at 22:00
  • 2
    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. – ndim Apr 21 '16 at 22:01

4 Answers4

9

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.

Olin Lathrop
  • 310,974
  • 36
  • 428
  • 915
3

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.

Nick Alexeev
  • 37,739
  • 17
  • 97
  • 230
  • 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.) – hildred Apr 21 '16 at 22:11
  • 1
    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. – Nick Alexeev Apr 21 '16 at 22:27
  • 1
    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). – WhatRoughBeast Apr 21 '16 at 22:46
  • @WhatRoughBeast, the problem is, if you stir the yogurt won't thicken. – The Photon Apr 21 '16 at 22:56
  • @ThePhoton - Ah. Well, then. You can tell I've never made yoghurt. – WhatRoughBeast Apr 21 '16 at 23:06
  • 1
    @ThePhoton - Per this video https://www.youtube.com/watch?v=LAZR1CUcLb0 and https://www.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. – WhatRoughBeast Apr 21 '16 at 23:29
  • I think occasional, gentle stirring shouldn't cause a problem (unless you're trying to make French set yogurt or something like that, of course). The negative effect of stirring will probably be much less significant than temperature nonuniformity, anyway. Most commercial yogurt is [apparently stirred](http://nchfp.uga.edu/publications/nchfp/factsheets/yogurt.html). Some advice from the experts [here](http://cooking.stackexchange.com/questions/26126/how-can-i-get-homemade-yoghurt-to-thicken-properly). – Oleksandr R. Apr 22 '16 at 13:20
  • @WhatRoughBeast, well I never experimentally tried stirring since all the recipes I read said to leave the stuff alone. In my experience leaving it to sit in a gas oven with the pilot light providing heat produces fine yogurt with little trouble. I've never tried for a 1 gallon batch either, but since you start with hot yogurt and just put it into the oven to maintain the temperature I wouldn't expect that to be a problem either. What would be a problem with a big batch is cooling it down from boiling to ~40 C before inoculating it with the yogurt culture. – The Photon Apr 22 '16 at 14:52
  • I wouldn't think a hotplate is a good means of heating the mass. It's at the bottom and relying on some mixture of convection and conduction to homogenise the temperature of the yoghurt. With heat loss from the top and the sides this is going to be quite complicated thermal physics. I'd want to get the temperature into the fluid from inside, which to me would suggest some form of immersion heating. Also, I thought this would be a spillage question, like "coke on my keyboard" or "water in my PSU". :) – Ian Bland Apr 28 '16 at 01:55
  • +1 for loss of convection, duplicated cheap US$10 controllers is a viable option. However I think the easiest will be the water bath with _Any Old Controller_ to hold the temperature and using smaller containers to remove the concern with the loss of convection and keeping the conduction distances smaller. – KalleMP Feb 05 '17 at 22:09
2

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.

Kelifer
  • 21
  • 1
1

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!

Neil M
  • 11
  • 1