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

API for the Veris TEAMS Temperature Transmitter. More...

Detailed Description

The Veris TEAMS temperature sensor provides it's output via a 4-20ma current loop. The supported temperature range is 10C to 35C.

This sensor was developed with a Cooking Hacks (Libelium) 4-channel 4-20ma Arduino interface shield. For this interface, the receiver resistance (rResistor) was specified as 165.0 ohms.

When using a 4-20ma current loop interface which scales the sensors' values to a 0-5vdc range, you can supply 0.0 as the rResistor value in the constructor (default), and it will act just like a normal analog input.

cout << "Initializing..." << endl;
// Instantiate an TEAMS instance, using A0 for temperature, and
// 165.0 ohms for the rResistor value (for the libelium 4-20ma
// interface)
upm::TEAMS sensor(0, 165.0);
// update and print available values every second
while (shouldRun) {
// update our values from the sensor
sensor.update();
// is the sensor connected? (current >= 4ma)
cout << "Is Connected: " << sensor.isConnected() << endl;
// print computed current on the loop. This includes the offset,
// if one was set by setOffsetMilliamps().
cout << "Milliamps: " << sensor.getRawMilliamps() << endl;
// 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 Member Functions

 TEAMS (int tPin, float rResistor=0.0, float aref=TEAMS_DEFAULT_AREF)
 
 ~TEAMS ()
 
void update ()
 
float getTemperature (bool fahrenheit=false)
 
bool isConnected ()
 
float getRawMilliamps ()
 
void setOffsetMilliamps (float offset)
 

Protected Attributes

mraa::Aio m_aioTemp
 

Constructor & Destructor Documentation

TEAMS ( int  tPin,
float  rResistor = 0.0,
float  aref = TEAMS_DEFAULT_AREF 
)

TEAMS object constructor

Parameters
tPinAnalog pin to use for temperature.
rResistorThe receiver resistance in ohms, when using a 4-20ma current loop interface. When specified, this value will be used in computing the current based on the voltage read when scaling the return values. Default is 0.0, for standard scaling based on voltage output rather than current (4-20ma mode).
arefThe analog reference voltage, default 5.0
~TEAMS ( )

TEAMS 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
bool isConnected ( )
inline

When using a direct 4-20ma interface (rResistor supplied in the constructor is >0.0), this function will return false when the computed milliamps falls below 4ma, indicating that the sensor is not connected. If rResistor was specified as 0.0 in the constructor, this function will always return true.

Returns
true if the sensor is connected, false otherwise.
float getRawMilliamps ( )
inline

When using a direct 4-20ma interface (rResistor supplied in the constructor is >0.0), this function will return the computed milliamps (after the offset has been applied). If rResistor was specified as 0.0 in the constructor, this function will always return 0.0.

Returns
The last measured current in milliamps after any offset has been applied.
void setOffsetMilliamps ( float  offset)
inline

Specify an offset in milliamps to be applied to the computed current prior to scaling and conversion. This can be used to 'adjust' the computed value. If rResistor was specified as 0.0 in the constructor, this function will have no effect.

Parameters
offseta positive or negative value that will be applied to the computed current measured.

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