Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use with Particle Photon shows results are off by a small amount #2

Open
buelowp opened this issue Aug 13, 2021 · 0 comments
Open

Use with Particle Photon shows results are off by a small amount #2

buelowp opened this issue Aug 13, 2021 · 0 comments
Labels

Comments

@buelowp
Copy link

buelowp commented Aug 13, 2021

Have you looked for an answer?

We appreciate you checking the documentation, release notes, or the Developer community before asking. Please tell us where you looked, so we can fill the gap and help the next person too.

I've googled, and looked through your tickets (open,closed). I've seen similar, but most of those seem to be programming issues.

Question/Issue:

I have ported your library to the Particle photon, and it works very well. Thank you. However, I have two DPS310 sensors from Adafruit, and I'm seeing similar results for both. The current measured conditions at the location of the sensor are ~80F (local thermometer), 29.88 InHG (taken from weather.com and weatherunderground.com), altitude ~670 feet above sea level. The values from both sensors are within a safe margin of error of each other, and reflect the print below.

0000093175 [app] INFO: Temperature: 83.078969 F, Pressure 29.19 InHG, Altitude 206.276611

Context
I'm using a Particle Photon, release 3.1.0. I'm using your library mostly unmodified (I added prints to init to show the id values), though cloned to my github so I can update the properties file to create a private library. Someone else has uploaded your library unmodified, but didn't publish so I needed to change some names so I could use it. The unit is running in my office, uncovered and away from other equipment. There is no AC at this time, and no moving airflow to speak of.

I've verified my calculations are accurate for inHG online.

I'm running roughly your example, modified to calculate inHg, convert C to F, and calculate altitude.

	//set measurement precision and rate to standard values;
	configTemp(DPS__MEASUREMENT_RATE_4, DPS__OVERSAMPLING_RATE_8);
	configPressure(DPS__MEASUREMENT_RATE_4, DPS__OVERSAMPLING_RATE_8);
#include "DPS.h"

#define INHG    0.00029529983071445

Dps310 dpsobj = Dps310();
SerialLogHandler logHandler;

// setup() runs once, when the device is first turned on.
void setup() 
{
    uint8_t ret = dpsobj.begin(Wire);
    if (ret != 0)
        Log.error("Got return code %d from begin", ret);
    else
        Log.info("Product ID: %d", dpsobj.getProductId());
}

// loop() runs over and over again, as quickly as it can execute.
void loop() 
{
    float temperature;
    float pressure;
    uint8_t oversampling = 7;
    int16_t ret;


    //lets the Dps310 perform a Single temperature measurement with the last (or standard) configuration
    //The result will be written to the paramerter temperature
    //ret = Dps310PressureSensor.measureTempOnce(temperature);
    //the commented line below does exactly the same as the one above, but you can also config the precision
    //oversampling can be a value from 0 to 7
    //the Dps 310 will perform 2^oversampling internal temperature measurements and combine them to one result with higher precision
    //measurements with higher precision take more time, consult datasheet for more information
    ret = dpsobj.measureTempOnce(temperature, oversampling);

    if (ret != 0)
    {
        Log.error("Error getting temperature: %d", ret);
    }

    //Pressure measurement behaves like temperature measurement
    //ret = Dps310PressureSensor.measurePressureOnce(pressure);
    ret = dpsobj.measurePressureOnce(pressure, oversampling);
    float mercury = pressure * INHG;
    if (ret != 0)
    {
        Log.error("Error getting pressure: %d", ret);
    }

    float altitude = 44330 * (1.0 - pow((pressure / 100) / 1013, 0.1903));

    Log.info("Temperature: %f F, Pressure %0.2f InHG, Altitude %f", (temperature * 1.8 + 32), mercury, altitude);
    //Wait some time
    delay(1000);    
}

The sensor identification outputs are

0000002275 [app] INFO: virtual uint8_t Dps310::init(): Product ID: 0
0000002276 [app] INFO: virtual uint8_t Dps310::init(): Revision ID: 1
0000002276 [app] INFO: virtual uint8_t Dps310::init(): sensor id: 1

Where did you expect to find the answer?
I'm hoping someone can explain why the results are consistent, but not accurate. I can't find another calibration option at this time and am hoping to use this as a weather station input.

THANKS!
@boramonideep boramonideep transferred this issue from Infineon/DPS310-Pressure-Sensor Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants