BME280 Teensy Library

Status
Not open for further replies.

brtaylor

Well-known member
Hello all,

I created an Arduino library for the Bosch Sensortec BME280 environmental sensor with support for all Teensy 3.x and LC devices:
https://github.com/bolderflight/BME280

In case you're not aware, the BME280 is an integrated environmental sensor, which combines high linearity, high accuracy sensors for pressure, temperature, and humidity in a compact LGA package.

This library supports I2C and SPI communication with the BME280 sensor. It also enables easy setup of the BME280 oversampling, IIR filter settings, and standby time. Or if those are not explicitly set, default values are used, which should provide good performance over a variety of applications. Data is collected using multi-byte reads, eliminating potential time skew in the results, and results are converted to SI units. I think the library provides access to the most used functionality of the BME280, is easy to use, and has great performance. I hope it is of use to the community and I'd love any feedback or suggestions.

Best!
Brian
 
FYI, I've updated this library to use the new SPIClass available in Teensyduino 1.37 and newer. The main difference is that SPI declaration can now indicate directly which SPI bus is used. Additionally the setMOSI, setMISO, and setSCK functions can be used to set the alternate pins.

For example, using SPI bus 0, the default pins, and pin 10 as the chip select, the object declaration can be simplified to:
Code:
BME280 bme(10);
void setup() {
  bme.begin();
}

Using SPI bus 1 and switching to pin 20 for SCK would be:
Code:
BME280 bme(10,&SPI1);
void setup() {
  SPI1.setSCK(20);
  bme.begin();
}

Please note that the chip select pin can be any available digital pin.

Best,
Brian
 
Question - been using models BME280 and BMP280 for approximately 20 months in some environmental chambers. First batch lasted about 10 to 11 months, and second and third batches ok no more than 6 months. Equipment test profiles have not changed and test instrument power is clean (battery power to Teensy, and Teensy 3.3v power to sensors with LC filters). Am assuming Bosch fab issues until they answer my questions.

Anyone else noticing reduced MTTF for these sensors?
 
Was it possble for water to condense onto the sensor? This would damage it and I have a sensor here that is reading ~2K high due to contact with liquid water.

@ brtaylor:
Why does your library have the same name as all the other librarys?
 
Last edited:
Was is possble for water to condense onto the sensor? This would damage it and I have a sensor here that is reading ~2K high due to contact with liquid water.

@ brtaylor:
Why does your library have the same name as all the other librarys?

I reckon I could have called it "BME280_t3"...but it also supports Teensy LC.
 
Condensation not likely, as same problem with sensors in all of my employer's environmental chambers at both factory and engineering sites. And my code running the chambers reads a parametric look table to avoid approaching the dew point. So now running several sensor models 'in parallel' and have changed code to use heater more often. If employer allows, will publish findings in a few months to this thread, pending any zombie apocalypse.

Library naming -> yet another reason not to use the arduino environment. You will have to pry my cold, dead hands from cmake and SCons.
 
Do the sensors stop working completely, or just the humidity sensing? Does temperature and pressure sensing continue to work? Am interested in what you eventually find is the problem.

I haven't encountered any problems but I don't run them continuously.
 
BME280 Possible Moisture Problem

Do the sensors stop working completely, or just the humidity sensing? Does temperature and pressure sensing continue to work? Am interested in what you eventually find is the problem.

I haven't encountered any problems but I don't run them continuously.

Looks like I might be way too late to the party but I have encountered this situation before. One time our manufacturing department ran some boards with environmentally sealed LSI precision resistor networks through their aqueous cleaning system (AKA "the dishwasher"). That totally changed the resistance values with predictable results...

I suggested that they pull a space-level vacuum on the boards in order to boil off all the moisture.

The boards returned to their original performance.

Hope this helps someone...
 
Contamination, per se, was not the problem. We had a batch of 29 sensors with deteriorating tolerances after a few months of several cycles per day (20 to 80%RH, -20 to 40C), of working 24/7. We bought another batch of sensors and life is much better: the IngSoc Emperor is happy, and the proles sing tribute to the party while working the fields.

Immersing a BMP280 in anything is most very ungood. And a "space-level vacuum" is doubleplus ungood for these type of sensors. The Ministries of Truth and Plenty has provided:

ae-bst.resource.bosch.com/media/_tech/media/application_notes/BST-BMP280-HS000-07.pdf
 
Thanks for the fast reply!

I wasn't suggesting pulling a hard vacuum on the baro sensors, apologies if it sounded that way. I was merely telling a story about how we had dried out some environmentally (that is, non-hermetically) sealed parts. I'm glad your new batch behaved themselves...
 
Status
Not open for further replies.
Back
Top