ModularSensors > Files > sensors / RainCounterI2C.h

RainCounterI2C.h file

Contains the RainCounterI2C sensor subclass and the variable subclasses RainCounterI2C_Tips and RainCounterI2C_Depth.

These are for an external tip counter, used to measure rainfall via a tipping bucket rain gauge

The tip counter works on an Adafruit Trinket. Documentation for it can be found at: https://github.com/EnviroDIY/TippingBucketRainCounter

This depends on Testato's SoftwareWire library if software I2C is needed.

Classes

class RainCounterI2C
The Sensor sub-class for the Arduino-based external tipping bucket counter.
class RainCounterI2C_Tips
The Variable sub-class used for the total tip count output from an Adafruit Trinket based I2C tipping bucket counter.
class RainCounterI2C_Depth
The Variable sub-class used for the depth of rain output from an Adafruit Trinket based I2C tipping bucket counter.

Defines

#define BUCKET_NUM_VARIABLES = 2
Sensor::_numReturnedValues; the tipping bucket counter can report 2 values.

Sensor Timing

The sensor timing for a Trinket-based tipping bucket counter

  • Readings transferred from the tipping bucket to the logger are from past tips, so there is no need to wait for stability or measuring.
#define BUCKET_WARM_UP_TIME_MS = 0
Sensor::_warmUpTime_ms; the tipping bucket counter warms up in 0ms.
#define BUCKET_STABILIZATION_TIME_MS = 0
Sensor::_stabilizationTime_ms; the tipping bucket counter is stable after 0ms.
#define BUCKET_MEASUREMENT_TIME_MS = 0
Sensor::_measurementTime_ms; the tipping bucket counter takes 0ms to complete a measurement.

Rain Depth

The rain depth variable from a Trinket-based tipping bucket counter

  • Range and accuracy depend on the tipping bucket used

RainCounterI2C_Depth(RainCounterI2C* parentSense, const char* uuid = "", const char* varCode = BUCKET_RAIN_DEFAULT_CODE) explicit

Construct a new RainCounterI2C_Depth object.

Parameters
parentSense The parent RainCounterI2C 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 "RainCounterI2CVol".

#define BUCKET_RAIN_RESOLUTION = 2
Decimals places in string representation; rain depth should have 2.
#define BUCKET_RAIN_VAR_NUM = 0
Sensor variable number; rain depth is stored in sensorValues[0].
#define BUCKET_RAIN_VAR_NAME = "precipitation"
Variable name in ODM2 controlled vocabulary; "precipitation".
#define BUCKET_RAIN_UNIT_NAME = "millimeter"
Variable unit name in ODM2 controlled vocabulary; "millimeter".
#define BUCKET_RAIN_DEFAULT_CODE = "RainCounterI2CVol"
Default variable short code; "RainCounterI2CVol".

Tip Count

Defines for tip count variable from a Trinket-based tipping bucket counter

  • Range and accuracy depend on the tipping bucket used.

RainCounterI2C_Tips(RainCounterI2C* parentSense, const char* uuid = "", const char* varCode = BUCKET_TIPS_DEFAULT_CODE) explicit

Construct a new RainCounterI2C_Tips object.

Parameters
parentSense The parent RainCounterI2C 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 "RainCounterI2CTips".

#define BUCKET_TIPS_RESOLUTION = 0
Decimals places in string representation; the number of tips should have 0 - resolution is 1 tip.
#define BUCKET_TIPS_VAR_NUM = 1
Sensor variable number; the number of tips is stored in sensorValues[1].
#define BUCKET_TIPS_VAR_NAME = "precipitation"
Variable name in ODM2 controlled vocabulary; "precipitation".
#define BUCKET_TIPS_UNIT_NAME = "event"
Variable unit name in ODM2 controlled vocabulary; "event".
#define BUCKET_TIPS_DEFAULT_CODE = "RainCounterI2CTips"
Default variable short code; "RainCounterI2CTips".