

The Adafruit HTS221 is a high-precision sensor module designed for acquiring environmental data by measuring both temperature and humidity. Its compact form factor and low power consumption make it an ideal choice for a variety of applications, including weather stations, home automation systems, and IoT devices. The sensor communicates over the I2C interface, allowing for easy integration with microcontrollers such as the Arduino UNO.








| Pin Number | Name | Description |
|---|---|---|
| 1 | VDD | Power supply (1.7V to 3.6V) |
| 2 | GND | Ground reference for power supply |
| 3 | SDA | I2C data line |
| 4 | SCL | I2C clock line |
| 5 | DRDY | Data Ready output (optional use) |
Connecting the Sensor:
Library Installation:
Sample Code:
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_HTS221.h>
Adafruit_HTS221 hts;
void setup() {
Serial.begin(9600);
// Wait for serial monitor to open
while (!Serial) { delay(10); }
Serial.println("Adafruit HTS221 test!");
if (!hts.begin()) {
Serial.println("Failed to find HTS221 chip");
while (1) { delay(10); }
}
Serial.println("HTS221 Found!");
}
void loop() {
sensors_event_t humidity, temp;
hts.getEvent(&humidity, &temp);// populate temp and humidity objects with fresh data
Serial.print("Temperature: "); Serial.print(temp.temperature); Serial.println(" degrees C");
Serial.print("Humidity: "); Serial.print(humidity.relative_humidity); Serial.println("% rH");
delay(500);
}
Q: Can the HTS221 be used with a 5V microcontroller? A: Yes, but a logic level converter is required to shift the I2C signals to 3.3V.
Q: How can I calibrate the sensor? A: The HTS221 comes factory-calibrated. If further calibration is needed, refer to the sensor's datasheet for calibration procedures.
Q: Is the HTS221 waterproof? A: No, the HTS221 is not waterproof. Protect it from moisture and condensation.
For further assistance, consult the Adafruit HTS221 datasheet and the Adafruit support forums.