upm  0.2.0
Sensor/Actuator repository for libmraa (v0.6.1)
All Data Structures Files Functions Variables Enumerations Enumerator Macros Modules Pages
Public Member Functions

C++ 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 ambient temperature, and another for the thermopile that measures object temperature.

Much of the code depends on analyzing the SeeedStudio examples and circuit design. As a result, there are several 'magic' numbers that were derived from their circuit design. By default, these values will be used.

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

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

// Instantiate a OTP538U on analog pins A0 and A1
// A0 is used for the Ambient Temperature and A1 is used for the
// Object tempewrature.
upm::OTP538U *temps = new upm::OTP538U(0, 1, OTP538U_AREF);
// Output ambient and object temperatures
while (shouldRun)
{
cout << "Ambient temp: " << std::fixed << setprecision(2)
<< temps->ambientTemperature()
<< " C, Object temp: " << temps->objectTemperature()
<< " C" << endl;
sleep(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)
 

Constructor & Destructor Documentation

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

OTP538U sensor constructor

Parameters
pinAanalog pin to use for Ambient temperature
pinOanalog pin to use for Object temperature
arefanalog reference voltage, default 5.0
~OTP538U ( )

OTP538U Destructor

Member Function Documentation

float ambientTemperature ( )

Get the ambient temperature in C

Returns
the ambient temperature
float objectTemperature ( )

Get the object temperature in C

Returns
the object's temperature
void setVoltageOffset ( float  vOffset)
inline

Set the offset voltage

The Seeedstudio wiki gives an example on 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
vOffsetthe desired offset voltage
void setOutputResistence ( int  outResistance)
inline

Set the output resistance value

The Seeedstudio wiki example uses a value, 2000000 in one of the equations used to calculate a 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 output resistor, default 2M Ohm.
void setVRef ( float  vref)
inline

Set the voltage reference of the internal seedstudio voltage regulator on the sensor board.

The Seeedstudio wiki example uses a value, 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 in the sensor board. This was 'decoded' by looking at the eagle files containing their schematics for this device.

Parameters
vrefinternal sensor voltage reference, default 2.5

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