Go Back   HomeSeer Message Board > HomeSeer Products & Services > HomeSeer Help > How-To's

How-To's This area provides in-depth information on how to do something in HomeSeer or home automation.

Thread Tools Display Modes
Old July 2nd, 2017, 12:00 PM
Pete's Avatar
Pete Pete is offline
Join Date: Jan 2001
Location: House
Posts: 14,266
How to use a AS3935 Lightning sensor with a Raspberry Pi

Rewrote this DIY post.

It is only for the Playing With Fusion AS3935 lightning board i2C connection to a Revision 2 of the Raspberry Pi (original Homeseer Zee).

I will compress the RPi image for downloading and attach it for those interested in doing this endeavor.

I have written to the playing with fusion folks regarding a couple of questions.
- The specs state 2-5 VDC. Most folks are using 3.3VDC with their Arduino testing. Below testing is using 5.0VDC. I may change it to using 3.3VDC.
- Another question relates to the capacitor value that I have and if I need to modify the python script with the value of the tuning capacitor value.

Got an answer back from my above questions:

Hi Pete,
Awesome, thanks for pointing me to this! I would definitely switch to 3.3V pins and change to 0x0D (x0D*8 =104).
Thanks, and have a great 4th weekend,

Going to re pin my stuff and make the changes for the capacitor and redo the below drawing today.

If you are not a person that solders stuff send me the Lightning board and I will solder jumper cables and or pins on the board.
With pins on the board you can just utilize jumper cables from your board to the RPi.

I am using the original RPi re purposed from the original Zee and some Linux knowledge.

HW RPi info timeline
==> Zee RPi #1 HS3 OS on Wheezy (with Z-Wave GPIO / PiFace RTC) - freed original RPi for use here.
==> Zee2 RPi #2 HS3 OS on Wheezy (with Z-Wave GPIO / PiFace RTC) - freed RPi2 turned this RPi2 to ZNet like device and 1-Wire hub connected via POE in attic
==> Zee2 OS on Pine64 2Gb #3 HS3 OS on Ubuntu 16.04 64 bit - currently running Zee2 HS3 Lite.

Note that I did this endeavor using SSH and never connected a monitor to the Raspberry Pi.


Step #1 - Preparing your RPi wiring

Step #2 - Preparing your AS3935 breakout board solder the wires - use a small tipped soldering iron, put a tiny drop of solder on the iron then touch the wire to solder.


1 - Raspberry Pi / original Homeseer Zee
2 - AS3935 Breakout board made by Playing with Fusion dot com.
3 - wires - preferred here is a starter wiring kit sold on Amazon, Ebay et al.
4 - soldering iron with a small tip and solder.

Connections are as follows
Note here you can instead solder a header to the lightning breakout board with straight or pins at 90 ° and just utilize single jumper cables.

1 - Board VDD ==> - 3.0VDC - PIN # 1 - RED
2 - Board GND ==> Ground - PIN # 6 - BLACK
3 - Board SCK / SCL ==> SCL - PIN # 5 - GPIO 3 - WHITE
4 - Board MOSI / SDA ==> SDA - PIN # 3 - GPIO 2 - GREEN
5 - Board IRQ ==> Pin #11 - GPIO 17 - YELLOW
6 - Board SI ==> 3.0VDC - Pin #17 for i2c - RED

Step #3 - Preparing your RPi

A - Download Wheezy from here ==> Wheezy Download
B - Download SD Card Formatter from here ==> Windows SD Card Formatter
C - Format you SD card. Here utilized Windows 7 and a 4Gb microSD card in an SD card holder
D - Download Win32 Disk Imager from here ==> Win32DiskImager
E - Write downloaded Wheezy Image to SD card - here utilize SD card slot on laptop or USB SD card stick.

Step #4 - Preparing your RPi via SSH

