Lovelace Lightning Detector Card for AS3935

This Lovelace card for Home Assistant displays lightning detections from you own inexpensive AS3935 Lightning Detection Sensor.

Install the sensor interface script the Raspberry Pi connected to your AS3935 sensor board.

Live Cards

GitHub: The card: Lovelace Lightning Detector Card shows data reported by your sensor.

GitHub: The Sensor Script lightning-detector-MQTT2HA-Daemon interfaces with the AS3935 sensor on your RPi and sends the accumulated data via MQTT to your HA installation.

Links to videos showing detections: (pls, pardon the lack of sound on the videos)

6 Likes

Can this be made to work with other lightning sensors that have direction, range and count (no kA)?

As of this moment, one would have to adapt my lightning-detector-MQTT2HA-Daemon script to pull data from one of those services, accumulate it as needed for this card, and then send the data to the card. It can be done. Iā€™m writing a document which Iā€™ll add to that same repo detailing how the data accumulated and what is sent to the card and why. With this document in hand (again, coming soon) it wouldnā€™t be a difficult task to make an adapter to feed this card.

Iā€™ll post here to let you know when the new document has arrived and how to get to it.

1 Like

this is awesome! i have one of these but have been trying to figure out how to just use it with an ESP rather than RPi. just havenā€™t had time!

1 Like

OK, the new document is in the REPO for the MQTT Daemon (since it does the sending to the card.)

See: https://github.com/ironsheep/lightning-detector-MQTT2HA-Daemon/blob/974d7c4e300a99afac39cd0627c910aff6d4ef4e/THEOPS.md

This should help with the ā€œhow toā€¦ā€ portion of the problemā€¦

Hello,
I just got my sparkfun as3935 lightning detector, but I am struggling to get it to work.
It seems to be a newer hardware version with i2c unsupported by default, but still being able to activate by ā€œswitchingā€ two jumpers.
https://learn.sparkfun.com/tutorials/sparkfun-as3935-lightning-detector-hookup-guide-v20
I cut SE and connected CS and connected the right one of i2c PU, ADR unchanged.
correct?
it does show up now:

 sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          03 -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

but the script gives me an error:

python3 /opt/ISP-lightning-mqtt-daemon/ISP-lightning-mqtt-daemon.py
Traceback (most recent call last):
  File "/opt/ISP-lightning-mqtt-daemon/ISP-lightning-mqtt-daemon.py", line 174, in <module>
    i2c_address = int(config['Sensor'].get('i2c_address', default_i2c_address))
ValueError: invalid literal for int() with base 10: '0x03'

i2c_address needs to be in decimal, not hexadecimal. So set it to "3"

1 Like

@Fugazzy, @lightmaster is correct. My example in the config.ini.dist uses the 0x prefix but should not!

1 Like

Why not add a check to the script to accept both decimal and hex, and convert to whichever the script already uses?

Could someone please post a wire diagram of how the AS3935 is connected to the pi I think I have mine right but not sure. Thank you

Is the table in the README sufficient or do you need something more? See: https://github.com/ironsheep/lightning-detector-MQTT2HA-Daemon#connecting-the-as3935-to-your-raspberry-pi

Iā€™m a visual person so sometimes Iā€™m dumb :slight_smile: Here is how mine is currently connected

This is what my mqtt output looks like.

{
ā€œsettingsā€: {
ā€œtimestampā€: ā€œ2020-08-30T02:14:19-04:00ā€,
ā€œhardwareā€: {
ā€œmin_strikesā€: 5,
ā€œafe_insideā€: true,
ā€œdisp_lcoā€: false,
ā€œnoise_floorā€: 1
},
ā€œscriptā€: {
ā€œperiod_minutesā€: 5,
ā€œend_minutesā€: 60,
ā€œnumber_ringsā€: 5,
ā€œdistance_unitsā€: ā€œmiā€
}
}
}

I got my system up and running, that means I see the entities in my homeassistant,
But I am not sure if the sensor itself is working correct?
Manually starting the script I do get a lot these outputs:
[2020-08-30 23:10:30] << INTR(17) >> Noise level too high - adjusting
Is that normal?

@Fugazzy there are a number of things to look at hereā€¦ make sure your sensor is away from your RPi as far as it can be. Move your RPi and sensor away from other electrical equipment, etc.

Also, new in the latest version of the script thereā€™s an Antenna fine tuning feature so you can better dial-in your detector board.

GitHub: The Sensor Script lightning-detector-MQTT2HA-Daemon :

  • NOW Supports SPI connections to AS3935

  • Has new feature for automatic determination of Antenna Fine-tuning value

See the README at the repo!

Hello
I have a different lightning detector.
I would like to know if it is compatible.

Greetings Andre

The post directly above yours says:

This is your sensor.

Hello Tom

Yes that is my sensor.
Would that work for me on the project?

greetings
AndrƩ

Thatā€™s what the word ā€œsupportsā€ means, yes.