BMP280 Sensor

Implement Temperature/Pressure BMP280

https://www.digikey.com/en/datasheets/bosch-sensortec/bosch-sensortec-bst-bmp280-ds001-19

The I2C example program has the assumption the BMP280 is connected to Pi bus 1, and the device is factory configured to operate as device address 0x77. If these assumptions are not possible, the bus and device address value can be passed as parms. Or modify the BMP280I2cExample program to use your specific bus and device address.

The SPI example assumes SPI bus 0, ChipSelect 0.

The program uses org.slf4j.simple Class SimpleLogger as suggested by the Pi4j_V2 documentation. Consult that logger class documentation to understand its various logging options.

The I2C connection functions as written in the Phillips spec.

I2C

  1. ./mvnw clean package
  2. cd target/distribution
  3. sudo ./runBMP280I2C.sh Args if bus and or address must be set -b 0x01 -a 0x77

The SPI connection per the Datasheet supports MODE0 or MODE3.

SPI

  1. ./mvnw clean package
  2. cd target/distribution
  3. sudo ./runBMP280SPI.sh

Will create the BMP280 device to create a BMP280Device instance Call the various temperature and pressure methods defined in the interface.

No parameters are required. However, if ‘any’ parameter value is to be supplied: parms: -b hex value bus -a hex value address -t trace
trace values : “trace”, “debug”, “info”, “warn”, “error” or “off” Default “info”

The file BMP280.pdf documents a method of connecting an Adafruit BMP280 to a Pi.

I2C connection

RPiColorSensor
Pin1 3.3VRedVin
N/C3v
Pin6 GndBrownGnd
Pin5 SCLGreenSCK
N/CYellowSDO
Pin3 SDABlueSDI
Pin17 3.3vOrangeCS

SPI connection using 4-wire SPI

RPiColorSensor
Pin19 MOSIBlueSDI
Pin21 MISOYellowSDO
Pin23 SCLKGreenSCK
Pin24 SPICE0OrangeCS
Pin6 GndBrownGND
Pin1 3.3VRedVin