Can Gateway perform calculations on sensor data before passing to controller?

  • I would like to have a Bosch BME280 in a remote location controlled by a Sensebender Micro (or similar). The processing math for this sensor demands a 32 bit processor for accuracy (I don't know the actual error in using a 8 bit but I believe Bosch's recommendations).

    My Gateway is a Sensebender_GW.

    Is there a way for the remote Node to read the raw BME280 data and pass it to the Gateway for computing/processing, then be sent to the controller?


  • You may use node-to-node communication to send the raw data from the BME-node to any other node for further calculation. Most likely best would be to use own ID's after calulation. But if this really is a problem, it's probably better to use directly a different mc (like STM32F103) for the node itself, the node-to-node-way makes things much more complex.

    Would you mind providing more info about the calculations problem you mentionned? My own BME280-node is just equipped with an ordinary pro mini...

  • @rejoe2 said in Can Gateway perform calculations on sensor data before passing to controller?:


    HI, Thanks for the insight and the ref to the ST board, I was not aware of its existence.

    Regarding the BME280 my original BME test was on a RasPi using Python, which seems to be capable of very long numbers. I did not use any library and coded it from the datasheet.

    Reading the datasheet, Bosch recommends a 32bit processor. See datasheet Appendix A.
    In any case the polynominals used for calculating the final temperature, humidity and pressure are quite long and small errors in the calculation will have some effect on the result / accuracy. How much...I don't know but for me a little OCD is enough to want the best I can do.

    If I ever quantify the error I will try to update this thread.

  • Mod

    I have a BME280 running next to a SHT31 and temperature readings are consistent without 32bit MCU

  • Mod

    @johnrob I can't find any mention of a requirement on 32-bit cpu.

    Appendix A does mention that the calculations should use 32-bit signed integers and single or double precision floats. Arduino supports all of them.

  • @mfalkvidd Thx for doing some deeper analysis.
    Until now, to me the data from the BME280-node seemed also to provide plausible data. My "reference" is a DS18B20 attached to another node installed at a different - less exposed, so also less accurate - place.

    Used lib is the BME280-lib by Tyler Glenn that comes with Arduino (Version 2.2.1, as latest 2.3.0 seems to be broken with AVR).

  • The calculations are for the calibration data calculated at the factory and stored on the chip.

    Assuming your remote sensor is powered by batteries, you probably aren't going to be running the sensor all the time, which limits your filtering options (higher resolution output requires consecutive readings).

    It's likely that the sensor is going to be accurate enough for the resolution you are using without applying the calibration data. You could test this experimentally with that sensor on your Raspberry Pi setup, comparing the output with and without application of the calibration information.

    (I spent a lot of time with that data sheet because I also have one connected to a Raspberry Pi. It was nice of them to provide sample numbers so I could make sure my calculation code was correct.)

  • My "concern" is more OCD than realistic. I really have no realistic need to know the temperature as such precision. Its just that I would prefer to get the most accurate reading the sensor is capable of.


    When you said "....Appendix A does mention that the calculations should use 32-bit signed integers and single or double precision floats. Arduino supports all of them...."

    I was assuming to get 32 bit double precision floats one would need a 32bit ยตP. Am I in error here?

    An old saying (not sure how old).
    A man with one thermometer knows what temperature is.
    A man with two thermometers does not.

  • Mod

    @johnrob yes you are ๐Ÿ™‚

  • @johnrob I understand wanting to apply the calibration data even though you don't need it. I did the same.

    The Arduino hardware doesn't support 32 bit calculations, but it can be done in software; it just makes your code bigger.