

The Adafruit HTS221 (Part ID: 4535) is a digital humidity and temperature sensor designed for precise environmental monitoring. Manufactured by Adafruit, this sensor combines high accuracy with ease of use, thanks to its I2C communication interface. The HTS221 is ideal for applications such as weather stations, HVAC systems, IoT devices, and other projects requiring reliable humidity and temperature measurements.








The Adafruit HTS221 is a compact and efficient sensor with the following key specifications:
| Parameter | Value |
|---|---|
| Operating Voltage | 1.7V to 3.6V |
| Communication Interface | I2C (default) or SPI |
| Humidity Measurement Range | 0% to 100% RH |
| Humidity Accuracy | ±3.5% RH (typical) |
| Temperature Range | -40°C to +120°C |
| Temperature Accuracy | ±0.5°C (typical) |
| Power Consumption | 2 µA in low-power mode |
| I2C Address | 0x5F (default) |
| Dimensions | 2.0mm x 2.0mm x 0.9mm |
The Adafruit HTS221 breakout board includes the following pins:
| Pin Name | Description |
|---|---|
| VIN | Power supply input (3.3V or 5V compatible) |
| GND | Ground connection |
| SCL | I2C clock line (connect to microcontroller SCL pin) |
| SDA | I2C data line (connect to microcontroller SDA pin) |
| CS | Chip Select (used for SPI communication, leave unconnected for I2C) |
| INT | Interrupt pin (optional, for event-driven applications) |
To use the Adafruit HTS221 with a microcontroller (e.g., Arduino UNO), follow these steps:
Below is an example of how to use the Adafruit HTS221 with an Arduino UNO. This code uses the Adafruit HTS221 library, which can be installed via the Arduino Library Manager.
#include <Wire.h>
#include <Adafruit_HTS221.h>
// Create an instance of the HTS221 sensor
Adafruit_HTS221 hts;
void setup() {
Serial.begin(9600);
while (!Serial) {
delay(10); // Wait for Serial Monitor to open
}
// Initialize the HTS221 sensor
if (!hts.begin_I2C()) {
Serial.println("Failed to find HTS221 sensor! Check wiring.");
while (1) {
delay(10); // Halt execution if sensor is not found
}
}
Serial.println("HTS221 sensor initialized successfully!");
}
void loop() {
// Read humidity and temperature values
float humidity = hts.readHumidity();
float temperature = hts.readTemperature();
// Print the values to the Serial Monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %RH");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
delay(1000); // Wait 1 second before the next reading
}
Sensor not detected:
Incorrect or fluctuating readings:
Interrupt pin not working:
Q: Can I use the HTS221 with a Raspberry Pi?
A: Yes, the HTS221 is compatible with Raspberry Pi. Use the I2C interface and appropriate libraries (e.g., Adafruit CircuitPython HTS221).
Q: What is the default I2C address of the HTS221?
A: The default I2C address is 0x5F.
Q: Can the HTS221 measure dew point?
A: The HTS221 does not directly measure dew point, but you can calculate it using the temperature and humidity readings.
Q: Is the HTS221 suitable for outdoor use?
A: The HTS221 can be used outdoors if protected from direct exposure to water, dust, and extreme conditions. Consider using an enclosure with proper ventilation.
By following this documentation, you can effectively integrate the Adafruit HTS221 into your projects for accurate environmental sensing.