Beer fermentation controller help

Hi guys
Total Newbie here so please excuse my mistakes.
After a couple of pointers...
Hacked a fridge and got an Arduino controlling my beer fermentation temperature.

So far so good.

Version 2
Installed LCD to display temps and heating/cooling on/off

Works sweet

But I want more precise temp control hence PID.

I have a working code for the PID part, which I don't fully understand, but working on that,

My question is.... Do I simply need to work out the PID side and then combine the two sets of code to make this work?

Obviously after I get to grips with PID

Thanks in advance

I don't see why not. But you might want to look around a bit first so that the combining process is smooth.

Two such programs written with combining them in the future in mind will be easily combined.

Two such programs without consideration of being combined can be a b*tch.

Talk to your friend google:

arduino combine two sketches


Why am I suddenly thirsty? :wink:



Thanks for your reply

The stage I'm at now has been basically building blocks.

Learn how to:-
display on LCD
read temp sensor
combine both
learn how to get input from keypad
and combine again
Learn PID (yep not so easy for me at least . I'm a 53 yr old ex tank mechanic. This stuff is all new to me)
In the future combine code to make it all work.

Is it as simple as that once I understand the PID side?


Sounds like a plan. But do take a look at what makes combining simple parts into a (relatively) complex whole easy or hard.

Have you convinced yourself that PID is going to help that much? Or is the best approach?

I am only familiar with it in other contexts where it is def effective if not the only way to code a control loop; I have not used it in the control of temperature.



Once again thanks for your reply.

At the moment my fermentation chamber (hacked fridge) is in my kitchen. This will be be moved outside to a garden shed, henceforth known as the brewery.

Large fluctuations in temperature can affect fermentation/flavour. A PID system is the only way to go once I get my shed brewery fully up and running.

Whilst in the house the system I have works fine.

Outside in the shed it just won't work.

I'm in the North East of Scotland. Temperature fluctuations are ridiculous.

This is where the PID comes in.

PID would sort all my fermentation temperature worries.

Any tips for combining the code?

In my experience with temperature control, full PID is not needed. Proportional yes, usually with a constant term so the output is not zero at setpoint.

What are you using to heat and cool the fermenting batch? Are you regulating flow or are you regulating temperature for control?

Have you done the google search on "Arduino fermentation temperature control(er)"? You are not on a new path.

The more I think about it the more I'm thinking I need to completely re-write my code. Or?

The control system effectiveness will depend on how decoupled the heating is from the sensing.
Do you have a diagram of where the heating is on the fermentation chamber and where/what you are measuring the temperature on?

Hi cattledog

Thanks for your reply

yes done many many google searches and lots of reading.

Like I said, in my kitchen the system I have works, but I want to move my brewing out into my shed.
This is where temperatures fluctuates wildly and, in my opinion I need PID control.

Temperature affects beer flavour hence PID control once in the shed.

What do you mean by proportional temperature control?

Hi Dacho,

I have a temp probe into the beer fermentation bucket (approx middle of fermenting beer) and I also have a temp probe measuring the chamber temp.

Where is the heating?


Heating is a heater belt controlled by the Arduino as is the cooling.
This may be changed depending on results once in the shed.

I've hacked the fridge.

Like I said previously, system works fine in the kitchen, but once out in the shed. who Knows?

I t will be connected to mains power supply so no interruption of power and regulated

Yes, but it is likely changing relatively slowly in regards to the heat loss or gain of the fermenting system. PID is mostly used where you have rapidly changing loads and need to respond quickly.

What do you mean by proportional temperature control?

The farther away from setpoint that you are, the more heating or cooling you apply. This can be done with time slices of on/off which vary or it can be done with temperature of the cooling or heating medium.

How are you heating and cooling the fermenting batch? Are you running hot or cold water through coils internal or external to the fermentation vessel?

Hi Cattledog

when I said temperatures fluctuate wildly I was talking about the ambient temperature.

The fermenting beer is in a converted fridge (henceforth chamber)

I'm only brewing 5 imperial gallons (6 US gollons) which can be affected by temp.

My location does produce wild fluctuations in outside temps. I've seen +15 in the daytime and - 8 at night.
Fermenting beer does not like that at all.

I was assuming that if my initial temp of liquid was close to required fermentation temp the PID would be able to handle all the external shit and keep my fermenting beer at it's required temp.

I suppose you could think of it as PID with the I and D constants or terms in the equation near zero.

But I write to ask who is making you move it out of the kitchen? Or do you just like a challenge? :wink:

15 to -8, that’s 60 degrees to 18 degrees in American.


I completely understand. You are fermenting inside an insulated box, and the variation in ambient is going to be relatively slow. Yes, you will need more or less heating or cooling depending upon ambient, but I don't think that PID control is necessary.

Heating is a heater belt controlled by the Arduino as is the cooling.

Please explain more. Is the fermentation tank wrapped in some sort of Peltier belt which can heat and cool?

part challenge part necessity. i have a very small kitchen. need the space.

Plus, if all the brewing process is in the one shed it is easier all round.

At the moment I have to carry equipment 80 yards to brew, then 80 yards back to storage.
Once brewery is up and running no moving. everything is on hand.

NE Scotland is a crazy place for temperatures.

However, we are getting off my original question.....
Am I looking at basically combining both sets of code?

Is it possible?
Or will I need to write new code to make the 2 things work?

Point to note I do brew beer successfully with the system I have at present.
But this is in my flat where the temperature is fairly consistant.

The brewery is a different story.
It is a wooden shed


heating is by means of a belt wrapped around the fermenting bucket applying direct heat.
Cooling is done by means of having hacked into the fridge and using my arduino to turn on/off the cooling.
My programming of my arduino reads the temp of the sensor in the beer and turns on heating/cooling as required.
Very basic but it works in the confines of my flat.

What is the current performance of the system. How much above and below setpoint does it go with simple on/off controls with some sort of small deadband? It's not clear to me that being in an insulated environment will really require a different control scheme between the kitchen and the shed.

You will certainly need to verify the limits, that is can the heater keep the batch warm enough with the coldest ambient, and can the fridge keep the batch cool enough on the hottest day with the fermentation zipping along.

In my opinion you should be able to control the system with proportional control where the on/off heater and refrigerator times(duty cycle) will vary with the difference between actual temperature and setpoint temperature. The outside temperature can be used to help set up the control parameters.

Is there a minimum run time for the refrigerator compressor to avoid short cycling? This may determine the minimum cooling cycle. The heater is probably more easily controlled with on/off cycle times. Are you using a relay for the heater, or solid state control?