Introduction
This I2C digital temperature & humidity sensor offers high accuracy of ±3.0RH% for humidity and ±0.5℃ for temperature, and features user-programmable humidity & temperature alarm function.
Its housing is made of 304 stainless steel to ensure good impact resistance, heat resistance, low temperature and chemical resistance. The sensor output is designed as DuPont 2.54 connector for easy wiring. Also, there are two built-in 4.7K pull-up resistors and one 100nF filtering capacitor so the sensor can be directly used with microcontrollers like Arduino.
This temperature & humidity sensor can be applied to electronic, medical, automotive, industrial, weather, and other fields, including home appliances like HVAC, dehumidifiers and refrigerators, testing & inspection equipment, and other relevant temperature & humidity measurements and controls.
Features
- 304 stainless steel, good impact resistance
- Low power consumption, high accuracy
- User-programmable temperature & humidity alarm response address (ARA)
Specification
- Operating Voltage: 2.5V~5.5V
- Standby Current: 0.05uA (Typical), 0.3uA (Max)
- Average Operating Current: 1.5uA (Typical), 3.0uA (Max)
- Temperature Measurement Range (℃): -40℃~125℃
- Temperature Measurement Accuracy (℃): ±0.5℃@0℃~50℃
- Humidity Measurement Range (%RH): 0%RH~100%RH
- Humidity Measurement Accuracy (%RH): ±3.0%RH@20%RH~80%RH
- Communication:I2C
- Connector: DuPont 2.54
- Reserved DuPont Wire Length: 5cm
- Wire Length: 1.5m
- Housing: 304 stainless steel
- Wire Sequence: red VCC; black GND; white SCL; yellow SDA
Pinout
Color | Label | Description |
---|---|---|
Red | VCC | + |
Black | GND | - |
White | SDL | Data |
Yellow | SDA | Clock |
Tutorial
Requirements
- Hardware
- DFRduino UNO R3 (or similar) x 1
- I2C Temperature & Humidity Sensor (Stainless Steel Shell) x 1
- Software
Connection Diagram
Sample Code
Download and install the Arduino Library (About how to install the library?)
Read Temperature & Humidity Values
#include "Wire.h"
#define address 0x40
char dtaUart[15];
char dtaLen = 0;
uint8_t Data[100] = {0};
uint8_t buff[100] = {0};
void setup()
{
Serial.begin(9600);
Wire.begin();
}
uint8_t buf[4] = {0};
uint16_t data, data1;
float temp;
float hum;
void loop()
{
readReg(0x00, buf, 4);
data = buf[0] << 8 | buf[1];
data1 = buf[2] << 8 | buf[3];
temp = ((float)data * 165 / 65535.0) - 40.0;
hum = ((float)data1 / 65535.0) * 100;
Serial.print("temp(C):");
Serial.print(temp);
Serial.print("\t");
Serial.print("hum(%RH):");
Serial.println(hum);
delay(500);
}
uint8_t readReg(uint8_t reg, const void* pBuf, size_t size)
{
if (pBuf == NULL) {
Serial.println("pBuf ERROR!! : null pointer");
}
uint8_t * _pBuf = (uint8_t *)pBuf;
Wire.beginTransmission(address);
Wire.write(®, 1);
if ( Wire.endTransmission() != 0) {
return 0;
}
delay(20);
Wire.requestFrom(address, (uint8_t) size);
for (uint16_t i = 0; i < size; i++) {
_pBuf[i] = Wire.read();
}
return size;
}
Result
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.