mph 11 Posted September 10, 2018 Share Posted September 10, 2018 The Bosch BME280 pressure-temperature-humidity sensor is very popular for projects because there are breakout boards available from Adafruit and Sparkfun as well as a large library of code to interface it to Arduino MCUs. Not so much for the MSP430, especially transparent code to understand what is happening at the register level. I have written and tested some demo C-code that hopefully fills that gap. It sacrifices generality and efficiency for compactness and transparency. I use the F5529 Launchpad and communication with the sensor is via SPI using the UCB0 module. I2C is also available for the BME280 but not implemented here. Temperature and relative humidity (no pressure) data is obtained using the forced mode with periodic polling by the MSP430. Sensor and MCU are in low-power sleep modes when not active. Data is streamed to a terminal program that is interfaced to the Launchpad via serial UART. Each BME280 has unique trimming parameters that must be retrieved and properly parsed to convert the raw data. This process is quite complicated, so separate functions were developed to handle them and placed in an include library. My IDE is CCS 6.1.3 with nofloat printf support. This code should work directly in the MSP430x5xx and MSP430x6xx families. Other MSP430 series such as FR and value-line will need to make appropriate module/register modifications. Link to github is here: https://github.com/microphonon/BME280 zeke, dubnet and Fmilburn 2 1 Quote Link to post Share on other sites
zeke 693 Posted September 11, 2018 Share Posted September 11, 2018 @mph Thank you for sharing this with us. 👍 Quote Link to post Share on other sites
mph 11 Posted September 12, 2018 Author Share Posted September 12, 2018 The above github for this sensor has been modified to include pressure readout. Pressure is displayed in units of hectoPascal (1 hPa = 1 mbar). Typical sea-level atmospheric pressure is 1013 hPa. I tested at ~5000 ft ASL and get a correct reading of 840 hPa. Quote Link to post Share on other sites
mph 11 Posted September 24, 2018 Author Share Posted September 24, 2018 Added code for the FR5969 Launchpad to the github repo. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.