Sensor – BME280 – Temperatuur, Luchtvochtigheid en Barometrische druk sensor

Hardware

BESTELLEN

Informatie (ENG)

Description:
The BME280 Breakout Board is the easy way to measure pressure and humidity, and without taking up a lot of room. It gives you easy to solder 0.1″ headers, runs I2C or SPI, takes measurements at less than 1mA and idles less than 5uA (yes, microamps!).
The BME280 can be used to take pressure, humidity, and temperature readings. Use the data to get relative altitude changes, or absolute altitude if the locally reported barometric pressure is known.

Specificaties:
Temp: -40C to 85C
Humidity: 0 – 100% RH, =-3% from 20-80%
Pressure: 30,000Pa to 110,000Pa, relative accuracy of 12Pa, absolute accuracy of 100Pa
Altitude: 0 to 30,000 ft (9.2 km), relative accuracy of 3.3 ft (1 m) at sea level, 6.6 (2 m) at 30,000 ft.

Typical application:
– Enhancement of GPS navigation (e.g. time-to-first-fix improvement,dead-reckoning,slope detection)
– Indoor navigation (floor detection,elevator detection)
– Outdoor navigation,leisure and sports applications
– Weather forecast
– Health care application (e.g. sirometry)
– Vertical velocity indication (e.g. risk/sink speed)

Mini module – change address

To change the I2C address from 0x76 to 0x77:

Pinout

Pin:Functie:
1+5V (VCC)
2GND
3SCL
Serial Clock (line)
4SCA
Serial Clock (data)
5CSB (Chip Select)
6SDO (Serial Data Out)

Arduino

Sluit de module aan volgens onderstaand overzicht:

Arduino pin:BMP280 pin:
+5V+5V (VCC)
GNDGND
A5SCL
Serial Clock (line)
A4SCA
Serial Clock (data)

Script met BME280 bibliotheek

Wat heb je nodig?

1) BME280 bibliotheek

Het script leest de Temperatuur, Luchtvochtigheid en Luchtdruk uit:

Het resultaat


Script met alleen wire bibliotheek

Wat heb je nodig?

1) Alleen de Wire bibliotheek (wordt standaard bijgeleverd bij ArduinoIDE)

Het standaard adres is 0x76, pas deze regel aan indien een afwijkend adres is gebruikt:

#define BME280_ADDRESS 0x76

Het script leest de Temperatuur, Luchtvochtigheid en Luchtdruk uit:

Het resultaat

Bronnen:
osoyoo.com


Script met BME280 bibliotheek op SPI

Wat heb je nodig?

1) BME280 bibliotheek

Sluit de BME280 module aan op de arduino aan zoals hieronder aangegeven:

Het script leest de Temperatuur, Luchtvochtigheid en Luchtdruk uit:


Arduino Library

Installatie van Arduino IDE libraries: Arduino info

BME280 Library

Informatie (ENG)

Summary

Reads temperature, humidity, and pressure. Calculates altitude, equivalent sea level pressure and dew point. Provides functions for english and metric. Also reads pressure in Pa, hPa, inHg, atm, bar, torr, N/m^2 and psi.

Installation

To use this library download the zip file, decompress it to a folder named BME280. Move the folder to {Arduino Path}/libraries.

Usage

Include the library at the top of your Arduino script. #include <BME280> Create a global or local variable. BME280 bme In your start up call bme.begin(). Read the temperature, humidity, pressure, altitude and/or dew point.

float pres, temp, hum bme.read(pres, temp, hum)

or

temp = bme.temp() hum = bme.hum() pres = bme.pres()

Enumerations

TempUnit Enum

  • TempUnit_Celsius
  • TempUnit_Fahrenheit

PresUnit Enum

  • PresUnit_Pa
  • PresUnit_hPa
  • PresUnit_inHg
  • PresUnit_atm
  • PresUnit_bar
  • PresUnit_torr
  • PresUnit_psi

OSR Enum

  • OSR_Off
  • OSR_X1
  • OSR_X2
  • OSR_X4
  • OSR_X8
  • OSR_X16

Mode Enum

  • Mode_Sleep
  • Mode_Forced
  • Mode_Normal

StandbyTime Enum

  • StandbyTime_500us
  • StandbyTime_62500us
  • StandbyTime_125ms
  • StandbyTime_250ms
  • StandbyTime_50ms
  • StandbyTime_1000ms
  • StandbyTime_10ms
  • StandbyTime_20ms

Filter Enum

  • Filter_Off
  • Filter_1
  • Filter_2
  • Filter_4
  • Filter_8
  • Filter_16

ChipModel Enum

  • ChipModel_Unknown
  • ChipModel_BME280
  • ChipModel_BMP280

