Raspberry Pi Lightning Detector - v1 and v2

Thanks,
I think everything is working. Now all I need is some lightning to make sure, then to add to the website

I just noticed this. I pressed the test button and see this

Exception in thread Thread-2:
Traceback (most recent call last):
File “/usr/lib/python3.7/threading.py”, line 917, in _bootstrap_inner
self.run()
File “/usr/lib/python3/dist-packages/pigpio.py”, line 1181, in run
cb.func(cb.gpio, newLevel, tick)
File “as3935_web.py”, line 114, in register_strike
with open(strike_log_filename, ‘a’, newline=‘/n’) as logfile:
ValueError: illegal newline value: /n

Or install v1.3 which should also fix the error. I’m a little puzzled that you saw this when pressed the Simulate Lighting button. The error is associated with real lightning.

Bonjour,
Même si je n’écris pas, je suis à la lettre vos informations e recommandations.
Merci à vous tous.

Serge

Version 2 is progressing well.

I’ve created a new ‘service’ program that doesn’t have the web server functionality built in. The service program has multi-level logging built in, writing to a log file in /var/log. The logs rotate weekly with 4 weeks of logs retained.

I’m also part way through changing the way the interrupts are handled. I’m now using a FIFO queue, so that it will be less likely for the program to become overloaded if there are large number of lightning strokes (wishful thinking round here at the moment!). The new FIFO queue mechanism will also allow me to adjust the noise floor down every so often so that it doesn’t get pushed very high due to localised/temporary noise and then stay that way until it’s restarted.

will WD pickup the simulated strokes?
also, just to be sure, what is the correct URL to enter in WD?

I want to be sure everything is functioning properly because a thunder storm is moving in

Should be
http://your raspberry pi IP address:5000/nowcast port 5000 is the default port change if you changed the port number

Simulated strokes are included in nowcast.txt so WD should see them.

URL is correct. Seeing nothing in WD

Do you see the nowcast.txt data if you go to the URL in a browser?

yes. Just not seeing anything in WD

Bonjour,
Pouvez-vous détailler pas à pas l’installation logiciel du genre via un “Wiki” ou des captures d’écrans car je me trompe dans l’installation.
Merci.

Serge

In version 2 the strike log file format is now…

epoch time, human readable date/time, distance, energy

…so the file looks like this…

"1595063492","2020-07-18 10:11:32","11","472163" "1595063504","2020-07-18 10:11:44","31","399727" "1595063507","2020-07-18 10:11:47","9","374295" "1595063520","2020-07-18 10:12:00","25","400494" "1595063532","2020-07-18 10:12:12","20","830544"

The human readable date/time format can be changed using the ‘date_format’ option in the config file if you prefer a different structure to “YYYY-mm-dd HH:MM:SS”

I’ve asked Brian about the file format that WD expects to see. I may have got it slightly wrong. In particular I’m not sure whether the lines should end in LF (Unix format) or CRLF (DOS/Windows format). If he confirms that I’ve got the format wrong it should be pretty easy to fix.

Salut Serge

Les instructions détaillées pour l’installation de la dernière version sont dans ce message. Ces instructions ont configuré la plupart du système. Il y a un fichier de correctif supplémentaire à ajouter une fois la configuration initiale terminée. J’espère inclure un installateur dans la prochaine version.

The detailed instructions for installing the latest version are in this message. These instructions set up most of the system. There is an additional patch file to add after the initial setup is done. I’m hoping to include an installer in the next version.

re the nowcast.txt file
it works here (the one Chris has sent me)

if I changed the strokes per minute from 3 to 4

then WD picked up that increase

(WD reads in that file every minute)

make sure to set to use that lightning2000 file and then select that file

in setup, adcvanced/misc , nexstorm/lightning2000

(then restart WD for good measure)

Thanks Brian.

The only other thing I can think of to check is that the location the nowcast.txt file is being downloaded to (using HTTP) is the same location that WD is looking for the file in.

I’d try to test this myself but my code is in a state of flux right now and I don’t want to roll-back to the previous version to try to debug it just at the moment.

I’m still setting up my Pi.

Can someone post a nowcast.txt file so I can play with WD?

Thanks

Quick status update before I go to bed…

I think to avoid confusion the next version will be version 3. I think the first ‘test’ had no number but I assumed it was version 1. Then I released a version 2 before (confusingly) dropping back to v1.1/1.2/1.3. Other ‘highlights’…

  • I’ve started to write the installer script. It’s got a fair way to go yet but what it does so far works.
  • The internal structure of the AS3935 monitor service (the code that runs in the background processing the chip data) has been modified to run with an internal scheduler. This will make it much easier to add new features and maybe make change the scheduling of some of the functionality.
  • The logging functionality seems to be working as intended
  • The monitor service updates nowcast.txt, the strike log and also creates a JSON file of the current settings/CPU temperature
  • As there’s no user interface to the monitor process, the lightning simulation is also scheduled with a degree of randomness included. This does mean that once you finish your testing you’ll need to update the config file to turn simulation off otherwise you’ll not be able to tell the difference between real and simulated lightning.
  • The monitor service now properly runs as a service and can be started/stopped/status checked
  • The only thing left to complete in the monitor service is the monthly archiving of the strike log. This is about 33% complete.

I’m leaving the monitor service running overnight to see if it survives. That’s one of the downsides of using an internal scheduler…you’re never quite sure when certain functions are going to pop up to run! I think they’re all pretty well tested though so I’m hoping that the system will still be up and running in the morning.