A - Insert your SD card in to your RPi and plug in an Ethernet cable to network port on RPi and plug in power up.
B - Have a look see at your firewall router to find the DHCP address of your RPi. It will be labeled as Raspberry.
C - Download Putty from here ==> Putty
D - Install it on your Windows PC
E - SSH to your RPi using user pi and password raspberry
F - type sudo su once in and hit enter
G - type raspi-config and hit enter - do what the picture shows. (Expand system, change password, internationalization options and advanced menu)
Go to advanced menu on raspi-config and do what the picture shows. (host name, memory split (go to 16) and i2c)
H - Exit and reboot.
I - SSH back to your RPi - adding one user
Type sudo su
add your name to users and sudo - note here using my name as an example
adduser pete *password and answer all of the questions - I use return on them
usermod -aG sudo pete
J - SSH back to your RPi - here we are going to create a static address - easy these days.
K - cd /etc
L - nano dhcpcd.conf
add your static IP to the end of the file. Use your network information. The example is my configuration.

interface eth0
static ip_address=
static routers=
static domain_name_servers=

M - reboot and ssh back to your RPi with your static IP and new username and type sudo su.
N - type apt-get update
O - type apt-get upgrade (note this will run for a while)
P - when finished reboot.
Q - you are now finished with base configuration on your RPi
P - if you have not connected your lightning sensor then do it now. Note type halt to shut down your RPi, unplug network and power cable, hook up your Lightning sensor.
Q - testing your i2C connection to you lightning sensor
R - cd /
S - type apt-get install i2c-tools
T - type i2cdetect -y 1 * you will see the following. If you see only 03 then you are connected to the AS3935

~# sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          03 -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --
Step #5 - Using the AS3935 Python library to test your lightning sensor AS3935 breakout board.

A - ssh to your RPi.
B - type cd /opt and mkdir lightning and cd lightning
C - type git - if it is not present then type apt-get install git
D - with your browser look at the following: hxxps://github.com/pcfens/RaspberryPi-AS3935 read the text file
E - type git clone hxxps://github.com/pcfens/RaspberryPi-AS3935
F - cd to /opt/lightning/RaspberryPi-AS3935
G - type pip install -r requirements.txt
H - if there in a python module missing then type: python -m pip install SomePackage
I - type again pip install -r requirements.txt
J- type cd /opt/lightning/RaspberryPi-AS3935
K - type python setup.py
L - testing demo.py - make one change to the file here:

# Rev. 1 Raspberry Pis should leave bus set at 0, while rev. 2 Pis should set
# bus equal to 1. The address should be changed to match the address of the
# sensor. (Common implementations are in README.md)
sensor = RPi_AS3935(address=0x03, bus=1)

sensor.calibrate(tun_cap=0x0D) * changed to my capacitor value of 104

M - ssh to your pi, cd /opt/lightning/RaspberryPi-AS3935
N - type python demo.py
O - I've attached another more elaborate demo for lightning sensor at the end of this post.
The python script is called AS3935-monitor.py.

Step #6 - A3935 mini web server - located here ==> hxxps://github.com/pcfens/RPi-AS3935-Web
Made the web page a link from main Homeseer 3 server and one HSTouch page.


A - SSH to your Pi
B - type cd /opt/lightning
C - type git clone hxxps://github.com/pcfens/RPi-AS3935-Web
D - type cd RPi-AS3935-Web
E - type pip install -r requirements.txt
F - if there in a python module missing then type: python -m pip install SomePackage
G - type again pip install -r requirements.txt
H - cp settings.cfg.sample to settings.cfg
I - type nano settings.cfg
J - changed the following lines to match.

; Rev. 1 Raspberry Pis should leave bus set at 0, while rev. 2 Pis should set
; bus equal to 1.
bus = 1

; Set the i2c address of lightning sensor
address = 0x03

; The value needed to tune the sensor
tuning_cap = 0x0F ==> 0x0D (x0D*8 =104) ==> tuning_cap = 0x0D

