PaleoTerra Redox topic

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://paleoterra.nl/

Build flags

  • -D MS_PALEOTERRA_SOFTWAREWIRE
    • switches from using hardware I2C to software I2C

Sensor Constructor

PaleoTerraRedox::PaleoTerraRedox(int8_t powerPin, uint8_t i2cAddressHex = 0x68, uint8_t measurementsToAverage = 1) explicit

Construct a new PaleoTerra Redox object using the primary hardware I2C instance.

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::PaleoTerraRedox(TwoWire* theI2C, int8_t powerPin, uint8_t i2cAddressHex = 0x68, uint8_t measurementsToAverage = 1)

Construct a new PaleoTerra Redox object using a secondary hardware I2C instance.

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::PaleoTerraRedox(SoftwareWire* theI2C, int8_t powerPin, uint8_t i2cAddressHex = 0x68, uint8_t measurementsToAverage = 1)

Construct a new PaleoTerra Redox object using a software I2C instance.

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.

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.


PaleoTerraRedox::PaleoTerraRedox(int8_t powerPin, int8_t dataPin, int8_t clockPin, uint8_t i2cAddressHex = 0x68, uint8_t measurementsToAverage = 1)

Construct a new PaleoTerra Redox object, also creating a SoftwareWire I2C instance for communication with that object.

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.

1#include <sensors/PaleoTerraRedox.h>
2
3// NOTE: Use -1 for any pins that don't apply or aren't being used.
4int8_t paleoTerraPower = sensorPowerPin; // Power pin
5uint8_t paleoI2CAddress = 0x68; // the I2C address of the redox sensor
6
7// Create the PaleoTerra sensor object
8#ifdef MS_PALEOTERRA_SOFTWAREWIRE
9PaleoTerraRedox ptRedox(&softI2C, paleoTerraPower, paleoI2CAddress);
10// PaleoTerraRedox ptRedox(paleoTerraPower, softwareSDA, softwareSCL,
11// paleoI2CAddress);
12#else
13PaleoTerraRedox ptRedox(paleoTerraPower, paleoI2CAddress);
14#endif
15
16// Create the voltage variable for the redox sensor
17Variable* ptVolt = new PaleoTerraRedox_Voltage(
18 &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

Sensor Variable Counts

The number of variables that can be returned by PaleoTerra redox sensor

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

Configuration Defines

Defines to set the address of the PaleoTerra redox sensor.

#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

PaleoTerraRedox_Voltage::PaleoTerraRedox_Voltage(Sensor* parentSense, const char* uuid = "", const char* varCode = "PTRVoltage") explicit

Construct a new PaleoTerraRedox_Voltage object.

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

Typedef documentation

typedef PaleoTerraRedox_Voltage PaleoTerraRedox_Volt

typedef for backwards compatibility; use the PaleoTerraRedox_Voltage class in new code


Define documentation

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


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


#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_UNIT_NAME = "millivolt"

Variable unit name in ODM2 controlled vocabulary; "millivolt" (mV)


#define PTR_VOLTAGE_DEFAULT_CODE = "PTRVoltage"

Default variable short code; "PTRVoltage".