Tally Counter I2C topic

Classes for the Tally Counter I2C external event counter.

Introduction

Northern Widget's Tally is

a minimal ultra low power digital event counter, designed to be a counterpart to a traditional data logger to measure and average rapid events like an anemometer reading. It communicates over I2C at either 3.3 or 5V.

The [Tally_Library] (https://github.com/EnviroDIY/Tally_Library/tree/Dev_I2C) is used internally for communication with the Tally.

Sensor Datasheet

Documentation for the sensor can be found at:

Sensor Constructor

TallyCounterI2C::TallyCounterI2C(int8_t powerPin = -1, uint8_t i2cAddressHex = 0x33)

Construct a new Tally Counter I2C object using the primary hardware I2C instance.

Parameters
powerPin

The pin on the mcu controlling power to TallyCounterI2C.

  • The default is to use -1 for continuous power because a counting device must always be on. However, the Tally also has a super capacitor that will keep it running even while powered down while the logger is in sleep during the interval between measurements.
  • The Tally Counter I2C can use either a 3.3V or 5V power source.
i2cAddressHex The I2C address of the Tally Counter I2C is 0x33 by default.


Example Code

The Tally countetr is used in the menu a la carte example.

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.

Sensor Variable Counts

The number of variables that can be returned by the Tally event counter

#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.

Configuration Defines

Defines to set the address of the Tally event counter.

#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_Events(TallyCounterI2C* parentSense, const char* uuid = "", const char* varCode = "TallyCounterI2CEvents") 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".

Define documentation

#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.


#define TALLY_WARM_UP_TIME_MS = 10

Sensor::_warmUpTime_ms; Tally warms up in <10 ms.


#define TALLY_MEASUREMENT_TIME_MS = 10

Sensor::_measurementTime_ms; Tally takes <10ms to complete a measurement.


#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_DEFAULT_CODE = "TallyCounterI2CEvents"

Default variable short code; "TallyCounterI2CEvents".