Posts: 16
Joined: Sun Jan 27, 2013 3:22 am

Outlier Temperature readings

Thu May 24, 2018 6:20 pm

Hello I have a sense hat installed on a raspberry pi 1 a+ with a GPIO extender I got at Amazon ... UTF8&psc=1 (The one on the left). I am using this so the temperature does not rise as the pi heats up. The problem I am having is I am getting outliers like 27 degrees Fahrenheit every time the machine turns on and occasionally it will report a high temperature of 97 degrees as well. About 99% of the time it is correct but I have it set up to report through email if the temperature is out of a certain range and I do not want to be bothered if it is one false reading. I do not know if anyone else has had issues like this and knows of a workaround.

Posts: 3413
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Outlier Temperature readings

Thu May 24, 2018 7:02 pm

Take a rolling median of multiple readings.
Keep a list of, say, 20 readings. Append the new reading at the head and remove the oldest reading at the tail then sort the list by value and take the middle value (index 10) and use that as the temperature for your alarm.
I expect there is a median function in numpy.

User avatar
Posts: 34425
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Outlier Temperature readings

Thu May 24, 2018 7:39 pm

97°F (36.1°C) is not an outlier - it's normal.
Note:Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

Return to “HATs and other add-ons”