Thermokon WRF04 CO2

From HSYCO
Jump to navigation Jump to search

Thermokon WRF04 is a sensor for detection of CO2 concentration, temperature and relative humidity in room and office spaces. The integration with HSYCO is possibile via MODBUS protocol.

What to I need?

HSYCO, of course. A Modbus/gateway or a FTDI RS485 cable. For further information consult the Modbus IO server page.

First steps

Open the WRF04 sensor following the instruction of the data sheet. Configure the Modbus address, baud rate, parity using the dip switches. In this example we will use: 9600,8,1,0,0 and Modbus address 1. Connect the WRF04 sensor to a Modbus bus. Assuming that we are using a Modbus/IP gateway this is a screenshot of the Modbus IO server definition in Settings:


Integrations WRF04.png

Integration

Let's write these simple lines in EVENTS:

INIT : PROGRAMTIMER modbusread = REPEAT 5
PROGRAMTIMER modbusread : IO modbus.1.256 = readinputregisters:short, IO modbus.1.257 = readinputregisters:ushort:2
IO modbus.1.256 : $temperature = IO modbus.1.256, $temperature / 10, log = "temperature: " $temperature " °C",  UISET "wrf04.temperature.text" = $temperature " &degC"
IO modbus.1.257 : $humidity = IO modbus.1.257, $humidity  / 10, log = "humididy: " $humidity  " %", UISET "wrf04.humidity.text" = $humidity  " %"
IO modbus.1.258 : $co2 = IO modbus.1.258, log = "co2: " $co2  " ppm", UISET "wrf04.co2.text" = $co2 " ppm"

Basically this is a polling request to the device. Every five seconds HSYCO is reading the value contained in the registers 256,257,258 which, accordingly to the WRF04 Modbus table, are respectively: temperature, humidity, co2 ppm.