PMODTMP2 Temperature Sensor and Thermostat Control - Review

Table of contents

RoadTest: PMODTMP2 Temperature Sensor and Thermostat Control

Author: s2000gt

Creation date:

Evaluation Type: Independent Products

Did you receive all parts the manufacturer stated would be included in the package?: True

What other parts do you consider comparable to this product?:

What were the biggest problems encountered?:

Detailed Review:

Introduction

 

The Digilent Pmod TMP2 (Revision B) is a temperature module allowing users to detect ambient temperatures ranging from -40 °C to 150 °C.

Features

  • 16-bit ambient temperature sensor
  • Typical accuracy better that 0.25 ºC
  • 240 ms continuous conversion time
  • Programmable over and under-temperature control pins
  • No calibration required
  • 2×4-pin connector with I2C interface

 

The Pmod TMP2 utilizes the Analog Devices ADT7420. Users may measure the ambient temperature at a default resolution of 0.0625 °C

 

I²C Address Selection

 

I²C Addresses
JP2JP1Device Address
OpenOpen0x4B (0b10001011)
OpenShorted0x4A (0b1001010)
ShortedOpen0x49 (0b1001001)
ShortedShorted0x48 (0b1001000)

 

 

Pinout Description Table

 

Header J1Jumper Blocks
PinSignalDescriptionJumper BlockStateDescription
1 & 5SCLSerial ClockJP1Open/ShortedAddress bit 0 high/low
2 & 6SDASerial DataJP2Open/ShortedAddress bit 1 high/low
3 & 7GNDPower Supply GroundUser Outputs
4 & 8VCCPositive Power SupplyHeader NamePin NameDescription
J2CTCritical Threshold Output
J3INTInterrupt Output

 

 

 

 

Test Setup

 

 

Example Code

 

/************************************************************************
*
* Test of Pmod TMP2
*
*************************************************************************
* Description: Pmod_TMP2
* The ambient temperature is displayed on the serial monitor.
* 
************************************************************************/


#include  // call library
#define ADT7420_Address 0x4B // I2C address of the Pmod TMP2


int MSB;
int LSB;
int value;
float temperature;


void setup()
{
 Serial.begin(9600); // initialization of serial communication
 Wire.begin(); // initialization of I2C communication
 Init_ADT7420(); // initialization of Pmod TMP2 module 
}


void loop()
{
 Wire.beginTransmission(ADT7420_Address); // Begin measurement
  Wire.endTransmission();
 delay(10);
 Wire.requestFrom(ADT7420_Address, 2); // Recovery of the two bytes MSB and LSB
 if(Wire.available() <=2)
 {
  MSB = Wire.read();
  LSB = Wire.read();
 }
 value=(MSB<<8)|LSB ;
 if (((value>>15)&1)==0) // If the temperature is positive
 {
  temperature=value/128.0;
 }
 else // If the temperature is negative
 {
  temperature=(value-65535)/128.0;
 }
 Serial.print("MSB="); // display in serial monitor
 Serial.println(MSB);
 Serial.print("LSB=");
 Serial.println(LSB);
 Serial.print("Value=");
 Serial.println(value);
 Serial.print("Temperature=");
 Serial.print(temperature);
 Serial.println(" C");
 Serial.println();
 delay(3000);
}


// Initialization of Pmod TMP2 module
void Init_ADT7420(void)
{
// Configuring the ADT7420 in 16 bit mode
 Wire.beginTransmission(ADT7420_Address);
 Wire.write(0x03);
 Wire.write(0x80);
 Wire.endTransmission();
}

 

Code Execution

 

 

Conclusion

 

The Pmod series of modules are nice easy way to interface a wide variety of devices to your microcontroller project.

They cover SPI, I2C, GPIO and UART and conform to Digilents Pmod interface standard.

While most development board do not come with a Pmod connector, it's easy enough to wire one up.

The TMP2 module seems to be a very accurate and capable module.

Anonymous