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.

Compiling AdvanceMAME 3.9 on a Raspberry Pi 4

It’s a breeze! Well, almost. Following the build instructions inside the “docs” folder of the source (download at https://www.advancemame.it/.) worked fine to give me an install.

(Don’t forget to run advcfg, the video configuration utility, first, I had “no video device found” until I had run it),

on my 4K monitor, though. it only displayed in the upper left, at about 1024×768. Long story short, the fix for that was to run sudo raspi-config, and go to “Advanced Options”, “GL Driver”, and disable that experimental GL driver. Now I get fullscreen, with no other changes.

Comment with any problems of your own attempting this!

WordPress Error: Error cropping images [FIX]

I recently installed WP on a new server (this one!), and everything worked, except when I tried uploading images, it always failed in the cropping process, with an error message along the lines of “error cropping image.”

In a google search I found a reference from someone with the same problem, and managed to apply their advice to my Ubuntu 18.04 build (different library name, I had to do some translating.) You need to install a library called php-gd, and restart your web server, and the problem vanishes. (At least it did for me!)