as3935 - weewx/weewx GitHub Wiki
AS3935 Service
This is a service for weewx that collects lightning strike data (time of strike, distance to strike) using the AS3935 sensor attached to a Raspberry Pi. The service augments the standard weewx archive record and optionally saves per-strike data to a separate lightning strike database.
Download
wget -O weewx-as3935.zip https://github.com/matthewwall/weewx-as3935/archive/master.zip
How to Install
- Run the extension installer:
weectl extension install weewx-as3935.zip
- Modify weewx.conf:
[AS3935]
address = 3
bus = 1
- Restart weewx
sudo systemctl stop weewx
sudo systemctl start weewx
Configuration
The default configuration will add the fields lightning_strikes
and avg_distance
to each archive record.
To save these in the weewx database (so that they can be used in reports and plots), extend the database schema as explained in the weewx customization guide. You must add two columns, lightning_strikes
and avg_distance
.
Connecting the AS3935
- AS3935 Pin --- Raspberry Pi Pin
- (GND) --- 25 (Ground)
- (VDD) --- 1 (3v3 Power)
- (IRQ) --- 11 (GPIO 17)
- (I2CL) --- 5 (SCL)
- (I2CD) --- 3 (SDA)
Options
binding - Specify either loop
or archive
. Default is archive
.
data_binding - To save the per-strike data to a separate, lightning
database, use the data_binding
option. For example,
[AS3935]
...
data_binding = lightning_binding
[DataBindings]
...
[lightning_binding](/weewx/weewx/wiki/lightning_binding)
database = lightning_sqlite
table_name = archive
manager = weewx.manager.DaySummaryManager
schema = user.as3935.schema
[Databases]
...
[lightning_sqlite](/weewx/weewx/wiki/lightning_sqlite)
database_name = lightning.sdb
database_type = SQLite
will save data to a sqlite database in the same directory as the other weewx databases. The lightning database schema is a format that works with the weewx reporting and plotting utilities, so you can extract lightning data and use it in standard weewx reports and plots.