Raspberry Pi: Monitoring the Temperature in Fahrenheit, Using Python

I was interested in monitoring the temperature of the CPU, and there’s an easy command for that:
/opt/vc/bin/vcgencmd measure_temp
Go ahead and try it sometime, it will give the following type of output:
temp=61.0'C

Every tutorial I looked up used this command, so the solutions they came up with always had the temperature in Celsius. I use Celsius for monitoring temperatures on my PC, and with my 3D printer, so I’m familiar with it, but as a little challenge I decided to try to adapt a simple temperature monitoring Python script This was complicated by the fact I don’t know Python, but I managed it, with the help of the Internet.

Keval Patel wrote a really nice tutorial all about monitoring the temperature of the Raspberry Pi, and it was his short “temperature monitor” Python script I used as a template. His excellent article can be found at:
https://medium.com/@kevalpatel2106/monitor-the-core-temperature-of-your-raspberry-pi-3ddfdf82989f and I recommend reading it, it explains all the ins and outs.

Without further ado, here is my python script to continuously (once per second) sample and display the temperature of the CPU, with the temperature in Fahrenheit.

import os
import time

def measure_temp():
        temp = os.popen("vcgencmd measure_temp").readline()
        temp = temp.replace("temp=","")
        temp = (temp.split(".",1))[0]
        return (temp)

while True:
        print int(measure_temp())*9/5+32,"F"
        time.sleep(1)

