notice: this is still a work in prorgess. I try to keep the main branch in a stable state and will try to fix issues if any come up / are reported but I do this in my spare time so...
This was adpated to work on an ESP 8266 (I used the Huzzah feather) and to add some connectivity. I added:
- MQTT to
- post the sensor data and ventilation status
- be able to change settings remotely
- config values are persisted across reboots
sources:
- original project + code from Taupunktlüfter bei heise make
- article in heise make
I used Visual Studio Code with the PlatformIO IDE
extension.
Arduino IDE should also work - hasn't been tested (and the folder structure would have to be adapted). The required libraries can be found in the platformio.ini
file.
configuration is mainly done in separate header files:
- see
src/secrets.h
for configuring your WiFi and MQTT server. - see
src/settings.h
for configuring the service (offsets, pins etc.)
- MQTT (
BASETOPIC
can be set insettings.h
- if not set it will be omitted.)- sensor data
- config status
- change configuration
- heartbeat
- ventilation status
- basic logs
- periodic ventilation even when ventilation should not occur according to dewpoints
BASETOPIC/ventilation/sensor-outside/temperature
: Outside sensor - current temperatureBASETOPIC/ventilation/sensor-outside/humidity
: Outside sensor - current humidityBASETOPIC/ventilation/sensor-outside/dewpoint
: Outside sensor - current dewpoint temperatureBASETOPIC/ventilation/sensor-outside/heater
: Outside sensor - integrated heater status (1 = ON, 0 = OFF)BASETOPIC/ventilation/sensor-inside/temperature
: Inside sensor - current temperatureBASETOPIC/ventilation/sensor-inside/humidity
: Inside sensor - current humidityBASETOPIC/ventilation/sensor-inside/dewpoint
: Inside sensor - current dewpoint temperatureBASETOPIC/ventilation/state
: State of the ventilator. Can beON
,OFF
.BASETOPIC/ventilation/stateNum
: State of the ventilator. Can be1
,0
(with 1=ON and 0=OFF).
All config values can be changed by appending set
to the topic.
BASETOPIC/config/mode
: Mode of the dewpoint ventilator. Can beON
,OFF
,AUTO
.BASETOPIC/config/deltaDPmin
: minimum difference between dewpoints before ventilator is turned onBASETOPIC/config/hysteresis
: distance between switch-on and switch-off pointBASETOPIC/config/tempInside_min
: minimum inside temperature at which ventilation is activatedBASETOPIC/config/tempOutside_min
: minimum outdoor temperature at which ventilation is activatedBASETOPIC/config/tempOutside_max
: maximum outdoor temperature at which ventilation is activatedBASETOPIC/config/correction_temp_inside
: offset for inside temperatureBASETOPIC/config/correction_temp_outside
: offset for outside humidityBASETOPIC/config/correction_humidity_inside
: offset for inside humidityBASETOPIC/config/correction_humidity_outside
: offset for outside humidityBASETOPIC/config/minHumidityForcedVentilation
: if the humidity inside is above this value, the ventilator will be turned on periodically to prevent moldBASETOPIC/config/maxHoursWithoutForcedVentilation
: after this time, the ventilator will be turned on for at leastoverrideVentilationMinutes
minutesBASETOPIC/config/forcedVentilationMinutes
: amount of minutes to override the ventilation statusBASETOPIC/condig/reference_temp_diff_threshold
: difference between the reference temperature and the outside temperature at which the reference temperature is used
BASETOPIC/log/startup
: startup time in UTC (requires internet to get current time from ntp server)BASETOPIC/log/heartbeat
: heartbeat timestamp in UTC - sent every 10 secondsBASETOPIC/log/ventilatorStatusReason
: Reason as string for the current state of the ventilator.
BASETOPIC/config/reset
: set this to1
ortrue
to reset the config values to the default config (aka what was insettings.h
)BASETOPIC/sensor-outside/reference_temperature/set
: current outside reference temperature to use. Overrides temperature from the sensor for a limited amount of time (1 hour). Helps avoid measuring errors when the sensor is in direct sun light.BASETOPIC/sensor-outside/reference_temperature
: current value of reference temperature.
- bad WiFi can cause strange things... some values were sent as NaN even though WiFi was connected (lots of packet drops though) and QoS was set to 1.
- don't put the outside sensor close to where the ventilator is. In my case I had it about 50cm from the ventilator and as soon as the ventilator ran, the outside temperature was strongly affected by the air coming from the ventilator.
- think about how to easily update your software during testing (I ran into the basement with my laptop from the 2nd floor about 100 times) -> will look at OTA in the future
- ESP8266 seems to be pretty resistant to interferences. It worked without the preventing measures mentioned in the original article (I only put the 1000 µF capacitor between + and - and left out all other capacitors & resistors that were meant to help with interferences)
- It's really hard to debug issues that come up after longer operation (for some reason I see restarts every few > 5 days and have no idea what it is. My solution for now: design everything in a way that restarts are not a problem)
- the longer I look at code the more ideas I get :-)
- DHT21 sensors are not suite for outside use - humidity clogs up at some point during colder season