Open Source Hardware HVAC Project

Automation Solutions: Air-conditioning system
July 4, 2019 by
Open Source Hardware HVAC Project


HVAC systems usually have an available contractor that will allow us to connect a relay. Connecting the relay to an Ardbox Relay industrial PLC, and the industrial Arduino PLC to the Touchberry Pi, we will be able to control climate conditions remotely. In this project, Opiron Electronics proposes to make a basic control system with an interface that will enable us to activate the HVAC system remotely with the Ardbox Relay PLC and the Touchberry Pi HMI, both from Industrial Shields. The purposed SCADA that will run on the Touchberry Pi is an open source automation software  which you can find in the following link:

Industrial Automation 

  • Monitoring and control installations.
  • Measure and acquire all the available information.
  • Control the humidity, temperature and other important values using an Arduino PLC.

Hardware and communication

We are going to use:

  • An Ardbox Relay PLC: This is an 18 digital inputs / outputs Arduino PLC that offers the possibility of communication between two computers using I2C. 
  • A Touchberry PI 10.1″: The Touchberry Pi is a 10.1″ panel PC designed to work in industrial environments and based on the popular Raspberry Pi. 

To communicate both devices, we will make use of I2C communication. The main advantage to use this protocol is its flexibility, as you can easily connect up to 128 slaves to the Touchberry Pi. See below the Software explanation for more details on how to do it.


Software and code

As mentioned above, the purposed SCADA is owned by myscadatechnologies. We’ve chosen this SCADA because it is open-source software, available to be downloaded and tested on Raspberry Pi, which is Touchberry Pi processor-based. From the communication point of view, I2C needs one Master. The other device will be the slave. The Ardbox Relay industrial PLC will be the slave and the Touchberry Pi the master. Regarding the Ardbox Relay, the code to be uploaded is the next one:

2014111 Arduino code

When the command received from the SCADA is activated, we will activate the relay. Regarding the Touchberry Pi software to be developed, basically, as well as installing the SCADA on our Touchberry Pi, we have to set it as a master in the I2C developed network, but before we need to enable the I2C module on the PI.

As root, edit /etc/modprobe.d/raspi-blacklist.conf and comment out the line blacklisting i2c-bcm2708

$ cat /etc/modprobe.d/raspi-blacklist.conf # blacklist spi and i2c by default (many users don't need them)
blacklist spi-bcm2708 #blacklist i2c-bcm2708

Next, add i2c-dev to the /etc/modules file so it’s loaded on boot:

# /etc/modules: kernel modules to load at boot time. #
# This file contains the names of kernel modules that should be loaded # at boot time, one per line.
Lines beginning with "#" are ignored. # Parameters can be specified after the module name. snd-bcm2835 ipv6 i2c-dev

Finally, install i2c-tools:

  	$ sudo apt-get install i2c-tools $ sudo adduser pi i2c

Finally, reboot the Touchberry Pi.

Key Benefits

The main benefits of the Operon proposed solution are:

  • Scalable system: The purposed system permits the connection of multiple devices to the Touchberry Pi.
  • Open Source automation software: This feature means big flexibility, big availability of resources on the internet in case of failures or changes implementations, etc. 
  • Remote control: Control climate conditions through an HMI panel.
// Industrial Shields by BOOT & WORK CORP. // Powered by Opiron Electronics // Feb.2015 technical information for newsletter // The sketch demonstrates how to control a relay // with Ardbox Relay PLC and a Toucbberry Pi. // Keywords: Ardbox Relay PLC, Touchberry Pi. ////////////////////////////// //// PLC: ARDBOX RELAY PLC //// //// Number of inputs: 0 //// Number of outputs: 1 //// you need to configurate the correctly switch position for running like digital / analog or PWM mode ////////////////////////////// //// EXTERNAL BOX PIN NUMBERS: //// LEFT SIDE (Where Input Voltage lives). //// Pin 4 (RELAY 1) => (Box Pins: 0 and 1) //// Pin 5 (RELAY 2) => (Box Pins: 2 and 3) //// Pin 6 (RELAY 3) => (Box Pins: 4 and 5) //// Pin 7 (RELAY 4) => (Box Pins: 6 and 7) //// Pin 8 (RELAY 5) => (Box Pins: 8 and 9) //// Pin 9 (RELAY 6) => (Box Pins: 10 and 11) //// Pin 10 (RELAY 7) => (Box Pins: 12 and 13) //// RIGHT SIDE (The other side). //// Pin 11 (RELAY 8) => (Box Pins: 0 and A) //// //// Pin 13 => (Box Pin 1 Arduino Digital => 5Vdc output if pinMode(13,OUTPUT)) //// OR //// (Box Pin 1 Arduino Digital => 5Vdc input if pinMode(13,INPUT)) //// //// Box Pin 2 (GND) //// Box Pin 3 (GND) //// //// Pin 3 => (Box Pin 4) //// Pin 2 => (Box Pin 5) //// //// Pin A0 => (Box Pin 6) //// Pin A1 => (Box Pin 7) //// Pin A2 => (Box Pin 8) //// Pin A3 => (Box Pin 9) //// Pin A4 => (Box Pin 10) //// Pin A5 => (Box Pin 11) //// //// Analog pins 0 to 5. Put the jumper ON in case of digitalRead (24Vdc) otherwise analogRead (10Vdc) //// //Libraries #include //Library for I2C Master & Slave //Pins defintion #define Relay 4 // Relay //I2C Address for the Ardbox Relay PLC #define SLAVE_ADDRESS 0x04 // Variables int number = 0; // Functions void receiveData(int byteCount); void setup() { pinMode(Relay, OUTPUT); Serial.begin(9600); // start serial for output // initialize i2c as slave Wire.begin(SLAVE_ADDRESS); // define callbacks for i2c communication Wire.onReceive(receiveData); Serial.println(“Ready!”); } void loop() { //Nothing } // I2C Slave communication void receiveData(int byteCount){ while(Wire.available()) { number =; if (number == 1) { digitalWrite(Relay, HIGH); // Switch on the Relay } else if (number == 0) { digitalWrite(Relay, LOW); // Switch off the Relay } } }


​Search in our Blog

Open Source Hardware HVAC Project
ADMIN July 4, 2019
Share this post

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.

Industrial PLC comparison >>>