dprotsiv / dps310-rs

Infineon DPS310 I2C driver in rust
MIT License
2 stars 5 forks source link

Reading calibrated pressure without temperature compensation #4

Open coder543 opened 1 year ago

coder543 commented 1 year ago

Thanks for the library! It works well.

I was wondering if it would be reasonable to also have a method that does everything read_pressure_calibrated does, but without the temperature compensation aspect. In an indoor environment, temperature seems more likely to throw off the readings than to contribute to an accurate result. If I place my finger on the sensor, I can watch the pressure value start to change rapidly due to temperature change, even though pressure isn't changing. If I try to read the raw value, it's some kind of negative number, which is confusing.

Obviously, if I keep the temperature constant, the pressure readings seem pretty reasonable. I just feel like they might be even more accurate in my situation without temperature compensation.

dprotsiv commented 1 year ago

Thank you for your interest in the library and the feedback on it. Looking at the spec sheet https://www.infineon.com/dgdl/Infineon-DPS310-DataSheet-v01_01-EN.pdf?fileId=5546d462576f34750157750826c42242 (link also cited in src/registers.rs) on page 40 there are a number of mentions regarding not touching sensor/blocking the vent as that will definitely impact the readings and may cause damage to the sensor. When reading uncalibrated values, these will incorrect and may be negative; this happened for me as well.

One of the things that I would like to draw your attention to is page 17 of the spec sheet of the sensor. Here there are references to indoor mode. What you have observed might be related to the fact that the library does not fully cover indoor/outdoor modes of operation, which might account for the behaviour you are observing. I would certainly appreciate if you could confirm that, in which case the library may end up benefiting from an additional configuration parameter allowing for indoor/outdoor operation modes.

Regards,

Dmytro