Skip to content

Commit b5ee5ad

Browse files
Fix bug in example 4, update readme, add example readme
1 parent 604e6bc commit b5ee5ad

File tree

4 files changed

+113
-54
lines changed

4 files changed

+113
-54
lines changed

README.md

Lines changed: 78 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,78 @@
1-
Qwiic_BME280_Py
2-
==============
1+
![Qwiic BME280 Python Package](docs/images/bme280-gh-banner-py.png "qwiic BME280 Python Package" )
32

4-
<p align="center">
5-
<img src="https://cdn.sparkfun.com/assets/custom_pages/2/7/2/qwiic-logo-registered.jpg" width=200>
6-
<img src="https://www.python.org/static/community_logos/python-logo-master-v3-TM.png" width=240>
7-
</p>
8-
<p align="center">
9-
<a href="https://pypi.org/project/sparkfun-qwiic-bme280/" alt="Package">
10-
<img src="https://img.shields.io/pypi/pyversions/sparkfun_qwiic_bme280.svg" /></a>
11-
<a href="https://github.com/sparkfun/Qwiic_BME280_Py/issues" alt="Issues">
12-
<img src="https://img.shields.io/github/issues/sparkfun/Qwiic_BME280_Py.svg" /></a>
13-
<a href="https://qwiic-bme280-py.readthedocs.io/en/latest/?" alt="Documentation">
14-
<img src="https://readthedocs.org/projects/qwiic-bme280-py/badge/?version=latest&style=flat" /></a>
15-
<a href="https://github.com/sparkfun/Qwiic_BME280_Py/blob/master/LICENSE" alt="License">
16-
<img src="https://img.shields.io/badge/license-MIT-blue.svg" /></a>
17-
<a href="https://twitter.com/intent/follow?screen_name=sparkfun">
18-
<img src="https://img.shields.io/twitter/follow/sparkfun.svg?style=social&logo=twitter"
19-
alt="follow on Twitter"></a>
20-
21-
</p>
3+
# SparkFun Qwiic BME280 - Python Package
224

