Saturday, March 14, 2020

Air Purifier Managed by Tasmota

My daughter has been suffering with allergies this spring. I decided to install a new air Purifier in the house. It may also help with bacteria/virus control too. It is a UV light in combination with an ionizer. It installs in the heater air duct. It was easy to install, cut a 3 inch hole in the duct after the fan and screw it into the hole. Install the provided transformer inside the heater and plug it in.

The air purifier installed.

For the size of this house based on square footage, it needs the fan to run at least 20 minutes at a time and repeat every hour regardless of whether the heater is on or not. I didn't have a timer and Amazon wanted way TOO much! I did find a dual relay module in my extras box and an esp8266, NodeMCU V0.9. I've had them quite a while.

I had heard of Tasmota, an IoT home automation software for ESP based controllers. I had not played with it before. I could have just written a program and webpage, but I usually do not add the extra code for robustness. I hoped that tasmota did. I downloaded it and flashed the ESP. It only took a couple days to find the little nuances that stopped it from doing what I wanted (without reading all the docs!). I was caught by the desire to not use MQTT or any cloud services. Finally I found that "on system#boot" does not work without MQTT and mDNS set, so it needed a patch, I downloaded tasmota_8.1.0.10.bin from http://thehackbox.org/tasmota/


The dual relay module and the NodeMCU V0.9
In the end it only required a single multi-part rule to get the 20 minutes ON followed by 60 minutes of OFF. And it comes back for a re-boot/or power cycle controlling properly.



 rule1
   on system#boot do backlog ruletimer1 1800; power1 1 endon
   on rules#timer=1 do backlog ruletimer2 3600; power1 0 endon
   on rules#timer=2 do backlog ruletimer1 1800; power1 1 endon




A 3D-printed enclosure

I think the ESP needs to be outside the metal enclosure of the heater so it needs a protective case. I printed one with my Ender3 Pro.
The Tasmota WiFi interface on my phone
With the stock interface the fan can be turned ON or OFF.

The details, if you are interested:


I downloaded and installed tasmota from:

   https://github.com/arendst/Tasmota/releases/tag/v8.1.0
I then found that "on system#boot" does not work without mqtt and mDNS set, need patch
downloaded tasmota_8.1.0.10.bin from http://thehackbox.org/tasmota/

Then flashed it on a nodemcu V0.9 board with:

   esptool.py --port /dev/ttyUSB0  write_flash -fs 1MB -fm dout 0x0 tasmota.bin

The dual relay module on D2. (I don't need the second relay, but it is what was on hand.)



Nodemcu   Relay
5V --     VCC
GND  --   GND
D2   --   IN1
jumper to JD-VCC-VCC  not VCC-GND

connect WiFi on phone to 192.168.4.1 then set local WiFi configuration
reboot, net scan to find address. It may do mDNS.

config menu:  Generic(0)
 Save
D2 Relay1i(29)

Console:
rule on system#boot do backlog ruletimer1 1200; power1 1 endon on rules#timer=1 do backlog ruletimer2 3600; power1 0 endon on rules#timer=2 do backlog ruletimer1 1200; power1 1 endon
Save

Configure Other
  PurifierFan, purifierFan2
  Save

Console
  Rule1 1

Config- Save Config to-> /Config_tasmota_A450B3_4275_8.1.0.10.dmp

It has been working flawless for 3 days now. No sneezing or watery eyes since!

No comments:

Post a Comment