Skip to content

HTS221 Module

This module contains the driver for STMicroelectronics HTS221 temperature and relative humidity sensor. Its highlight is that it outputs its measurement in a 16-bit resolution and has a high rH sensitivity of 0.004% (datasheet).

class HTS221

class HTS221(drvsel, int_pin, address=0x5F, clk=400000)

Creates an intance of a new HTS221.


  • drvsel – I2C Bus used ( I2C0, I2C0 )
  • int_pin – Interrupt pin used for events
  • address – Slave address, default 0x5f
  • clk – Clock speed, default 400kHz


from stm.hts221 import hts221

temp_hum = hts221.HTS221( I2C1,D31 )
temp, hum = temp_hum.get_temp_humidity()


Retrieves both temperature and humidity in one call.

Returns temp, humidity