PaleoTerra Redox module
Classes for the PaleoTerra Redox digital preassure sensor.
Introduction
Because older versions of these sensors all ship with the same I2C address, and more than one is frequently used at different soil depths in the same profile, this module has an optional dependence on Testato's SoftwareWire library for software I2C.
Sensor Datasheet
Documentation for the sensor can be found at: https:/
Build flags
-D MS_PALEOTERRA_SOFTWAREWIRE
switches from using hardware I2C to software I2C
Sensor Constructor
Construct a new PaleoTerra Redox object using the primary hardware I2C instance. Construct a new PaleoTerra Redox object using a secondary hardware I2C instance. Construct a new PaleoTerra Redox object using a software I2C instance. The constructor - need the power pin, optionally can give an instance of TwoWire for I2C communication, an address, and a number of measurements to average. Construct a new PaleoTerra Redox object, also creating a SoftwareWire I2C instance for communication with that object.
PaleoTerraRedox(int8_t powerPin,
uint8_t i2cAddressHex = MCP3421_
Parameters
powerPin
The pin on the mcu controlling power to the PaleoTerra redox sensor. Use -1 if it is continuously powered.
i2cAddressHex
The I2C address of the redox probe.
measurementsToAverage
The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1.
PaleoTerraRedox(TwoWire* theI2C,
int8_t powerPin,
uint8_t i2cAddressHex = MCP3421_
Parameters
theI2C
A TwoWire instance for I2C communication. Due to the limitations of the Arduino core, only a hardware I2C instance can be used. For an AVR board, there is only one I2C instance possible and this form of the constructor should not be used. For a SAMD board, this can be used if a secondary I2C port is created on one of the extra SERCOMs.
powerPin
The pin on the mcu controlling power to the PaleoTerra redox sensor. Use -1 if it is continuously powered.
i2cAddressHex
The I2C address of the redox probe.
measurementsToAverage
The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1.
PaleoTerraRedox(SoftwareWire* theI2C,
int8_t powerPin,
uint8_t i2cAddressHex = MCP3421_
Parameters
theI2C
A SoftwareWire instance for I2C communication.
powerPin
The pin on the mcu controlling power to the PaleoTerra redox sensor. Use -1 if it is continuously powered.
i2cAddressHex
The I2C address of the redox probe.
measurementsToAverage
The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1.
PaleoTerraRedox(int8_t powerPin,
int8_t dataPin,
int8_t clockPin,
uint8_t i2cAddressHex = MCP3421_
Parameters
powerPin
The pin on the mcu controlling power to the PaleoTerra redox sensor. Use -1 if it is continuously powered.
dataPin
The pin on the mcu that will be used for I2C data (SDA). Must be a valid pin number.
clockPin
The pin on the mcu that will be used for the I2C clock (SCL). Must be a valid pin number.
i2cAddressHex
The I2C address of the redox probe.
measurementsToAverage
The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1.
Example Code
The PaleoTerra Redox is used in the menu a la carte example.
#include <sensors/PaleoTerraRedox.h> // NOTE: Use -1 for any pins that don't apply or aren't being used. int8_t paleoTerraPower = sensorPowerPin; // Power pin uint8_t paleoI2CAddress = 0x68; // the I2C address of the redox sensor // Create the PaleoTerra sensor object #ifdef MS_PALEOTERRA_SOFTWAREWIRE PaleoTerraRedox ptRedox(&softI2C, paleoTerraPower, paleoI2CAddress); // PaleoTerraRedox ptRedox(paleoTerraPower, softwareSDA, softwareSCL, // paleoI2CAddress); #else PaleoTerraRedox ptRedox(paleoTerraPower, paleoI2CAddress); #endif // Create the voltage variable for the redox sensor Variable* ptVolt = new PaleoTerraRedox_Voltage( &ptRedox, "12345678-abcd-1234-ef00-1234567890ab");
Classes
- class PaleoTerraRedox
- The Sensor sub-class for the PaleoTerra redox sensor.
- class PaleoTerraRedox_Voltage
- The Variable sub-class used for the voltage output from a PaleoTerra redox sensor.
Typedefs
-
using PaleoTerraRedox_Volt = PaleoTerraRedox_
Voltage deprecated in v0.33.0 - typedef for backwards compatibility; use the PaleoTerraRedox_
Voltage class in new code
Defines
- #define PTR_NUM_VARIABLES = 1
- Sensor::
_numReturnedValues; the PaleoTerra redox sensor can report 1 value. - #define PTR_INC_CALC_VARIABLES = 0
- Sensor::
_incCalcValues; we don't calculate any additional values. - #define MCP3421_ADR = 0x68
- The default I2C address of the PaleoTerra redox sensor.
Sensor Timing
The sensor timing for a PaleoTerra redox probe
- #define PTR_WARM_UP_TIME_MS = 1
- Sensor::
_warmUpTime_ms; the PaleoTerra redox sensor is immediately warmed up. - #define PTR_STABILIZATION_TIME_MS = 0
- Sensor::
_stabilizationTime_ms; the PaleoTerra redox sensor is immediately stable. - #define PTR_MEASUREMENT_TIME_MS = 67
- Sensor::
_measurementTime_ms; the PaleoTerra redox sensor takes 67ms to complete a measurement.
Voltage
The voltage variable from a PaleoTerra redox probe
- Accuracy is ±5mV
Construct a new PaleoTerraRedox_
PaleoTerraRedox_Voltage(Sensor* parentSense,
const char* uuid = "",
const char* varCode = PTR_
Parameters
parentSense
The parent PaleoTerraRedox 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 "PTRVoltage".
- #define PTR_VOLTAGE_RESOLUTION = 2
- Decimals places in string representation; voltage should have 2.
Resolution is 1mV and 1 extra digit is added to increase the number of significant figures to allow for averaging of multiple measurements.
- #define PTR_VOLTAGE_VAR_NUM = 0
- Sensor variable number; voltage is stored in sensorValues[0].
- #define PTR_VOLTAGE_VAR_NAME = "Voltage"
- Variable name in ODM2 controlled vocabulary; "Voltage".
- #define PTR_VOLTAGE_UNIT_NAME = "millivolt"
- Variable unit name in ODM2 controlled vocabulary; "millivolt" (mV)
- #define PTR_VOLTAGE_DEFAULT_CODE = "PTRVoltage"
- Default variable short code; "PTRVoltage".