DS18B20 PID Tuning on the warm side


Inside one of the boxes.
Sorry, that should have read two boxes of 12 bottles each with 6 loose bottles.


Here is the chart for the last 44 hours.


Previously was it in the liquid in the bucket? If so that that is a vast change to the system.


It was inside a stainless steel tube about 12" into the liquid. This one was inside a cardboard box with the lid taped shut, no air flow. I think I would expect a little over shoot because of the insulation of the cardboard compared to a thin layer of food grade plastic. That's why I didn't give it much thought. It's not a typical batch.


What you have now is measuring the temperature of the air inside the box, which will react completely differently to the temperature of gallons of liquid. In fact I am surprised it controls as well as it does. It just goes to show how tolerant PID is.


It's a temporary situation. As soon as I can free up some room in my aging freezer I'll move it over there. When I start a batch of black currant wine, 3 gallons, I'll update the chart.


Just for curiosity sake and for future reference, what would be the best practice for adjusting parameters to compensate for the over shoot?


Well looking at the time to the undershoot the Integral time is not too small (too small an integral time will give ringing). If you were measuring the temperature with a sensor with greater resolution then the first thing would be to put in some integral, but the trouble with a DS18B20 is that only measures steps of 1/16 degree C. Derivative works on rate of change and with that sensor the measured value sits on one value, then steps to the next, sits there, sets again, etc. So the derivative calculation does not have much to work with. It is probably worth trying though. Set the Derivate Smoothing Factor to 3 and then try some derivative. Start with 600 seconds and see what happens. Because of the steps that will introduce noise into the power, If the noise on the heat and cool is more than about 5 or 10% then that is too much derivative so wind it back a bit. If it is not too noisy then increase it. You can probably go up and down by a factor of 2 initially. The ideal would probably be a couple of hours but I doubt if you will be able to get anywhere near that.
If the derivative doesn't help then you haven't got much option other than to increase the PB which will make it slower to approach the setpoint and bring the undershoot/overshoot down.


A type K thermocouple would give a linear temp reading but I don't see anyone on the forum interfacing one to nodered. Besides that, I'm not sure I want to start over. :wink:
I have a can of puree black current I want to try...


I wasn't suggesting you did start over. You just have to accept the limitations of the 'cost effective' hardware you are using.
I don't suppose it matters if you overshoot a couple of degrees on initial start anyway. If it did you could ramp the setpoint down (or up) in order to bring it down gently. It was better than that with your bucket anyway wasn't it?


It's all curiosity now. The bucket was at the sweet spot and I'm happy with that and did not mean to imply discontent. You are correct, a little overshoot in the beginning is not a problem. Steady is the goal.


I don't know what I would suggest for an application that needs more resolution. The cheap thermocouple interfaces are worse than the DS18B20 (but measure over much greater range). This one, for example, is 0.25 degree resolution. https://www.modmypi.com/raspberry-pi/sensors-1061/temperaturepressurehumidity-1066/adafruit-thermocouple-amplifier-v2.0


I have to confess that I was thinking more on the line of a temperature probe to insert into the end of a sausage for a RPi temp controlled smoker.
The DS18B20 is to bulky for snack size sticks plus I'm concerned about the wire covering at 170°F environment. I keep telling myself I don't need/want another project but it keeps coming back to mind.


Would it not be good enough to control the temperature around the sausages?


The trick for juicy sausages is to not go over 160F while not under cooking and risking bacterial or parasitical infection. I was thinking that a probe in the sausage could halt the cooking at 155F and maybe even turn on a fan to cool it down quickly.
The trichinella parasite dies at 137F and bacteria die off at around the same temp and fat begins to melt away at around 160F.


How long are they in there?


The duration depends on who you listen too. Some say the sausage should be held at 80F or an hour then stepped up to 170F in three or so steps at 1.5 hr increments. Others say just toss it in at 170F and pull them when they reach 155F. The only real constant is the 155F.

The easiest thing would be to just use a meat thermometer and set the alarm for 155F. Slightly more complicated would be to use the beeper signal on the meat thermometer to set a GPIO pin on the RPi.


Two thoughts: First, I am not clear why the resolution of the Adafruit amplifier breakout is so poor. It may be due to customizing for the K-type thermocouple, which has a very large temperature range. The chip they use can do much better, and they make a "universal version" for which they claim 0.0078125°C resolution (!!?). You would have to dig to see what thermocouple type is doing that. I suspect a T-type would be better for @Backup's application in any case. Second, when smoking sausage, don't depend on the absolute temperature reading from a thermocouple. It can be off by up to 6°C or so, leaving only about a 5°C margin of safety. So calibrate.


At 0.0078, that likely means it is a 16 bit ADC. I would be a bit concerned about how they do the cold junction compensation. It has to measure the temperature of the block that the t/c connects into, and I don't see how they do that very accurately. If I were going to use it for anything serious I would want to know how much the measurement varies with the ambient temperature (at the board).
That's good advice about calibrating it.


I thought so too, but the data sheet for the part they use actually claims 19 bits.

They do an on-chip temperature measurement (presumably using a diode), so the chip has to be located close to the thermocouple connector (the actual cold junction). They claim +/- 0.7°C accuracy for the internal temperature measurement over the range -20°C to +85°C. The chip also has the option to use an external cold junction. It even stores linearization look-up tables for every letter-type thermocouple and does all sorts of digital magic -- or so it seems to someone who used to put a cold junction in an ice bath. I haven't done a real analysis or looked closely at the breakout board, but I would guess that with a well-made thermocouple you could expect the accuracy to be 2°C or better and the stability to be good enough to let you use most of the quoted resolution (perhaps 0.02°C) in a control system. It might be fun to test, and for less than $20 US it seems pretty remarkable.