Settings

BME280::Settings Struct

BME280I2C::Settings Struct

  • Includes all fields in BME280 settings.

BME280Spi::Settings Struct

  • Includes all fields in BME280 settings.

BME280Spi::Settings Struct

  • Includes all fields in BME280 settings.

Methods

BME280I2C(const BME280I2C::Settings& settings)

Constructor used to create the I2C Bme class. All parameters have default values.

BME280Spi(const BME280Spi::Settings& settings)

Constructor used to create the Spi Bme class. All parameters have default values except chip select.

BME280SpiSw(const BME280SpiSw::Settings& settings)

Constructor used to create the software Spi Bme class. All parameters have default values except chip select, mosi, miso and sck.

bool begin()

Method used at start up to initialize the class. Starts the I2C or SPI interface. Can be called again to re-initialize the mode settings.

void setSettings(const Settings& settings)

Method to set the sensor settings.

const Settings& getSettings() const

Method to get the sensor settings.

float temp(TempUnit unit)

Read the temperature from the BME280 and return a float.

float pres(PresUnit unit)

Read the pressure from the BME280 and return a float with the specified unit.

float hum()

Read the humidity from the BME280 and return a percentage as a float.

void read(float& pressure, float& temp, float& humidity, TempUnit tempUnit, PresUnit presUnit)

Read the data from the BME280 with the specified units.

ChipModel chipModel()

Environment Calculations

float Altitude(float pressure, AltitudeUnit = AltitudeUnit_Meters, float seaLevelPressure = 1013.25, outsideTemp = 15.0, TempUnit = TempUnit_Celsius)

Calculate the altitude based on the pressure with the specified units.

float EquivalentSeaLevelPressure(float altitude, float temp, float pres, AltitudeUnit altUnit, TempUnit tempUnit )

Convert current pressure to equivalent sea-level pressure.

float DewPoint(float temp, float hum, TempUnit = TempUnit_Celsius)

Calculate the dew point based on the temperature and humidity with the specified units.

float AbsoluteHumidity(float temperature, float humidity, TempUnit = TempUnit_Celsius)

Calculate the absolute humidity based on the temperature and humidity with the specified units.

int HeatIndex(float temperature, float humidity, TempUnit tempUnit = TempUnit_Celsius)

Calculate the heat index based on the temperature and humidity with the specified units. The heat index is only calculated if the temperature is above 26.7°C or 80°F and humidity above 40%. The precision is +/- 0.7°C / 1.3°F.

History

  • Jan 1, 2016 – Version 1.0.0 released
  • Sep 19, 2016 – Version 2.0.0 released (Restructure for I2C and SPI)
  • Nov 21, 2016 – Version 2.0.1 released (Set mode support)
  • Dec 19, 2016 – Version 2.1.0 released (Support for SPI)
  • Dec 21, 2016 – Version 2.1.1 released (Bugs)
  • Feb 17, 2017 – Version 2.1.2 released (Docs)
  • Sept 9, 2017 – Version 2.1.3 released (Formatting, reorg)
  • Sept 13, 2017 – Version 2.1.4 released (Examples update, bug fixes)
  • Oct 7, 2017 – Version 2.2.0 released (Enums, begin restructure)
  • Oct 10, 2017 – Version 2.2.1 released (Bug fixes)

Download bibliotheek @ finitespace * Github

Raspberry Pi

Sluit de module aan zoals aangegeven op onderstaand schema:

Raspberry Pi pin:I2C module pin:
+5v+5v
GNDGND
3 (GPIO2) SDASDA
5 (GPIO3) SCLSCL

Ps. Altijd de pinout van je Raspberry Pi controleren, deze kan verschillen per versie.

Wat moet je doen?

1) I2C aanzetten op de Pi.
2) SMBUS module installeren voor Python:

Om de I2C bus in Python te gebruiken moet je een module installeren, genaamd SMBUS, dit kan via APT-GET met het commando:  sudo apt-get install python-smbus

Je kan dan de module importeren in python door middel van: import smbus

Controleren van de aansluiting

Om de aansluiting van de module te controleren voor je het volgende commando uit: sudo i2cdetect -y 1, je ziet dan adres 0x77 staan in de lijst:


Het script bme280.py om de module uit te lezen:

Start het script met: sudo python bme280.py, resultaat:


Script #2

Output:

Importeren vanuit een ander script is mogelijk, gebruik onderstaand voorbeeld:


Bronnen:
ControlEverythongCommunity @ Github.com
raspberrypi-spy.co.uk

Schema

Teardown

GEEN GEGEVENS

Datasheet

Fritzing

Downloads

GEEN GEGEVENS