drivers.LPS25HB.LPS25HB

Driver for the STMicroelectronics LPS25HB barometric pressure sensor.

Provides I2C communication with the LPS25HB MEMS absolute pressure sensor via the Adafruit CircuitPython LPS2x library. The driver supports either I2C bus 0 or bus 1, performs automatic reinitialization on I/O errors, and uses an MCP23017 GPIO expander to toggle the 3.3V power rail for hardware fault recovery.

The LPS25HB measures absolute barometric pressure in the 260-1260 hPa range and includes an embedded temperature sensor used for thermal compensation. This module exposes a single class, LPS25HB, that wraps the low-level driver with retry, logging, and power-cycle recovery semantics consistent with other Oizom sensor wrappers (see SensorBase.SensorBase.GenericSensor).

Example

Initialize the driver and read a pressure / temperature pair:

>>> from drivers.LPS25HB.LPS25HB import LPS25HB
>>> sensor = LPS25HB(i2c_port=0, i2c_addr=0x5D)
>>> sensor.get_temperature()
24.7
>>> sensor.get_pressure()
1013.25

Note

Hardware / register layout details:

  • Interface: I2C (bus 0 or 1) – SPI is also supported by silicon but this driver targets I2C only.

  • Default I2C address: 0x5D (SA0 tied high). Alternate address 0x5C (SA0 tied low).

  • Supply: 3.3 V (power rail controlled via MCP23017 channel 6 by default; override with the MCP_ID environment variable).

  • Range: 260-1260 hPa absolute pressure; embedded temperature sensor.

  • Accuracy: +/-0.2 hPa (absolute), +/-2 degrees C (temperature).

  • Key registers used by the underlying Adafruit driver: WHO_AM_I (0x0F = 0xBD), CTRL_REG1 (0x20), PRESS_OUT_XL/L/H (0x28-0x2A), TEMP_OUT_L/H (0x2B-0x2C).

  • Required Python packages: adafruit-circuitpython-lps2x, board, and busio.

Attributes

Classes

LPS25HB

I2C driver for the STMicroelectronics LPS25HB pressure sensor.

Module Contents

drivers.LPS25HB.LPS25HB.basic_logger
drivers.LPS25HB.LPS25HB.context_logger