PWM Period: No Control

a) It will when you add the integrator.
b) Achieved output value is calculated over the last 2 PWM cycles, which is why it lags a bit

6 hours because you want it to span a few PWM cycles. 4h might also work.
I think trying a 20m PWM period will also help your situation.

Heating the fridge with a 30W heater while you are trying to cool it is silly. Why not put the fan on a 5m PWM at 5% so it runs for 15s every 5 minutes? That’s enough to recirculate the air without heating it too much.

After the last graph, you think Kp is large enough?
I was aiming to maximize it without getting it to oscillate.

Agree, a shorter PWM cycle will help, but tax the compressor more.
I can shorten the cycle time if the fluctuations show themselves in the beer temp. If they don’t, then a longer cycle time is best for the compressor.
I realize this is a cheap, almost disposable freezer, but that commercial upright I’m planning on is almost $2k.

I agree with the fan. I guess all I can claim is being lazy.
I’ll go ahead and wire it up to a relay.

Let’s try with the fan not heating first. But would be interesting to see what a shorter PWM period will do.

OK. Here is Kp = -7.5 and the fan on low (it’s been on high for the rest of the time).


Looks like Kp is too large. The Output Value is chopped rather than continuous.

I’ll try it again with Kp = -6.25. I have time to wire up the relay while I wait for the chamber to warm up to ambient…

At least it heats up a lot less. When set to zero, the pwm achieved value is set to zero too. I’ll try if I can do a gradual decrease there too. Might work better in relation to the PID.

Here’s a great looking graph, Kp = -5:

With the fan not heating things up, I had to lower Kp even more to keep from undershooting. There is still a bit of undershoot from 0600 - 01000, but I think that may have to do with the ambient temp cooling off during that time. I think I’ve settled on a good Kp value.

You can see the ripple of the 5 minute PWM for the fan. As far as cooling beer is concerned, this ripple is meaningless.

I still have the cooling PWM set to 30m, but it seems to have settled on ~60m periods.
I cannot even put into words why, but it seems like 6 hours (6 cycles) is the Ti value I want to try now, still with no Td.

2 Likes

Nice. Looks like taming the fan was a good idea.
Try with Ti indeed. You can also try a lower setpoint to see the effect of the intergral.

Ti = 6 hours.
~15°F drop from ambient:


Looking good.

~20°F drop further from there (typical fermentation temp for me):


Looks like it needs more I action.

Going to try 3 hours and drop it to 32°F…

1 Like

So here is the Ti = 3 hours, 50°F step down to 32°F graph:

Everything was actually going too slow, and I was thinking of increasing the I action.
Then the output value crashes to zero, just as the temp reaches the set point.
Looks like maybe that is because I lost communications with the temp sensor for a moment.

I was connecting another expansion board and sensor to the Spark and it rebooted.
I am going to blame the PWM reset to that reboot and shorten Ti some more (~90min) and try again at a warmer temp. Warmer should overshoot sooner than colder.

Yes a restart will reset the integral. You can set it to a value manually.

Final values, Kp = -5.5, Ti = 2h, Td = 0.

Here is 60°F step down to 50°F:

Here is 50°F step down to 32°F:

I has a tiny belly that corrects itself, but does not present a problem.
With Ti = 3 hours, the step down to 32°F took over 8 hours to reach the set point, even after increasing Kp to -5.5.

I do not see a need for Td at all.
If I set up a 5°F step down from ambient, it undershoots by almost 5°F, but I am not using this chamber at anything that warm. 68°F is the warmest I get.

I think I am good now, thanks to @Elco @JoeV and the rest of the community here that has shared their learning experience in the past.
Thank you all!

2 Likes

Your graphs are looking good now.

You could add a bit of filtering in the setpoint to reduce the effect of the fan heating.

Your reports have triggered me to rework some PWM calculations, which will be part of next release:

I settled on 3 minutes of filtering.
I found that with 10 minutes, undershoot was induced.

The ripple is not due the fan heating; just the opposite.
I created a graph of the chamber temp along width the fan actuator.
Every time the fan cuts on, the temp drops. It continues to cool for a couple minutes after the fan cuts off. The fan is moving cool air up to where the sensor is.

Glad I could do my very small part here.
I figured there was some black magic between the PID output and the PWM setting.
I figure the same has to be true for the PID to Setpoint Driver offset.
I can’t work out the transfer function, but I’m slowly tuning that beer PID.
Takes way longer to warm up 6 gallons back to ambient than air!

Thanks for your commitment to this product.

(assuming water used for tests) Maybe use two containers? Let one go back to ambient while the other is in the fridge.

2 Likes