Hex value of 0x0F = 15 X 8 = 120 µF capacitor value
Hex value of 0x0D = 13 X 8 = 104 µF capacitor value

To calculate your tune your sensor value take your capacitor value and divide it by 8 and convert it to hex.

Here is another demo script called AS3935-monitor.py

VCT fork of RaspberryPi-AS3935 is located here: hxxps://github.com/VCTLabs/py-sensor-test/blob/master/python/AS3935-monitor.py

# -*- coding: utf-8 -*-
#! /usr/bin/env python
AS3935-monitor.py: A monitoring script for the AS3935 lightning
    sensor on the MOD-1016 v6 breakout board.  Requires both the
    RaspberryPi-AS3935 and RPi.GPIO Python modules.  Note that
    the reset function requires VCT fork of RaspberryPi-AS3935.

simple invocation:
    $ sudo python AS3935-monitor.py

error logging invocation:
    $ sudo python -u AS3935-monitor.py > >(tee -a output.log) 2> >(tee error.log >&2)

Licensed under the GNU General Public License (GPL) version 2 or greater.
Copyright 2014 Vanguard Computer Technology Labs, Inc.

from RPi_AS3935 import RPi_AS3935
import RPi.GPIO as GPIO
import time
from datetime import datetime


## Rev 1 Raspberry Pi: bus=0
## Rev 2 and later Raspberry Pi: bus=1
## All: address=

sensor = RPi_AS3935(address=0x03, bus=1)

## Uncomment to reset all registers to factory default values.
## sensor.reset()


## uncomment/set to filter out false positives

def log_raw_data(data):
    # need to pass time as parameter and convert to UTC here
    utcnow = datetime.utcnow()
    version = 01
    timestamp = utcnow.strftime("%Y-%m-%d %H:%M:%S.%f")
    outstring = str(version)+" "+str(timestamp)+" "+str(data)+" "+str(min_strikes)+" "+str(noise_floor)+"\n"

def handle_interrupt(channel):
    global sensor
    reason = sensor.get_interrupt()
    if reason == 0x01:
        print("Noise level too high - adjusting")
    elif reason == 0x04:
        print("Disturber detected - masking")
    elif reason == 0x08:
        now = datetime.now()
        distance = sensor.get_distance()
        if 0 < distance < 63:
        if distance == 1:
            print("Overhead lightning detected - distance = " + str(distance) + " km at %s ") % now.strftime("%H:%M:%S.%f")[:-3],now.strftime("%Y-%m-%d")
        elif 40 < distance < 63:
            print("Distant lightning detected - distance = " + str(distance) + " kms at %s") % now.strftime("%H:%M:%S.%f")[:-3],now.strftime("%Y-%m-%d")
        elif 2 <= distance <= 40:
            print("Lightning detected - distance = " + str(distance) + " kms at %s") % now.strftime("%H:%M:%S.%f")[:-3],now.strftime("%Y-%m-%d")
            print("Invalid data; distance out of range.")

irq_pin = 17
cs_pin = 24

GPIO.setup(irq_pin, GPIO.IN)
GPIO.add_event_detect(irq_pin, GPIO.RISING, callback=handle_interrupt)

def read_settings():
    global min_strikes, noise_floor
    min_strikes = sensor.get_min_strikes()
    noise_floor = sensor.get_noise_floor()

def print_settings():
    print("Minimum allowed strikes is " + str(min_strikes))
    print("Current noise floor is " + str(noise_floor))

running = True

    print("AS3935 Lightning Detection Monitor Script - v0.1")
    print("  Monitor Status: ONLINE")
    ## log raw data to file

    while running:

except KeyboardInterrupt:
    print("  Monitor Status: OFFLINE")

    GPIO.cleanup() # clean up GPIO on CTRL+C exit
18:18c 07/02/2017 testing while storm rolls through - hear thunder and seeing lightning

