ModularSensors > Files > src / sensors / TallyCounterI2C.h

TallyCounterI2C.h file

Implements the TallyCounterI2C sensor subclass.

Contains the TallyCounterI2C sensor subclass and variable subclasse TallyCounterI2C_Events.

This file is for NorthernWidget's Tally external event counter, which is used to measure windspeed or rainfall from reed-switch analog sensors.

This depends on the [Tally_Library] (https://github.com/EnviroDIY/Tally_Library/tree/Dev_I2C)

Classes

class TallyCounterI2C
The Sensor sub-class for the Tally Counter I2C.
class TallyCounterI2C_Events
The Variable sub-class used for the events output from a Tally Counter I2C - shows the number of events since last read.

Defines

#define TALLY_NUM_VARIABLES = 1
Sensor::_numReturnedValues; the Tally can report 1 value.
#define TALLY_INC_CALC_VARIABLES = 0
Sensor::_incCalcValues; we don't calculate any additional values.
#define TALLY_ADDRESS_BASE = 0x33
The default address of the Tally.

Sensor Timing

The sensor timing for a Northern Widget Tally event counter

  • Readings transferred from the reed-switch counting device (i.e. anemometer or tipping bucket) to the logger are from past events, so there is no need to wait for stability or measuring.
#define TALLY_WARM_UP_TIME_MS = 10
Sensor::_warmUpTime_ms; Tally warms up in <10 ms.
#define TALLY_STABILIZATION_TIME_MS = 10
Sensor::_stabilizationTime_ms; Tally is stable after <10ms.
#define TALLY_MEASUREMENT_TIME_MS = 10
Sensor::_measurementTime_ms; Tally takes <10ms to complete a measurement.

Events

The events variable from a Northern Widget Tally event counter

TallyCounterI2C_Events(TallyCounterI2C* parentSense, const char* uuid = "", const char* varCode = TALLY_EVENTS_DEFAULT_CODE) explicit

Construct a new TallyCounterI2C_Events object.

Parameters
parentSense The parent TallyCounterI2C 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 "TallyCounterI2CEvents".

#define TALLY_EVENTS_RESOLUTION = 0
Decimals places in string representation; events are an integer should be 0 - resolution is 1 event.
#define TALLY_EVENTS_VAR_NUM = 0
Sensor variable number; events is stored in sensorValues[0].
#define TALLY_EVENTS_VAR_NAME = "counter"
Variable name in ODM2 controlled vocabulary; "counter".
#define TALLY_EVENTS_UNIT_NAME = "event"
Variable unit name in ODM2 controlled vocabulary; "event".
#define TALLY_EVENTS_DEFAULT_CODE = "TallyCounterI2CEvents"
Default variable short code; "TallyCounterI2CEvents".