AOSong AM2315 topic
- Quick Notes
- Sensor Datasheet
- Sensor Constructors
- Example Code
- Reference
- Detailed Descriptions
Classes for the AOSong AM2315 encased I2C capacitive humidity and temperature sensor.
Quick Notes
- Applies to both the AOSong AM2315 and CM2311 capacitive relative humidity and temperature sensors
- Depends on the Adafruit AM2315 Library.
- Communicates via I2C
- only one address possible, 0xB8
- Only 1 can be connected to a single I2C bus at a time
- Requires a 3.3 - 5.5V power source
Sensor Datasheet
Sensor Constructors
AOSongAM2315:: AOSongAM2315(int8_t powerPin,
uint8_t measurementsToAverage = 1) explicit
Construct a new AOSongAM2315 object using the primary hardware I2C instance.
Parameters | |
---|---|
powerPin | The pin on the mcu controlling power to the AOSong AM2315. Use -1 if it is continuously powered.
|
measurementsToAverage | The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1. |
Because this is I2C and has only 1 possible address (0xB8), we only need the power pin.
Example Code
The AM2315 is used in the double logger and menu a la carte example
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.
Sensor Variable Counts
The number of variables that can be returned by an AOSong AM2315
- #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_Humidity(AOSongAM2315* parentSense,
const char* uuid = "",
const char* varCode = "AM2315Humidity") explicit
Construct a new AOSongAM2315_
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_Temp(AOSongAM2315* parentSense,
const char* uuid = "",
const char* varCode = "AM2315Temp") explicit
Construct a new AOSongAM2315_
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".
Define documentation
#define AM2315_NUM_VARIABLES = 2
#include <src/sensors/AOSongAM2315.h>
Sensor::
#define AM2315_INC_CALC_VARIABLES = 0
#include <src/sensors/AOSongAM2315.h>
Sensor::
#define AM2315_WARM_UP_TIME_MS = 500
#include <src/sensors/AOSongAM2315.h>
Sensor::
#define AM2315_STABILIZATION_TIME_MS = 500
#include <src/sensors/AOSongAM2315.h>
Sensor::
#define AM2315_MEASUREMENT_TIME_MS = 2000
#include <src/sensors/AOSongAM2315.h>
Sensor::
#define AM2315_HUMIDITY_RESOLUTION = 1
#include <src/sensors/AOSongAM2315.h>
Decimals places in string representation; humidity should have 1 (0.1 % RH for the 16 bit sensor).
#define AM2315_HUMIDITY_VAR_NUM = 0
#include <src/sensors/AOSongAM2315.h>
Sensor variable number; humidity is stored in sensorValues[0].
#define AM2315_HUMIDITY_VAR_NAME = "relativeHumidity"
#include <src/sensors/AOSongAM2315.h>
Variable name in ODM2 controlled vocabulary; "relativeHumidity".
#define AM2315_HUMIDITY_UNIT_NAME = "percent"
#include <src/sensors/AOSongAM2315.h>
Variable unit name in ODM2 controlled vocabulary; "percent" (percent relative humidity)
#define AM2315_HUMIDITY_DEFAULT_CODE = "AM2315Humidity"
#include <src/sensors/AOSongAM2315.h>
Default variable short code; "AM2315Humidity".
#define AM2315_TEMP_RESOLUTION = 1
#include <src/sensors/AOSongAM2315.h>
Decimals places in string representation; temperature should have 1. (0.1°C for the 16 bit sensor)
#define AM2315_TEMP_VAR_NUM = 1
#include <src/sensors/AOSongAM2315.h>
Sensor variable number; temperature is stored in sensorValues[1].
#define AM2315_TEMP_VAR_NAME = "temperature"
#include <src/sensors/AOSongAM2315.h>
Variable name in ODM2 controlled vocabulary; "temperature".
#define AM2315_TEMP_UNIT_NAME = "degreeCelsius"
#include <src/sensors/AOSongAM2315.h>
Variable unit name in ODM2 controlled vocabulary; "degreeCelsius" (°C)
#define AM2315_TEMP_DEFAULT_CODE = "AM2315Temp"
#include <src/sensors/AOSongAM2315.h>
Default variable short code; "AM2315Temp".