AS3935 Lightning Detection Monitor Script - v0.1
Monitor Status: ONLINE

Disturber detected - masking
1 2017-07-02 23:16:00.074464 1 1 0

Overhead lightning detected - distance = 1 km at 18:16:00.067 2017-07-02
1 2017-07-02 23:16:01.165121 1 1 0

Overhead lightning detected - distance = 1 km at 18:16:01.158 2017-07-02
1 2017-07-02 23:16:03.188902 1 1 0

Overhead lightning detected - distance = 1 km at 18:16:03.178 2017-07-02

7th of July, 2017

Overhead lightning detected - distance = 1 km at 14:19:53.838 2017-07-07
1 2017-07-07 19:21:48.004053 1 1 0

Overhead lightning detected - distance = 1 km at 14:21:47.993 2017-07-07
1 2017-07-07 19:22:42.710066 5 1 0

Lightning detected - distance = 5 kms at 14:22:42.699 2017-07-07
1 2017-07-07 19:23:48.668980 5 1 0

Lightning detected - distance = 5 kms at 14:23:48.658 2017-07-07
1 2017-07-07 19:25:49.172010 5 1 0

Lightning detected - distance = 5 kms at 14:25:49.161 2017-07-07
1 2017-07-07 19:38:49.285675 6 1 0

Lightning detected - distance = 6 kms at 14:38:49.275 2017-07-07
1 2017-07-07 19:47:19.987470 24 1 0

Lightning detected - distance = 24 kms at 14:47:19.977 2017-07-07
1 2017-07-07 19:54:57.464848 24 1 0

Lightning detected - distance = 24 kms at 14:54:57.454 2017-07-07
- Pete


HS3 Pro & Lite
Edition Beta | Ubuntu 16.04 64 bit | Oracle Windows Virtual Box ==> for Wintel only SAPI and HS3 plugins

Last edited by Pete; July 7th, 2017 at 05:04 PM.
Reply With Quote
Old July 4th, 2017, 08:11 AM
Pete's Avatar
Pete Pete is offline
Join Date: Jan 2001
Location: House
Posts: 14,266
Updated post.

Please let me know what doesn't work.

Note relating to this post you have to be familiar with Linux and Python.

I will make a compressed basic RPi (original) image. It is currently running on a 4Gb SD card.
In order for this image to work with your Lightning sensor you will need to follow the above post relating to connectivity of the lightning sensor.
Reply With Quote
Old July 11th, 2017, 11:47 AM
Pete's Avatar
Pete Pete is offline
Join Date: Jan 2001
Location: House
Posts: 14,266
Different scripts to test with.


It is attached.

Recommended installation via git though located here:


Install it as described on github dot com.

Do not forget to make your adjustments here in the script:


## Rev 1 Raspberry Pi: bus=0
## Rev 2 and later Raspberry Pi: bus=1
## All: address=

sensor = RPi_AS3935(address=0x03, bus=1)

## Uncomment to reset all registers to factory default values.


/opt/lightning# python -u AS3935-monitor.py > >(tee -a output.log) 2> >(tee error.log >&2)
AS3935 Lightning Detection Monitor Script - v0.1
  Monitor Status: ONLINE

Disturber detected - masking
/opt/lightning# tail -f output.log

Disturber detected - masking
  Monitor Status: OFFLINE
Minimum allowed strikes is 1
Current noise floor is 0

AS3935 Lightning Detection Monitor Script - v0.1
  Monitor Status: ONLINE

Disturber detected - masking
Attached Files
File Type: zip AS3935-monitor.py.zip (1.5 KB, 3 views)
Reply With Quote
Old July 11th, 2017, 12:53 PM
Pete's Avatar
Pete Pete is offline
Join Date: Jan 2001
Location: House
Posts: 14,266
AS3935 Lightning sensor Python script that tweets

This script came from Toulouse, France.

