Introduction

The Voltcraft CO-100 displays temperature, relative humidity and CO2 levels in the house. It has adjustable alarm levels for CO2 which, when exceeded, illuminate an orange or red LED on the front and optionally a beep alarm. It also has a datalogger that keeps historic data for 24 hours.

But what's the use of a datalogger if you have to be near the device and press some buttons to see the values?

I decided to look into the possibilities of reading the data directly from the device and store it in my Domoticz home domotica system so that the history would be available online in graph form.

Data format

Careful opening of the device reveals a long sensor marked ZGW063RY, and some googling tells me it is made by a company named ZyAura. I also found some this document with a host of technical information about the device, in particular the following:

ZG01C will send dates to the host computer by RS232 .You can use some communication assistant software to receive them : (below is only one example software.You can use the other RS232 communication softare.)Item “P” (50h): CntR (Relative Concentration of CO2)Item “B” (42h): Tamb (Ambient Temperature)Item “A” (41h): RH (humidity)

Well well well! Could that have anything to do with the RJ45 connector that is on the side of the CO-100 housing? The website says that the RJ45 is 'for factory use only'. So we should probably stay away from it, right?

Nope.

Connecting the RJ45 output of the CO-100 to a digital voltmeter to read the signal levels and to my Saleae logic analyzer is revealing. Four outputs can be used for my purpose of getting the data out, they are 6 VDC, GND, DATA and CLOCK lines!

The DATA and CLOCK signals look like this:

Another document I found describes in detail what the timings of the DATA/CLOCK are and what the format is of the data that is sent over the line. It turns out that CO2 level, relative humidity and temperature are encoded in a frame that is 5 bytes long (including checksum and terminator), using the SPI protocol.

Looking at the analyzer snapshot, above, it can be seen that the CLOCK signal is high while there is no data to be sent. When the CLOCK goes low the level (high/low) on the DATA line must be measured and stored. Doing this 40 times gives the complete data word (parameter, value and checksum).

To the right in the snapshot two measured words can be seen, starting with 0x41 and 0x43. These are the hexadecimal values for the characters 'A' (which is the relative humidity parameter) and 'C' - I do not know what that parameter is.

Data format

bit 1-8

bit 9-16

bit 17-24

byte 25-32

bit 33-40

ID

MSB

LSB

SUM

CR

rel. humidity

41h (A)

MSB

LSB

ID+MSB+LSB

0Dh

temperature (Kelvin)

42h (B)

MSB

LSB

ID+MSB+LSB

0Dh

CO2

50h (P)

MSB

LSB

ID+MSB+LSB

0Dh

Conveniently, the signal level voltage is 3.3 VDC, which makes it compatible with small devices like Arduino and the Oak.

Electrical hookup

For this example I am hooking up the Digistump Oak directly to the output of the CO-100.The Oak reads the data, converts it to human-legible numbers and publishes them to an MQTT topic, for Domoticz.

Apologies for the lame formatting but Fritzing does not include an RJ45 plug...

Pin hookup:

RJ45 pin

1 (6 VDC)

2 (DATA)

3 (CLOCK)

4 (GND)

Oak pin

VCC

8

9

GND

Physical layout

I fashioned a wooden frame from some leftover 3mm plywood and attached that to the back of the CO-100 with a couple of small bolts. This frame holds the Oak in place and allows for easy access:

The software

The code that I wrote for Arduino and Digistump Oak using Arduino IDE 1.6.8 is available on GitHub. It includes two working examples: