upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Data Structures | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

API for the Veris TEX00 Temperature Sensor. More...

Detailed Description

The Veris TEX00 temperature sensor family is made up of a series of RTD thermistors in wall mount packaging.

This driver was developed using the TED00, which utilizes a 10K Ohm Type 2 thermistor. However, this driver can support the other 12 variants of the TE series as well by providing the correct sensor type to the class constructor. These other sensor types have not been tested. Only the TED00 was tested with this driver.

This sensor must be connected as part of a voltage divider, with the balancing resistor ideally matched to the sensor's 25C detection range. For the TED00 (10kt2), a 10K Ohm (1% tolerance) resistor was used in a circuit like the following:

GND o-—|TED00(10k2)|-—o-—|balanceResistor(10K)|-—o VCC (+5vdc) | | |-—o A0 (analog input to MCU)

A 3.3vdc voltage can be used as well if desired.

cout << "Initializing..." << endl;
// Instantiate an TEX00 instance, using A0 for the analog input. In
// this example, we are using a 10K Ohm balance resistor and a TED
// (10k type 2) thermistor.
upm::TEX00 sensor(0, 10000, upm::TEX00::STYPE_THERMISTOR_TED);
cout << "Minimum temperature: " << sensor.getTemperatureRangeMin() << " C" << endl;
cout << "Maximum temperature: " << sensor.getTemperatureRangeMax() << " C" << endl;
cout << endl;
// update and print available values every second
while (shouldRun) {
// update our values from the sensor
sensor.update();
if (sensor.isOutOfRange()) {
cout << "Temperature out of range" << endl;
} else {
// we show both C and F for temperature
cout << "Temperature: " << sensor.getTemperature() << " C / "
<< sensor.getTemperature(true) << " F" << endl;
}
cout << endl;
upm_delay(1);
}
cout << "Exiting..." << endl;

Public Types

enum  SENSOR_TYPES_T {
  STYPE_THERMISTOR_TED = 0, STYPE_THERMISTOR_TEB, STYPE_THERMISTOR_TEC, STYPE_THERMISTOR_TEI,
  STYPE_THERMISTOR_TEE, STYPE_THERMISTOR_TEF, STYPE_THERMISTOR_TEH, STYPE_THERMISTOR_TEJ,
  STYPE_THERMISTOR_TES, STYPE_THERMISTOR_TER, STYPE_THERMISTOR_TEM, STYPE_THERMISTOR_TEU,
  STYPE_THERMISTOR_TET
}
 

Public Member Functions

 TEX00 (int tPin, float balanceResistor, SENSOR_TYPES_T stype, float aref=TEX00_DEFAULT_AREF)
 
 ~TEX00 ()
 
void update ()
 
float getTemperature (bool fahrenheit=false)
 
float getTemperatureRangeMin ()
 
float getTemperatureRangeMax ()
 
bool isOutOfRange ()
 

Protected Member Functions

float thermistor (float ohms)
 

Protected Attributes

mraa::Aio m_aioTemp
 

Constructor & Destructor Documentation

TEX00 ( int  tPin,
float  balanceResistor,
SENSOR_TYPES_T  stype,
float  aref = TEX00_DEFAULT_AREF 
)

TEX00 object constructor

Parameters
tPinAnalog pin to use for temperature.
balanceResistorResistance (in Ohms) of the balance resistor used in your voltage divider.
stypeThe sensor type. One of the SENSOR_TYPES_T values.
arefThe analog reference voltage, default 5.0
~TEX00 ( )

TEX00 object destructor

Member Function Documentation

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.

float getTemperature ( bool  fahrenheit = false)

Get the current temperature. update() must have been called prior to calling this method.

Parameters
fahrenheittrue to return the temperature in degrees fahrenheit, false to return the temperature in degrees celsius. The default is false (degrees Celsius).
Returns
The last temperature reading in Celsius or Fahrenheit
float getTemperatureRangeMin ( )

Return the smallest temperature that can be measured by the current sensor.

Returns
The smallest detectable temperature this sensor can measure, in C.
float getTemperatureRangeMax ( )

Return the largest temperature that can be measured by the current sensor.

Returns
The largest detectable temperature this sensor can measure, in C.
bool isOutOfRange ( )
inline

Detect whether the last measurement exceeded the sensors detection range. update() must have been called prior to calling this method.

Returns
true if the last measurement was out of range, false otherwise.

The documentation for this class was generated from the following files: