Created
March 7, 2016 08:08
-
-
Save norbekaiser/14ee657590245631d8a6 to your computer and use it in GitHub Desktop.
Temperature Results of Sense hat, with correction via cpu temperature ( not very accurate)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
norbert@raspberrypi:~ $ ./temp.py | |
Temperature(h): 22.962310791 C | |
Temperature(p): 0 C | |
Temperature(c): 30.4 C | |
Temperature: -7.43768920898 | |
norbert@raspberrypi:~ $ ./temp.py | |
Temperature(h): 22.9989624023 C | |
Temperature(p): 22.9895839691 C | |
Temperature(c): 29.9 C | |
Temperature: 16.0885463715 | |
norbert@raspberrypi:~ $ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from sense_hat import SenseHat | |
import os | |
sense = SenseHat() | |
sense.clear() | |
#temp = sense.get_temperature() | |
#print("Temperature: %s C" % temp) | |
temph = sense.get_temperature_from_humidity() | |
print("Temperature(h): %s C" % temph) | |
tempp = sense.get_temperature_from_pressure() | |
print("Temperature(p): %s C" % tempp) | |
tempt = os.popen('/opt/vc/bin/vcgencmd measure_temp') | |
tempc = tempt.read() | |
tempc = tempc.replace('temp=','') | |
tempc = tempc.replace('\'C\n','') | |
tempc = float(tempc) | |
print("Temperature(c): %s C" % tempc) | |
temp = (tempp + temph) / 2.0 | |
temp = temp - (tempc - temp) | |
msg = "%s" % int(round(temp)) | |
print("Temperature: %s" % temp) | |
sense.show_message(msg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using the sense hat for temperature aquirisation , it is kinda impossible to get proper values from the temperature sensor
An Offset error is assumed, using the cpu heat ( without air transfer calculus) difference as an offset error