Toulouse (UK: /tuːˈluːz/;[4] French pronunciation: [tuluz] (About this sound listen) locally: [tuˈluzə] (About this sound listen); Occitan: Tolosa [tuˈluzɔ], Latin: Tolosa) is the capital of the French department of Haute-Garonne and of the region of Occitanie. The city is on the banks of the River Garonne, 150 kilometres (93 miles) from the Mediterranean Sea, 230 km (143 mi) from the Atlantic Ocean and 680 km (420 mi) from Paris. It is the fourth-largest city in France, with, 466,297 inhabitants as of January 2014.

The Toulouse Metro area, with 1,312,304 inhabitants, as of 2014, is France's fourth-largest metropolitan area, after Paris, Lyon and Marseille, ahead of Lille and Bordeaux.

Toulouse is the centre of the European aerospace industry, with the headquarters of the Airbus Group (formerly EADS), the Galileo positioning system, the SPOT satellite system, ATR and the Aerospace Valley. It also hosts the European headquarters of Intel and CNES's Toulouse Space Centre (CST), the largest space centre in Europe. Thales Alenia Space, and Astrium Satellites also have a significant presence in Toulouse. The University of Toulouse is one of the oldest in Europe (founded in 1229) and, with more than 103,000 students, it is the fourth-largest university campus in France, after the universities of Paris, Lyon and Lille.
Mr. Nobody's blog is here.

Raspberry Pi lightning strikes detection station that tweets storm information

Posted on June 27, 2017 by Hexalyse

A few days ago I was browsing the world wide web, when suddenly I stumbled upon an article speaking about an IC sensor made by AMS, called the AS3935 Franklin Lightning Sensor, which could detect the electrical signature of lightning strikes up to 40km and give the “strength” of the lightning as well as an estimation of the distance to the head of the storm. And all this in a tiny 4x4mm SMD circuit designed to be embedded in personal weather stations, watches, cars, etc.

My dark nerd side was tickled and I suddenly needed wanted to buy one and build a lightning detection station that could tweet about incoming storms, using my Raspberry Pi which is lying on a table doing nothing most of the time. And so I did it ! What I ended up with is a Twitter account on which lightning strikes info is tweeted in real time, with energy and distance estimation : hxxps://twitter.com/toulouse_orages

After some research, I found that Embedded Adventure was selling a module with a pre-soldered sensor with the right antenna and components added to the board, ready to be used via an I2C interface. Some more research and I found that somebody already implemented a Python library to use such sensors on a Raspberry Pi. Perfect ! We have everything we need.

Writing the code to make it work

The Python library is pretty well self-documented, so just browse through the code and it should be enough. If you want to understand exactly how each of the sensor parameter works (Watchdog Threshold, Signal Rejection, etc, even some of which are not implemented in the library), refer to the AS9535 datasheet.

It could be useful to change those parameters that are not directly exposed, and it’s pretty easy to do so by directly calling RPi_AS3935.set_byte(register, value) (just be sure to call RPi_AS3935.read_data() first, and get the current value of the register so you only change the bits you need in it). For the Twitter part of the script, I chose to use the Tweepy module.

I just wanted to write a script that would listen for lightning, then tweet when a storm is happening. So first, to avoid getting false positives, I set the “minimum strikes” parameter to 5 (the sensor waits for 5 strikes in a predefined period before it starts sending IRQs for each subsequent strike). Then I have a handler which is run each time an IRQ is received. If it’s a strike, we tweet about it. But to avoid spamming tons of tweets, I set up a 5 minutes delay : if more than one strike happen during those 5 minutes, I’ll just tweet the number of strikes that have been detected. After 30min with no activity from the sensor, we can declare that the storm is over and tweet people that they should be okay now.

Here is an example tweet (yes it tweets in French, because I live in France. Baguette.) :

The translation would be “/!\ 117 strikes detected in the last 5 minutes. Power of the last strike : 429714 – distance to the head of the storm : 1km“.
As you can see, it was a pretty violent storm, with tons of intra-cloud strikes happening and being detected almost every other second (which is close to the maximum the sensor can detect, since in the datasheet we can read it waits for 1,5s after a strike has been detected and analyzed, before it starts listening again).
The Twitter account is : hxxps://twitter.com/toulouse_orages

Final words

I had the chance to set it up right before a period of storms, here in Toulouse. At first I thought it might be crazy because it detected hundreds of strikes every few minutes. But no… it’s been 4 days now and I saw no false positives. The sensor didn’t detect any lightning for 48 hours, and started going crazy anytime a storm was approaching ! So I’m really happy with the results, that are much better than I would have thought from a little sensor like it. Especially since I didn’t take any time to calibrate it properly and mainly used factory settings. I just used the antenna capacitor tuning value given by Embedded Adventure, but it can be a good idea calibrating it again since temperature and other factors can influence it. A way to calibrate the antenna by reading the oscillation speed from the IRQ pin using an Arduino is explained here : as you can see, the process could be easily automatized.

If you’re interested in building your own station, you can find the final Python code for this bot on Github : Github – Hexalyse / LightningTweeter

Feel free to fork it, modify it and hack it to your needs ! If you have any question, remark or observation, do not hesitate to post a comment.
Git Lightning Tweeter

Installing dependencies:

Last edited by Pete; July 11th, 2017 at 03:49 PM.
Reply With Quote
Old July 11th, 2017, 01:06 PM
Pete's Avatar
Pete Pete is offline
Join Date: Jan 2001
Location: House
Posts: 14,266
Tuning the antenna

Tuning the antenna

Detection at 500kHz

The hard-coded detection algorithm in the AS3935 is build for a 500kHz signal.
[...] The AMS does not simply look for a peak over a threshold. They look for the multi stage crackling signature of a lightning stroke. Where a series of small events occur before the major stoke occurs. This allows them to filter out noise events from things like solenoids from generating false alarms. 500 kHz was likely picked as it is a section of the RF spectrum that gets little HAM use, hence little interference [...]

The algorithm seems to look for a signal signature like this:


The incoming signal of the RLC resonator to the IC needs to be tuned to the resonant frequency of 500.000 Hertz, +-3.5% It is tuned by setting the capacitor value (=tuning capacitor) of the RLC resonator. You set the capacitor value (16 discrete options), then you detect the current antenna frequency by counting the square-wave oscillation on the _IRQPin. Then you adjust if the value is not close to 500.000 Hz.

Outputting the frequency values resulting from setting all possible capacitor values:

tune antenna to capacitor 0 gives frequency: 3165 = 506400 Hz
tune antenna to capacitor 1 gives frequency: 3129 = 500640 Hz
tune antenna to capacitor 2 gives frequency: 3118 = 498880 Hz
tune antenna to capacitor 3 gives frequency: 3109 = 497440 Hz
tune antenna to capacitor 4 gives frequency: 3130 = 500800 Hz
tune antenna to capacitor 5 gives frequency: 3119 = 499040 Hz
tune antenna to capacitor 6 gives frequency: 3111 = 497760 Hz
tune antenna to capacitor 7 gives frequency: 3100 = 496000 Hz
tune antenna to capacitor 8 gives frequency: 3090 = 494400 Hz
tune antenna to capacitor 9 gives frequency: 3081 = 492960 Hz
tune antenna to capacitor 10 gives frequency: 3039 = 486240 Hz
tune antenna to capacitor 11 gives frequency: 3028 = 484480 Hz
tune antenna to capacitor 12 gives frequency: 3019 = 483040 Hz
tune antenna to capacitor 13 gives frequency: 3041 = 486560 Hz
tune antenna to capacitor 14 gives frequency: 3032 = 485120 Hz
tune antenna to capacitor 15 gives frequency: 3023 = 483680 Hz

