upm
0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
|
UPM API for the T3311 MODBUS Temperature and Humidity Sensor. More...
This module implements support for the Comet System T3311 Temperature and Humidity transmitter. It uses MODBUS over an RS232 serial port. You must have libmodbus v3.1.2 (or greater) installed to compile and use this driver.
This module was developed using libmodbus 3.1.2, and T3311 Firmware revison 2.66 connected via a Prolific RS232 Serial to USB adaptor. You cannot use the built in TTL UART pins for accessing this device – you must use a full serial RS232 interface connected via USB.
Public Member Functions | |
T3311 (std::string device, int address, int baud=9600, int bits=8, char parity='N', int stopBits=2) | |
~T3311 () | |
bool | extendedDataAvailable () |
void | update () |
float | getTemperature (bool fahrenheit=false) |
float | getHumidity () |
float | getComputedValue () |
float | getDewPointTemperature (bool fahrenheit=false) |
float | getAbsoluteHumidity () |
float | getSpecificHumidity () |
float | getMixingRatio () |
float | getSpecificEnthalpy () |
std::string | getSerialNumber () |
int | getFirmwareMajor () |
int | getFirmwareMinor () |
void | setDebug (bool enable) |
Protected Member Functions | |
uint16_t | readInputReg (int reg) |
int | readInputRegs (int reg, int len, uint16_t *buf) |
Protected Attributes | |
modbus_t * | m_mbContext |
bool | m_isCelcius |
bool | m_isExtendedDataAvailable |
int | m_fwRevHi |
int | m_fwRevLo |
std::string | m_serialNumber |
T3311 | ( | std::string | device, |
int | address, | ||
int | baud = 9600 , |
||
int | bits = 8 , |
||
char | parity = 'N' , |
||
int | stopBits = 2 |
||
) |
T3311 constructor
device | Path to the serial device |
address | The MODBUS slave address |
baud | The baudrate of the device. Default: 9600 |
bits | The number of bits per byte. Default: 8 |
parity | The parity of the connection, 'N' for None, 'E' for Even, 'O' for Odd. Default: 'N' |
stopBits | The number of stop bits. Default: 2 |
|
inline |
Indicate whether the attached sensor supports extended Computed Data registers. Firmware versions at, or higher than 2.44 provide this data.
void update | ( | void | ) |
Read current values from the sensor and update internal stored values. This method must be called prior to querying any values, such as temperature or humidity.
float getTemperature | ( | bool | fahrenheit = false | ) |
Get the current temperature. update() must have been called prior to calling this method.
fahrenheit | true to return the temperature in degrees fahrenheit, false to return the temperature in degrees celcius. The default is false (degrees Celcius). |
float getHumidity | ( | void | ) |
Get the current relative humidity. update() must have been called prior to calling this method.
float getComputedValue | ( | ) |
Get the current computed value. update() must have been called prior to calling this method. This value is configured via the configuration of the sensor using the sensors configuration utility, and can represent several different computed values. The default value from the factory is the current Dew Point Temperature.
Since the actual value configured is unknown (and unknowable) to this driver, the units represented depend on how you have configured the device. This function simply returns the value without any conversion or interpretation, other than the default scaling.
float getDewPointTemperature | ( | bool | fahrenheit = false | ) |
Get the current dew point temperature. update() must have been called prior to calling this method. This information is only available if the sensor supports Extended Data (ie: extendedDataAvailable() returns true).
fahrenheit | true to return the temperature in degrees fahrenheit, false to return the temperature in degrees celcius. The default is false (degrees Celcius). |
float getAbsoluteHumidity | ( | ) |
Get the current absolute humidity. update() must have been called prior to calling this method. This information is only available if the sensor supports Extended Data (ie: extendedDataAvailable() returns true).
float getSpecificHumidity | ( | ) |
Get the current specific humidity. update() must have been called prior to calling this method. This information is only available if the sensor supports Extended Data (ie: extendedDataAvailable() returns true).
float getMixingRatio | ( | ) |
Get the current mixing ratio. update() must have been called prior to calling this method. This information is only available if the sensor supports Extended Data (ie: extendedDataAvailable() returns true).
float getSpecificEnthalpy | ( | ) |
Get the current specific enthalopy, a measure of energy density. update() must have been called prior to calling this method. This information is only available if the sensor supports Extended Data (ie: extendedDataAvailable() returns true).
|
inline |
Get the serial number of the sensor.
|
inline |
Get the firmware revision major number.
|
inline |
Get the firmware revision minor number.
void setDebug | ( | bool | enable | ) |
Enable or disable debugging output. This primarily enables and disables libmodbus debugging output.
enable | true to enable debugging, false otherwise |