23-
<img src="https://cdn.sparkfun.com//assets/parts/1/2/3/2/9/14348-01.jpg" align="right" width=300 alt="SparkFun Qwiic Environmental Combo Breakout">
5+
![PyPi Version](https://img.shields.io/pypi/v/sparkfun_qwiic_bme280)
6+
![GitHub issues](https://img.shields.io/github/issues/sparkfun/qwiic_bme280_py)
7+
![License](https://img.shields.io/github/license/sparkfun/qwiic_bme280_py)
8+
![X](https://img.shields.io/twitter/follow/sparkfun)
9+
[![API](https://img.shields.io/badge/API%20Reference-blue)](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html)
2410

25-
Python module for the qwiic bme280 sensor, which is part of the [SparkFun Qwiic Environmental Combo Breakout](https://www.sparkfun.com/products/14348)
11+
The SparkFun Qwiic BME280 Atmospheric Sensor and BME280/ENS160 Environmental Combo Breakout Boards provide a simple and cost effective solution for adding atmospheric sensing to your project. Implementing a SparkFun Qwiic I2C interface, these sensors can be rapidly added to any project with boards that are part of the SparkFun Qwiic ecosystem.
2612

27-
This python package is a port of the existing [SparkFun BME280 Arduino Library](https://github.com/sparkfun/SparkFun_BME280_Arduino_Library)
13+
This repository implements a Python package for the SparkFun Qwiic BME280. This package works with Python, MicroPython and CircuitPython.
14+
15+
### Contents
16+
17+
* [About](#about-the-package)
18+
* [Getting Started](#getting-started)
19+
* [Installation](#installation)
20+
* [Supported Platforms](#supported-platforms)
21+
* [Documentation](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html)
22+
* [Examples](#examples)
2823

29-
This package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py)
24+
## About the Package
25+
26+
This python package enables the user to access the features of the BME280 via a single Qwiic cable. This includes reading humidity, pressure, altitude, temperature, calibration and more. The capabilities of the BME280 are each demonstrated in the included examples.
3027

3128
New to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic).
3229

33-
## Contents
30+
### Supported SparkFun Products
3431

35-
* [Supported Platforms](#supported-platforms)
36-
* [Dependencies](#dependencies)
37-
* [Installation](#installation)
38-
* [Documentation](#documentation)
39-
* [Example Use](#example-use)
32+
This Python package supports the following SparkFun qwiic products on Python, MicroPython and Circuit python.
33+
34+
* [SparkFun Atmospheric Sensor Breakout - BME280](https://www.sparkfun.com/sparkfun-atmospheric-sensor-breakout-bme280-qwiic.html?gad_source=1)
35+
* [SparkFun Environmental Combo Breakout - ENS160/BME280](https://www.sparkfun.com/sparkfun-atmospheric-sensor-breakout-bme280-qwiic.html?gad_source=1)
36+
37+
### Supported Platforms
38+
39+
| Python | Platform | Boards |
40+
|--|--|--|
41+
| Python | Linux | [Raspberry Pi](https://www.sparkfun.com/raspberry-pi-5-8gb.html) , [NVIDIA Jetson Orin Nano](https://www.sparkfun.com/nvidia-jetson-orin-nano-developer-kit.html) via the [SparkFun Qwiic SHIM](https://www.sparkfun.com/sparkfun-qwiic-shim-for-raspberry-pi.html) |
42+
| MicroPython | Raspberry Pi - RP2, ESP32 | [SparkFun RP2040 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-rp2040.html), [SparkFun RP2350 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-rp2350.html), [SparkFun ESP32 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-esp32-wroom-usb-c.html)
43+
|CircuitPython | Raspberry Pi - RP2, ESP32 | [SparkFun RP2040 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-rp2040.html), [SparkFun RP2350 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-rp2350.html), [SparkFun ESP32 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-esp32-wroom-usb-c.html)
44+
45+
> [!NOTE]
46+
> The listed supported platforms and boards are the primary platform targets tested. It is fully expected that this package will work across a wide variety of Python enabled systems.
4047
41-
Supported Platforms
42-
--------------------
43-
The qwiic BME280 Python package current supports the following platforms:
44-
* [Raspberry Pi](https://www.sparkfun.com/search/results?term=raspberry+pi)
45-
* [NVidia Jetson Nano](https://www.sparkfun.com/products/15297)
46-
* [Google Coral Development Board](https://www.sparkfun.com/products/15318)
48+
## Installation
4749

48-
Dependencies
49-
---------------
50-
This driver package depends on the qwiic I2C driver:
51-
[Qwiic_I2C_Py](https://github.com/sparkfun/Qwiic_I2C_Py)
50+
The first step to using this package is installing it on your system. The install method depends on the python platform. The following sections outline installation on Python, MicroPython and CircuitPython.
5251

53-
Documentation
54-
-------------
55-
The SparkFun qwiic BME280 module documentation is hosted at [ReadTheDocs](https://qwiic-bme280-py.readthedocs.io/en/latest/?)
52+
### Python
5653

57-
Installation
58-
-------------
54+
The package is primarily installed using the `pip` command, downloading the package from the Python Index - "PyPi". Note - the below instructions outline installation an Linux-based (Raspberry Pi) system.
5955

60-
### PyPi Installation
61-
This repository is hosted on PyPi as the [sparkfun-qwiic-bme280](https://pypi.org/project/sparkfun-qwiic-bme280/) package. On systems that support PyPi installation via pip, this library is installed using the following commands
56+
#### PyPi Installation
57+
58+
The SparkFun Qwiic BME280 Python package is part of the overall SparkFun Qwiic Python package which is hosted on PyPi. On systems that support PyPi installation via pip, this library is installed using the following commands
6259

6360
For all users (note: the user must have sudo privileges):
6461
```sh
65-
sudo pip install sparkfun-qwiic-bme280
62+
sudo pip install sparkfun-qwiic
6663
```
6764
For the current user:
6865

6966
```sh
70-
pip install sparkfun-qwiic-bme280
67+
pip install sparkfun-qwiic
7168
```
72-
73-
### Local Installation
69+
---
70+
---
71+
> [!CAUTION]
72+
> **TODO** Put together how this works with the new virtual environments used with the latest Python install
73+
---
74+
---
75+
#### Local Installation
7476
To install, make sure the setuptools package is installed on the system.
7577

7678
Direct installation at the command line:
@@ -86,11 +88,34 @@ A package file is built and placed in a subdirectory called dist. This package f
8688
```sh
8789
cd dist
8890
pip install sparkfun_qwiic_bme280-<version>.tar.gz
89-
9091
```
92+
93+
### MicroPython Installation
94+
If not already installed, follow the [instructions here](https://docs.micropython.org/en/latest/reference/mpremote.html) to install mpremote on your computer.
95+
96+
Connect a device with MicroPython installed to your computer and then install the package directly to your device with mpremote mip.
97+
```sh
98+
mpremote mip install github:sparkfun/qwiic_bme280_py
99+
```
100+
101+
### CircuitPython Installation
102+
If not already installed, follow the [instructions here](https://docs.circuitpython.org/projects/circup/en/latest/#installation) to install CircUp on your computer.
103+
104+
Ensure that you have the latest version of the SparkFun Qwiic CircuitPython bundle.
105+
```sh
106+
circup bundle-add sparkfun/Qwiic_Py
107+
```
108+
109+
Finally, connect a device with CircuitPython installed to your computer and then install the package directly to your device with circup.
110+
```sh
111+
circup install --py qwiic_bme280
112+
```
113+
91114
Example Use
92115
---------------
93-
See the examples directory for more detailed use examples.
116+
Below is a quickstart program to print humidity, pressure, altitude, and temperature read from the BME280.
117+
118+
See the examples directory for more detailed use examples and [examples/README.md](https://github.com/sparkfun/qwiic_bme280_py/blob/main/examples/README.md) for a summary of the available examples.
94119

95120
```python
96121
import qwiic_bme280
548 KB
Loading

examples/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Sparkfun BME280 Examples Reference
2+
Below is a brief summary of each of the example programs included in this repository. To report a bug in any of these examples or to request a new feature or example [submit an issue in our GitHub issues.](https://github.com/sparkfun/qwiic_bme280_py/issues).
3+
4+
NOTE: The abnormal numbering of examples is to retain consistency with the Arduino library from which this was ported.
5+
6+
## Example 1: Basic Readings
7+
This example demonstrates basic bringup of the BME280 to extract humidity, pressure, altitude, and temperature.
8+
9+
The key methods showcased by this example are:
10+
11+
- [read_humidity()](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#a601d62c86ef837f61c3e452a3f390b9d)
12+
- [read_pressure()](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#af799265b51181bd65cae6983c245c513)
13+
- [get_altitude_feet()](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#af5b0a1f1c2355f72d2182ed0c036ef8e)
14+
- [get_temperature_fahrenheit()](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#a31603e97db007558964618800b055a61)
15+
16+
These methods are invoked via reading their corresponding properties([humidity](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#ace5c02deec66d7096a322f68bd19e35d), [pressure](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#a169132f58174ba65b2ef1148858a93f7), [altitude_feet](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#aa6b842360817379f6c9026767b4c51cb), and [temperature_fahrenheit](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#a42eb4ab7f10b8188d9174384feb2e328))
17+
18+
## Example 4: Settings
19+
This example shows how to change the various filter and oversample settings of the BME280. It sets several filtering and oversampling settings and then performs the same readings as in Example 1.
20+
21+
The key methods showcased by this example are:
22+
23+
- [set_filter()](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#a5f32790df30c3c23c82b2aa2f43fc378)
24+
- [set_standby_time()](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#ac92bbaf17893b45805678d05af28cff8)
25+
- [set_tempature_oversample()](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#a4cb331d973e88bb6e85c03ead63b042f)
26+
- [set_humidity_oversample()](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#a510a98a4a15cdf4d634aaacfbde6139c)
27+
- [set_mode()](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#a4cb378ab043d8dfa7c3c6c48e19bab84)
28+
29+
These methods are invoked via reading their corresponding properties ([filter](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#abd7049904b69e17438de6c1bfad899b4), [standby_time](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#a16991516b62efcb3400ce1a6ead3f8a3), [tempature_oversample](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#aaa2c92f61e6c0360c2d480074ed73b3a), [humidity_oversample](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#a7b7bf88a522fced77db96301b5fced51), [mode](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#aec55ad7625fa470e5f7f4d0e415ec96e))
30+
31+
## Example 5: Read All Registers
32+
This example configures the BME280 to read all measurements. It also displays the BME280's physical memory and what the driver perceives the calibration words to be.
33+
34+
This method showcases direct I2C reads as well as the use of the [calibration property](https://docs.sparkfun.com/qwiic_bme280_py/classqwiic__bme280_1_1_qwiic_bme280.html#a61ff5a498e96023a6c82cb99ca6a093b)

examples/qwiic_bme280_ex4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def runExample():
5959
mySensor.filter = 1 # 0 to 4 is valid. Filter coefficient. See 3.4.4
6060
mySensor.standby_time = 0 # 0 to 7 valid. Time between readings. See table 27.
6161

62-
mySensor.over_sample = 1 # 0 to 16 are valid. 0 disables temp sensing. See table 24.
62+
mySensor.tempature_oversample = 1 # 0 to 16 are valid. 0 disables temp sensing. See table 24.
6363
mySensor.pressure_oversample = 1 # 0 to 16 are valid. 0 disables pressure sensing. See table 23.
6464
mySensor.humidity_oversample = 1 # 0 to 16 are valid. 0 disables humidity sensing. See table 19.
6565
mySensor.mode = mySensor.MODE_NORMAL # MODE_SLEEP, MODE_FORCED, MODE_NORMAL is valid. See 3.3

0 commit comments

Comments
 (0)