Get temperature of your Raspberry Pi

You Raspberry Pi has some nice commands that comes from its firmware that gets you information about the condition of some hardware components. One of this commands is able to measure and prints out the current temperature of your temperature sensor on your board. This may sounds complicated, but is really simple!


All you need is vcgencmd which gets you different informations based on parameters you set. You can get a list of all possible commands if you type this command into command line:

You will get a list of all possible parameters. Some of them are really interesting.

Get system temperature

For this you need the measure_temp param. With it you will get the current temperature on your board:

You will get the current temperature in degree Celsius. The output is not good formatted. I want to get a better output and a temperature in Fahrenheit. So for this use the following script:

You can call the script with this command and you may get following output:

Get current clock frequency

You can get clock frequency information with the measure_clock param. For this you also need the name of the component which should get measured. There are many different possible components, you can find a list here. One of this components is ARM which gets you your current clock speed of your processor:

I get the standard value of 700 Million Hertz or 700 MHz.

Get the voltage

Another nice possibility is to measure the voltage. You need the measure_volts param and again you need the name of the component. Here you have 4 possibilities: core (standard), sdram_c, sdram_i, sdram_p:

You have now learned how to get online board information! It is a good idea to write a script to get this values regularly. Maybe you want to store it into database and display it with a small PHP web app?

(Visited 5,338 times, 1 visits today)

7 Responses

  1. grant says:

    Hi there how do i get vcgencmd?

  2. adnen says:

    please any one know how i can Display this Values “Temperature” into a PHP pages,
    please Help

    • This is really easy. There is a php command for executing shell commands (exec). So with this little php script you can display the temperature:

  3. LinuxMaven says:


    for id in core sdram_c sdram_i sdram_p ; do \
    echo -e “$id:\t$(vcgencmd measure_volts $id)” ; \

    C2F() {
    TC1=echo $TC | cut -d '.' -f1
    TC2=echo $TC | cut -d '.' -f2
    #echo TC=$TC, $TC1 $TC2
    TF=$(( (9*(10*$TC1 + $TC2) +25)/50 +32 ))

    tm=/opt/vc/bin/vcgencmd measure_temp
    TC=echo $tm| cut -d '=' -f2 | sed 's/..$//'
    C2F $TC

    echo temp = $TC\°C \($TF\°F\)

Leave a Reply

Your email address will not be published. Required fields are marked *