LPS25H piezoresistive pressure sensor and ESP32 example

In this article we look at another pressure sensor – this time its the LPS25H and as usual we will connect it up to an ESP32 based Wemos Lolin32 board and see what we can get it to do

Lets look at what the vendor says about this sensor

The LPS25H is an ultra-compact absolute piezoresistive pressure sensor. It includes a monolithic sensing element and an IC interface able to take the information from the sensing element and to provide a digital signal to the external world.

The sensing element consists of a suspended membrane realized inside a single mono-silicon substrate. It is capable of detecting pressure and is manufactured using a dedicated process developed by ST.

The membrane is very small compared to the traditionally built silicon micromachined membranes. Membrane breakage is prevented by an intrinsic mechanical stopper.
The IC interface is manufactured using a standard CMOS process that allows a high level of integration to design a dedicated circuit which is trimmed to better match the sensing element characteristics.

The LPS25H is available in a cavity holed LGA package (HLGA). It is guaranteed to operate over a temperature range extending from -30 °C to +105 °C. The package is holed to allow external pressure to reach the sensing element.


260 to 1260 mbar absolute pressure range
High-resolution mode: 1 Pa RMS
Low power consumption
Low-resolution mode: 4 μA
High-resolution mode: 25 μA
High overpressure capability: 20x full scale
Embedded temperature compensation
Embedded 24-bit ADC
Selectable ODR from 1 Hz to 25 Hz
SPI and I²C interfaces
Supply voltage: 1.7 to 3.6 V
High shock survivability: 10,000 g


Parts Required


Name Link
Wemos ESP32 WeMos Mini D1 LOLIN32 ESP32
LPS25H Diybigworld LPS25HTR ST CJMCU-25 Miniature high Precision Pressure Sensor Temperature Compensation
Connecting wire Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire
sensor shield Expansion IO Board Sensor Shield


ESP32 Module
3v3 Vcc
Gnd Gnd


Code Example

This uses the library from https://github.com/pololu/lps-arduino

#include <Wire.h>
#include <LPS.h>
LPS ps;
void setup()
if (!ps.init())
Serial.println("Failed to autodetect pressure sensor!");
while (1);
void loop()
float pressure = ps.readPressureMillibars();
float altitude = ps.pressureToAltitudeMeters(pressure);
float temperature = ps.readTemperatureC();
Serial.print("p: ");
Serial.print(" mbar\ta: ");
Serial.print(" m\tt: ");
Serial.println(" deg C");



Open the serial monitor and you should see something like this

p: 993.38 mbar a: 166.75 m t: 23.85 deg C
p: 993.41 mbar a: 166.47 m t: 24.00 deg C
p: 993.15 mbar a: 168.66 m t: 24.16 deg C
p: 993.28 mbar a: 167.56 m t: 24.29 deg C
p: 993.28 mbar a: 167.56 m t: 24.29 deg C
p: 993.44 mbar a: 166.21 m t: 24.41 deg C



Click to access lps25h.pdf

Previous articleBH1745NUC Luminance and Colour Sensor and Wemos Lolin32 example
Next articleLPS22HB absolute pressure sensor and ESP32 example