Dew Point Ventilation based on Zigbee with ESP32C6
This repository contains the source code for a dew point ventilator as initially described here by german MAKE magazin: Taupunktluefter. The whole build is explained in german language (behind a paywall) at heise.de
July 2025: Update of the visualization. Now directly in HTML and javascript. Try it out here: VisualizeData.html.
These instructions describe a dew point ventilation system. This system is used to measure the humidity of the air at two locations. If the air outside is drier in absolute terms than inside, a fan is switched on.
The following picture shows the components schematically:
The temperature is measured by an internal and external DHT22 sensor. The controll unit checks whether ventilation is useful and commands the socket via zigbee to turn on the fan for ventilation.
The individual components inside the control unit are described in more detail in the following image:
Check out the following 3d modelled parts:
The code is intended to be compiled in vscode with platformio. The main programm logic can be found in the main.cpp and is calling six helping classes, which can be found in the lib folder:
Here is also a short sketch of the main idea:
You can use PlatformIO to flash the board with this fast steps.
The outdoor sensor should be placed outside so that it can measure the air temperature and humidity of the outside air. A hanger is provided for this purpose.
The control unit should be mounted indoors and reach the outdoor sensor with the 3m long cable. The indoor sensor on the housing of the control unit should not be directly in the airflow of the future fan. It is better if it can measure the indoor temperature and humidity undisturbed.
The control unit is supplied with power using a cell phone power supply unit and a USB-C cable. When the power is connected, the device starts after 4s and shows information on the display.
The device always starts in automatic mode.
The device includes a switchable socket that works according to the Zigbee standard, as sold by Philips Hue or IKEA, for example.
The measured values of the sensors can be read on the display of the control unit. On the left for the indoor sensor and on the right for the outdoor sensor.
Internally, each measured value is averaged over 8 single measurements. The number of valid measurements in the FIFO is shown in the display in the second line, if the value is NOT equal to 8. Therefore, during initialization, a zero is shown here. Also a smaller value is shown here, if you have connection problems with the sensor.
Additionally, the fan state and mode is shown in the upper left corners in all screens.
The mode of the device can be switched using the small recessed button.
The device always starts in automatic mode and shows this as “AUTO” on the display.
When the button is pressed, the appliance switches to ON mode. Here the fan is always switched on for 15 minutes - is then switched off for 10 minutes and then starts again in any case.
If you press the button again and select the off mode (“OFF”), the fan will never start.
If you press the button a third time, you will return to automatic mode.
Regardless of the mode, the display always shows whether ventilation is theoretically useful.
The micro SD card can be clicked into place by pressing lightly on the right-hand side of the housing. This causes it to come out a few millimeters and can be removed.
The data on the SD card can be converted into a nice graphic using the Jupyter notebook Dewpoint-Visualization.ipynb. The second approach works directly from the browser. See the code here Visualization/VisualizeData.html or view the page directly on github pages: VisualizeData.html. There is also a german version: VisualizeData_DE.html.
The visualization shows:
A new zigbee device can be coupled for 180s after a reset of the controller. To delete old couplings a zigbee factory reset can be done with a long press on the boot button on the esp32c6.
The DHT sensors are connected as follows:
pins of “Analog” connector | pins of DHT22.1 |
---|---|
GND | GND |
3V3 | VDD |
N/A = A0 | NC (not in function) |
0 = D0 | SDA |
| pins of “UART” connector | pins of DHT22.2 | | — | — | |GND | GND | |3V3 | VDD | |TX.6 | NC (not in function) | |RX.7 = D7 | SDA |
Modified picture, original taken from here: https://wiki.seeedstudio.com/Seeeduino-XIAO-Expansion-Board/#pinout-diagram
| component | Approx. price | | — | — | | ESP32-C6 by Seeed Studio | 6 € | | XIAO Expansion Board | 15 € | | 2x DHT22 Sensors | 20 €| | XLR socket and cable | 5 € | | SD card | 6 € | | 3D print | 15 € | | Zigbee socket | 8 € | | Cell phone power supply + USB-C cable | 5 € | | CR1220 battery for RTC | <1€ | | M2 and M3 screws … | <1€ | | total | 80 € |
Obviously, additionally required:
Try scrubbing the connection of the battery pad with a screw driver, as there may be some residue from the soldering process which prohibits good contact to the battery.
Yes, the gpio warning may be ignored.
This is not used now, but the idea is, that the system uses wifi to get a proper time stamp. Unfortunately, WiFi and zigbee is not working at the same time now.
processSensorData.timeSinceAllDataWhereValid()