If you want to know the GPU temperature of your Raspberry Pi you issue
/opt/vc/bin/vcgencmd measure_temp
and will get a response like
temp=45.5’C
form this command.
We will show a script here that send this temperature to a VSCP daemon so that you can handle, display, diagram, react on the measured value etc
The script to do this is here.
You use it like this
./send_pi_gpu_temp.py 192.168.1.6 admin secret –
First remember to make it executable (chmod a+x send_pi_gpu_temp.py ).
The parameters are.
- IP address to server (192.168.1.9) where VSCP daemon resides.
- User name for TCP/IP connection, obviously you should use anther user than the admin user in most cases.
- Passsword for TCP/IP connection.
- GUID to use for the temperature event. This is an optional parameter and if not given “-” wil be used which is the same as a GUID with all zeros and mans that the event will have the GUID of the interface. It is better to give an explicit GUID but this works for now.
So issuing this and watching it in VSCP Works
now we can add this to a cron script to get the temperature sent to the VSCP daemon every minute.
We add a script send_gpu_temp to /etc/cron.d looking like this
* * * * * root cd /root;./send_pi_gpu_temp.py 192.168.1.6 admin secret 00:00:00:00:00:00:00:00:00:00:00:00:00:01:00:03
Note that a GUID has been assigned here for the sensor. The
00:00:00:00:00:00:00:00:00:00:00:00:xx:xx:xx:xx
can be used for lab usage and I put a id for some hardware in byte 2/3 in this case 00:01 and index in byte 0/1 ( 00:03). We could have used the MAC address or the IP address of the Raspberry Pi as a base for this or a privately assigned GUID series. You can read more about the GUID’s here.
Thats it. You can now alarm yourself when the temperature reach critical levels or just diagram the data or collect it in a database.