BME280 Humidity and Pressure Sensor

Overview

This sample application periodically reads temperature, pressure and humidity data from the first available device that implements SENSOR_CHAN_AMBIENT_TEMP, SENSOR_CHAN_PRESS, and SENSOR_CHAN_HUMIDITY. This sample checks the sensor in polling mode (without interrupt trigger).

Building and Running

This sample application uses an BME280 sensor connected to an Arduino 101 board via I2C. Connect the sensor pins according to the connection diagram given in the bme280 datasheet at page 38. There are two processor cores (x86 and ARC) on the Arduino 101. You will need to flash both this sample’s code on the ARC core (using the arduino101_sss board target), and stub code on the x86 core (using the arduino_101 board target), as shown below.

# On Linux/macOS
cd $ZEPHYR_BASE/samples/sensors/bme280
mkdir build && cd build
# On Windows
cd %ZEPHYR_BASE%\samples\sensors\bme280
mkdir build & cd build
cmake -GNinja -DBOARD=arduino_101_sss ..
ninja flash
# On Linux/macOS
cd $ZEPHYR_BASE/tests/booting/stub
mkdir build && cd build
# On Windows
cd %ZEPHYR_BASE%\tests\booting\stub
mkdir build & cd build
cmake -GNinja -DBOARD=arduino_101 ..
ninja flash

Sample Output

To check output of this sample , any serial console program can be used. This example uses picocom on the serial port /dev/ttyUSB0:

$ sudo picocom -D /dev/ttyUSB0
temp: 27.950000; press: 100.571027; humidity: 61.014648
temp: 27.940000; press: 100.570269; humidity: 61.012695
temp: 27.950000; press: 100.570695; humidity: 61.002929