Ozone PDM Timer With Sonoff: Coronavirus Defense
by marco.sillano in Living > Health
459 Views, 4 Favorites, 0 Comments
Ozone PDM Timer With Sonoff: Coronavirus Defense
The ozone is great in domestic sanitation, but you must use it with care (see domestic ozone overview). I started some DIY projects about ozone use, this one is about a timer for ozone generators.
Many ozone generators are without PDM (Pulse Duration Modulation) and therefore cannot regulate the ozone produced in the unit of time. Some inexpensive generators are even without timer. But both PDM and the timer are practically indispensable for the correct use of ozone in domestic sanitation (see ozone diffusion simulation).
Ozone in air purify applications
The timerPDM allows a first control of the ozone produced by PDM (2% .. 100%). Furthermore, in LOOP mode, it allows you to adjust the ON (1min..3h) and the OFF (1min..24h) times separately in 1 minute intervals.
Ozone in chock applications
In AUTO mode, in addition to the PDM control and the setting of the switch-on duration, it is possible to program the start of the ozone generator (hh:mm). In addition, the button on the timerPDM allows the manual start of AUTO mode with an initial delay of 1 minute to move away.
This timerPDM is autonomous, but at the same time compatible with any external standard MQTT clients and brokers: therefore it can be used standalone or remotely controlled or even integrated into more complex projects IOT, like smart homes.
All required files and the last complete version of this project can be found here: github-timerPDM
Supplies
- Itead Sonoff S20, Smart Socket Plug Wifi https://it.aliexpress.com/item/4000382230184.html
(You can also use Sonoff S26 or Sonoff-basic for this project) - FTDI USB to TTL Serial Converter Adapter 3.3V https://www.aliexpress.com/item/32617951363.html
- 4/5 pins for p.c.
-
Female To Female Jumper Cable Dupont
Preparation of Sonoff Switch S20
Remove the S20 card from the container.
Solder a 4/5 pin connector into the Sonoff-S20 pitches
Prepare the 4-wire connection FTDI ↔ Sonoff:
- FTDI → S20
- VCC → 3.3
- RX → TX
- TX → RX
- GND → GND
Download:
- esptool (https://github.com/espressif/esptool,
- esp_MQTT (https://github.com/martin-ger/esp_mqtt/tree/master...
Clean Sonoff flash memory using esptool/write-erase-flash.bat
White Sonoff using esptool/write-esp-Sonoff.bat
Now Sonoff switch can be closed.
You use a laptop with WiFi, and connect the timer: AP "MyAP" (initial default) or "timerPDM" (after configuration).
Now use PuTTY, previously installed on the laptop, to connect Sonoff (Telnet, IP: 192.168.4.1, port: 7777) and give it the commands:
CMD>set system_output CMD>set speed CMD>set ssid -router_ssid- CMD>set password -router_password- CMD>set ap_ssid timerPDM CMD>set mqtt_host ozonetimer CMD>save CMD>reset
You can also use an Android smartphone and the TCP Telnet Terminal app (or other telnet clients): https://play.google.com/store/apps/details?id=project.telnettcpterminal&hl=en
The "timerPDM02.cde" file is the script used by the timerPDM.
The easiest way to load a script into timerPDM in OTA mode is to use a WEB server.
Using the remote console (telnet: Putty or TCP Telnet Terminal) give the command :
CMD>script -url_to_script-
After a reset the timerPDM is ready
TimerPDM-red: Node-red Client
This app is the most complete, suitable for fixed applications, or for use with portable PCs. Since node-red acts like a WEB server, all devices connected to the network, including smartphones, can use it.
Node-red can be installed on any PC (Win / Linux) and also on Raspberry pi 3 if you want a dedicated low-cost computer (for node-red installation, see https://nodered.org/docs/getting-started/installation)
- Copy the contents of the node-red/ timerPDM.json file to the clipboard and import it into a new flow in node-red.
- Configure access to the timer MQTT broker: -timer_IP-:1883
PDM Timer: Android Client
This simple client allows you to control the timer using a WiFi connected Android smartphone. Convenient and above all portable solution, it acts as a remote control, allowing you to activate the ozone generator from a safe area.
For this client, I chose the free IoT MQTT Dashboard https://play.google.com/store/apps/details?id=com.thn.iotmqttdashboard because it is rich in inputs and aesthetically pleasing, but there are also other alternatives. You can search Google Play. The important thing is that the application you choose manages JSON payload.
Unfortunately, it is not possible to import a dashboard into IoT MQTT Dashboard from a file: the PDM timer dashboard must be created interactively, following figures. Long but simple, see the app help.