RAK12027-D7S is modified from D7S_Arduino_Library Version 1.1.0 written by Alessandro Pasqualini. Contains very convenient interfaces to implement all the operations you want with D7S.
- Product Repository - Product repository for the RAKWireless RAK12027 Earthquake module.
- Documentation - Documentation and Quick Start Guide for the RAK12027 Earthquake module.
In Arduino IDE open Sketch->Include Library->Manage Libraries then search for RAK12027.
In PlatformIO open PlatformIO Home, switch to libraries and search for RAK12027. Or install the library project dependencies by adding
lib_deps =
RAKWireless/RAKWireless D7S Earthquake library
into platformio.ini
For manual installation download the archive, unzip it and place the RAK12027-D7S folder into the library directory. In Arduino IDE this is usually /libraries/ In PlatformIO this is usually <user/.platformio/lib>
The library provides RAK_D7S class, which allows communication with D7S via IIC. These examples show how to use RAK12027.
- RAK12027_Earthquake_Seismograph_D7S When the trigger earthquake occurs, the serial port outputs the SI and PGA values in the current calculation. About 2 minutes of seismic processing ends.
- RAK12027_Earthquake_Interrupt_D7S Example of interrupt usage. INT1 active (ON) when the shutoff judgment condition and collapse detection condition are met. INT2 active (ON) during earthquake calculations, offset acquisition,and self-diagnostic processing.
- RAK12027_Earthquake_RankedDate_D7S Read the data for five earthquakes with the largest SI values, out of all earthquakes that occurred in the past. SI Ranked Data 1 always holds the largest SI value.
- RAK12027_Earthquake_ClearDate_D7S Clear all data inside D7S.
bool RAK_D7S::begin(TwoWire &wirePort, uint8_t deviceAddress)
Confirm that the D7S sensor is ready.
Direction | Name | Function |
---|---|---|
in | wirePort | IIC interface used. |
in | deviceAddress | Device address should be 0x55. |
return | If the device init successful return true else return false. |
**D7S_status_t RAK_D7S::getState() **
Read the STATE register at 0x1000.
Direction | Name | Function |
---|---|---|
return | D7S status. |
**D7S_axis_state_t RAK_D7S::getAxisInUse() **
Get current axes used for SI value calculation.
Direction | Name | Function |
---|---|---|
return | Current axes used for SI value calculation. |
**void RAK_D7S::setThreshold(D7S_threshold_t threshold) **
Change the threshold in use.
Direction | Name | Function |
---|---|---|
in | threshold | 0 : Threshold level H. 1 : Threshold level L. |
return | none |
**void RAK_D7S::setAxis(D7S_axis_settings_t axisMode) **
SI value calculation axes setting pattern.
Direction | Name | Function |
---|---|---|
in | axisMode | 0 : YZ axes. 1 : XZ axes. 2 : XY axes. 3 : Auto switch axes (auto axes calculation by automatically. |
return | none |
**float RAK_D7S::getLastestSI(uint8_t index) **
Get the lastest SI at specified index (up to 5) [m/s].
Direction | Name | Function |
---|---|---|
in | index | Index 0~4 SI data. |
return | SI value. |
**float RAK_D7S::getLastestPGA(uint8_t index) **
Get the lastest PGA at specified index (up to 5) [m/s^2].
Direction | Name | Function |
---|---|---|
in | index | Index 0~4 PGA data. |
return | PGA value. |
float RAK_D7S::getLastestTemperature(uint8_t index)
Get the lastest Temperature at specified index (up to 5) [Celsius].
Direction | Name | Function |
---|---|---|
in | index | Index 0~4 Temperature data. |
return | Temperature value. |
**float RAK_D7S::getRankedSI(uint8_t position) **
Get the ranked SI at specified position (up to 5) [m/s].
Direction | Name | Function |
---|---|---|
in | position | Index 0~4 ranked SI data. |
return | Ranked SI value. |
**float RAK_D7S::getRankedPGA(uint8_t position) **
Get the ranked PGA at specified position (up to 5) [m/s^2].
Direction | Name | Function |
---|---|---|
in | position | Index 0~4 ranked PGA data. |
return | Ranked PGA value. |
**float RAK_D7S::getRankedTemperature(uint8_t position) **
Get the ranked Temperature at specified position (up to 5) [Celsius].
Direction | Name | Function |
---|---|---|
in | position | Index 0~4 ranked Temperature data. |
return | Ranked Temperature value. |
**float RAK_D7S::getInstantaneusSI() **
Get instantaneus SI (during an earthquake) [m/s].
Direction | Name | Function |
---|---|---|
return | Instantaneus SI value. |
**float RAK_D7S::getInstantaneusPGA() **
Get instantaneus PGA (during an earthquake) [m/s^2].
Direction | Name | Function |
---|---|---|
return | Instantaneus PGA value. |
**void RAK_D7S::clearEarthquakeData() **
Delete both the lastest data and the ranked data.
Direction | Name | Function |
---|---|---|
return | none. |
**void RAK_D7S::clearInstallationData() **
Delete initializzazion data.
Direction | Name | Function |
---|---|---|
return | none. |
**void RAK_D7S::clearLastestOffsetData() **
Delete offset data.
Direction | Name | Function |
---|---|---|
return | none. |
**void RAK_D7S::clearSelftestData() **
Delete selftest data.
Direction | Name | Function |
---|---|---|
return | none. |
**void RAK_D7S::clearAllData() **
Delete all data.
Direction | Name | Function |
---|---|---|
return | none. |
**void RAK_D7S::initialize() **
Initialize the D7S (start the initial installation mode).
Direction | Name | Function |
---|---|---|
return | none. |
**void RAK_D7S::selftest() **
Start autodiagnostic and resturn the result (OK/ERROR).
Direction | Name | Function |
---|---|---|
return | none. |
**D7S_mode_status_t RAK_D7S::getSelftestResult() **
Return the result of self-diagnostic test (OK/ERROR).
Direction | Name | Function |
---|---|---|
return | 0 : OK. 1 : ERROR. |
**void RAK_D7S::acquireOffset() **
Start offset acquisition and return the rersult (OK/ERROR).
Direction | Name | Function |
---|---|---|
return | none |
D7S_mode_status_t RAK_D7S::getAcquireOffsetResult()
Return the result of offset acquisition test (OK/ERROR).
Direction | Name | Function |
---|---|---|
return | 0 : OK. 1 : ERROR. |
**uint8_t RAK_D7S::isInCollapse() **
After each earthquakes it's important to reset the events calling resetEvents() to prevent polluting the new data with the old one Return true if the collapse condition is met (it's the sencond bit of _events).
Direction | Name | Function |
---|---|---|
return | Return the second bit of _events. |
uint8_t RAK_D7S::isInShutoff()
Return true if the shutoff condition is met (it's the first bit of _events).
Direction | Name | Function |
---|---|---|
return | Return the second bit of _events. |
void RAK_D7S::resetEvents()
Reset shutoff/collapse events.
Direction | Name | Function |
---|---|---|
return | none |
**uint8_t RAK_D7S::isEarthquakeOccuring() **
Return true if an earthquake is occuring.
Direction | Name | Function |
---|---|---|
return | true : Earthquake is occuring. false : no earthquake. |
**bool RAK_D7S::isReady() **
Ready state.
Direction | Name | Function |
---|---|---|
return | true : D7S ready. false : D7S not ready. |