3.11 Pressure Sensor

3.11.1 Overview

BMP388 pressure sensor is a pneumatic MEMS sensor a very compact package, featuring small size, low power consumption but high performance. In brief, it is a combination of the temperature and pressure sensor, which is perfect for mobile applications.

This module adopts proven piezoresistive pressure sensing technology with high accuracy and linearity, as well as long-term stability and high EMC stability. Besides, it maximize flexibility in multi-device working, and is ideal for altitude tracking in consumer electronics drones, wearables, smart homes, etc.

As for improvement, we can optimize the device in terms of power consumption, resolution and filtering performance.

3.11.2 Schematic Diagram

6-11

Based on piezoelectric pressure sensing technology, the BMP388 pressure sensor accurately measures pressure and temperature. It is capable of measuring air pressure in the 300 ~ 1250 hPa range without consuming much power (consuming only 3.4 µA at 1 Hz operating frequency). In addition, the built-in infinite impulse response filter can effectively reduce effects from external interference.

3.11.3 Code Blocks

  1. j35

    This block initializes the BMP388 pressure sensor. Without this block, the module will not work.

  2. j36

    This block reads BMP388 sensor values. If the values are not read, they cannot be output.

  3. j37

    This block outputs the values read by BMP388 sensor, including Pressure, Altitude and Temperature.

j38

3.11.4 Test Code

3.11.4.1 Build Code

There are two ways to upload the code: directly open the code file we provide; or manually build blocks.

Directly open the code file we provide:

  1. Click and choose Load from your computer

  1. We have already downloaded the codes on computer desktop, so open the file and choose 3-11-bmp388.sb3

Manually build blocks:

  1. In events, find j1 block.

  2. In , find and put j35 under j1.

  3. In serial, drag j12 and set baud rate to 9600, and put it under j35.

  4. In control, drag j2.6-4-4-1-1

6-2

  1. In , put j13 in j2

  2. In serial, put j13 under and set to print “Pressure:” in no-warp mode.

  3. Add one more image-20240701141959486 block and set to no-warp

  4. In , drag and put j14 block in the printing content of j13 and set to show “Pressure:” values.

    6-11

  5. Duplicate 6-11 and set to print “ Altitude:”(the two spaces separates the two values to be output). Modify to show data “Altitude”.

  6. Duplicate 6-11 and set to print “ Temperature:” (the two spaces separates the two values to be output). Modify to show data “°C”.

  7. Set 6-11 to print in warp mode.

  8. Add a delay of 1S for better observing the results.

Complete Test Code

6-11-4-1-5

3.11.4.2 Test Result

After uploading code, the serial monitor prints the values read by BMP388 sensor.

6-11