This is a project for measuring CO2 concentration as well as humidity and temperature. Different GUI modes are available.
In order to reduce the number of wires and required soldering, this sensor is using the TTGO module.
The module is connected via MQTT to the home automation solution. A nice user interface is achieved via NoreRED running on a raspberry pi also connected via MQTT. In addition you can control the Sensor module since it is subscribing to a specific topic.
Settings for this GUI: mode = 1
Settings for this GUI: mode = 2
Settings for this GUI: mode = 3
Settings for this GUI: mode = 4
Settings for this GUI: mode = 5
Settings for this GUI: mode = 6
Settings for this GUI: mode = 0
Two good German resources which helped me to get started:
- https://unsinnsbasis.de/co2-sensor-mhz19b/
- http://steinlaus.de/stinkt-das-hier-teil-2-mit-dem-winsen-mh-z19b/#comment-18510
The DHT22 is measuring both while using only one wire for data submission. As an alternative BME280 might be used.
ESP PIN | ESP Name | MHZ19B Name |
---|---|---|
26 | RX | TX |
27 | TX | RX |
GND | GND | GND |
5V | V | Vin |
ESP PIN | ESP Name | DHT22 Name |
---|---|---|
25 | GPIO25 | DATA |
GND | GND | GND |
3V3 | Vcc | Vcc |
The name of this device is defined in include/user_config.h. This name is used as client-ID for MQTT. Be aware that the name / client-ID must be unique in your local network. Default name: "TTGO-1"
For the time being, the MQTT username and password are ignored.
- tele/<name>/... ?
- tele/TTGO-1/CO2
- tele/TTGO-1/info
- tele/TTGO-1/temp
- tele/TTGO-1/humi
- stat/TTGO/result
- cmnd/TTGO
- {"name":"mode","value":3}
Command | Value | Reason |
---|---|---|
mode | 0...6 | Select GUI |
calibration | 1 | Start calibration |
Copy the files from
Settings | From | To | Reason |
---|---|---|---|
TFT Driver | README\TFT_eSPI | .pio\libdeps\TTGO-MQTT-lora32-v1\TFT_eSPI | You need to select the correct TFT driver in the library, otherwise the screen will just be black |
WLAN + MQTT Credentials | include\user_config_override_sample.h | included\user_config_override.h | Modify this to match your credentials. |
- Calibration
Is already build in but not tested yet