DS18B20 smoothing and PID tuning

There is an influx db node that makes it really easy to use with node red, but there is some learning curve involved. I would go that way rather than sqlite though. I am sure there will be some sample flows in flows.nodered.org

With the sample rate it is best to set that based on what the control loop requires rather than on graphing requirements. You don’t want to compromise control in order to satisfy graphing requirements, there are other ways to do that such as limiting the sample rate going to the graph but keeping the control loop at whatever speed it needs. However, I see from the previous charts that the maximum slew rate (under cooling anyway) may only be about 1C/hour, and since the resolution of the sensor is 0.0625C that is one bit of resolution about every 4 minutes. You want the sample rate to be higher than this so one minute should be fine.

I am a bit confused by the megabyte every five seconds. I would have expected it only to transfer the latest data eac time, the chart buffering is done in the browser. That is assuming you are just feeding each sample into the chart. It sounds as if it is sending the complete chart every time which is odd.

Hi Colin:
I checked out graphana and found it will connect to MySQL with no additional plugins. I managed to get MySQL installed along with MyPHPAdmin. I'll be working on inserting data today.

My data collection schema can easily be adapted to any rate I need without changing the how often I sample sensors. One minute is a rate I've considered but I'm a little concerned about the 10 minute cycle for the timeprop node. Evan with an error of only 1F it's sending my freezer to 20F and seems to amplify my over shoot. I may change that to 5 minutes. This freezer is only used occasionally so a shorter cycle rate won't shorten the life of the compressor to any significant degree.

The megabyte issue was when I was taking my data off the end of the chart node. I learned it was saving the entire chart every time. I've changed how that works too.

I set my setpoint to about 0.1F of the PV last night when I gave up for the day and here's what I found this morning:


Apparently my parameters are good for maintenance but maybe too aggressive for large temperature changes. Is it time to tinker with the derivative?

Charles :slight_smile:

I don’t understand the graph, there doesn’t appear to be any heat or cool requested, yet I can see the cooler doing stuff. Or is the cooler just switching on for its minimum 15 seconds or thereabouts each time? As you say, in steady state the control there looks perfect. What P and I have you got?

I don’t understand what you mean by “I set my setpoint to about 0.1F of the PV”.

Let me see how it does when it has to do something. Disable the outputs (and the PID) and let it warm up then start it up again and post the chart. Or if you have csv of such an event already then post a chart that if it is easy to do.

As I was examining the graph I noticed the the cool status register about 1% then back to 0, so, in my opinion, it would appear to be working as expected.

Sorry, the pv was 59.900F and the setpoint was 60F when I left it last night.

Typical ale yeast likes about 65F so I’ll see if I can get it to 66F or abouts and start over.

as of today:
PB = 4.575
Ti = 5746
d = 0

Timeprop:
600
15
1

I have also changed my csv sample rate to 1/min.

Hi @Backup
I 'm Homebrewer myself as well. I have 3 ds1820 intended for fermentrack but once node-red is my favorite platform, I prefer to deploy somenthing similar to yours. Do you mind sharing your flow ?
thanks

Hi Deedos!

I don’t mind sharing my flow. what kid of setup do you have. Are you using a freezer for cooling and a heat lamp for heat? I’m using a Raspberry Pi3 with 40amp SSRs to turn my heat lamp and freezer on an off. I suppose my flows could be adapted to almost any setup though.

Could you start a new thread for the flow discussion so we can keep this for the tuning? It is getting overly long already.

I'll wait for deedos to start it.

Hi @Backup, thanks for the quick reply!
The setup is pretty much the same: One fridge and a lamp as a heat source. I would lik to use esp8266 and use 5V relay modules i have bought instead of SSRs. anyway, agree the best is starting another thread!

Cheers

Let me know when you start it and I'll find you.
Beware 5V mechanical relays will fail in no time. I froze a 6 gallon batch of wine using mechanical relays. I had broken carboy glass and 4" of wine in my freezer to deal with. SSRs are not expensive and the Opto22s require only 3v trigger voltage. If you are using a RPi you will only have 3.3v trigger voltage available unless you buffer it.

Charles

Good morning Colin,
I started with:
brewbox = 70.1375F
brewbucket = 65.1875F
setpoint = 64F
Start time = 13:49:07
Here's what I got up to bed time.
Dang! my pic won't upload correctly. Maybe to large?
I also have a pretty complete csv file which I think will be more useful.

Charles

problem solved below.

Charles

Here it is. I was pasting multiple layers and only one came through.

Charles

I think it is only marginally stable. It shoved in much too much cool initially so it overshot a long way, switching the cool right off. Try the PB at 10, so effectively doubling it. I would also push the Integral up to 9999 for the moment to prevent it confusing things. The PB in cooling will have to be pretty large because the cooler is much more powerful than it needs to be. In fact, if there were a choice, a fridge would likely be better than a freezer as you only need it to bring the temp down to 60F, not 0.

Isn't d supposed to dampen the oscillation?
I wanted a chest type enclosure so the temperature wouldn't spike to much when I opened the lid, and secondarily, it fits my garage. :slight_smile:
The temperature is fairly stable now so I'll begin right away.
The maximum power ratio was 33.4% whatever that means.
BTW: the sawtooth appearance of the brewbox temp is because we stretched the cycle out to 10 minutes in the timeprop node.

Charles

D can cut down overshoot but you have to start from stable control with just PB, then the I is used to pull it onto the setpoint, but that puts overshoot back in and the D can be used to reduce the overshoot if necessary. Let it warm up again so it repeats a similar situation with the new params. It is a pain with a slow process when you can only get one go per day. I had a similar situation tuning my underfloor heating. That can be even trickier of course because people keep opening doors and so on.

Since it was stable at 64f I just started again with a set point of 63F. Maybe I can get a good long-term chart before I have to go to bed.
I'm learning that there is a lot more to PID than I ever thought. :thinking:

Speaking of stability and open doors, my issues will be volume of brew and garage temperature. Garage temps typically range down to 35F in the winter and up to 90F in the summer though I don't do much in the worst of the winter. I bought the 7CUFT freezer because two buckets of beer would fit in it. That would be 10 gallons, then a batch of kit wine is typically 6 gallons and a DIY fruit wine is usually 3 gallons. I haven't done 10 gallons in years, since most of my beer buddies moved away so the liquid volume will range from 3 to 6 gallons.
Now that I'm learning the process from an expert I may try tuning for each size batch and add buttons to select volume.

Charles

What size are you running at at the moment? I would expect that you can find a set of tuning constants that would work ok over the range.

I have my beer bucket in there now. It has a capacity of 6.5 gallons but makes 5 gallon batches, so I have 5 gallons of water in it.
The difference between 6 gallon and 5 gallon batches wouldn't be significant, I think. They would have similar temperature ranges.