BiffoBear / CircuitPython_AS3935

A CircuitPython driver library for the Franklin AS3935 lightning detector. The driver supports connections via SPI and I2C.
MIT License
6 stars 5 forks source link

Having problems with false lightning stikes #3

Closed Whimick closed 2 years ago

Whimick commented 2 years ago

Hi, Can any one tell me how to set up the driver to reduce false possitives, unfortuntaly my knowledge of python3 is a little limited, I would be greatful for any help.

Michael

BiffoBear commented 2 years ago

Hi,

Please have a look at the API documentation on Read The Docs. Particularly the indoor property, noise_floor_limit property and the spike_threshold property. Experiment with different combinations and see if they solve your problem.

Cheers, Martin

Whimick commented 2 years ago

Thank you for repling.

Unfortunatly my knowledge of programming is limited.

Looking at : @property def noise_floor_limit(self): """int: Get or set the noise floor limit threshold in the range 0 - 7 (default is 2). When this threshold is exceeded, an interrupt is issued. Higher values allow operation with higher background noise but decrease sensitivity to lightning strikes. """ return self._get_register(self._NF_LEV)

How would I set the set the noise floor limit threshold? Would you be kind enough to show me an example? Michael

BiffoBear commented 2 years ago

Assuming that you have created a sensor object as in the example code and called it sensor then setting properties works like this:

>>> sensor.indoor = True
>>> sensor.noise_floor_limit = 4
>>> sensor.spike_threshold = 6

Hope that helps.

Cheers, Martin

Whimick commented 2 years ago

Thanks for your help. Using your as3935_simpletest.py, and adding your examples like below:

sensor = biffobear_as3935.AS3935_I2C(i2c, interrupt_pin=interrupt_pin) sensor.indoor = True sensor.noise_floor_limit = 4 sensor.spike_threshold = 6

I hope I've got it right

Michael

BiffoBear commented 2 years ago

Hi, that looks fine. I suggest running it with various combinations of values until you find the best solution for you.

Cheers, Martin