Giter VIP home page Giter VIP logo

Comments (2)

Gadgetoid avatar Gadgetoid commented on July 19, 2024

Bear in mind your sensor might also be thermally coupled to the Pi, which can also cause erroneous temperature readings and - in my experience - has more of an impact than the temperature of the sensor itself.

However you can tweak the sampling modes in code using something like:

from bmp280 import BMP280
bmp280 = BMP280()

with bmp280._bmp280.CTRL_MEAS as CTRL_MEAS:
    CTRL_MEAS.set_osrs_t(16)   # Temperature oversampling: 1, 2, 4, 8 , 16
    CTRL_MEAS.set_osrs_p(16)   # Pressure oversampling: 1, 2, 4, 8, 16
    CTRL_MEAS.write()

Let me know if this works for you, and I'll make this a public method.

An alternate approach might be to switch the sensor into "Forced Mode" which performs a single measurement and then returns it into sleep mode. This way you can couple the sensor measurement frequency directly to the speed at which your code runs by requesting a conversion on-demand rather than letting the sensor run continuously. This would- if device overheating is indeed an issue- have the most impact upon temperature readings:

from bmp280 import BMP280
bmp280 = BMP280()

bmp280._bmp280.CTRL_MEAS.set_mode("forced")
while bmp280._bmp280.STATUS.get_measuring():
    time.sleep(0.001)

temperature = bmp280.get_temperature()

from bmp280-python.

Gadgetoid avatar Gadgetoid commented on July 19, 2024

I've raised PR #3 to add these as first-party features.

I'm running some tests with two sensors side-by-side to see what factors most affect accuracy.

From a test with one sensor on our breakout garden extender, and one plugged directly in, I'm seeing a 2 degree difference that's rapidly growing to 3 degrees after I cooled both sensors with compressed air to form a baseline.

IE: The sensor plugged directly into Breakout Garden and thermally coupled to the Pi (Model A) is running 3+ degrees warmer than one attached via around 20cm of wire. This is unsurprising!

I will attempt to test Forced vs Normal mode, too.

Edit: Well, uh, initial test showed Force at 0.3 degrees warmer than Normal. Swapping the sensors around to see if the same results emerge.

Long story short- the difference between Forced and Normal mode is so minute as to be impossible to distinguish from the standard margin for error of the sensor which is - at best - 0.5C and - at worst - 1C variation +-. IE: It's entirely possible for two sensors to differ by 2 degrees C and be operating within spec so any difference less than 2 degrees can't be accurately attributed to ambient sensor temperature.

For specifically the BMP280 I can't find anything in the datasheet that suggests that heat generated by the IC itself is of concern. Perhaps this is accounted for in the stated accuracy ranges. I can't see any reason why you wouldn't want to always run at 16x oversampling for accuracy/stability on a Pi- since power consumption is broadly not a concern.

In summary I think the stuff you link is conflating "low power" with "low thermal interference" since they "Weather monitoring" use-case detailed in the BME280 datasheet suggests using 1x sampling only because it uses less power, and not because it avoids overheating the sensor IC itself. This is because weather monitoring devices are usually deployed in the field with batteries and designed to run on extremely low currents to prolong their life.

Additionally the BME280 is also only accurate to +-0.5 to 1.0 degrees, so the 1 degree variation mentioned is not sufficient to categorise any difference in performance.

TLDR: linked issue is nonsense, just make sure your sensor is not thermally coupled to, or in proximity to any sources of heat.

from bmp280-python.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.