Raspberry Pi

Q: How can I repair a Raspberry Pi OS when an update fails or due to power cycle during kernel update? sudo mount /dev/sda2 /mnt
sudo mount /dev/sda1 /mnt/boot
or use /media/userid/device sudo mount -o bind /dev /mnt/dev
sudo mount -o bind /sys /mnt/sys
sudo mount -t proc proc /mnt/proc
cd /mnt (or the new /media/username/device location)
sudo chroot .
sudo rpi-update

Q: Where is the Raspberry Pi OS documentation? https://www.raspberrypi.com/documentation/computers/os.html

Q: How do I format a Raspberry Pi OS using MacOS X? https://www.raspberrypi.com/software/

Q: Do I need a resister when connecting a switch to a Raspberry Pi GPIO Input Pin? No. When the GPIO Pin has been configured correctly with either Pull Down or Pull Up internal resisters.

GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_UP) If the pin has to be configured to use internal pull-down, it must be set up like this: GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

Many people add a resister inline with a switch as a safety fuse when connecting to Ground. Should the GPIO Pin be configured as an OUTPUT PIN to deliver 3V and accidentally connected to Ground (-) through a push button switch, then the Pi will be shorted to Ground, causing possible damage to the Pi Circuit.


Q: How hot can a Raspberry Pi get?


Q: How to read the CPU Temperature?

vcgencmd measure_temp

Q: How to monitor the Raspberry Pi CPU temperature continuously?

watch -n 10 vcgencmd measure_temp

Q: How to update the Raspberry Pi Software?

In Terminal enter:

sudo apt update
sudo apt full-upgrade

Q: How do I play a MP3 file?

sudo apt-get install mpg321


import pygame

pygame.mixer.init() pygame.mixer.music.load(“file.mp3”) pygame.mixer.music.set_volume(1.0) pygame.mixer.music.play()

while pygame.mixer.music.get_busy() == True: pass


Load two sounds snd1 = pygame.mixer.Sound(‘sounds/bang.wav’) snd2 = pygame.mixer.Sound(‘sounds/zoom.wav’) Play the sounds; these will play simultaneously snd1.play() snd2.play()

Q: How do I display an image from the command line? https://forums.raspberrypi.com/viewtopic.php?t=202057 Try pygame first.

Q: How to change Audio output from HDMI to Audio Port?


Q: How do use a non standard monitor resolution of 1024x600 on the Raspberry Pi?

Firstly a very important point with Pi 4 and 400. https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-mode

“Because the Raspberry Pi 4 and Raspberry Pi 400 have two HDMI ports, some HDMI commands can be applied to either port. You can use the syntax :, where port is 0 or 1, to specify which port the setting should apply to. If no port is specified, the default is 0.”

Make sure the screen is connected to Port 1, you can check this from the Monitor Preferences application.

This is my screen, the link has an excellent breakdown on what the commands do. Just remember its for HDMI port 1 and not 2.





Q: How do I change the desktop image from the command line?

pcmanfm -w /home/username/image.jpg

Last modified October 4, 2023: Page Update (6f55776)