Sensor: bme280
Overview
This sample demonstrates how to read temperature, pressure, and humidity data from a Bosch BME280 sensor using the Zephyr sensor driver.
The OpenAir wrapper is intended for Atmosic hardware and includes test targets for MikroE Weather Click shield configurations over both I2C and SPI. It can also run on an ATM5/e EVK with the ATM5/e Peripheral Board, which carries a BME280 that can be connected over I2C or SPI.
For more details, refer to zephyr/samples/sensor/bme280/README.rst.
Requirements
One of the following:
Atmosic ATMBTCSTAG-3405 Tag Reference Design with a MikroE Weather Click shield connected over I2C or SPI
Atmosic ATM5/e EVK (e.g. ATMEVK-5305-NQK-2) with the ATM5/e Peripheral Board (see ATM5/e Peripheral Board), with its switch in the I2C or SPI position
Building and Running
This sample is built from openair/samples/sensor/bme280.
The source code can be found under zephyr/samples/sensor/bme280.
Build command (I2C):
west build -p always -b ATMBTCSTAG-3405 openair/samples/sensor/bme280 --sysbuild -T samples.sensor.bme280.atm
Build command (SPI):
west build -p always -b ATMBTCSTAG-3405 openair/samples/sensor/bme280 --sysbuild -T samples.sensor.bme280.atm.spi
Build command (ATM5/e Peripheral Board, switch in the I2C position):
west build -p always -b ATMEVK-5305-NQK-2 --shield atm5_peripheral_board_i2c_i2s openair/samples/sensor/bme280 --sysbuild -T samples.sensor.bme280.atm
Build command (ATM5/e Peripheral Board, switch in the SPI position):
west build -p always -b ATMEVK-5305-NQK-2 --shield atm5_peripheral_board_spi openair/samples/sensor/bme280 --sysbuild -T samples.sensor.bme280.atm.spi
The shield must match the switch position on the peripheral board.
Flash command:
west flash --no-rebuild --device <DEVICE_ID> --jlink [--erase_flash]
Configuration
The OpenAir sample provides a board overlay under boards/app.overlay for an
I2C-connected BME280, while the test targets select the appropriate shield
configuration for the MikroE Weather Click.
When a shield is applied (e.g. --shield atm5_peripheral_board_spi or
-DSHIELD=atm5_peripheral_board_spi), the sample’s overlays are not applied
and the BME280 node comes from the shield.