Problematic: the frequency values vary over time!! Either due to faults in the measurement (no reliable clock) or due to environmental influences on hardware? Changes to the IC thresholds seem to change the antenna frequency values, and therefore require recalibration calls?

Apparently the chosen antenna on the board should determine the tuning value. I've read online that the Tindie-board capcitor value should be 5. Yet when i run the automatic calibration procedure, it usually picks either 0, 1 or 2. I've implemented a funciton to manually set it to 5, but i can't quite tell yet the effect of the different settings on the results.

Successful lightning strike detection results in an energy value and a distance value (discrete steps, limited to: 0, 5, 6, 8, 10, 12, 14, 17, 20, 24 ..). The Km distance corresponds to the distance of the storm head instead of the distance to the last lightning strike. The system stores all recent lighting strikes and uses them to calculate the storm head.


Man-made disturbers

Action at a distance! Activating a solenoid (6V) within the same room (couple meters in between) definitely causes the disturber interrupt to go off. The solenoid EM-pules is detected on disrupting the solenoid circuit (when nail is again released from coil). This can be a good tester to verify the circuit is working, though reports online say, that disturbers going off doesn't necessarily mean the system is properly calibrated.

possible sources of EMI (electromagnetic interference):
  • piezo BBq lighter
  • noisy electric drill, electric motors
  • ignotion system of motor cars
  • appliances
  • fluorescent lights
  • Tv sets
  • light switches
  • high voltage wires
  • solenoid

Running the Arduino on a 9V battery, flashing an LED for disturber interrupts, i investigated my apartment for disturbers. I noticed: increase in disturbers if i hold the antenna at a specific distance (~5-10cm) at a specific angle to a light source. Doesn't seem to work for incandescent bulbs though.

Trying to calibrate the IC

Calibrating the chip has been the major issue so far. The chip has several values that need calibration to avoid false positives:
  • noise floor threshold : 0...7
  • watchdog threshold : 0...7
  • spike rejection threshold : 0...7
  • AFE gain : setIndoors..or..setOutdoors

Good practice is to recalibrate after every setting change.

Others report:

Setting it too sensitive make it less sensitive to local strikes, and setting it less sensitive makes it less sensitive to remote strikes

Grounding the chip (to mains ground) reduces the number of strikes it reports, better battery power

Successfull measurements with visual verification

There's only been one proper thunderstorm since i've played with the board. But at least i managed to collect some data with visual verification. These are the settings that produce accurate results. Definitely less strikes than i noticed by eye, but at least the reported strikes corresponded to real lightning strikes.

I got the best results when activating the IC's outdoor setting. No matter if it actually was physically outdoors or indoors. Though i eventually packed the Arduino and the chip into a ziplock bag and stuck it out the window to get rained on.

noisefl | spike rej | watchdog | indoor/outdoor | tuneAntenna

Sept 5th
0,0,0,outdoors > 37km, 20km, 20km
0,0,0,outdoors,5 > 40km, 37km, 34km, 34km, 27km
1,0,0,outdoors,5 > 27km, 24km,

Last edited by Pete; July 11th, 2017 at 01:20 PM.
Reply With Quote
Old July 13th, 2017, 09:15 AM
Pete's Avatar
Pete Pete is offline
Join Date: Jan 2001
Location: House
Posts: 14,266
Moving RPi with AS3935 up to attic and next to the old Hobby boards 1-wire lightning sensor. (this is high on the WAF as it has been adjacent to the kitchen).

Still setting up the HB dual counter here with a total lightning strike and a lightning strike rate per minute.

The HB board is all about how fast I can update the counters. The AS3935 board is a totally different approach to lightning.

Eventually will utilize these two sensors for Homeseer and may add the EMP sensor to the mix for three lightning sensors.

