API Reference

adafruit_hdc302x

CircuitPython driver for the Adafruit HDC302x Precision Temperature/Humidity breakout

  • Author(s): Liz Clark

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_hdc302x.HDC302x(i2c_bus: busio.I2C, address: int = 0x44)

Driver for the HDC302x temperature and humidity sensor.

Initialize the HDC302x sensor with the given I2C bus and address.

Parameters:
  • i2c_bus – The I2C bus object.

  • address – The I2C address of the sensor.

property auto_mode: int

Auto mode for measurements. Options:

“5MPS_LP0”, “5MPS_LP1”, “5MPS_LP2” “5MPS_LP3”, “1MPS_LP0”, “1MPS_LP1” “1MPS_LP2”, “1MPS_LP3”, “2MPS_LP0” “2MPS_LP1”, “2MPS_LP2”, “2MPS_LP3” “4MPS_LP0”, “4MPS_LP1”, “4MPS_LP2” “4MPS_LP3”, “10MPS_LP0”, “10MPS_LP1” “10MPS_LP2”, “10MPS_LP3”, “EXIT_AUTO_MODE”

Returns:

The current auto mode.

property auto_relative_humidity: float

Read relative humidity in auto mode.

Returns:

The relative humidity in percent.

property auto_temperature: float

Read temperature in auto mode.

Returns:

The temperature in degrees Celsius.

clear_high_alert(temp: float, humid: float) bool

Clear the high alert thresholds for temperature and humidity.

Parameters:
  • temp – The temperature threshold in degrees Celsius.

  • humid – The relative humidity threshold in percent.

clear_low_alert(temp: float, humid: float) bool

Clear the low alert thresholds for temperature and humidity.

Parameters:
  • temp – The temperature threshold in degrees Celsius.

  • humid – The relative humidity threshold in percent.

property heater: bool

Heater power. Can be set to:

“OFF”, “QUARTER_POWER”, “HALF_POWER”, “FULL_POWER”

Returns:

True if the heater is on, False otherwise.

property high_alert: bool

Check if the high alert is activated.

Returns:

True if the high alert is activated, False otherwise.

property low_alert: bool

Check if the low alert is activated.

Returns:

True if the low alert is activated, False otherwise.

property manufacturer_id: int

Manufacturer ID of the sensor.

Returns:

The manufacturer ID.

property nist_id: List[int]

NIST ID of the sensor.

Returns:

NIST ID as a list of integers.

property offsets: Tuple[float, float]

Set temperature and relative humidity offsets

Returns:

The temperature and humidity offsets.

property relative_humidity: float

The measured relative humidity in percent.

Returns:

The relative humidity in percent.

set_high_alert(temp: float, humid: float) bool

Set the high alert thresholds for temperature and humidity.

Parameters:
  • temp – The temperature threshold in degrees Celsius.

  • humid – The relative humidity threshold in percent.

set_low_alert(temp: float, humid: float) bool

Set the low alert thresholds for temperature and humidity.

Parameters:
  • temp – The temperature threshold in degrees Celsius.

  • humid – The relative humidity threshold in percent.

property status: int

Status of the sensor.

Returns:

The status of the sensor.

property temperature: float

The measured temperature in degrees Celsius.

Returns:

The temperature in degrees Celsius.