søndag den 19. juni 2016

The Logic Behind my Temperature and Humidity Control

Hello again.

Well no matter how good the intentions are, reality has its way of kicking in, and I never got around to do an “as we go” blog on the build. Now a year, and some, later, the build is done.


Figure 1 and 2

I ended up adding a load cell as well. This will allow me to log changes in weight, humidity and temperature, for easy comparison and trouble shooting. 

In this blog I want to go a little further into how I control the environment inside the curing chamber.

For controlling the temperature, the cooling circuit of the fridge was connected to one of the relays. Also, an incandescent lightning bulb was painted black, hooked up with a relay, and hung inside the fridge, for heating. The control scheme used, is simple hysteresis control. See figure 3 below.


Figure 3 The basic temperature and humidity control scheme

Using temperature as an example; If the chamber is situated in a cold room and the chamber temperature drops below the minimum setting the heater will turn on, and keep running until the temperature goes above the set point. Alternately if the ambient temperature is high, causing the chamber temperature to rise above the Max level, then the cooler will turn on and keep running until the temperature falls below the set point.
This solution was chosen due to its simplicity, and because it quite easy to implement in the code as well.

To define the different parameter boundaries, I have set the bands for the controller illustrated in figure 3, with the blue circles. These are used in the code itself, as well as to ease communication here.

For humidification, a small desktop USB humidifier was installed in the fridge. For this small space the capacity of this humidifier is plenty big. So as shown with the temperature, the humidity spectrum was also divided into four bands, centred on the set point. For the humidifier the control logic was as simple as for the heater, shown in the previous example. It would turn on, when the current humidity crosses from band 1 into band 0, and turn off again when crossing from band 1 to band 2. The rest of the time, it is off.

Since the fridge available to me wasn’t very roomy, I didn’t want to cramp it any further, by adding a huge dehumidifier in there. I had earlier tried to dehumidify by adding a fan, for circulating outside air through the chamber, but for most of the year, this actually worsened the humidity. So another method had to be applied.

During the tests of the chamber we had observed that condensation on the cooling element, made the humidity drop drastically during cooling. So this gave an obvious way to keep the humidity in the chamber down. But since this now made the dehumidification controller intertwine with the temperature control, close mind had to be paid.

So what I did was to add two humidity dependent conditions to the logic of the heater controller.
The conditions are quite simple. If the current humidity is above humidity band 2 and the current temperature is within temperature bands 0, 1 or 2, the heater turns on. This will drive the temperature up into temperature band 3. Here the cooler will engage, and stay engaged until the temperature falls below band 2. This fall in temperature will happen slower than usual due to the fact that the heating element is turned on as well. I have tried to illustrate the scheme in figure 4.

Figure 4 This Temperature control scheme will run, as long as the current humidity is above humidity band 2.

Since the heating element now forces the cooler to be running more frequently and for longer periods of time, the humidity should be driven down below humidity band 3. And the temperature control scheme should return to normal one shown in figure 3.

As an example of the code in action I will show you a graph from a curing a few legs of venison. See figure 5.

Figure 5 An excerpt from ½ a days curing


So what we see in the figure is temperature fluctuations within approximately 3 degrees Celsius. And humidity fluctuations within 10% RH. In figure 6 I have taken a detailed view of a 1½ hour span, and included an I/O indication for the heater and cooler. The humidifier was left out, since it wasn’t on at all during the time span.

Figure 6 Detail of figure 5. This figure also includes indications of when the cooler and heater turns on and off.

So in this detailed view it is very easy to see how the heater turns on whenever the humidity rises above band 2. We can also see how this increase in temperature actually causes the RH to fall. This is because of the temperature dependence between the relative humidity, absolute humidity and temperature.  So when the temperature rises faster than the absolute humidity we will see a fall in RH.

Well guys this was a small presentation of the logic which I have built in to my curing chamber control unit. I hope that you find it use full!

And of course, if you have any questions to what you have just read, or any general questions to the blog or curing chamber unit, please feel free to put them in the comments section. You might help someone else out there having the same doubts or questions.

Until next time! Have a good one!

Niels