HB counters.jpg
Reply With Quote
Old July 20th, 2017, 03:46 PM
Pete's Avatar
Pete Pete is offline
Join Date: Jan 2001
Location: House
Posts: 14,266
20th of July 2017

Noticed that mounting it in the attic that the AS3935 Lightning sensor board is very directional with it's tiny antenna. I placed it in the attic with the antenna facing up.

It seemed to work better pointed out a window with a Southern exposure. Comparing it here to the omnidirectional antenna on the old Hobby Boards lightning sensor which only counts lightning.

Here in the midwest the storms typically do not come from any repetitive direction. IE: yesterday we had a quick tumultuous thunderstorm with much wind and rain and lightning lasting maybe 30 minutes in the wee hours of the morning....2AM or so...

Rethinking best placement. It's been suggested to just put it in the yard some 3 feet up from ground level, no earth ground and using a battery instead instead of a transformer to power up the RPi2. Ideally then making it a wireless device?

So as documented some battery and a small solar panel to charge the battery would probably work.

So far then the easy button way is using the old Hobby Boards dual counter 1-wire lightning detector where traditionally see the counts increment to the thousands from zero on approaching storms. It is omnidirectional and works well in the attic. This board needs a earth ground to work well. Here using metal electrical conduit in the attic which is using the water ingress copper pipe in the basement for ground (there is also a ground stake outside).
Reply With Quote
Old July 21st, 2017, 07:53 PM
Pete's Avatar
Pete Pete is offline
Join Date: Jan 2001
Location: House
Posts: 14,266
21st of July, 2017

Moved it down from the attic to the study facing a window today.

Noticed the IRQ wire fell off so resoldered it.

Storms passing through tonight...

lightning# python AS*.py
AS3935 Lightning Detection Monitor Script - v0.1
Monitor Status: ONLINE

Noise level too high - adjusting
1 2017-07-22 03:31:46.398574 1 1 0

Overhead lightning detected - distance = 1 km at 22:31:46.395 2017-07-21
Noise level too high - adjusting

Last edited by Pete; July 21st, 2017 at 11:47 PM.
Reply With Quote
Old July 27th, 2017, 02:11 PM
Pete's Avatar
Pete Pete is offline
Join Date: Jan 2001
Location: House
Posts: 14,266
27th of July, 2017

Changed configuration for testing some...

Just running the python software and an output to a log file and error file.

Sharing the Lightning directory to Homeseer data lightning directory providing a realtime logging directory to HS.
Reply With Quote
Old December 6th, 2017, 08:06 AM
Pete's Avatar
Pete Pete is offline
Join Date: Jan 2001
Location: House
Posts: 14,266
6th of December, 2017.

While the lightning sensor works. It does not work well connected to an RPi with a 5VDC power supply in the house. It is too sensitive to this.

I have read that it works best with a battery power supply and outside with a remote RF connection.

This device in in the attic next to a Hobby boards lightning sensor which works fine in the attic even though the antenna is omni direction and the range is up to 50-60 miles.

So here two endeavors will be done related to a low cost lightning sensor for Homeseer 3.

1 - is to purchase the Accurite battery operated lightning sensor and
2 - the other to DIY build an Arduino with a RF connection to the mothership.

The Accurite sensor will connect fine to the Meteostick.

or will get in to it with current standards of lightning sensor devices (which are much more expensive).

Last edited by Pete; December 6th, 2017 at 09:30 AM.
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Raspberry Pi + Bluetooth4.0(Tag/FitnessBand/SmartWatch) = Proximity Sensor Project TomTom HS3 / HS3PRO Discussion 50 December 3rd, 2016 09:55 AM
Lightning Detector Pete MCS Temperature 9 October 20th, 2005 11:07 AM
Lightning Psalm871 HomeSeer General Discussion Area 2 March 12th, 2004 12:14 AM

All times are GMT -4. The time now is 07:59 AM.

Copyright HomeSeer Technologies, LLC