2018 Dec 11, 05:43 PM
Hmm..
I ran the code for about a half hour and didn't see any great variation in output. Raspbian is not a real-time operating system. It switches between tasks in the background and this may cause occasional problems with timing. I am running the lite version which has fewer background processes than the full version.
I added a check in the code that will skip any reading that is much different from the previous one. This should provide a more consistent output than averaging multiple readings if there is an outlier.
You can find the updated code on GitHub at:
https://gist.github.com/Dan-in-CA/681a1a...48662492c6
Dan
I ran the code for about a half hour and didn't see any great variation in output. Raspbian is not a real-time operating system. It switches between tasks in the background and this may cause occasional problems with timing. I am running the lite version which has fewer background processes than the full version.
I added a check in the code that will skip any reading that is much different from the previous one. This should provide a more consistent output than averaging multiple readings if there is an outlier.
You can find the updated code on GitHub at:
https://gist.github.com/Dan-in-CA/681a1a...48662492c6
Dan