Skip to main content

bmp280lp

This library allows you to use BMP280 or BME280 sensor. Tested on Orange Pi 5 plus.
Cette bibliothèque permet d'utiliser le capteur BMP280 ou BME280. Testé avec succés sur Orange Pi 5 plus.

Installation

pip install bmp280lp

Usage example

import sys
import time
from bmp280lp import BMP280

# Reset the sensor
def reset_sensor(sensor):
    sensor.device_reset()
    time.sleep(1)

# Create an instance of the sensor with the appropriate parameters
bmp = BMP280(port=2, address=0x77, mode=BMP280.NORMAL_MODE, 
             oversampling_p=BMP280.OVERSAMPLING_P_x16, oversampling_t=BMP280.OVERSAMPLING_T_x2,
             oversampling_h=BMP280.OVERSAMPLING_H_x1, filter=BMP280.IIR_FILTER_OFF, standby=BMP280.T_STANDBY_1000)

reset_sensor(bmp)

# Wait a few moments to ensure the sensor is properly initialized
time.sleep(1)

# Read pressure and temperature
pressure = bmp.read_pressure()
temp = bmp.read_temperature()

# Format the output to one decimal place
print(f"Pressure (hPa): {pressure:.1f}")
print(f"Temperature (°C): {temp:.1f}")

# Read humidity if the sensor is a BME280
if bmp.is_bme280:
    humidity = bmp.read_humidity()
    print(f"Humidity (%): {humidity:.1f}")
else:
    print("The sensor is not a BME280, humidity measurement not available.")

Documentation

Parameter Documentation

The BMP280 class offers several configuration parameters that allow you to customize the behavior of the sensor. Here is a detailed description of each of these parameters:

Port: The I2C port used
Address: The address of the sensor, typically 0x76 or 0x77
  1. mode

The operating mode of the sensor. Possible values are:

BMP280.SLEEP_MODE (0b00): The sensor is in sleep mode.
BMP280.FORCED_MODE (0b01): The sensor performs a single measurement when forced.
BMP280.NORMAL_MODE (0b11): The sensor performs continuous measurements.
  1. oversampling_p

The oversampling factor for pressure measurements. The higher the factor, the greater the accuracy, but the measurement time also increases. Possible values are:

BMP280.OVERSAMPLING_P_NONE (0b000): No pressure measurement.
BMP280.OVERSAMPLING_P_x1 (0b001): Oversampling x1.
BMP280.OVERSAMPLING_P_x2 (0b010): Oversampling x2.
BMP280.OVERSAMPLING_P_x4 (0b011): Oversampling x4.
BMP280.OVERSAMPLING_P_x8 (0b100): Oversampling x8.
BMP280.OVERSAMPLING_P_x16 (0b101): Oversampling x16.
  1. oversampling_t

The oversampling factor for temperature measurements. The higher the factor, the greater the accuracy, but the measurement time also increases. Possible values are:

BMP280.OVERSAMPLING_T_NONE (0b000): No temperature measurement.
BMP280.OVERSAMPLING_T_x1 (0b001): Oversampling x1.
BMP280.OVERSAMPLING_T_x2 (0b010): Oversampling x2.
BMP280.OVERSAMPLING_T_x4 (0b011): Oversampling x4.
BMP280.OVERSAMPLING_T_x8 (0b100): Oversampling x8.
BMP280.OVERSAMPLING_T_x16 (0b101): Oversampling x16.
  1. filter

The IIR (Infinite Impulse Response) filter coefficient. This helps smooth the measurement data by reducing rapid variations due to noise. Possible values are:

BMP280.IIR_FILTER_OFF (0b000): Filtering disabled.
BMP280.IIR_FILTER_x2 (0b001): Filter coefficient x2.
BMP280.IIR_FILTER_x4 (0b010): Filter coefficient x4.
BMP280.IIR_FILTER_x8 (0b011): Filter coefficient x8.
BMP280.IIR_FILTER_x16 (0b100): Filter coefficient x16.
  1. standby

The standby time between measurements in normal mode. The longer the standby time, the lower the power consumption, but the measurement rate is also reduced. Possible values are:

BMP280.T_STANDBY_0p5 (0b000): Standby time of 0.5 ms.
BMP280.T_STANDBY_62p5 (0b001): Standby time of 62.5 ms.
BMP280.T_STANDBY_125 (0b010): Standby time of 125 ms.
BMP280.T_STANDBY_250 (0b011): Standby time of 250 ms.
BMP280.T_STANDBY_500 (0b100): Standby time of 500 ms.
BMP280.T_STANDBY_1000 (0b101): Standby time of 1000 ms.
BMP280.T_STANDBY_2000 (0b110): Standby time of 2000 ms.
BMP280.T_STANDBY_4000 (0b111): Standby time of 4000 ms.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Authors

This library was developed by Laurent Pastor. It's a fork off bmp-280 library with adding the setting address.

Metadata

Release files for bmp280lp 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bmp280lp 0.1.6
File Size Uploaded
bmp280lp-0.1.6.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bmp280lp 0.1.6
File Interpreter ABI Platform
bmp280lp-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / bmp280lp-0.1.6.tar.gz

Download URL bmp280lp-0.1.6.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
590f64003df2e71ad36e30de670a6d606a9b3f5504d3b72fa5b5cd209a452045
BLAKE2b-256 checksum
How to use checksums
cc8f08bcabf59c093651e4d5bfc9336bc209ff267d306a0d4d081c5d0d8796d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Release files / bmp280lp-0.1.6-py3-none-any.whl

Download URL bmp280lp-0.1.6-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d1f09ea3472bde46eb945f852d2ddfbf40fe6736577f41195bc39fd33199894
BLAKE2b-256 checksum
How to use checksums
8337a379e80978e5fd87107075dcccd0ea4a68b1df8e90512a48ab90f887a666
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page