8 #ifndef ALORA_ALORASENSORKIT_H
9 #define ALORA_ALORASENSORKIT_H
13 #include <Adafruit_Sensor.h>
14 #include <Adafruit_BME280.h>
15 #include <ClosedCube_HDC1080.h>
17 #include <Streamers.h>
19 #include <SparkFunCCS811.h>
21 #include "GpioExpander.h"
24 #undef SECONDS_PER_DAY
26 #include "AllAboutEE_MAX11609.h"
27 using namespace AllAboutEE;
32 #if !defined(ALORA_IMU_SENSOR)
33 #define ALORA_IMU_SENSOR AloraIMULSM9DS1Adapter
37 #if !defined(ALORA_SENSOR_USE_CCS811)
38 #define ALORA_SENSOR_USE_CCS811 1
42 #if !defined(ALORA_SENSOR_QUERY_INTERVAL)
43 #define ALORA_SENSOR_QUERY_INTERVAL 300
47 #if !defined(ALORA_USE_MAX11609)
48 #define ALORA_USE_MAX11609 1
52 #if !defined(ALORA_USE_AIR_QUALITY_GAS_SENSOR)
53 #define ALORA_USE_AIR_QUALITY_GAS_SENSOR 1
57 #if !defined(ALORA_USE_IMU_SENSOR)
58 #define ALORA_USE_IMU_SENSOR 1
62 #if !defined(ALORA_USE_GPIO_EXPANDER)
63 #define ALORA_USE_GPIO_EXPANDER 1
67 #if !defined(ALORA_USE_HDC1080_SENSOR)
68 #define ALORA_USE_HDC1080_SENSOR 1
72 #if !defined(ALORA_USE_BME280_SENSOR)
73 #define ALORA_USE_BME280_SENSOR 1
77 #if !defined(ALORA_USE_TSL2591_SENSOR)
78 #define ALORA_USE_TSL2591_SENSOR 1
82 #define ALORA_HDC1080_ADDRESS 0x40
85 #define ALORA_I2C_ADDRESS_CCS811 0x5A
88 #if ALORA_IMU_SENSOR == ALORA_IMU_SENSOR_LSM9DS1
89 #define ALORA_I2C_ADDRESS_IMU_M 0x1E
90 #elif ALORA_IMU_SENSOR == ALORA_IMU_SENSOR_LSM303AGR
91 #define ALORA_I2C_ADDRESS_IMU_M 0x3C
95 #if ALORA_IMU_SENSOR == ALORA_IMU_SENSOR_LSM9DS1
96 #define ALORA_I2C_ADDRESS_IMU_AG 0x6B
97 #elif ALORA_IMU_SENSOR == ALORA_IMU_SENSOR_LSM303AGR
98 #define ALORA_I2C_ADDRESS_IMU_AG 0x32
102 #if !defined(ALORA_MAGNETIC_SENSOR_PIN)
103 #define ALORA_MAGNETIC_SENSOR_PIN 35
107 #if !defined(ALORA_ADC_GAS_HEATER_PIN)
108 #define ALORA_ADC_GAS_HEATER_PIN 13
112 #if !defined(ALORA_ADC_GAS_CHANNEL)
113 #define ALORA_ADC_GAS_CHANNEL 1
117 #if !defined(ALORA_GPS_ENABLE_PIN)
118 #define ALORA_GPS_ENABLE_PIN 12
157 AloraSensorKit(uint8_t enablePin = 16, uint8_t activeLogic = HIGH);
164 void scanAndPrintI2C(Print& print);
165 void printSensingTo(Print& print);
166 void printSensingTo(String& str);
167 uint16_t readADC(uint8_t channel);
168 DateTime getDateTime();
170 void initGPS(Stream* gpsStream);
171 NMEAGPS* getGPSObject();
174 void setCCS811WakeLogic(uint8_t wakeLogic = LOW);
181 Stream* gpsStream = NULL;
182 Adafruit_BME280* bme280 = NULL;
183 ClosedCube_HDC1080* hdc1080 = NULL;
185 CCS811* ccs811 = NULL;
189 RTC_DS3231* rtc = NULL;
192 uint32_t lastSensorQuerryMs = 0;
197 void readBME280(
float& T,
float& P,
float& H);
198 void readHDC1080(
float& T,
float& H);
199 void readTSL2591(
double& lux);
200 void configureTSL2591Sensor();
201 void readGas(uint16_t& gas, uint16_t& co2);
202 void readAccelerometer(
float &ax,
float &ay,
float &az);
203 void readMagnetometer(
float &mx,
float &my,
float &mz,
float &mH);
204 void readGyro(
float &gx,
float &gy,
float &gz);
205 void readMagneticSensor(
int& mag);
206 void readWindSpeed(
float& windspeed);
207 void readGPS(gps_fix& fix);
float magZ
Definition: AloraSensorKit.h:141
float accelZ
Definition: AloraSensorKit.h:135
float gyroY
Definition: AloraSensorKit.h:137
float T2
Definition: AloraSensorKit.h:128
Definition: AloraSensorKit.h:155
float gyroZ
Definition: AloraSensorKit.h:138
Definition: Adafruit_TSL2591.h:120
float P
Definition: AloraSensorKit.h:126
gps_fix gpsFix
Definition: AloraSensorKit.h:145
Definition: AllAboutEE_MAX11609.h:12
Definition: GpioExpander.h:36
float magY
Definition: AloraSensorKit.h:140
uint8_t enablePin
Definition: AloraSensorKit.h:177
float accelY
Definition: AloraSensorKit.h:134
#define ALORA_IMU_SENSOR
Definition: AloraSensorKit.h:33
uint8_t enablePinActiveLogic
Definition: AloraSensorKit.h:178
float accelX
Definition: AloraSensorKit.h:133
Definition: AloraSensorKit.h:124
uint16_t gas
Definition: AloraSensorKit.h:131
uint8_t ccs811WakeLogic
Definition: AloraSensorKit.h:194
uint16_t co2
Definition: AloraSensorKit.h:132
float H2
Definition: AloraSensorKit.h:129
float T1
Definition: AloraSensorKit.h:125
SensorValues lastSensorData
Definition: AloraSensorKit.h:191
float windSpeed
Definition: AloraSensorKit.h:144
int magnetic
Definition: AloraSensorKit.h:143
float H1
Definition: AloraSensorKit.h:127
float magX
Definition: AloraSensorKit.h:139
double lux
Definition: AloraSensorKit.h:130
float magHeading
Definition: AloraSensorKit.h:142
float gyroX
Definition: AloraSensorKit.h:136