AS3935 Franklin Lightning sensor~
This feature is included only in tasmota-sensors.bin
The AS3935 is a programmable fully integrated Lightning Sensor IC that detects the presence and approach of potentially hazardous lightning activity in the vicinity and provides an estimation on the distance to the head of the storm. The embedded lightning algorithm checks the incoming signal pattern to reject the potential man-made disturbers.
Tasmota driver includes:
- support for all AS3935 Parameters
- support of all related commands for configuration
- support of NF-Auto Function to auto Threshold the Noise Reduction
- support of Auto Disturber
- support of calibrating the internal OSC with switchable Caps
"Sensor uses a software interrupt. Make sure that the connection with the IRQ pin is stable to prevent flicker."
In the Configuration -> Configure Module page assign:
- GPIOx to
I2C SDA (6)
- GPIOy to
I2C SCL (5)
- GPIOz to
Note for I2C Use
You will need to wire up all of the associated pins for the different boards.
- Always connect CS and MISO to GND.
- If "SI" is present, you need to connect to VCC.
See some wiring on the Board pictures below. I2C wiring
After a reboot the driver will detect AS3935 automatically.
and in MQTT topic when an Event occurs:
Commands and Use~
|AS3935power||Power On/Off the Device||0/1 (On/Off)||(1 Bit)|
|AS3935setnf||Noise Floor Level||value from 0-7||(3 Bit)|
|AS3935setml||Minimum number of lightning||1, 5, 9, 16||(2 bit)|
|AS3935default||load default for Sensor and Settings||no argument|
|AS3935settunecaps||Internal Tuning Cap.||value from 0-15||(4 Bits)|
|AS3935setrej||Spike rejection||value from 0-15||(4 Bits)|
|AS3935setwdth||Watchdog threshold||value from 0-15||(4 Bits)|
|AS3935setminstage||min stage that could be come with NFautotune||value from 0-15: 0-7 Indoors, 8-15 Outdoors||(4 Bits)|
|AS3935disturber||Set Disturber||0/1 (On/Off)||(1 Bit)|
|AS3935autonf||Set Auto Tune for Noise Level||0/1 (On/Off)||(1 Bit)|
|AS3935autodisturber||Set Auto-Disturber||0/1 (On/Off)||(1 Bit)|
|AS3935autonfmax||Auto Tune with INDOOR and OUTDOOR||0/1 (On/Off)||(1 Bit)|
|AS3935lightevent||mqtt messages only for lightning events||0/1 (On/Off)||(1 Bit)|
|AS3935noirqevent||suppress mqtt "IRQ with no Event" Messages||0/1 (On/Off)||(1 Bit)|
|AS3935settings||show all settings||no argument|
|AS3935calibrate||auto calibrate the internal Capacitors||no argument|
|AS3935disttime||time for reset Disturber in auto-mode||0-15 min.||(4 Bit)|
|AS3935nftime||time for auto-Nf treshhold||0-15 min||(4 Bit)|
Normally you don't need the calibrate function. If you buy the AS3935, the module has a sticker on it with the calibrated cap. Use
AS3935Settunecaps for setting up this value.
if the calibration fails, it is possible that you have a board with the wrong caps on it! (some CJMCU-Boards) CJMCU Board
|No.||Description||Suppress with |
|Suppress with |
|1||Lightning with Distance detected|
|2||Lightning out of Distance|
|3||Distance cannot be determined|
|4||Storm is Overhead|
|5||Noise level too high||*|
|7||Irq with no Event detected||*|
|8||Irq Pin flicker detected|
|9||Device is Powerd Off|
NF setting table:~
Setting table of the NF-noise sensitivity and stages:
|Stage 0||000||Indoors||28||highly sensitive|
|Stage 15||111||Outdoors||2000||less sensitive|
Hint and Tips
- take a stabilized power supply.
- keep a distance of at least 200 mm from the ESP and the AS3395
- be careful with "ready to Use" devices like Sonoff, etc. they don't have a good power supply inside.
- use a Ferrit clamp filter on the sensor cable.
- wire all related Pins for I2C use.
You can find some troubleshooting tips in the Tasmota GitHub discussion.
Breakout Boards and Wiring for I2C use:~
Sparkfun Board V2.0:
Embedded Adventures Board:
"Some type of this sensor have wrong capacitors (100pF and 1000pF) installed and the calibration fails. The correct caps are 680pF and 270pF."