Thursday, March 26, 2020

Time Lapse Camera

I decided I needed a time lapse camera video of the bus build. I have two of the ESP32-CAM modules from AI Thinker.

To flash the ESP32-CAM I hooked a FTDI USB-serial adapter as:

5v  -> 5V  (pin 1 sorta)
GND -> GND (pin 2 sorta)
Tx  -> UOR
Rx  -> UOT
IO0 - GND during flash, press reset once first

I first tried the example in the Arduino IDE for it. It seems OK so I looked for an example time lapse. I found His code is called E8. All I changed was to un-comment the correct camera definitions.

It boots, takes a photo, writes it to the SD card and sleeps for about 15 seconds. Then repeats. Sounds just right.

I then found a micro SD card that I could reformat to FAT32.

To use it, it needs a mount. There is a mounting box at that fit fairly good. The hole for the power wires is in the wrong corner for me so I just left the cover off.

I powered it with an 18650 battery direct to the 3.3v input pin. and mounted it to the forward bulkhead of the bus. I try to remember to take out the battery when I stop working for the day and put it back in the next time.

Converting the photos to a video was trivial in linux:

  pot$ ffmpeg -pattern_type glob -i "IMG*.jpg" ~/tmp/output4.mpeg

Here is today's video:

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

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.

   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:
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

Then flashed it on a nodemcu V0.9 board with: --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 then set local WiFi configuration
reboot, net scan to find address. It may do mDNS.

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

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

Configure Other
  PurifierFan, purifierFan2

  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!