Skip to content

reading pressure or humidity without temperature can result incorrect results #39

@pbolduc

Description

@pbolduc

The readings for the humidity and pressure can be off because they depend on the temperature reading. There is a instance variable t_fine that both humidity and pressure reference. It is only initialized in when reading the temperature. This fact should be documented.

I propose adding a single method that reads all three measurements in a single call to the sensor. In my measurements on a Moteino M0, the time required to read temperature, humidity and pressure can be reduced by about 35% (1139 us vs 1729 us). Reading all values in a single call ensures the sensor values are all from the same measurement.

My first prototype looks like this. However, I am thinking on changing this a bit to align it better with the style of BME280 class with various methods (ie temperature in C / F, altitude in meters / feet). Thoughts?

struct BME280_SensorMeasurements
{
  public:
	float temperature;
	float pressure;
	float humidity;
};

class BME280
{
  public:
    void read(BME280_SensorMeasurements *measurements);
}

edit: fixed units from ns to us.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy