Tasmota: AS3935 I2C device goes missing from I2C on restarts

Created on 2 Aug 2020  路  30Comments  路  Source: arendst/Tasmota

PROBLEM DESCRIPTION

AS3935 is detected on I2C on cold starts but goes missing if the device is restarted

REQUESTED INFORMATION

_Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!_

  • [ x] Read the Contributing Guide and Policy and the Code of Conduct
  • [ x] Searched the problem in issues
  • [x ] Searched the problem in the docs
  • [x ] Searched the problem in the forum
  • [ ] Searched the problem in the chat
  • [ ] Device used (e.g., Sonoff Basic): node mcu
  • [ ] Tasmota binary firmware version number used: 8.4.0

    • [ x] Pre-compiled

    • [ ] Self-compiled

    • [ ] IDE / Compiler used: _____

  • [ ] Flashing tools used: esptool
  • [ ] Provide the output of command: Backlog Template; Module; GPIO 255:
  Configuration output here:
19:28:32 CMD: Backlog Template; Module; GPIO 255
19:28:32 RSL: stat/tasmota_FC5E57/RESULT = {"NAME":"Generic","GPIO":[255,255,255,255,255,255,255,255,255,255,255,255,255],"FLAG":15,"BASE":18}
19:28:32 RSL: stat/tasmota_FC5E57/RESULT = {"Module":{"0":"Generic"}}
19:28:33 RSL: stat/tasmota_FC5E57/RESULT = {"GPIO0":{"0":"None"},"GPIO1":{"0":"None"},"GPIO2":{"0":"None"},"GPIO3":{"0":"None"},"GPIO4":{"6":"I2C SDA"},"GPIO5":{"5":"I2C SCL"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO12":{"0":"None"},"GPIO13":{"0":"None"},"GPIO14":{"0":"None"},"GPIO15":{"0":"None"},"GPIO16":{"0":"None"}}

  • [ ] If using rules, provide the output of this command: Backlog Rule1; Rule2; Rule3:
  Rules output here:


  • [ ] Provide the output of this command: Status 0:
  STATUS 0 output here:
19:30:42 CMD: Status 0
19:30:42 RSL: stat/tasmota_FC5E57/STATUS = {"Status":{"Module":0,"FriendlyName":["Tasmota"],"Topic":"tasmota_FC5E57","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}}
19:30:42 RSL: stat/tasmota_FC5E57/STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://thehackbox.org/tasmota/release/tasmota.bin","RestartReason":"External System","Uptime":"0T00:01:09","StartupUTC":"2020-08-02T18:29:33","Sleep":50,"CfgHolder":4617,"BootCount":32,"BCResetTime":"2020-08-02T18:15:12","SaveCount":86,"SaveAddress":"F6000"}}
19:30:42 RSL: stat/tasmota_FC5E57/STATUS2 = {"StatusFWR":{"Version":"8.3.0(sensors)","BuildDateTime":"2020-05-14T16:18:52","Boot":31,"Core":"2_7_1","SDK":"2.2.2-dev(38a443e)","Hardware":"ESP8266EX","CR":"325/699"}}
19:30:42 RSL: stat/tasmota_FC5E57/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["abcd",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["00008009","2805C8000100060000005A00000000000000","00000000","00006000"]}}
19:30:42 RSL: stat/tasmota_FC5E57/STATUS4 = {"StatusMEM":{"ProgramSize":621,"Free":380,"Heap":24,"ProgramFlashSize":4096,"FlashSize":4096,"FlashChipId":"1640EF","FlashMode":2,"Features":["00000809","8FDAA787","0415A3A4","B7FFBFCD","01DA9BC4","64367CC7","00000072"],"Drivers":"1,2,3,4,5,6,7,8,9,10,12,14,16,17,20,21,24,29,34","Sensors":"1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,26,28,31,34,37,39,40,42,43,51,52,55,56,58,59,62,64,66,67"}}
19:30:42 RSL: stat/tasmota_FC5E57/STATUS5 = {"StatusNET":{"Hostname":"espgeiger","IPAddress":"192.168.1.118","Gateway":"192.168.1.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.1.1","Mac":"84:F3:EB:FC:5E:57","Webserver":2,"WifiConfig":4,"WifiPower":17.0}}
19:30:42 RSL: stat/tasmota_FC5E57/STATUS6 = {"StatusMQT":{"MqttHost":"","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_FC5E57","MqttUser":"DVES_USER","MqttCount":0,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30}}
19:30:42 RSL: stat/tasmota_FC5E57/STATUS7 = {"StatusTIM":{"UTC":"2020-08-02T18:30:42","Local":"2020-08-02T19:30:42","StartDST":"2020-03-29T02:00:00","EndDST":"2020-10-25T03:00:00","Timezone":"+01:00","Sunrise":"05:25","Sunset":"20:26"}}
19:30:42 RSL: stat/tasmota_FC5E57/STATUS10 = {"StatusSNS":{"Time":"2020-08-02T19:30:42","AS3935":{"Event":0,"Distance":0,"Energy":0}}}
19:30:42 RSL: stat/tasmota_FC5E57/STATUS11 = {"StatusSTS":{"Time":"2020-08-02T19:30:42","Uptime":"0T00:01:09","UptimeSec":69,"Heap":24,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":20,"MqttCount":0,"Wifi":{"AP":1,"SSId":"abcd","BSSId":"D4:6E:0E:36:CA:C8","Channel":11,"RSSI":70,"Signal":-65,"LinkCount":1,"Downtime":"0T00:00:03"}}}

  • [ ] Provide the output of the Console log output when you experience your issue; if applicable:
    _(Please use_ weblog 4 _for more debug information)_
  Console output here:

00:00:00 CFG: Loaded from flash at F6, Count 86
00:00:00 Project tasmota Tasmota Version 8.3.0(sensors)-2_7_1
00:00:00 WIF: Connecting to AP1 abcd Channel 11 BSSId D4:6E:0E:36:CA:C8 in mode 11N as espgeiger...
00:00:01 WIF: Connected
00:00:01 HTP: Web server active on espgeiger with IP address 192.168.1.118
19:31:36 RSL: tele/tasmota_FC5E57/INFO1 = {"Module":"Generic","Version":"8.3.0(sensors)","FallbackTopic":"cmnd/DVES_FC5E57_fb/","GroupTopic":"cmnd/tasmotas/"}
19:31:36 RSL: tele/tasmota_FC5E57/INFO2 = {"WebServerMode":"Admin","Hostname":"espgeiger","IPAddress":"192.168.1.118"}
19:31:36 RSL: tele/tasmota_FC5E57/INFO3 = {"RestartReason":"Software/System restart"}
19:31:40 RSL: tele/tasmota_FC5E57/STATE = {"Time":"2020-08-02T19:31:40","Uptime":"0T00:00:09","UptimeSec":9,"Heap":24,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"Wifi":{"AP":1,"SSId":"abcd","BSSId":"D4:6E:0E:36:CA:C8","Channel":11,"RSSI":74,"Signal":-63,"LinkCount":1,"Downtime":"0T00:00:03"}}
19:31:46 APP: Restarting

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 3456, room 16
tail 0
chksum 0x84
csum 0x84
va5432625
~ld
00:00:00 CFG: Loaded from flash at F5, Count 87
00:00:00 Project tasmota Tasmota Version 8.3.0(sensors)-2_7_1
00:00:00 WIF: Connecting to AP1 abcd Channel 11 BSSId D4:6E:0E:36:CA:C8 in mode 11N as espgeiger...
00:00:01 WIF: Connected
00:00:01 HTP: Web server active on espgeiger with IP address 192.168.1.118
19:31:51 RSL: tele/tasmota_FC5E57/INFO1 = {"Module":"Generic","Version":"8.3.0(sensors)","FallbackTopic":"cmnd/DVES_FC5E57_fb/","GroupTopic":"cmnd/tasmotas/"}
19:31:51 RSL: tele/tasmota_FC5E57/INFO2 = {"WebServerMode":"Admin","Hostname":"espgeiger","IPAddress":"192.168.1.118"}
19:31:51 RSL: tele/tasmota_FC5E57/INFO3 = {"RestartReason":"Software/System restart"}
19:31:55 RSL: tele/tasmota_FC5E57/STATE = {"Time":"2020-08-02T19:31:55","Uptime":"0T00:00:09","UptimeSec":9,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"Wifi":{"AP":1,"SSId":"abcd","BSSId":"D4:6E:0E:36:CA:C8","Channel":11,"RSSI":72,"Signal":-64,"LinkCount":1,"Downtime":"0T00:00:03"}}

TO REPRODUCE

Add the DFRobot AS3935 board and click on the restart button on the UI, click Ok to confirm

EXPECTED BEHAVIOUR

AS3935 is detected on restart and appears on the UI. Instead there are no devices detected.

ADDITIONAL CONTEXT

If I add a BME680, it comes back without issues after restarts.

(Please, remember to close the issue when the problem has been addressed)

bug fixed

All 30 comments

Hi,

Can you update to latest Tasmota and try again please?

Your template shows _Tasmota binary firmware version number used: 8.4.0_
But your status 0 shows ("Version":"8.3.0(sensors)")

Please update and try again. Thanks.

@rowanalex123

Hi, any news on this? Were you able to try with latest Tasmota?

@ascillato Yes I tried initially on 8.4.0 and then downgraded to 8.3.0 to see if this was a regression bug. AS3935 disapears after a "restart 1" command on both versions.

an app restart probably does not reset the sensor. Maybe it does not like to be setup twice?
Then toggling bit 0 (power) of addr 0x00 and waiting a bit at the start of AS3539Setup() might help.

an app restart probably does not reset the sensor. Maybe it does not like to be setup twice?
Then toggling bit 0 (power) of addr 0x00 and waiting a bit at the start of AS3539Setup() might help.

this might be not helped, but the sensor is missing and we don't can send commands.

@rowanalex123 :
do you have additional sensors on the bus?
what does I2C scan indicate after restart?
give please a status0 after a fail restart.

thanks

PS.: please use 8.4.0!

Sorry, I can't help.

I don't understand the device and have no clue how to get rid of the abundance of mqtt messages and gui texts like "noise detected","interrupt with no event","disturber detected". I guess it has something to do with the capacitor data to be entered but my device has a (standard it seems) sticker with the standard "MA5532-AE" label. No clue what 8-bit value (deducted from the code) I should use here.

But at least I can say the device always pops back up after a restart ;-) so you likely have a power issue as @device111 suggested.

yes, the device had a lot of messages and a lot of things to adjust.
The device itself is verry complex and you have to study the datasheet.
You can watch the youtube Video for a better understanding the settings and the messages. (21 minutes!)

https://www.youtube.com/watch?v=fTEEDfWbGEU

otherwise you can go to
https://github.com/arendst/Tasmota/pull/8130
or contact @ludwich66. Ludwich has a lot of Experience with the device.

@arendst
The sticker with the "tuningcap" Value is apparently stuck on the outside of the packaging. If the sticker is not there, you can calibrate the sensor with "AS3935calibrate". The device should now calibrated.

The funny thing is, I never had a sensor...my order and my money fell victim to the COVID crisis and the sensor never arrived.
All the tests were made by ludwich66. :-)

I don't have any other device on the i2c bus. If I add a bme680, it comes up after restart correctly. I'm away from my computer for the next one week, will try setting toggling bit 0 (power) of addr 0x00 and post here. I'm using the df robot breakout board of this sensor.

@rowanalex123
can you try the bin here? It reset the device to there defaults every restart and then load the settings from eeprom.

tasmota.bin.gz

FWIW, the Sparkfun version of this sensor says it is not supported on I2C, but they left that code there anyway. SPI is how they recommend interfacing. I have one but haven't submitted a request to have it supported over SPI.

thats definitiv not true. the Sparkfun Sensor have full I2c support and even with a 2nd address.

grafik

I was not clear in my post. They left the circuitry not code.

See notes here may only apply to V2 of the board

https://learn.sparkfun.com/tutorials/sparkfun-as3935-lightning-detector-hookup-guide-v20?_ga=2.115263175.1580721257.1597002705-930883413.1597002705

ah, ok. :-)
they don't give code support for I2c, but the sensor can be used with I2c.

Yes, but it may be why you are having inconsistent/intermittent issues:

"SparkFun does not actively support I2C on this product due to the inconsistency of its' implementation by its' manufacturer AMS and their lack of active support of the product."

ok, do you know what errors can occur? they don't write about the detailed issues.

@device111 thanks for the build.

There's a description of some issues with the device here esp. in the comments, in case you've not come across it before - http://fll-freak.com/blog/?p=554.

I tried with a different NodeMCU board and the AS3935 seems to be coming back after restarts now. I dont know how the board influences the I2C device scan though. I'll keep testing and post here if I encounter the issue with this new board.

Could you please share the code changes you made? I'd like to add them back and retest if I face an issue again.

thanks for the link. So I didn't know the article before.

Several problems are described:

  1. Problem with register 0x00:
    The problem should not actually occur with Tasmota, since all registers are read with the I2cRead8() function and the function does always a "Repeated Start".
    But, in your case this could eventually the Issue. The The chip is identified using the 0x00 address. So, we need more investigation, what extactly the Problem is. (So we can read the Chip always after Cold Boot)

  2. Problems with the board / antenna.
    Unfortunately there is nothing we can do with the Code.

  3. Problems with the IRQ pin. This behavior cannot be suppressed even by SPI communication. This is mostly noticeable in Tasmota with "IRQ with no event".

ok, some questions:

  1. you have no Problems with the new Board?
  2. Do you have tested both Versions of Tasmota with the new board? (Normal and my modified)
  3. What does I2Cscan says if the AS3935 was not detected?

at he moment a make a refactor of the driver and if its ready, i do a Pull-Request with the changes i made.

Not sure if it is helpful but here is some code that runs on an ESP8266 and connects to the sensor over SPI. It uses a REST API to make the data available. I haven't had any lightning in a while so not sure if it is working or not.

https://github.com/shred/kaminari

there is no reason to switch to SPI at the moment.

What does the status "Interrupt with no Event!" exactly mean?
Im getting this status almost constantly and cant figure out how to get rid of it.

This means that an interrupt was triggered via the interrupt pin but there is no event in register 0x03 (Int).
The article described by @ rowanalex123 states that the interrupt register is sometimes empty when an interrupt is triggered.

what kind of board do you have?
have you checked the wiring of the interrupt Pin?
have you only this event or can you simulate a Disturber via an piezzo lighter?

I have written to @ludwich66. He does a logging from his sensor and gave Infos about the counts of "Interrupt with no event".

Now, i have orderd a second time a AS3935. With no testing, its hard to find some issues.

@mar565
do you have defined the right interrupt Pin in Tasmota settings?

Almost 95% of the time I get "IRQ..", 4% "noise detected" and almost never "listening..".
Based on the changing status, I gues the wirering and Tasmota setting are correct.
Testing with a piezo lighter has no effect (and today there was a Thunderstrom, also without an effect).
I have the MA5532-AX board from AliExpress.
IMG_20200822_212225

HI As 3935 User,

I use my AS3935 with a ESP8266 Board . There are no "great" electrical differences but:
A stable Poweradapter (2 Meter Cable)
220 mycroF on 3,3 V rail
An old Ferrit clamp filter
image
on the Sensor Cable 25cm.

Tasmota Config:
image

This Sensor Settings:
22:31:14 MQT: stat/tasmota_DEAA8F/RESULT = {"AS3935":{"Gain":"Indoors","NFfloor":0,"uVrms":28,"Tunecaps":4,"MinNumLight":1,"Rejektion":2,"Wdthreshold":2,"MinNFstage":0,"NFAutoTime":4,"DisturberAutoTime":1,"Disturber":"Off","NFauto":"On","Disturberauto":"On","NFautomax":"On","Mqttlightevent":"Off"}}

Yesterday i changed my Node Red setting. Now it sends a E-Mail for Event "Interrupt with no Events"but there is no Mail yet.

I received 1800 messages Since 1.07.2020 (node red birth. the messages coincide with the lightning card (https://kachelmannwetter.com/de/blitze)

--> Pay attention to a good voltage supply without spikes

ludwich

All sonoff devices do NOT have a good stable power supply.
For such a high sensitive sensor a sonoff device is not a good choice

@mar565
what else you have to consider:
I don't know your Board but you will need to wire up all of the associated pins for the different boards.

For I2C Use:

  • Always connect CS and MISO to GND
  • If "SI" is present, you need to connect to VCC

new version. go to 9221

@ascillato2
can be closed.

I was not clear in my post. They left the circuitry not code.

See notes here may only apply to V2 of the board

https://learn.sparkfun.com/tutorials/sparkfun-as3935-lightning-detector-hookup-guide-v20?_ga=2.115263175.1580721257.1597002705-930883413.1597002705

Not sure if it's relevant, but it worked for me...
Most* dev. boards have pull-downs on I2C address pins (A0 & A1)
Page 24, in Data Sheet states in bold
"The combination a0 = 0 (low) and a1 =0 (low) is explicitly not allowed for I虏C communication."
I pulled both A0 & A1 HIGH & now everything is working reliable. [ESP-07 & CJMCPU-AS3935]

AS3935 - CJMCU board I2C

Ok, thanks!
If you want, Feel free to enter the changes in the Tasmota Docs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

he-so picture he-so  路  3Comments

abzman picture abzman  路  3Comments

TylerDurden23 picture TylerDurden23  路  3Comments

Vujagig picture Vujagig  路  3Comments

esp32x picture esp32x  路  3Comments