BME280 Box of Tricks

bme280I’ve just wasted more time than I care to think, trying to get a BME280 driver to work – finally done it by adapting some work from this fellow (Cosmin Plasoianu) who’s code is good but was out of date for the current SDK and also referred to another chip as so many bits of code do – the BMP280.

So what’s the difference? Well, the BMP280 is a modern temperature and pressure chip – but it does NOT do what the BME280 does – and that is humidity. In other words it can form a replacement for the DHT22 as long as you don’t mind using another wire (i2c). It responds quickly and is relatively accurate. The BME280 is also on a different I2c address to the BMP280.  Anyway – all SORTED.

It is not cheap at nearly £4 but adding in pressure lets you do all sorts of weather-predicting stuff!  As usual I limit accuracy to the nearest degrees C or percentage humidity because while seeing decimal points looks good  - the ultimate accuracy does not warrant it.

I’ve updated the manual {temp_type:3}  - and this uses i2c. The new command assuming GPIO4 and 5 are used for I2c and assuming there are pull-ups in use  - this  fills in the variables temperature, pressure and humidity which can be accessed as {temperature?} {pressure} and {humidity} as normal and are also generated automatically – see manual.

One more success for Home Control 2016.

humidity

Facebooktwittergoogle_pluspinterestlinkedin

8 thoughts on “BME280 Box of Tricks

  1. First of all thanks for your usefull work.
    Today I tryed your firmware and I relly like it.
    I noted that for DHT22 there wasnt decimals so I searched and found "As usual I limit accuracy to the nearest degrees C".
    Thare is an Easy way to see One decimal point? Would be usefull for temperature regulation.
    Have a nice evening

    1. The accuracy just does not warrant it.

      And I quote - accuracy - temperature <+-0.5Celsius So it could be plus or minus 0.5c - a total range of 1 degree C.. Hence I go to the nearest degree.

    2. And unless you are controlling a special oven - keeping a house to within one degree temperature would be a very neat trick indeed - and would involve a lot of turning on and off of the heating system.

  2. Hi Pete, long time reader but first time poster here!

    I think you're conflating precision and accuracy. Accuracy is how close the measured value is to the true value, while precision is how much noise there is in the output.

    According to the datasheet, the BME280 is rated for an *accuracy* of +/- 0.5 C like you say, but the *precision* is much higher (RMS error of 0.005 C with automatic oversampling). In other words, at least the first decimal place reported is reliable. The range of the accuracy of the sensor is not a big deal, it can be calibrated out; it's the precision you care about when determining how many decimal places are significant.

    1. Understand both points here about the accuracy etc... as I've used an integer for other chips - I'd have to break compatibility with existing stuff and change code to do this - not happy about that as I can see a barrage of gripes about temperature not working properly.... of course as the code is open to all, anyone who wishes to make that change can do so.

      1. OK so to keep everyone happy - I've added a {hightemperature?} command to bring back the temperature * 10 - so you can use divide and mod to get your 0.1 degree.

        I've also added an experiment - port expander on I2c GPIO4 and 5 - gives you (just simple out for now) extra outputs out17 to out24. I was getting sick of running out of outputs. See I2c and port expander - and I've updated the manual

Leave a Reply

Your email address will not be published. Required fields are marked *