Brewpi working normally, then suddenly big temp swings [Arduino]

I have been fermenting for about 3 days and everything was working normally. Beer temp stayed with 0.1F of set temp and the temp increase occured on schedule. Then, suddenly, without any changes, big temp swings and the fridge way overshooting. Granted, beer temp on swings +- .5F but you can clearly see the difference. Again, zero changed made to anything during this process.

I’m using an Arduino home built setup with default settings as they seemed to work well for every past brew. Chamber is an insulated enclosure similar to a Son of a Fermentation Chiller and a light bulb for heat and air from a fridge for cooling. Beer probe is in a thermowell in the beer. Fridge probe is in the middle of the chamber. Any thoughts?

I noticed some weird looking stuff in my logs from today about the wifi checker? Then again, my computer that runs the Arduino is hard wired to the internet. Can anyone translate this and tell me if this might be part of the problem?

I don’t think that WiFi check is part of the problem. The problem is probably that the beer temperature lags quite a bit on the fridge temperature. They get out of out of sync and start oscillating because of this lag.

I think reducing your beer-to-fridge Kp can solve this. On the Spark, you can define a minimum time between switching from heating to cooling, but this is not possible on the Arduino version.

You can also try reducing the filtering on the beer temperature, because that also contributes to the lag.

Thanks Elco. Just seems strange that it has never done this on my previous brews before. Do you have suggestions for what to start with? The beer fast filter is 78 sec, the slow is 159 sec and the slope is 8 minutes. The Kp is currently 5. Thanks again for everything you have done with this awesome program!

Just try halving Kp. Also make the filters twice as fast.

So that didn’t do the trick. Same large oscillations and switching between heating and cooling after it way overshot. Used to keep a .1 degree error and now it’s +- .5 or more. Any other thoughts?

Share your full settings and a close up of the chart. Also check that your temperature sensor is still deep in the beer. I have had others report this issue and it turned out the sensor slipped out of the thermowell.

Sorry Elco. I did double check the beer and fridge probes. Both were in the same place as before. I do wonder if my cooling setup may be partly to blame. I use a computer fan that blows air from my freezer through a small duct into the Ferm chamber. When I remember using heat, it seemed to do better. Cooling, not so much. Anyway, here are all my current settings:

Control Settings:

Cooling Overshoot Estimator - 0.002
Heating Overshoot Estimator - 0.639

I have not touched any of these settings above… and am currently fermenting a 1 gallon test batch. I’m guessing these values might be different for a 5 gallon batch.

Control Constants

Temp Min - 33.8F
Temp Max - 86F
PID: Kp - 2.5
PID: Ki - 0.25
PID: Kd - 1.5
PID: Max - 18
Integrator: Max Temp Error - 0.9F
Temp Idle Range Top - 1.801
Temp Idle Range Bottom - -1.801
Heating Target Upper Bound - 0.541
Heating Target Lower Bound - -0.359
Cooling Target Upper Bound - 0.359
Cooling Target Lower Bound - -0.541
Max Time for Heating Overshoot Estimator - 600 sec
Max Time for Cooling Overshoot Estimator - 1200 sec
Beer Fast Filter Delay - 159 sec
Beer Slow Filter Delay - 318 sec
Beer Slope Filter Delay - 16 min
Fridge Fast Filter Delay - 18 sec
Fridge Slow Filter Delay - 159 sec
Fridge Slope Filter Delay - 4 min
Use Light as Heater - Yes (I do use a light heater)
Trigger Rotary Encoder at Every - Full Step

Here are a couple chart pics of an April batch. This is where it started cycling differently, but it still held the beer within 0.3F the whole time. First, a wide view.

Now more close up.

From my last batch. Again, wide view.

Close up.

The last two batches have started off doing well, then a couple days in, go wonky. Hope this helps! Thanks again.

Aaron

Let me first say that this behavior will not occur with the BrewPi Spark algorithms. They have evolved a lot since the Arduino days of BrewPi. I have addressed many issues that you currently have in the code, I’m now just trying to help you work with what you have, because you choose to use our old stuff that we currently do not support anymore. Therefore I will not invest much time into investigating this. It has already been fixed, you are just using something old and unsupported.

I think your beer-fridge difference is too aggressive. It works okay at the start, because we also have limits to not allow cooling when the beer is too warm. The fridge setpoint is too low though. When your beer heats up, the fridge is allowed to cool in frequent and shorter bursts and will cause a later drop in the beer temperature due to delayed effect.

This kind of limit on when the fridge can be cooled to setpoint based on the beer temp skews the algorithm and has been removed in the Spark algorithm. Only the fridge setpoint controls the fridge actuator.

I think your integrator is way too fast, causing the fridge setpoint to continue dropping and dropping further than needed, just because the beer is slow to respond. You want the proportional part to do more (Increase Kp) and the integral part to do less (decrease Ki). (For Spark readers: on the Spark, Ti is a time constant. You would actually increase the time constant to solve the same problem).

Elco,

Thank you for the advice. I will play with these settings to see if I can find a happier medium.

I understand the Arduino is no longer supported and of older technology. I’m a DIY project brewer and building the Arduino setup with my laptop was one of my most rewarding projects to date. Everyone I show BrewPi and my archaic Arduino setup to is blown away with how cool it is. So, thank you for that. I’ve been hesitant to upgrade because I don’t want to get rid of my homemade setup. However, I do regularly use two fermentors in one chamber and I’m eagerly awaiting the release of dual fermentor/dual chamber capability.

At that time I absolutely will be upgrading, even though my current system works pretty well. I know you have given more time and effort than I can imagine, for free, toward this project. Your support and efforts are a great benefit to us all.

Regards,

Aaron

1 Like

Elco, can you clarify your two statements about aggressiveness? Btw, thanks for trying to help us arduino users ( I’m the one that emailed asking if you might take pre-orders on the spark3.)

For Beer-Fridge difference, are you referring to PIDmax=18? If so, what would you consider less aggressive - 12? 8?

Similar for Ki, what would you define as less aggressive?

Thanks,
Bob

No I’m talking about Kp:

The temperature difference between beer and fridge setpoint on Arduino is:

Kp * error + Ki * integral + Kd * derivative

By choosing a larger Kp, you will work with a smaller temperature difference between fridge and beer temperature, reducing your chance of overshoot.

By choosing a smaller Ki, the integral has less effect and therefore it will take more time before the integral affects the setpoint.

However, there is one big issue that you need to take into account: if your Kp is too small, it the proportional part will not correct your beer temperature, leaving it up to the integrator to correct it. Because the integrator is slow too respond, it will cause overshoot. You want the integrator to only correct steady state errors, not the errors that the proportional part should handle.

So in short: you want Kp as big as you can without it causing overshoot (you can test this by setting Ki to zero) and then try to increase Kp until you have overshoot.

I changed my Kp to 5 and Ki to .125 and that is helping quite a bit so far. It does still however let the fridge go very warm immediately upon reaching the desired beer temp as seen in this shot. So I have so more adjusting to do, but I’m getting closer.