Just save it in a file with a .py extension ("name".py), and run from the command line with
python "name".py (Of course, replace “name” with the actual name, like tempmon.py.

And there you have your CPU temperature in Fahrenheit, updated once a second.

1,106 Replies to “Raspberry Pi: Monitoring the Temperature in Fahrenheit, Using Python”

  1. Just want to say your article is as astonishing. The clearness in your post is simply cool and i can assume you’re an expert on this subject. Well with your permission allow me to grab your feed to keep updated with forthcoming post. Thanks a million and please carry on the rewarding work.

  2. Hello! I’ve been following your site for a while now and finally got the courage to go ahead and give you a shout out from Huffman Tx! Just wanted to tell you keep up the good job!

  3. Hi, I think your blog might be having browser compatibility issues.
    When I look at your blog inn Opera, iit looks fine but when opening in Internet Explorer, it has some overlapping.

    I just wanted to give you a quick heads up! Other then that, great
    blog!

  4. I’m impressed, I have to admit. Seldom do I come across a blog that’s both educative and engaging, and without a
    doubt, you’ve hit the nail on the head. The issue is something
    which not enough men and women are speaking intelligently about.
    I am very happy I came across this during my hunt for something regarding this.

  5. Interesting blog! Is your theme custom made or did you download it from somewhere?
    A design like yours with a few simple adjustements would really make my blog stand out.
    Please let me know where you got your design. Thanks

  6. Hey there just wɑnted to gіvе yoou a quick heads ᥙp. The wors in your article seem tо
    ƅe running off the screen inn Internet explorer.
    І’m not ѕure if this is a format issue оr ѕomething tօ do with browser compatibility ƅut I
    thought I’d post to ⅼet you know. Tһe layout looҝ
    great tһough! Hope yyou ցet the ρroblem solved ѕoon. Cheers

  7. Pingback: best cialis site
  8. Pingback: doctor7online.com
  9. Generally I do not read article on blogs, however I would like to say that this write-up very pressured me to take a look at and do so! Your writing style has been amazed me. Thank you, quite nice post.

  10. Appreciating the time and effort you put into your site and in depth information you present.
    It’s nice to come across a blog every once in a while that isn’t the same unwanted rehashed material.

    Excellent read! I’ve saved your site and I’m adding your RSS feeds to
    my Google account.

  11. It’s the best time to make some plas for the future and it is time
    to be happy. I have read this post and if I could I desire to suggest you some interesting things or advice.
    Maybe you could write neext articles referring to this article.

    I desire to read even moee things about it!

  12. Pingback: naltrzone online
  13. I was recommended this blog by my cousin. I’m not
    sure whether this post is written by him as no one else know such detailed about
    my problem. You’re amazing! Thanks!

  14. cialis online shopping Cialis Online 64305187 online pharmacy canada generic cialis
    where buy cialis Cialis Coupon 104199474 buy cialis generic online
    cialis for sale Price Of Generic Cialis 93509454 buy cialis online with mastercard
    how much does cialis cost per pill Cialis Lowest Price 73355657 cialis coupons
    canadian pharmacy cialis generic Cost Of Cialis 20mg Tablets 100846328 buy cialis cheap prices fast delivery

  15. Good day! This is my first comment here so I just wanted to give a quick shout out and tell
    you I truly enjoy reading through your articles. Can you suggest any other blogs/websites/forums that deal
    with the same topics? Appreciate it!

  16. After checking out a few of the blog articles on your
    site, I honestly appreciate your way of writing a blog.

    I saved it to my bookmark site list and will be checking back soon. Please visit my web site too and let me
    know what you think.

  17. Казино топ 100 является новейшей разработкой компании NetglobeServicesLtd, которая в
    свою очередь имеет несколько популярных игровых
    проектов. Лицензия международного
    уровня подтверждает, насколько работа казино прозрачна и безопасна.

    Подробнее казино
    Для того чтобы каждый клиент незабываемо провел время, игровой портал представляет
    огромный ассортимент различного развлекательного
    софта от самых безопасных и надежных провайдеров: Microgeming, Endorphina, BetSoft и
    многих других.
    Игровой портал имеет достаточно простой
    интерфейс, который помогает быстро найти ту или иную игру.
    Все развлечения поделены
    на несколько категорий:
    1.Один из главных разделов это слоты.
    Это раздел с классическими автоматами,у которых несколько барабанов и суть игры в том чтобы выбросить определнные комбинации.

    2.Вторая категория – это джек-поты.
    Даный раздел для тех кто привык играть
    по крупному, это видеослоты в которых можно сорвать большой куш.

    3.Третий раздел содержит в себе живые игры, которые представляют
    собой игры с участием крупье, которые реально
    руководят игроым процессом посредством веб камер.

    4.Затем идут настольные игры. Это эмуляторы покера, рулетки и многих азартных
    игры.
    5.Больше всего популярностью пользуется покер по видео, популярность его обусловлена большим процентом выигрыша.

    6.И еще один из разделов содержит в
    себе самые разнообразные
    лотереи, где можно испытать свою
    удачливость и судьбу.

    Каждый из игровых аппаратов имеет пробную бесплатную версию,
    в которой можно ознакомиться с правилами
    и интерфейсом, а также возможно разработать свою стратегию выигрыша.
    Самым главным отличием демо-версии от платной – это виртуальные ставки,
    остальные спецэффекты и особенности идентичны игры с
    выводом денежных средств. В пробную игру может сыграть любой посетитель игрового
    портала, а что бы начать игру на реальные средства, нужно пройти некоторый процесс регистрации своего аккаунта.

    Не сложная регистрация в топ 100 казино
    Чтобы пользоваться всеми возможностями сайта в полном объеме, нужно
    пройти не сложную процедуру регистрации.

    При регистрации нужно указывать исключительно достоверные данные
    о себе, это необходимо для того,
    чтобы была возможность вывода средст с вашего депозита, что
    не маловажно.
    На игровом портале для сохранения личных данных клиента действует политика конфиденциальности, исходя из этого, любая информация о пользователе не
    может быть распространена третьим лицам.

    После того, как игрок прошел процедуру регистрации,
    ему для личного пользования, выделяется кабинет,
    в котором возможно отредактировать
    личные данные, ввести промокод
    на бонусы, а также пополнять свой личный баланс и выводить выигрыш.

    Здесь для тех кто постоянно играет в казино, действуют и скидки иакции, каждому
    игроку присваивается свой статус, который
    увеличивается с каждой вашей ставкой.

    Поддержка на сайте
    Тех поддержка на сайте работает
    круглосуточно, здесь вы можете
    задать абсолютно любой вопрос. Служба поддержки работает как на английском так и на
    русском языках.
    Приходите к нам в казино топ 100
    и получите свой выигрыш!

  18. Wonderful beat ! I wish to apprentice whilst you amend your web site, how
    can i subscribe for a weblog web site? The account helped me a acceptable deal.
    I have been a little bit acquainted of this your
    broadcast offered vivid transparent concept

  19. Have you ever considered writing an e-book or guest authoring
    on other sites? I have a blog based on the same ideas
    you discuss and would love to have you share some stories/information. I know my readers would appreciate your work.
    If you are even remotely interested, feel free
    to send me an email.

  20. I’ll immediately grasp your rss feed as I
    can not in finding your email subscription hyperlink or e-newsletter service.
    Do you have any? Kindly let me know so that I may subscribe.
    Thanks.

  21. Howdy just wanted to give you a quick heads up and let you know a few
    of the pictures aren’t loading correctly.
    I’m not sure why but I think its a linking issue.

    I’ve tried it in two different browsers and both show the same outcome.

  22. It’s perfect time to make some plans for the future
    and it’s time to be happy. I have read this put up and
    if I may just I desire to counsel you some fascinating issues or suggestions.
    Maybe you can write subsequent articles regarding this article.
    I desire to learn more issues approximately it!

  23. My programmer is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the expenses.

    But he’s tryiong none the less. I’ve been using Movable-type on a number of websites for
    about a year and am nervous about switching to another
    platform. I have heard very good things about blogengine.net.
    Is there a way I can import all my wordpress content
    into it? Any kind of help would be really appreciated!
    cbd store cbd drops cbd drops

  24. Aw, this was a very nice post. Taking the time and actual effort to create a superb article but
    what can I say I hesitate a whole lot and don’t seem to get
    anything done.

  25. Wow! Thank you! I continuously needed to write on my site something like that. Can I include a part of your post to my site?.
    I like what you guys 스웨디시
    are usually up too. This kind of clever work and coverage! Keep up the very good works guys I’ve incorporated you guys to blogroll.

  26. An impressive share! I have just forwarded this onto a friend who was conducting a little
    homework on this. And he actually ordered me lunch simply because I stumbled upon it for him…

    lol. So let me reword this…. Thank YOU for the meal!!
    But yeah, thanks for spending the time to talk about this matter here on your blog.

  27. Good day! This is my first visit to your blog! We are a team of volunteers and starting a new initiative
    in a community in the same niche. Your blog provided us
    valuable information to work on. You have done a wonderful
    job!

  28. Greetings from Florida! I’m bored to death at work so I
    decided to browse your site on my iphone
    during lunch break. I really like the knowledge you present
    here and can’t wait to take a look when I get home. I’m shocked at how fast your
    blog loaded on my phone .. I’m not even using WIFI, just
    3G .. Anyhow, excellent site!

  29. I loved as much as you’ll receive carried out right here.
    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get got an nervousness over that you wish be
    delivering the following. unwell unquestionably
    come more formerly again as exactly the same nearly very often inside case you shield this hike.

    Also visit my homepage; Tucson SEO