Raspberry Pi and Temperature Controls

The term HVAC means Heating, Ventilation, and Air Conditioning. The simplest form of an HVAC controller that has been around for ages is the simple thermostat that is found in  just about every home that has a heating system or and/or air conditioning system.

The Raspberry Pi is ideally suited to be the ultimate home HVAC controller. Here is a project using an RPi3, two Pi-SPi modules, two temperature sensors (only one is required) and a power supply to power up the control relays.

The sample code provided uses the "Indoor" Temperature sensor as the main control sensor, the "Outdoor" temperature sensor is for informational purposes only.

One important variable that is used in these simple applications is the concept of "Deadband" or "Differential". If only a simple setpoint was used, the control relay could turn on and off very rapidly if the measured temperature was sitting at the same temperature as the setpoint. To prevent relay "Chatter", the deadband (or differential) setting is used in the equation as follows (Heat Example):

Heat Relay turns on if the Temperature Reading falls below the Heat Setpoint.

Heat Relay turns off if the Temperature Reading goes above the Heat Setpoint PLUS the Deadband setting.

Example: Heat Setpoint = 22 Deg C, Deadband Setting = 2 Deg C.

Heat will turn on if the Temperature Reading falls below 22 Deg C and will turn off if the Temperature Reading goes above 24 Deg C.

This control strategy can be extended with all kinds of extra features found in more elaborate thermostats. The RPi is suited to be the most elaborate thermostat of all!

In the Sample Code, the control strategy is very simple:

If the Heat_Cool Variable is Set to HEAT:

  • If the Indoor Temperature is less than or equal to the "Heat Setpoint", the HEAT Relay turns on.
  • If the Indoor Temperature is greater than the "Heat Setpoint" + the "Deadband", the HEAT Relay turns off.

If the Heat_Cool Variable is Set to COOL:

  • If the Indoor Temperature is greater than or equal to the "Cool Setpoint", the COOL Relay turns on.
  • If the Indoor Temperature is less than the "Cool Setpoint" - the "Deadband", the COOL Relay turns off.

Sample Code can be found in the Temperature Sensor HVAC KIT found here.

There is a kit available that has all the necessary parts, all you need to add is your Raspberry Pi. The sample code has been tested with the RPi3.

 

 Pi-SPi-HVAC-KIT

 

SaveSave

Leave a comment

Please note, comments must be approved before they are published