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

API for the OTP538U IR Temperature Sensor. More...

Detailed Description

UPM module for the OTP538U IR temperature sensor

This module was tested with the Grove IR non-contact temperature sensor.

The sensor provides 2 analog outputs: one for the thermistor that measures the ambient temperature, and the other for the thermopile that measures the object temperature.

Much of the code depends on analyzing Seeed Studio* examples and the circuit design. As a result, there are several 'magic' numbers derived from their circuit design. These values are used by default.

The tables used came from the "538U VT Table__20_200(v1.3).pdf" and "538RT_table.pdf" datasheets.

These tables assume the object to be measured is 9 cm (3.54 inches) from the sensor.

This sensor will not work at 3.3v on the Edsion or the Galileo 2. It works fine on both systems at 5v. It will work at 3.3v on the Arduino 101 (tested via firmata subplatform on edison).

otp538u.jpg
// Instantiate a OTP538U on analog pins A0 and A1
// A0 is used for the Ambient Temperature and A1 is used for the
// Object temperature.
upm::OTP538U temps(0, 1, OTP538U_AREF);
// enable debugging if you would like
// temps.setDebug(true);
// Output ambient and object temperatures
while (shouldRun) {
try {
cout << "Ambient temp: " << std::fixed << setprecision(2) << temps.ambientTemperature()
<< " C, Object temp: " << temps.objectTemperature() << " C" << endl;
} catch (std::out_of_range& e) {
cerr << "Temperature(s) are out of range: " << e.what() << endl;
}
cout << endl;
upm_delay(1);
}

Public Member Functions

 OTP538U (int pinA, int pinO, float aref=5.0)
 
 ~OTP538U ()
 
float ambientTemperature ()
 
float objectTemperature ()
 
void setVoltageOffset (float vOffset)
 
void setOutputResistence (int outResistance)
 
void setVRef (float vref)
 
void setDebug (bool enable)
 

Protected Attributes

otp538u_context m_otp538u
 

Constructor & Destructor Documentation

OTP538U ( int  pinA,
int  pinO,
float  aref = 5.0 
)

OTP538U constructor

Parameters
pinAAnalog pin to use for the ambient temperature
pinOAnalog pin to use for the object temperature
arefAnalog reference voltage; default is 5.0 V

Here is the caller graph for this function:

~OTP538U ( )

OTP538U destructor

Here is the call graph for this function:

Member Function Documentation

float ambientTemperature ( )

Gets the ambient temperature in Celsius

Returns
Ambient temperature

Here is the call graph for this function:

float objectTemperature ( )

Gets the object temperature in Celsius

Returns
Object temperature

Here is the call graph for this function:

void setVoltageOffset ( float  vOffset)
inline

Sets the offset voltage

The Seeed Studio wiki gives an example of calibrating the sensor and calculating the offset voltage to apply. Currently, the default value is set, but you can use the function to set one of your own.

Parameters
vOffsetDesired offset voltage

Here is the call graph for this function:

void setOutputResistence ( int  outResistance)
inline

Sets the output resistance value

The Seeed Studio wiki example uses a value of 2,000,000 in one of the equations used to calculate voltage. The value is the resistance of a resistor they use in the output stage of their SIG2 output. This was 'decoded' by looking at the EAGLE* files containing their schematics for this device.

Parameters
outResistanceValue of the output resistor; default is 2M Ohm

Here is the call graph for this function:

void setVRef ( float  vref)
inline

Sets the reference voltage of the internal Seeed Studio voltage regulator on the sensor board.

The Seeed Studio wiki example uses a value of 2.5 in one of the equations used to calculate the resistance of the ambient thermistor. The value is the voltage of an internal voltage regulator used on the sensor board. This was 'decoded' by looking at the EAGLE files containing their schematics for this device.

Parameters
vrefReference voltage of the internal sensor; default is 2.5

Here is the call graph for this function:

void setDebug ( bool  enable)
inline

Enable debugging output.

Parameters
enabletrue to enable some debug output, false otherwise

Here is the call graph for this function:

Collaboration diagram for OTP538U:
Collaboration graph
[legend]

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