Skip to content

7semi-solutions/7Semi-BMP58x-Pressure-Sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

7Semi BMP58x Arduino Library

The 7Semi BMP58x Arduino Library is a lightweight, register-level driver for the Bosch Sensortec BMP58x barometric pressure sensor. It supports both I2C and SPI communication on Arduino-core platforms. The library also exposes advanced features such as oversampling control, output data rate, IIR filtering, interrupts, FIFO, out-of-range detection, and user NVM access.


Features

  • Supports I2C and SPI
  • Configurable:
    • Oversampling (OSR)
    • Output Data Rate (ODR)
    • IIR filtering
    • FIFO
    • Interrupts (DRDY, FIFO, OOR)
    • Out-of-Range (OOR) window
    • User NVM read/write
  • Optional custom I2C / SPI pins on ESP32

Connections / Wiring

I²C Connection (Most Common)

BMP58x Pin MCU Pin Notes
VDD 3.3V 3.3V only (do NOT use 5V)
GND GND Common ground
SDI SDA I²C data
SCK SCL I²C clock
INT GPIO (optional) Required only for interrupts

SPI Connection

BMP58x Pin MCU Pin Notes
VDD 3.3V 3.3V only
GND GND Common ground
SCK SPI SCK Clock
SDI SPI MOSI Master → sensor
SDO SPI MISO Sensor → master
CS GPIO Chip Select (active-low)
INT GPIO (optional) Interrupt output

SPI Notes

  • SPI mode MODE0 required
  • Dummy byte is required after address (handled by library)
  • CS must stay LOW during the entire transaction

Notes

SPI mode: MODE0

Start with 1 MHz SPI clock

Keep SPI wires short for reliability

Installation

Arduino Library Manager

  1. Open Arduino IDE
  2. Go to Library Manager
  3. Search for 7Semi BMP58x
  4. Install

Manual

  1. Download this repository as ZIP
  2. Arduino IDE → Sketch → Include Library → Add .ZIP Library

Library Overview

Reading Temperature

float tempC;

bmp.readTemperatureC(tempC);

Serial.println(tempC);

Returns temperature in degrees Celsius.

Reading Pressure

float pressure;

bmp.readPressurePa(pressure);

Serial.println(pressure);

Returns pressure in Pascals (Pa).

Reading Temperature and Pressure (Recommended)

float tempC;
float pressure;

bmp.readTemperaturePressure(tempC, pressure);

Reads both values in one burst measurement.

Reading Altitude

float altitude;

bmp.readAltitudeM(1013.25, altitude);

Returns altitude in meters using sea level pressure reference.

Sensor Configuration

Oversampling

bmp.setOSR(OSR::OSR_8, OSR::OSR_8);

Data Rate:

OSR::OSR_1
OSR::OSR_2
OSR::OSR_4
OSR::OSR_8
OSR::OSR_16
OSR::OSR_32
OSR::OSR_64
OSR::OSR_128
Output Data Rate
bmp.setODR(ODR::ODR_10_Hz, PowerMode::Normal);

Controls how often the sensor produces new data.

IIR Filter

bmp.setIIR(IIRCoeff::IIRCoeff_7, IIRCoeff::IIRCoeff_7);

Smooths pressure and temperature readings.

FIFO

Configure FIFO

bmp.configureFIFO(FIFOFrame::PressTemp, 0, 10, FIFOMode::StreamToFIFO);

Stores sensor measurements in an internal buffer.

Read FIFO Count

uint8_t count = bmp.getFIFOCount();

Returns number of frames currently stored in FIFO.

Read FIFO Frame

FIFORead frame = bmp.readFIFOFrame();

Returns temperature and pressure stored in FIFO.

Interrupts

Configure Interrupt Pin

bmp.configureInterruptPin(true, true, false, true);

Configures interrupt pin behavior.

Enable Interrupt Sources

bmp.setInterruptSources(true, false, false, false);

Possible interrupt sources:

  • ata Ready

  • FIFO Full

  • FIFO Threshold

  • Pressure Out of Range

Read Interrupt Status

InterruptStatus status = bmp.readInterruptStatus();

Returns interrupt flags.

Out-of-Range Detection

bmp.setOORWindow(101325, 50, 3);

Triggers interrupt if pressure moves outside the defined range.

NVM (Non-Volatile Memory)

Read NVM Status

NVMStatus status = bmp.readNVMStatus();

Returns NVM ready/error flags.

Read NVM User Row

uint16_t value;
bmp.readNVMUserRow(0x20, value);

Reads user programmable memory.

Write NVM User Row

bmp.writeNVMUserRow(0x20, 1234);

Writes value to user NVM memory.

⚡ Quick Start (I2C)

#include <Wire.h>
#include "7Semi_BMP58x.h"

BMP58x_7Semi bmp;

void setup() {
  Serial.begin(115200);

  if (!bmp.beginI2C(Wire, 0x46, 400000)) {
    Serial.println("BMP58x not found!");
    while (1);
  }
}

void loop() {
  float tC, pPa;

  if (bmp.readTemperaturePressure(tC, pPa)) {
    Serial.print("T = ");
    Serial.print(tC, 2);
    Serial.print(" C, P = ");
    Serial.print(pPa, 2);
    Serial.println(" Pa");
  }

  delay(200);
}

About

Arduino library for the Bosch Sensortec BMP58x barometric pressure sensor. Supports I2C and SPI.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages