Adding WiFi to my home ventilation system

My home is equipped with an mechanical ventilation system intent to circulate fresh air using ducts and fans. not connected to heating or anything, the single purpose is to provide a constant airflow to optimise the inside air quality. A ventilator always runs in the background but can also run at a higher speed to provide some extra capacity while showering for instance.

The problem is that the control switch for the ventilation is in my kitchen, two floors down from the bathroom. Despite the fogs at long showering sessions I have never seen any family member (including myself) run down the stairs to turn up the ventilation before and after showering. The nice result is that I have to repaint to walls every year with fungus killing wallpaint to prevent growth like this.

So it would be nice to have the control also upstairs but the wiring is in de walls and the easiest solution is a remote control of sorts.

esp2866 to the rescue

…or how to add WiFi to a ventilator

Although I do have a raspberry pi based solution for switching the lights with my phone, based on a 433MHz transmitter I wanted to have something more reliable and above all, a way to check the status of the switch. I read some positive blogs about some cheap tiny WiFi modules (esp8266) with GPIOs that can run scripts and thought that might do the trick. Since they are cheaper than the parking fees for parking 5 minutes in my city I ordered a few because well… always nice to have some spares in case i kill some.

ESP8266 offers a complete and self-contained Wi-Fi networking solution, allowing it to either host the application or to offload all Wi-Fi networking functions from another application processor.

After some experimentation I settled on NodeMCU as my firmware of choice. Thanks to the excellent Quickstart Guide I got my first esp up and running in no time. That settled, what do I want my esp to do?

Basically I wanted to replace this switch with something I could control with my iPhone, add it to the remote I made for my lights.

The ingredients:

an old 5V phone charger

esp8266 esp01

DCDC stepdown 3.3V module

a high level trigger 1-channel relay module

A bit of soldering gave me this

Just the esp01 with the 3.3V step-down and some leads to relay and power supply.

The trick is in the programming. The NodeMCU firmware launches the script init.lua at boot-time and and mine contains the basic network stuff.





init.lua

listen for a http get command : http:// youripadress /?aan (“aan” is Dutch for “on”) should switch the ventilator on, http://ipadress/?uit should switch it off.

: http:// /?aan (“aan” is Dutch for “on”) should switch the ventilator on, http://ipadress/?uit should switch it off. auto-shutdown: knowing my family members… they will not switch the ventilation off after showering so I decided that it should turn itself of after a while to prevent it being on for the next 24hrs

The last line calls the script that does the actual “smarts”. What does it do?

So, I decided not to give it a gui of its own but let it respond to http calls. This makes it easier for me to add the device to my php-based remote I already had written to control the lights in my home.