pcfens / RaspberryPi-AS3935

A basic library for working with the AS3935 that's connected to the Raspberry Pi.
Other
52 stars 24 forks source link

automatic antenna tuning #27

Open wjcarpenter opened 5 years ago

wjcarpenter commented 5 years ago

You have the bones for someone to set the tuning capacitors, which is great for someone who knows what the value should be. In my case, there was no such info from the vendor.

Using the frequency output on the IRQ pin, you could simply iterate through all 16 possibilities and select the best one. Here is a version done in C++: https://github.com/SloMusti/AS3935-Arduino-Library/blob/master/AS3935/AS3935.cpp It uses a divisor of 16, but divisors of 32, 64, and 128 are also available. (I'm not sure how fast an interrupt handler in python on a RPi could count.)

This person claims that the tuning with this method does not agree with what they were told for their board, and they also claim it varies over time. https://github.com/evsc/ThunderAndLightning Beats me.

I'm hoping to have you do this work :-), but if you are not interested, I assume you would consider a PR if I coded it up.

ecodina commented 4 years ago

Hi! For a project I am currently developing, I had to create a new module for the AS3935 as I had to use Pigpio instead of rpi.gpio.

You can download it from https://pypi.org/project/as3935/ and has the function to calibrate it: calculate_tuning_cap(self, frequency_divisor=16, tries_frequency=3, seconds_try=4)

It can actually perform all the actions detailed on the Datasheet with easy to use methods. It is fully documented.

I hope you find it useful.