Giter Site home page Giter Site logo

mp_bme280's Introduction

README

This is a driver for the Bosch BME280 temperature/pressure/humidity sensor, for use with MicroPython-based boards.

About the BME280

The Bosch BME280 Environmental Sensor is a combined temperature, pressure and humidity sensor. It can communicate via I2C or SPI; this driver uses I2C.

Usage

Use ftp to copy bme280.py to the flash or flash/lib directory on the board. Then:

from machine import I2C
import bme280

i2c = I2C(0, I2C.MASTER, baudrate=400000)
sensor = bme280.BME280(i2c=i2c)

print(sensor.temperature, sensor.pressure, sensor.humidity)

Detailed Usage

The temperature, pressure and humidity properties are convenience functions that provide human-readable string values to quickly check that the sensor is working. In practice, the methods to use are:

  • get_temperature(): returns the temperature in hundredths of a degree celsius. For example, the value 2534 indicates a temperature of 25.34 degrees.
  • get_pressure(): returns the atmospheric pressure. This 32-bit value consists of 24 bits indicating the integer value, and 8 bits indicating the fractional value. To get a value in Pascals, divide the return value by 256. For example, a value of 24674867 indicates 96386.2Pa, or 963.862hPa.
  • get_humidity(): returns the relative humidity. This 32-bit value consists of 22 bits indicating the integer value, and 10 bits indicating the fractional value. To get a value in %RH, divide the return value by 1024. For example, a value of 47445 indicates 46.333%RH.

mp_bme280's People

Contributors

brotherdust avatar paulcunnane avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.