Giter Site home page Giter Site logo

as3935-arduino-library's Introduction

AS3935-Arduino-Library

AS3935 Franklin Lightning Sensor™ IC by AMS Arduino library

Link to manufacturer site:

    http://www.ams.com/eng/Products/RF-Products/Lightning-Sensor/AS3935

Link to my blog:

    http://www.rrkb.lv/musings

To use is chip/board, you will definitely need to read it's datasheet, so I am not going to dwell into details of tuning and using this small gem.

Tested with Arduino 1.0.1 on Arduino Mega 2560 and mpide-0023-20120903-newlib on chipKIT Max32.

Connections between breakout by TAUTIC LLC and chipKIT Max32 or Arduino Mega 2560 for example code to work:

breakout pin    arduino pin

VDD             3.3V - Max32, 5V - Mega 2560
GND             GND
MOSI            51
MISO            50
SCLK            52
IRQ             2
SI              GND
CS              53

NB! on Mega 2560 you have to comment out attachInterrupt(1,AS3935Irq,RISING); line and uncomment attachInterrupt(0,AS3935Irq,RISING); line

Short function reference: AS3935(byte (*SPItransfer)(byte),int csPin,int irq);     object constructor, first parameter is pointer to a function that     does SPI transfer, second parameter is pin that has to be used as     chip select and third parameter is interrupt pin

void registerWrite(byte reg, byte mask, byte data)

    write to specified register specified data using specified bitmask,     the rest of the register remains intact

byte registerRead(byte reg, byte mask)

    read specified register using specified bitmask and return value aligned     to lsb, i.e. if value to be read is in a middle of register, function     reads register and then aligns lsb of value to lsb of byte

void reset()

    reset all the registers on chip to default values

bool calibrate()

    perform calibration routine, calibrate receiving antenna tank and then     instruct the chip to calibrate both RCOs present on chip

void powerDown()

    put chip into power down mode

void powerUp()

    bring chip out of power down mode and perform RCO calibration

int interruptSource()

    return interrupt source, bitmask, 0b0001 - noise, 0b0100 - disturber,     0b1000 - lightning

void disableDisturbers()

    disable indication of disturbers

void enableDisturbers()

    enable indication of distrubers

int getMinimumLightnings()

    return number of lightnings that need to be detected in 17 minute period     before interrupt is issued

int setMinimumLightnings(int minlightning)

    set number of lightnings that need to be detected in 17 minute period     before interrupt is issued

int lightningDistanceKm()

    return distance to lightning in kilometers, 1 means storm is overhead,     63 means it is too far to reliably calculate distance

void setIndoors()

    load gain preset to operate indoors

void setOutdoors()

    load gain preset to operate outdoors

int getNoiseFloor()

    return noise floor setting - refer to datasheet for meaning and range

int setNoiseFloor(int noisefloor)

    set noise floor setting

int getSpikeRejection()

    return spike rejection value - refer to datasheet for meaning and range

int setSpikeRejection(int srej)

    set spike rejection value

int getWatchdogThreshold()

    return watchdog threshold value - refer to datasheet for meaning and range

int setWatchdogThreshold(int wdth)

    set watchdog threshold value

void clearStats()

    clear internal accumulated lightning statistics

as3935-arduino-library's People

Contributors

chatelao avatar raivisr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

as3935-arduino-library's Issues

Impossible to use ethernet functions

Hi,

thank you for developping this library. I have successfully connect the tautic AS3935 mini board to the arduino with it.

But when i want to use ethernet functions with an Ethernet board, i met some issues, like the impossbility to send requests to a server.

the ethernetClient.connect(server, port) method doesn't works.

I think it is because there is something common between your library an Ethernet Library. But i don't know what.

Can you help me please ?

Thank you very much.

Best regards

Stability?

I have installed the default code, and commented out the specified line because I am running an Arduino 256. Every time I start this up, I get:

Noise floor is: 2
Spike rejection is: 2
Watchdog threshold is: 2
Noise level too high, try adjusting noise floor
...

I have verified my connections and power cycled. Any thoughts?

Distance Mask Incorrect?

Thanks for the library. I bought a sensor and was using it yesterday. I believe however that there is an issue in returning the distance.

I think the mask for distance should be:

define AS3935_DISTANCE 0x07, 0x3F

instead of the present

define AS3935_DISTANCE 0x07, 0x1F

From the AS3935 spec sheet:
DISTANCE [5:0] R 000000 Distance estimation

The 1F mask only allows 5 bits instead of 6, so distances returned would always be less than 32km instead of the 63km range of the chip.

Let me know if I am correct about this.

Thanks,
Frank

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.