Storm Detector with Tasmota

Moderator: bbiernat

Post Reply
User avatar
pancio
Administrator
Posts: 43
Joined: 18 September 2013, 23:02 - Wed
Location: SILESIA

Storm Detector with Tasmota

Post by pancio »

I need to equip my Home Assistant with storm detector so i found chip module GY-AS3935 made by CJMCU. It's very tiny but smart module with I2C and SPI interfaces. I Decide to use I2C with Wemos D1 mini under Tasmota. No more other staff was required...

Prototype.
storm_detector_prototype.jpg
storm_detector_prototype.jpg (979.54 KiB) Viewed 731 times
Actually you need to connect 3 signals: SDA, SCL, IRQ and 3V3/GND. Rest available signals on the GY-AS3935 you must connect to 3V3 or GND ( see attached scheme)
Of course you must flash your Wemos D1 (or other module with ESP8266) using tasmota_sensors image.
stsch.png
stsch.png (9.58 KiB) Viewed 731 times
as3935_i2c.png
as3935_i2c.png (104.46 KiB) Viewed 724 times
Workflow.

1. Download Tasmota image:
There is a big list of binaries for each release, which can be confusing if you don’t know which one you need. In case you should download binaries called tasmota-sensors.bin:
https://github.com/arendst/Tasmota/rele ... ensors.bin

2. Download and install esptool

Esptool is a utility that can be used to read and write the flash memory on devices using the ESP8266 and ESP32 microcontrollers.
Follow the instructions on that page to install it on your computer: https://github.com/espressif/esptool

3. Determine your serial device related to ESP8266
Your USB-to-Serial converter connects to your computer by USB, and appears to the computer as a virtual serial port like e.g. ttyUSB0 if you have only one device connected. Use dmesg command to determine serial name:

Code: Select all

[42904.761182] usb 2-1.2: new full-speed USB device number 13 using ehci-pci
[42904.870228] usb 2-1.2: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54
[42904.870229] usb 2-1.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[42904.870231] usb 2-1.2: Product: USB2.0-Serial
[42904.899590] usbcore: registered new interface driver ch341
[42904.899600] usbserial: USB Serial support registered for ch341-uart
[42904.899614] ch341 2-1.2:1.0: ch341-uart converter detected
[42904.900431] usb 2-1.2: ch341-uart converter now attached to ttyUSB1
[42905.047877] usb 2-1.2: USB disconnect, device number 13
[42905.048256] ch341-uart ttyUSB1: ch341-uart converter now disconnected from ttyUSB1
[42905.048306] ch341 2-1.2:1.0: device disconnected
4. Put Wemos D1 into bootloader mode

Disconnect power from the Wemos D1 module, hold the GPIO0 pin low (use micro switch on the board if available), and connect power again. Then release GPIO0. This will put the Wemos into a mode where it waits for new firmware to be loaded.

5. Upload the Tasmota firmware

Open a terminal, and go into the directory where you have the Tasmota binary (downloaded earlier). Use esptool to push it to the Wemos by command:

Code: Select all

esptool.py -p /dev/ttyUSB0 write_flash -fm dout 0x0 tasmota-sensors.bin
Uploading the binary takes a few seconds - you may observe progress. After while device with new firmware will be ready to start...

6. Connect to Tasmota via WiFi

Disconnect the Wemos power, then reconnect it. When the Tasmota firmware starts up and doesn’t find any existing configuration, it goes into a setup mode and creates its own WiFi network. The network will have a name similar to “tasmota-a3b2”, with the 4 digits based on the last part of the unique MAC address of the ESP8266 hardware.

Connect to the Tasmota's WiFi network. From the web browser open address: http://192.168.4.1.
Your computer should then automatically open the WiFi configuration screen. Now enter the WiFi settings for your network using at home. Enter all required details, and click “Save”.

The Wemos will then reboot and attempt to connect to your WiFi network by using IP assigned to Wemos by your router. If for some reason it will not happens, wail around 180 seconds and try to connect to generic tasmota-a3b2 WiFi network and check/edit parameters.

6. Set required signals.
sd3.png
sd3.png (64.36 KiB) Viewed 731 times
7. Customisation (very important!)
In order to avoid so quickly FLASH damage I recommended switch off autosave configuration by using SaveData 0 option:
storm_flash_count.png
storm_flash_count.png (94.4 KiB) Viewed 451 times
savedata0.png
savedata0.png (133.76 KiB) Viewed 451 times
Next, you should set the gain, noise flor level etc.
All details you may find on: https://tasmota.github.io/docs/AS3935/

8. Checking detection
sd1.png
sd1.png (41.32 KiB) Viewed 731 times
sd2.png
sd2.png (208.62 KiB) Viewed 731 times
9. PCB
sdpcb.png
sdpcb.png (66.29 KiB) Viewed 731 times
sd3dv.png
sd3dv.png (75.77 KiB) Viewed 731 times
Have a nice Lights!
Attachments
storm_detector.zip
Storm Detector Module GERBER's files
(24.52 KiB) Downloaded 38 times

Post Reply