65Views2Replies
Raspberry Pi PC temp checker
Hello forum,
I'm planning on buying a raspberry Pi this week. I know a couple programming languages, but only the basics.
I've had this idea for quite a while: Connect multiple thermal sensors to the Pi, and then connect the Pi to my old Android cellphone (Nexus 2), and mount the phone to my PC case, so I get read outs for the PC components (CPU, VGA, PSU, HDD, and so on).
Can someone help me, and explain how I can do this? I see it as a fun hobby to get into programming, and also reuse a cell phone, so I don't throw it away.
Comments
5 years ago
Hey Just something i wrote up quickly feel free to message me if you need any help
[code]
import os
import json
import requests
def getCPUtemperature():
res = os.popen('vcgencmd measure_temp').readline()
return(res.replace("temp=","").replace("'C\n",""))
def GetCpuFrequency():
res = os.popen('cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_fr$
return res
def SendNotificationToDevice():
temp = float(getCPUtemperature())
url = 'https://maker.ifttt.com/trigger/Comp_data/with/key/YOUR_KEY_HERE
payload = {'value1' : temp }
headers = {}
res = requests.post(url, data=payload, headers=headers)
temp = float(getCPUtemperature())
CyrrentCPUFreq = GetCpuFrequency()
##if (temp >60):
print('Current CPU frequency');
print(CyrrentCPUFreq);
print('Current CPU Temp');
print(temp);
SendNotificationToDevice();
[/code]
Cheers Benji
Reply 5 years ago
Woops I didn't read your post properly lol i thought you wanted to get the temp of the raspberry pi lol