ModularSensors > Modules > Supported Sensors > PaleoTerra Redox

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

Build flags

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

Sensor Constructor

PaleoTerraRedox(int8_t powerPin, uint8_t i2cAddressHex = MCP3421_ADR, 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(TwoWire* theI2C, int8_t powerPin, uint8_t i2cAddressHex = MCP3421_ADR, 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(SoftwareWire* theI2C, int8_t powerPin, uint8_t i2cAddressHex = MCP3421_ADR, 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(int8_t powerPin, int8_t dataPin, int8_t clockPin, uint8_t i2cAddressHex = MCP3421_ADR, 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.

#include <sensors/PaleoTerraRedox.h>

int8_t paleoTerraPower = sensorPowerPin;  // Pin to switch RS485 adapter power
                                          // on and off (-1 if unconnected)
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_Volt(&ptRedox, "12345678-abcd-1234-ef00-1234567890ab");

Classes

class PaleoTerraRedox
The Sensor sub-class for the PaleoTerra redox sensor.
class PaleoTerraRedox_Volt
The Variable sub-class used for the voltage output from a PaleoTerra redox sensor.

Defines

#define PTR_NUM_VARIABLES = 1
Sensor::_numReturnedValues; the PaleoTerra redox sensor can report 1 value.
#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_Volt(Sensor* parentSense, const char* uuid = "", const char* varCode = PTR_VOLTAGE_DEFAULT_CODE) explicit

Construct a new PaleoTerraRedox_Volt 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.

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