ModularSensors > Files > src / sensors / AOSongAM2315.h

AOSongAM2315.h file

Contains the AOSongAM2315 sensor subclass and the variable subclasses AOSongAM2315_Humidity and AOSongAM2315_Temp.

These are used for the AOSong AM2315 capacitive humidity and temperature sensor.

This file is dependent on the Adafruit AM2315 Library.

Classes

class AOSongAM2315
The Sensor sub-class for the AOSong AM2315.
class AOSongAM2315_Humidity
The Variable sub-class used for the relative humidity output from an AOSong AM2315.
class AOSongAM2315_Temp
The Variable sub-class used for the temperature output from an AOSong AM2315.

Defines

#define AM2315_NUM_VARIABLES = 2
Sensor::_numReturnedValues; the AM2315 can report 2 values.
#define AM2315_INC_CALC_VARIABLES = 0
Sensor::_incCalcValues; we don't calculate any additional values.

Sensor Timing

The sensor timing for an AOSong AM2315

#define AM2315_WARM_UP_TIME_MS = 500
Sensor::_warmUpTime_ms; the AM2315 warms up in 500ms (estimated).
#define AM2315_STABILIZATION_TIME_MS = 500
Sensor::_stabilizationTime_ms; the AM2315 is stable after 500ms (estimated).
#define AM2315_MEASUREMENT_TIME_MS = 2000
Sensor::_measurementTime_ms; the AM2315 takes 2000ms (2s) to complete a measurement.

Humidity

The humidity variable from an AOSong AM2315

  • Range is 0 to 100% RH
  • Accuracy is ± 2 % RH at 25°C

AOSongAM2315_Humidity(AOSongAM2315* parentSense, const char* uuid = "", const char* varCode = AM2315_HUMIDITY_DEFAULT_CODE) explicit

Construct a new AOSongAM2315_Humidity object.

Parameters
parentSense The parent AOSongAM2315 providing the result values.
uuid A universally unique identifier (UUID or GUID) for the variable; optional with the default value of an empty string.
varCode A short code to help identify the variable in files; optional with a default value of "AM2315Humidity".

#define AM2315_HUMIDITY_RESOLUTION = 1
Decimals places in string representation; humidity should have 1 (0.1 % RH for the 16 bit sensor).
#define AM2315_HUMIDITY_VAR_NUM = 0
Sensor variable number; humidity is stored in sensorValues[0].
#define AM2315_HUMIDITY_VAR_NAME = "relativeHumidity"
Variable name in ODM2 controlled vocabulary; "relativeHumidity".
#define AM2315_HUMIDITY_UNIT_NAME = "percent"
Variable unit name in ODM2 controlled vocabulary; "percent" (percent relative humidity)
#define AM2315_HUMIDITY_DEFAULT_CODE = "AM2315Humidity"
Default variable short code; "AM2315Humidity".

Temperature

The temperature variable from an AOSong AM2315

  • Range is -40°C to +125°C
  • Accuracy is ±0.1°C

AOSongAM2315_Temp(AOSongAM2315* parentSense, const char* uuid = "", const char* varCode = AM2315_TEMP_DEFAULT_CODE) explicit

Construct a new AOSongAM2315_Temp object.

Parameters
parentSense The parent AOSongAM2315 providing the result values.
uuid A universally unique identifier (UUID or GUID) for the variable; optional with the default value of an empty string.
varCode A short code to help identify the variable in files; optional with a default value of "AM2315Temp".

#define AM2315_TEMP_RESOLUTION = 1
Decimals places in string representation; temperature should have 1. (0.1°C for the 16 bit sensor)
#define AM2315_TEMP_VAR_NUM = 1
Sensor variable number; temperature is stored in sensorValues[1].
#define AM2315_TEMP_VAR_NAME = "temperature"
Variable name in ODM2 controlled vocabulary; "temperature".
#define AM2315_TEMP_UNIT_NAME = "degreeCelsius"
Variable unit name in ODM2 controlled vocabulary; "degreeCelsius" (°C)
#define AM2315_TEMP_DEFAULT_CODE = "AM2315Temp"
Default variable short code; "AM2315Temp".