Alora Library
Library for using Alora shield
 All Classes Namespaces Files Functions Variables Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
AloraSensorKit Class Reference

Public Member Functions

 AloraSensorKit (uint8_t enablePin=16, uint8_t activeLogic=HIGH)
 Instantiate Alora board library object. More...
 
void begin ()
 
void run ()
 
void turnOff ()
 Turn off the Alora board.
 
void turnOn ()
 Turn on the Alora board.
 
void scanAndPrintI2C (Print &print)
 
void printSensingTo (Print &print)
 
void printSensingTo (String &str)
 
uint16_t readADC (uint8_t channel)
 
DateTime getDateTime ()
 
SensorValuesgetLastSensorData ()
 
void initGPS (Stream *gpsStream)
 
NMEAGPS * getGPSObject ()
 
GpioExpandergetIOExpander ()
 Get GPIO Expander pointer. More...
 
ALORA_IMU_SENSORgetIMUSensorAdapter ()
 Get IMU sensor adapter pointer. More...
 
void setCCS811WakeLogic (uint8_t wakeLogic=LOW)
 Set CCS811 air quality sensor wake logic. More...
 

Private Member Functions

void doAllSensing ()
 
void readBME280 (float &T, float &P, float &H)
 
void readHDC1080 (float &T, float &H)
 
void readTSL2591 (double &lux)
 
void configureTSL2591Sensor ()
 
void readGas (uint16_t &gas, uint16_t &co2)
 
void readAccelerometer (float &ax, float &ay, float &az)
 
void readMagnetometer (float &mx, float &my, float &mz, float &mH)
 
void readGyro (float &gx, float &gy, float &gz)
 
void readMagneticSensor (int &mag)
 
void readWindSpeed (float &windspeed)
 
void readGPS (gps_fix &fix)
 

Private Attributes

uint8_t enablePin
 
uint8_t enablePinActiveLogic
 
NMEAGPS * gps = NULL
 
Stream * gpsStream = NULL
 
Adafruit_BME280 * bme280 = NULL
 
ClosedCube_HDC1080 * hdc1080 = NULL
 
Adafruit_TSL2591tsl2591 = NULL
 
CCS811 * ccs811 = NULL
 
ALORA_IMU_SENSORimuSensor = NULL
 
GpioExpanderioExpander = NULL
 
MAX11609max11609 = NULL
 
RTC_DS3231 * rtc = NULL
 
SensorValues lastSensorData
 
uint32_t lastSensorQuerryMs = 0
 
uint8_t ccs811WakeLogic
 

Detailed Description

Examples:
examples/AloraReadAllSensor/AloraReadAllSensor.ino, and examples/AloraReadGPS/AloraReadGPS.ino.

Constructor & Destructor Documentation

AloraSensorKit::AloraSensorKit ( uint8_t  enablePin = 16,
uint8_t  activeLogic = HIGH 
)

Instantiate Alora board library object.

Originally written by Andri Yadi on 8/5/16 Maintained by Alwin Arrasyid

Parameters
enablePinGPIO pin to enable Alora, 16 on Alora v2 and 13 on Alora v2.2. Default to 16
activeLogicAlora enable pin logic. Use LOW for Alora v2.2. Default to HIGH

Member Function Documentation

void AloraSensorKit::begin ( void  )

Initialize Alora board and its sensors.

void AloraSensorKit::configureTSL2591Sensor ( )
private

Configure the TSL2591 sensor

void AloraSensorKit::doAllSensing ( )
private

Read all sensors data and store them to he lastSensorData property.

See Also
lastSensorData
DateTime AloraSensorKit::getDateTime ( )

Get current time from RTC.

Returns
DateTime object of current time.
NMEAGPS * AloraSensorKit::getGPSObject ( )

Get NMEAGPS object

Returns
NMEAGPS object of the GPS
ALORA_IMU_SENSOR * AloraSensorKit::getIMUSensorAdapter ( )

Get IMU sensor adapter pointer.

Returns
ALORA_IMU_SENSOR* pointer to Alora IMU sensor adapter object
GpioExpander * AloraSensorKit::getIOExpander ( )

Get GPIO Expander pointer.

Returns
GpioExpander* pointer to GPIO Expander object
SensorValues & AloraSensorKit::getLastSensorData ( )

Get latest sensor data from Alora board.

Returns
object of SensorValues struct
See Also
SensorValues
void AloraSensorKit::initGPS ( Stream *  gpsStream)

Initialize GPS

void AloraSensorKit::printSensingTo ( Print &  print)

Print the sensing data in a non-standarized format.

Parameters
printany object which class derived from Print including Serial and String.
void AloraSensorKit::printSensingTo ( String &  str)

Print the sensing data in a non-standarized format.

