Skip to content

Module to use the Adafruit BMP280 sensor with the pyboard.

License

Notifications You must be signed in to change notification settings

rsmith-nl/pyboard-BMP280

Repository files navigation

Using the Adafruit BMP280 with the pyboard

Date: 2018-04-11
tags:pyboard, BMP280
Author: Roland Smith

Introduction

This code was written to get the Adafruit BMP280 breakout board to work with the pyboard.

The pyboard runs micropython, while Adafruit uses a variant of micropython called circuitpython on their boards.

Adafruit's Python code is generally not compatible with micropython because of API differences.

But using the datasheet of the BMP280 and the Adafruit code as guides, it was not difficult to create a working version for the pyboard.

Wiring the BMP280 to the pyboard

This module only supports an I²C connection.

The code in the examples assumes that the BMP280 is connected to the 2nd I²C channel on the pyboard. That is, Y9 on the byboard is connected to SCK on the BMP280 and Y10 on the pyboard is connected to SDI on the BMP280.

The 3V3 pin of the pyboard is connected to VIN on the BMP280. The GND pin of the pyboard is connected to the GND pin of the BMP280. Additionally, the SDO pin of the BMP280 is also connected to GND, to select I²C address 0x76.

Using the code

Copy the file BMP280.py to the pyboard. Then you can use it from either the REPL or from main.py.

Examples

There are two examples that you can use or study.

  • main-continuous.py reports the sensor reading every minute over the serial connection.
  • main-query.py reports the sensor reading whenever it receives a line containing ?.

Both examples can be used by copying one of them to the pyboard as main.py and rebooting the pyboard.

If you use main-query.py on the pyboard, you can use listener.py on your computer to retrieve the sensor values periodically and store them in a file.

License

MIT. See LICENSE.txt

About

Module to use the Adafruit BMP280 sensor with the pyboard.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages