Measuring the Broadcom chip temperature on the Raspberry Pi

The electronic package for my weather balloon project is now complete and housed in a lightweight plastic cage. I have reduced heating problems by using 25 cm male to female USB connectors to connect the LPRS radio and the GPS/FTDI to the Raspberry Pi, now the 4 way USB block runs at a reasonable temperature. I can monitor the internal temperature of the LPRS radio and the ambient temperature, but I was concerned that in the cramped conditions in the container the Broadcom chip may overheat. Early experiments with the Pi in a case and all four USB sockets used showed that the system would behave erratically as the temperature rose above 30C.

A quick scan of the Internet seemed to show that although the Broadcam chip has temperature sensors they could not easily be accessed. However, it seems that although this was true in early versions of the Raspberry Pi later versions allow the temperature to be read. Open a terminal window and type in the following:

/opt/vc/bin/vcgencmd measure_temp

and receive the reply

temp=48.7'C

Using

/opt/vc/bin/vcgencmd measure_temp| egrep "[0-9.]{4,}" -o

Will just return

48.7

My Python code sends ACK after each requested data has been sent back to the master unit and I intend to add the Broadcom temperature to this monitor the Raspberry Pi.

Using the code with Python

To use this code with Python use the following:

include os

cmd = '/opt/Vcc/bin/vcgencmd measure_temp'
coreTemp = os.popen(cmd).readline().strip()

This will return a string similar to

temp = 44.6'C

If you need just the temperature value you can add the following line to the above

temperature = coreTemp.split('=')[1].split("'")[0]

temperature will then contain the value. It seems the Broadcom processor runs at about 40 to 50’C, but could operate up to about 80’C.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s