# adafruit_lps35hw¶

A driver for the ST LPS35HW water resistant MEMS pressure sensor

• Author(s): Bryan Siepert

## Implementation Notes¶

Hardware:

Software and Dependencies:

Options for data_rate

DataRate

Time

DataRate.ONE_SHOT

One shot mode

DataRate.RATE_1_HZ

1 hz

DataRate.RATE_10_HZ

10 hz (Default)

DataRate.RATE_25_HZ

25 hz

DataRate.RATE_50_HZ

50 hz

DataRate.RATE_75_HZ

75 hz

Driver for the ST LPS35HW MEMS pressure sensor

Parameters
• i2c_bus (I2C) – The I2C bus the LPS35HW is connected to.

• address (int) – The I2C device address for the sensor. Default is 0x5d but will accept 0x5c when the SDO pin is connected to Ground.

Quickstart: Importing and using the LPS35HW

Here is an example of using the LPS35HW class. First you will need to import the libraries to use the sensor

import board


Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()   # uses board.SCL and board.SDA


Now you have access to the temperature and pressure attributes. Temperature is in Celsius and Pressure is in hPa.

temperature = lps.temperature
pressure = lps.pressure

data_rate = 3
The rate at which the sensor measures pressure and temperature.

data_rate should be set to one of the values of adafruit_lps35hw.DataRate().

Note

Setting data_rate to DataRate.ONE_SHOT places the sensor into a low-power shutdown mode where measurements to update pressure and temperature are only taken when take_measurement() is called.

property high_threshold_enabled: bool

Set to True or False to enable or disable the high pressure threshold

property high_threshold_exceeded: bool

Returns True if the pressure high threshold has been exceeded. Must be enabled by setting high_threshold_enabled to True and setting a pressure_threshold.

low_pass_enabled

True if the low pass filter is enabled. Setting to True will reduce the sensor bandwidth from $$data_rate/2$$ to $$data_rate/9$$, filtering out high-frequency noise.

property low_threshold_enabled: bool

Set to True or False to enable or disable the low pressure threshold.

Note

The low pressure threshold only works in relative mode

property low_threshold_exceeded: bool

Returns True if the pressure low threshold has been exceeded. Must be enabled by setting high_threshold_enabled to True and setting a pressure_threshold.

property pressure: float

The current pressure measurement in hPa

property pressure_threshold: float

The high pressure threshold. Use high_threshold_enabled or high_threshold_enabled to use it

reset() None

Reset the sensor, restoring all configuration registers to their defaults

reset_pressure() None

Reset pressure to be reported as the measured absolute value

take_measurement() None

Update the value of pressure and temperature by taking a single measurement. Only meaningful if data_rate is set to ONE_SHOT

property temperature: float

The current temperature measurement in degrees Celsius

zero_pressure() None

Set the current pressure as zero and report the pressure relative to it