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
exit
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.
References:
- https://roboticsbackend.com/raspberry-pi-gpios-default-state/
- https://github.com/raspberrypilearning/physical-computing-guide/blob/master/pull_up_down.md
- https://www.engineersgarage.com/articles-raspberry-pi-python-push-button-interface-digital-input/
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
OR
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
https://www.pygame.org/docs/ref/music.html#pygame.mixer.music.set_volume
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?
https://funconsumertech.com/no-audio-on-raspberry-pi-a-helpful-illustrated-guide/
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
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.
https://alselectro.wordpress.com/2020/09/10/7-hdmi-touch-1024-x-600-display-for-raspberry-pi/
Try
hdmi_edid_file=1
hdmi_force_hotplug=1
Q: How do I change the desktop image from the command line?
pcmanfm -w /home/username/image.jpg