Différences entre versions de « ENG-CANSAT-PICO-BMP280 »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
Ligne 77 : Ligne 77 :
 
== Wiring the sensor ==
 
== Wiring the sensor ==
  
Here how to connect the board to a Raspberry-Pi Pico
+
Here how to connect the board to the Raspberry-Pi Pico
  
 
[[Fichier:ENG-CANSAT-PICO-BMP280-20.jpg|480px]]
 
[[Fichier:ENG-CANSAT-PICO-BMP280-20.jpg|480px]]

Version du 26 février 2022 à 21:50

About the BMP280 breakout

The BMP280 sensor can measure the atmospheric pressure and temperature. As the temperature also impact the sensor physics, the sensor measure it to apply appropriate correction to the measured pression.

The BMP280 is a Bosch sensor upgraded from the BMP085/BMP180/BMP183 serie. This sensor is really great to make environmental or weather measurements.

It can be used over an I2C or a SPI bus. Best of all, it is now fitted with a StemmaQt I2C connector (Qwiic compatible). So it is really easy to connect to a StemmaQT/Qwiic capable board like the Kit Cansat avec Raspberry-Pi Pico.

BMP280-v2.png

It is one of the best sensor, it offer good accuracy for an affordable price. The accuracy is ±1 hPa for the pressure and ±1.0°C for the temperature. This sensor is not really made to measure the temperature but you can estimate its range with the BMP280.

As the pressure also change with the altitude, the sensor accuracy allows you to use the BMP280 to make an altimeter (with accuracy of ±1m at worst, about 0.25m in best conditions).

To ease the usage of this sensor, the SMD component is solder on a breakout board with some additional passive electronics. The board also bring a level shifter and 3V voltage regulator so it is save for 3V and 5V logic microcontrolers.

technical details

Install the Library

The BMP280 do have a MicroPython library available on GitHub. It must be copied to the microcontroler before using the sensor with the board.

So:

  • Download bme280.py from the online reposity to the local computer
  • copy the file bme280.py from the computer to the microcontroler board

Manual Installation

The Adafruit's BMP280 & BME280 are provided with a MicroPython library available on GitHub.

It is the same library for the both boards (BME280 also reads the humidity).

You can download and copy the library manually to your board from the Repository.

Download-icon.pngDownload the BMP280 MicroPython library from the repository

First, open the repository, then navigate to the bme280.py file by clicking on it.

ENG-CANSAT-PICO-BMP280-10.png

On the bme280.py file content. Right click the "Raw" button to show the contextual menu.

Select the "Save target as..."

ENG-CANSAT-PICO-BMP280-11.png

Navigates to the target directory (eg: user folder) then save the target as bme280.py .

ENG-CANSAT-PICO-BMP280-12.png

From now, the file should be visible in the Thonny's file manager (see menu "View | Files" to activate it).

ENG-CANSAT-PICO-BMP280-13.png

Select the bme280.py file from computer in Thonny.

Right click the file to get the contextual menu... then select the option "Upload to root /"

ENG-CANSAT-PICO-BMP280-14.png

Check the library

It is easy to check if the library is properly uploaded to the MicroPython board.

Just key-in the line from bme280 import * into the REPL/shell.

IF the file is missing or contains a syntax error THEN MicroPython will returns an error.

ENG-CANSAT-PICO-BMP280-15.png

IF everything is all right THEN the import proceed without error.

ENG-CANSAT-PICO-BMP280-16.png

Wiring the sensor

Here how to connect the board to the Raspberry-Pi Pico

ENG-CANSAT-PICO-BMP280-20.jpg



Written by Meurisse D. for MCHobby


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.