I have written a small procedure to read the Bosch BME280 sensor through the Raspberry Pi. The sensor reading is performed via I2C bus interface.
The procedure performs the following steps:
0. Opens the I2C channel.
1. Reads the BME280 Calibration Coefficients. First reads the Calibration Registers, than converts the Registers to Raw Calibration Coefficients.
2. Initializes the BME280 device for operation in 'Normal mode'. The normal mode is a perpetual cycling of measurements and inactive periods.
3. Cyclically reads the data registers from the BME280 device and converts them in calibrated Pressure, Temperature and Humidity measures.
4. Closes the I2C channel.
The VI routine named RPi_I2C_BME280_read_example.vi contains an example of the reading procedure of the BME280 sensor through the I2C bus.
The RPi_I2C_BME280_read_example.vi block diagram
If someone is interested the code is available on github at:
For my work I took inspiration from the following sources:
Thank you very much, very useful and great work. The code can be easily adapted for use with an Arduino instead of a Raspberry.