Parameters
stra string where the sensing data will be stored.
void AloraSensorKit::readAccelerometer ( float &  ax,
float &  ay,
float &  az 
)
private

Read accelerometer data from LSM9DS1.

Parameters
axaccelerometer X axis value will be stored in this variable.
ayaccelerometer Y axis value will be stored in this variable.
azaccelerometer Z axis value will be stored in this variable.
uint16_t AloraSensorKit::readADC ( uint8_t  channel)

Read analog data from MAX11609 (ADC)

Returns
read value
void AloraSensorKit::readBME280 ( float &  T,
float &  P,
float &  H 
)
private

Read data from BME280 sensor.

Parameters
Ttemperature reading will be stored in this variable.
Ppressure reading will be stored in this variable.
Hhumidity reading will be stored in this variable.
void AloraSensorKit::readGas ( uint16_t &  gas,
uint16_t &  co2 
)
private

Read data from either CCS811 or analog gas sensor.

Parameters
gasthe TVOC value will be stored in this variable.
co2the CO2 reading from CCS811 will be stored in this variable. If CCS811 is not used, the value will be 0.
void AloraSensorKit::readGPS ( gps_fix &  fix)
private

Read GPS location data

void AloraSensorKit::readGyro ( float &  gx,
float &  gy,
float &  gz 
)
private

Read gyroscope data from LSM9DS1.

Parameters
gxgyroscope X axis value will be stored in this variable.
gygyroscope Y axis value will be stored in this variable.
gzgyroscope Z axis value will be stored in this variable.
void AloraSensorKit::readHDC1080 ( float &  T,
float &  H 
)
private

Read data from HDC1080 sensor.

Parameters
Ttemperature reading will be stored in this variable
Hhumidity reading will be stored in this variable
void AloraSensorKit::readMagneticSensor ( int &  mag)
private

Read magnetic sensor.

Parameters
magmagnetic sensor reading value will be stored in this variable.
void AloraSensorKit::readMagnetometer ( float &  mx,
float &  my,
float &  mz,
float &  mH 
)
private

Read magnetometer data from LSM9DS1.

Parameters
mxmagnetometer X axis value will be stored in this variable.
mymagnetometer Y axis value will be stored in this variable.
mzmagnetometer Z axis value will be stored in this variable.
mHmagnetometer heading value will be stored in this variable,
void AloraSensorKit::readTSL2591 ( double &  lux)
private

Read luminance value from TSL2591.

Parameters
luxthe luminance value will be stored in this variable.
void AloraSensorKit::readWindSpeed ( float &  windspeed)
private

Read the windspeed in MPH unit.

Parameters
windspeedthe speed of the wind value will be stored in this variable.
void AloraSensorKit::run ( )

Read all sensors value and store the result to a private member. This function is usually called inside loop() function.

void AloraSensorKit::scanAndPrintI2C ( Print &  print)

Scan for I2C devices and print the result.

Parameters
printany object which class derived from Print including Serial and String.
void AloraSensorKit::setCCS811WakeLogic ( uint8_t  wakeLogic = LOW)

Set CCS811 air quality sensor wake logic.

Parameters
wakeLogiceither HIGH or LOW

Member Data Documentation

Adafruit_BME280* AloraSensorKit::bme280 = NULL
private

Object of Adafruit BME280 sensor

CCS811* AloraSensorKit::ccs811 = NULL
private

Object of CCS811 sensor

uint8_t AloraSensorKit::ccs811WakeLogic
private

CCS811 air quality sensor wake logic

uint8_t AloraSensorKit::enablePin
private

Alora board enable pin

uint8_t AloraSensorKit::enablePinActiveLogic
private

Aloar board enable pin active logic

NMEAGPS* AloraSensorKit::gps = NULL
private

NMEAGPS object

Stream* AloraSensorKit::gpsStream = NULL
private

Stream of GPS data

ClosedCube_HDC1080* AloraSensorKit::hdc1080 = NULL
private

Object of HDC1080 sensor

ALORA_IMU_SENSOR* AloraSensorKit::imuSensor = NULL
private

IMU sensor adapter object

GpioExpander* AloraSensorKit::ioExpander = NULL
private

Object of GPIO Expander (SX1509)

SensorValues AloraSensorKit::lastSensorData
private

Object of SensorValues struct. All sensor data are stored in this property

uint32_t AloraSensorKit::lastSensorQuerryMs = 0
private

Records the time when the sensor data is read in milliseconds

MAX11609* AloraSensorKit::max11609 = NULL
private

Object of MAX11609

RTC_DS3231* AloraSensorKit::rtc = NULL
private

Object of RTC sensor

Adafruit_TSL2591* AloraSensorKit::tsl2591 = NULL
private

Object of Adafruit TSL2591 sensor


The documentation for this class was generated from the following files: