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.
The Pmod TMP2 utilizes the Analog Devices ADT7420. Users may measure the ambient temperature at a default resolution of 0.0625 °C
| I²C Addresses | ||
|---|---|---|
| JP2 | JP1 | Device Address |
| Open | Open | 0x4B (0b10001011) |
| Open | Shorted | 0x4A (0b1001010) |
| Shorted | Open | 0x49 (0b1001001) |
| Shorted | Shorted | 0x48 (0b1001000) |
| Header J1 | Jumper Blocks | |||||
|---|---|---|---|---|---|---|
| Pin | Signal | Description | Jumper Block | State | Description | |
| 1 & 5 | SCL | Serial Clock | JP1 | Open/Shorted | Address bit 0 high/low | |
| 2 & 6 | SDA | Serial Data | JP2 | Open/Shorted | Address bit 1 high/low | |
| 3 & 7 | GND | Power Supply Ground | User Outputs | |||
| 4 & 8 | VCC | Positive Power Supply | Header Name | Pin Name | Description | |
| J2 | CT | Critical Threshold Output | ||||
| J3 | INT | Interrupt 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.
Top Comments
The AM2320 is another I2C module but it can't go above 80C
Are you going to verify the temperature range and accuracy stability?
Try putting it next to a metal container containing an ice cube and then monitor the temperature while the ice melts.
You should be able…
boards not really set up for contact with all the jumper pins, i'm satisfied with just an ambient check.