Accuracy of Adafruit Sensors and needing to be updated

Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Locked
User avatar
Tom_Henry
 
Posts: 350
Joined: Wed Aug 26, 2020 8:19 pm

Accuracy of Adafruit Sensors and needing to be updated

Post by Tom_Henry »

I have set up a Raspberry Pi Zero W with 2 Adafruit sensors: MS8607, PMSA003I running a CircuitPython program: see attached copy.

I have this package outside on my deck sending temperature, humidity, pressure, and various readings from the PMSA003I.

I have created a public Adafruit IO dashboard to view the readings that are update every minute or so.

Here is a link to this public dashboard: https://io.adafruit.com/Tom_Henry/dashb ... -date-time

I have attached a copy of the CircuitPython program that runs everything.

Here is my question:

I notice that I often have to restart the CircuitPython program to get updated accurate temperature readings. I have also noticed this with other Adafruit sensors.

Why is this? I thought the Adafruit sensors were always accurate and giving out the correct readings.

Thanks,

Tom Henry
Attachments
PMSA003I.12.4.py
(6.59 KiB) Downloaded 2 times

User avatar
brubell
Learn User Page
 
Posts: 2010
Joined: Fri Jul 17, 2015 10:33 pm

Re: Accuracy of Adafruit Sensors and needing to be updated

Post by brubell »

For the MS8607,
"Pressure measurements accuracy comes in at +/- 2 hPa, relative humidity at +/- 3% rH, and temperature is good to within 1 degree Celsius."

What do you mean by "updated accurate temperature readings". Is the program crashing?

User avatar
Tom_Henry
 
Posts: 350
Joined: Wed Aug 26, 2020 8:19 pm

Re: Accuracy of Adafruit Sensors and needing to be updated

Post by Tom_Henry »

Monday morning

Let me give you an example of what I am talking about.

This morning I went to my dashboard and you can see the attached screen shot readings, notice the temperature is 50.3 degrees F. I know for a fact that the outside temperature is NOT 50 degrees, it’s more like 34 degrees.

So using VNC I navigate to the Raspberry Pi, I stop the CircuitPython program, and then restart the CircuitPython program.

Now notice the new screen shot showing the temperature is 35.32 degrees which is most likely correct.

I have documented this happening with multiple Adafruit sensors including multiple MS8607, BME280.

My only solution would be to somehow build in a restart the CircutPython program every x number of hours. I’m not sure how to do that.

I would be interested to hear your comments as to why the Adafruit sensors are not reporting the temperature accurately unless I restart the CircuitPython program.

Thank you,

Tom Henry
Attachments
2.png
2.png (147.57 KiB) Viewed 130 times
1.png
1.png (154.94 KiB) Viewed 130 times

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: Accuracy of Adafruit Sensors and needing to be updated

Post by adafruit_support_bill »

Sounds more like a problem with your program hanging or crashing than a sensor accuracy problem.

User avatar
Tom_Henry
 
Posts: 350
Joined: Wed Aug 26, 2020 8:19 pm

Re: Accuracy of Adafruit Sensors and needing to be updated

Post by Tom_Henry »

Your comment: Sounds more like a problem with your program hanging or crashing than a sensor accuracy problem.

______________________

The program is not crashing. It is refreshing every 60 seconds. I can tell that by reading the data from the dashboard. I have built in a counter and that tells me it is actually updating every 60 seconds.

I am going to make my example much simpler.

I will use Adafruit’s Simple Test for the MS8607 with slight modifications: added Fahrenheit temperature and changed refresh time to every 10 minutes: see attached CircuitPython program.

I have put this outside on my deck, and will let it run all day and tomorrow morning I will check the temperature readings from Adafruit’s MS8607 sensor using my VNC connection to the Raspberry Pi Zero W 2.

Here is what I am seeing right now for the temperature which seems to be an accurate outside temperature.

12.65 C and 54.66 F

I will get back to you tomorrow morning with my results.
Attachments
ms8607_simpletest.py
(574 Bytes) Downloaded 1 time

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: Accuracy of Adafruit Sensors and needing to be updated

Post by adafruit_support_bill »

Looking at the values in your previous post, the error would seem to be in the conversion to Fahrenheit. The sensor itself reports in Celsius and that value is 2.64 C in the first reading and 2.65 C in the second. Both of which are very close to what you believe was the correct temperature at the time.

User avatar
Tom_Henry
 
Posts: 350
Joined: Wed Aug 26, 2020 8:19 pm

Re: Accuracy of Adafruit Sensors and needing to be updated

Post by Tom_Henry »

I certainly owe you an apology.

Your are absolutely right. The line of code to convert the C to F was in the wrong place.

I changed it to this:

# SPDX-FileCopyrightText: 2020 Bryan Siepert, written for Adafruit Industries
# SPDX-License-Identifier: MIT
from time import sleep
import board
from adafruit_ms8607 import MS8607

i2c = board.I2C()
sensor = MS8607(i2c)

while True:

print("Pressure: %.2f hPa" % sensor.pressure)
print("Temperature: %.2f C" % sensor.temperature)
f = (sensor.temperature * 1.8) + 32.
print("Temperature: %.2f F" % f)
print("Humidity: %.2f %% rH" % sensor.relative_humidity)
print("\n------------------------------------------------\n")
sleep(600)

It now works just fine thanks to you.

Now I can fix this in all my other CircuitPython programs.

Much appreciated.

Tom Henry

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: Accuracy of Adafruit Sensors and needing to be updated

Post by adafruit_support_bill »

Good to hear there was a straightforward solution. Thanks for the follow-up.

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”