Wednesday, June 5, 2019



Article

https://medium.com/@kevalpatel2106/monitor-the-core-temperature-of-your-raspberry-pi-3ddfdf82989f


#!/usr/bin/python2.7
import os
import time

def measure_temp():
        temp = os.popen("vcgencmd measure_temp").readline()
        return (temp.replace("temp=",""))

while True:
        print(measure_temp())
        time.sleep(1)


Thru a web page using python direct listening

https://raspberrypi.stackexchange.com/questions/8689/how-do-i-display-the-temperature-from-the-internal-sensor-on-a-html-page

install python-tornado

#!/usr/bin/env python

import tornado.ioloop
import tornado.web
import os

class MainHandler(tornado.web.RequestHandler):
    def getCPUtemperature( self ):
        res = os.popen('vcgencmd measure_temp').readline()
        return(res.replace("temp=","").replace("'C\n",""))

    def get(self):
        self.write( "Temperature: %s" % ( self.getCPUtemperature() ) )

application = tornado.web.Application([
    (r"/", MainHandler),
])

if __name__ == "__main__":
    application.listen(8888)
    tornado.ioloop.IOLoop.instance().start()
 

using RRD tool

http://lazydroid.com/2013/05/raspberry-pi-monitoring-cpu-temperature-with-rrdtool/

raw measurement of cpu temp
 
vcgencmd measure_temp
Monitor loop
watch -n 1 vcgencmd measure_temp


 

--30--

No comments:

Post a Comment