Lab 104 (AI KIT): Reading Barometric Pressure from the DPS368 Sensor

Background

Overview of the DPS368 Sensor

The DPS368 is a miniaturized digital barometric air pressure sensor with a built-in temperature sensor. This kit communicates with the PSoC 6 MCU via the I2C interface, using a default I2C address of 0x77 (which can optionally be changed to 0x76 if the R66 resistor is populated).

Step 1: Device Initialization

After power-up or a soft reset, the sensor runs a self-initialization routine. Before taking measurements, you must wait for this to finish and load the calibration coefficients:

  1. Read the MEAS_CFG register (0x08) and wait for the SENSOR_RDY bit (bit 6) to read 1 (which typically takes ~12 ms) to confirm that the sensor initialization is complete.
  2. Wait for the COEF_RDY bit (bit 7) in the MEAS_CFG register (0x08) to read 1 (which typically takes ~40 ms), indicating that the calibration coefficients are ready for reading.
  3. Read the calibration coefficients from registers 0x10 through 0x21. These unique coefficients are required later to calculate the compensated (accurate) pressure and temperature values.

Step 2: Configure Output Data Rates (ODR) and Precision

Next, you must configure the measurement rates and oversampling (precision) settings for the sensors:

  1. Configure Pressure: Write to the PRS_CFG register (0x06). The upper bits (bits 6:4) define the measurement rate (PM_RATE) in Hz, and the lower bits (bits 3:0) define the oversampling precision (PM_PRC).
  2. Configure Temperature: Write to the TMP_CFG register (0x07). This sets the temperature measurement rate (TMP_RATE) and oversampling (TMP_PRC), as well as a bit that selects whether to use the internal ASIC temperature sensor or the external MEMS temperature sensor.

Step 3: Enable Sensors and Configure Background Mode

To continuously read both pressure and temperature data, you need to transition the device into Background Mode (continuous measurement):

  1. Write to the MEAS_CTRL bits (bits 2:0) in the MEAS_CFG register (0x08).
  2. Setting these bits to 111 enables continuous background measurements for both pressure and temperature.

Step 4: Reading Pressure and Temperature Data

The raw measurement results are provided as 24-bit 2's-complement numbers, split across three 8-bit registers (MSB, LSB, and XLSB) for each measurement type.

  • Pressure Data is stored in registers PRS_B2 to PRS_B0 (0x00 ~ 0x02).
  • Temperature Data is stored in registers TMP_B2 to TMP_B0 (0x03 to 0x05).

Reading operation:

  • You can capture all pressure and temperature data in a single command using an auto-increment burst read starting at register address 0x00.
  • Note on data: The raw 24-bit data read from these registers is uncompensated. You must apply the provided compensation scaling factors and the calibration coefficients (retrieved in Step 1) using the datasheet's specific formulas to convert the raw data into accurate Pascal (Pa) and Celsius (°C) values.

© 2026 Air Supply Information Center (Air Supply BBS)