ModularSensors > Files > sensors / MaximDS3231.h

MaximDS3231.h file

Contains the MaximDS3231 sensor subclass and the MaximDS3231_Temp variable subclass.

These are for the DS3231 real time clock which is required for all AVR boards.

This depends on the EnviroDIY DS3231 library.


class MaximDS3231
The Sensor sub-class for the Maxim DS3231 when used as a low-accuracy temperature sensor.
class MaximDS3231_Temp
The Variable sub-class used for the temperature output from a DS3231.


#define DS3231_NUM_VARIABLES = 1
Sensor::_numReturnedValues; the DS3231 can report 1 value.

Sensor Timing

The sensor timing for a Maxim DS18 RTC

#define DS3231_WARM_UP_TIME_MS = 0
Sensor::_warmUpTime_ms; the DS3231 should never be powered off so there is no warm-up time.
Sensor::_stabilizationTime_ms; the DS3231 should never be powered off so there is no stabilization time.
#define DS3231_MEASUREMENT_TIME_MS = 200
Sensor::_measurementTime_ms; the DS3231 takes 200ms to complete a measurement - A single temperature conversion takes 200ms.


The temperature variable from a Maxim DS18 RTC

  • Range is -55°C to 125°C
  • Accuracy: ± 3°C

MaximDS3231_Temp(MaximDS3231* parentSense, const char* uuid = "", const char* varCode = DS3231_TEMP_DEFAULT_CODE) explicit

Construct a new MaximDS3231_Temp object.

parentSense The parent MaximDS3231 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 "BoardTemp".

#define DS3231_TEMP_RESOLUTION = 2
Decimals places in string representation; temperature should have 2 - resolution is -0.25°C (10 bit).
#define DS3231_TEMP_VAR_NUM = 0
Sensor variable number; temperature is stored in sensorValues[0].
#define DS3231_TEMP_VAR_NAME = "temperatureDatalogger"
Variable name in ODM2 controlled vocabulary; "temperatureDatalogger".
#define DS3231_TEMP_UNIT_NAME = "degreeCelsius"
Variable unit name in ODM2 controlled vocabulary; "degreeCelsius" (°C)
#define DS3231_TEMP_DEFAULT_CODE = "BoardTemp"
Default variable short code; "BoardTemp".