You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DFRobot_AS393DFRobot_AS39355/readme.md

203 lines
4.0 KiB

6 years ago
# AS3935
AS3935 Lightning Sensor can detect lightning and display the distance and intensity of the lightning without the disturbance of electric arc and noise.<br>
It can be set as indoor or outdoor mode.<br>
## DFRobot_AS3934 Library for Arduino
---------------------------------------------------------
Provide a library faciltates operations in the as3935 modules.
## Table of Contents
* [Summary](#summary)
* [Feature](#feature)
* [Installation](#installation)
* [Methods](#methods)
* [Compatibility](#compatibility)
* [Credits](#credits)
<snippet>
<content>
## Summary
Input commands and read data from AS3935 modules
## Feature
6 years ago
1. Lightning sensor warns of lightning storm activity within a radius of 40km <br>
2. Distance estimation to the head of the storm from overhead to 40km in 15 steps <br>
3. Detects both cloud-to-ground and intra-cloud(cloud-to-cloud) flashes <br>
4. Embedded man-made disturber rejection algorithm <br>
5. Programmable detection levels enable threshold setting for optimal controls <br>
6. Three i2c interfaces, switch freely to avoid site conflicts <br>
6 years ago
## Installation
Download the library ZIP file and unzip it to the Arduino folder of the library.<br>
## Methods
```C++
#include "DFRobot_AS3935_I2C.h"
/*
* @brief AS3935 object
*
6 years ago
* @param irqx irq pin
* devAddx i2c address
6 years ago
*/
6 years ago
DFRobot_AS3935_I2C(uint8_t irqx, uint8_t devAddx);
6 years ago
6 years ago
/*
* @brief AS3935 object
*
* @param irqx irq pin
*/
DFRobot_AS3935_I2C(uint8_t irqx);
6 years ago
/*
* @brief reset registers to default
6 years ago
*
* @return 0 success
6 years ago
*/
6 years ago
int defInit(void);
6 years ago
/*
* @brief set i2c address
*
6 years ago
* @param devAddx i2c address
6 years ago
*/
6 years ago
void setI2CAddress(uint8_t devAddx);
6 years ago
/*
* @brief manual calibration
*
* @param capacitance capacitance
* location location
* disturber disturber
*/
6 years ago
void manualCal(uint8_t capacitance, uint8_t location, uint8_t disturber);
6 years ago
/*
* @brief view register data
*/
6 years ago
void printAllRegs(void);
6 years ago
/*
* @brief get interrupt source
*
* @return 0 interrupt result not expected
* 1 lightning caused interrupt
* 2 disturber detected
* 3 Noise level too high
*/
6 years ago
uint8_t getInterruptSrc(void);
6 years ago
/*
6 years ago
* @brief get lightning distance
6 years ago
*
6 years ago
* @return unit kilometer
6 years ago
*/
6 years ago
uint8_t getLightningDistKm(void);
6 years ago
/*
6 years ago
* @brief get lightning energy intensity
6 years ago
*
6 years ago
* @return lightning energy intensity(0-1000)
6 years ago
*/
6 years ago
uint32_t getStrikeEnergyRaw(void);
6 years ago
/*
* @brief Set to the outdoor model
*/
6 years ago
void setOutdoors(void);
6 years ago
/*
* @brief Set to the indoor model
*/
6 years ago
void setIndoors(void);
6 years ago
/*
6 years ago
* @brief Disturber detection enabled
6 years ago
*/
6 years ago
void disturberEn(void);
6 years ago
/*
6 years ago
* @brief Disturber detection disenabled
6 years ago
*/
6 years ago
void disturberDis(void);
6 years ago
/*
6 years ago
* @brief Sets LCO_FDIV register
*
* @param fdiv Set 0, 1, 2 or 3 for ratios of 16, 32, 64 and 128, respectively
*/
void setLcoFdiv(uint8_t fdiv);
/*
* @brief Set interrupt source
*
* @param irqSelect 0 = NONE, 1 = TRCO, 2 = SRCO, 3 = LCO
6 years ago
*/
6 years ago
void setIRQOutputSource(uint8_t irqSelect);
6 years ago
6 years ago
/*
* @brief Set the noise level
*
* @param 0~7,More than 7 will use the default value:2
*/
void setNoiseFloorLvl(uint8_t nfSel);
/*
* @brief Get the noise level
*
* @return 0~7
*/
uint8_t getNoiseFloorLvl(void);
/*
* @brief Set an anti-interference rating
*
6 years ago
* @param 0~7,More than 7 will use the default value:2
6 years ago
*/
void setWatchdogThreshold(uint8_t wdth);
/*
* @brief read WDTH
*
* @return 0~7
*/
uint8_t getWatchdogThreshold(void);
/*
* @brief Modify SREJ (spike rejection)
*
* @param 0~7,More than 7 will use the default value:2
*/
void setSpikeRejection(uint8_t srej);
/*
* @brief read SREJ (spike rejection)
*
* @return 0~7
*/
uint8_t getSpikeRejection(void);
6 years ago
```
## Compatibility
MCU | Work Well | Work Wrong | Untested | Remarks
------------------ | :----------: | :----------: | :---------: | -----
Arduino uno | √ | | |
esp8266 | √ | | |
6 years ago
## Credits
6 years ago
Written by DFRobot_JH, 2018. (Welcome to our [website](https://www.dfrobot.com/))