Controller for a curing fridge - PID for DO's

Hey guys,

I am playing around with my UNO - complete newbie, but i have not slept for the last few days with excitement of my new found hobby (was the curing fridge, but now it is more the project!).

I have the project working - DHT22 mounted and calibrated, getting values, put in a simple start logic for dead bands and it is all working. dehumid, humid, turn on the fridge and heating lamp.

So far so good.

Then as it always happens, i want to improve the project - So i started to look into the PID controllers.

But i can not find any way to control DO's with the PID controller libs - Any tips really appreciated.

Pulse width modulation.

Bang-bang control.

Barrel shifter.

So i guess i am trying to find a way to pulse my bang-bang controller in the right intervals.

Google has plenty off examples covering theory and practice of using PID with a digital output . For a fridge the lags involved ( time before the temperature starts to drop when powered on ) may make PID control difficult and on /off may still give the best result . Do have a play tho - might be worth experimenting with say heating up a resistor and something to measure temperature .


I see from your deleted posts that we're specifically discussing the fridge compressor. Mentioning that is useful given the fact that you referred to several potential things in your original post.

Pulse width modulation is a good choice. For a compressor the pulse width might be something measured in minutes (e.g. 15 minutes) or hours. 100% would mean "run for 15 minutes". 50% would mean "run for 7.5 minutes". With a compressor you would also need to include a minimum run time and a minimum quiet time.

Handling the process variable is where the magic happens. I suspect a simple average covering twice the pulse width would be a good starting point.

I've seen effective controllers that use 50% output as a trigger. When the output crosses the 50% line the compressor state is toggled. Obviously that would include a dead-band. This is essentially a bang-bang controller with a twist.

I've seen effective controllers that band the output. For example: less than 33% is compressor off, more than 66% is compressor on, anything in the middle is leave it.

If possible, start small: a resistor, a capacitor, and a thermistor attached to the resistor. The goal is to control the temperature of the resistor (essentially a tiny heating element). There are some advantages to that system: cheap, short dead time, the temperature change of the resistor can be calculated, a small fan introduces cooling.

1 Like

Thank you, you gave me some food for thought about how to approach the problem. I deleted the posts, because i clearly misunderstood your first reply - My mind was in a different aras of the problem when i read it.

I understand your method now, and it was somehow what i meant when i asked the forum the first time - If there is any "PID" controller for PO's.

Maybe someone did the calculations before and have an amazing way to do this, already coded in a rutine.

In my case i have a peltier dehumidifier (on/off controlled), a cool mist humidifier for the humidity side (also on/off controller).

I have a fridge with a normal compressor and a heating lamp for the very few times i would need heating (maybe never).

I was searching for a good place ot start in a premade rutine, that i could then get to know and slowly adjust as my wisdom got larger - Else i will start doing as you write above, but i will be ugly and rough code haha as i am new in both arduino and temperature/humidity control! :slight_smile:

Thank you, yes - I have been searching google for many hours now, could not really find any useful information, but i have a few more keywords to explore now :slight_smile:

I have a live fridge runnig, so for testing would not be a problem - I can just set the target temperature lower/higher and see it work its magic :slight_smile:

Found this one!


I will take your advice and play around more with it - Need to understand the basics more. I did play around with a light sensor and diode before, but it is too fast acting for what i need.

I will make a small chamber around my board and a fan like you suggest.

Why PID particularly? It has its place but when you only have on/off control, it's a hack to use it.

I am just trying to make the RH and C stay as close to the setpoint as possible - But i see your point. In fact the controller is working fine as it is.. I just got geeky and wanted to try and make it work better.

In that case, you may do better with custom code. The thing about PID is that it's all reactive - it doesn't know anything about your setup. Since you do, you can use that knowledge to make the controller smarter.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.