Xensiv CO2 sensor module from Infineon is a simple serial interfaced (I2C) sensor that can measure absolute CO2 values. Values indoor can indicate bad environment, and an advice to air/ventilate the room:
The Xensiv CO2 module is small and compact, and integrates the sensor and the intefacing in one pcb:
Module uses a 12V high voltage to pre-heat the sensor and measure the actual CO2 level. Part can be calibrated and works by I2C / UART calling or by interrupted streaming using PWM interface. Sensor shows many flags like 12V ok, temperature out of range, initialization fault. Also can the local air pressure be uploaded, to have a more accrate measurement.
Part is not really low power due to the 12V pre-heater, battery operated sensor could be possible but is not ideal. Infineon has some documentation to optimize this. This is the diagram of the module :
Details and documentation can be found on the Infineon website: CO₂ sensor - Infineon Technologies, download all 4 key documents for datasheet (registers), programming, low power and design guide.
Arduino SensorThe sensor app is using the 'single shot' measurement, which is triggered every 10 minutes and post it to a MQTT server, then sleeps and reset the system.
I2C interface makes it easy to read the sensor setting and the values. Code is setup in C++, Arduino IDE style.
Schematic is as follows:
Code is setup in C++, and uses the following libraries:
#include <WiFiNINA.h> // https://github.com/arduino-libraries/WiFiNINA
#include <PubSubClient.h> // https://github.com/knolleary/pubsubclient
#include <EasyWiFi.h> // https://github.com/javos65/EasyWifi-for-MKR1010
#include <RTCZero.h> // https://github.com/arduino-libraries/RTCZero
#include <WDTZero.h> // https://github.com/javos65/WDTZero
#include <Wire.h> // standard I2C lib ArduinoThe EasyWifi can be replaced by standard Wifi MRK library, however this lib is using the Flash storage on the UBlox Nina module to store your Wifi credentials encrypted.Code is written with Global variables (G_xxxx) to avoid overkill on variable passing, and has defined Debug settings to use the serial USB interface as feedback.
#define DEBUG_X 1 // Debug info for messages over serialMQTT posting to Noder-Red or Home AssistantData is posted as a JSON string to a local MQTT server. (non secure) Using 'MQTT Explorer' the following data can been seen:
Once dat is on the MQTT server, using tools like NoreRed or Home Assistant can be used to make the sensoring visible in your environment:
- Solve the buggy first reading, which is mostly false, while the sensor status shows not alarm.
- Test power optimalization
- Add Web interface in case to use a HTTP/Get for JSON API
Build the MKR1010, DCDC and Xensiv module on a Arduino proto board:
Designed also a 3D printed casing.. just in 'case' :)
STL file is downloadable in the files section.












Comments