A WIFI connected CO2 sensor based on the ESP8266 microcontroller and MH-Z19 CO2 sensor. A 128x64 I2C oled display also shows the current measurements. Its measurements are pubished via MQTT and in my home system are received via a raspberry pi running Mosquitoo, Nodered, InfluxDB and Grafana.
- Configuration of WIFI SSID/PWD via web interface
- Design a PCB and 3D printed enclosure
{room}
└─── HixCO2
└─── {deviceTag}
└─── device
│ └─── count
│ └─── room
│ └─── device_type
│ └─── device_version
│ └─── device_tag
│ └─── device_name
│ └─── wifi_ssid
│ └─── wifi_ip
│
└─── status
│ └─── count
│ └─── wifi_rssi
│ └─── co2
│ └─── temperature
│
└─── influxdb
To make the import in the influxdb from Node-RED as easy as possible the influxdb
topic publishes a json document that can immediatly imported using the influxdb in
node.
They only thing required is to convert it to a json object via the To json
node.
Following the influxdb in
node the json is an array where:
- the first element contains the measurements
- the second element contains the tags
[
{
"co2" : 4564,
"temperature" : 45,
"wifi_rssi" : -45
},
{
"device_type" : "HixCO2",
"device_version": "2.5.8",
"device_tag" : "at_door"
"room" : "office",
"wifi_ssid" : "public_wifi"
}
]
This device does not subscribe to any topics
- Once connectted to the WIFI a normal browser can be used to configure the MQTT details.
- Just go the the device's ip address with your browser
- Password is intitially set as
bornem1973
. - At this moment the WIFI SSID and password are hardcoded in the src/secret.cpp file