Raspberry Pi
Raspberry Pi Parts as Standard:
- https://core-electronics.com.au/raspberry-pi-4-metal-case-with-3-5-480x320-tft-touch-screen.html
- Going to always use this from now on. Its a great case with screen at a great price. Has mounting holes on the back and looks very professional. No matter the application, its great to be able to diagnose problems via the screen, asking the customer what is on the screen, rather than needing to plug in a HDMI monitor.
Raspberry Pi Reference
Pinout
Questions
Q: How to display GPIO Status on the command line?
Q: How to enlarge the console font for Raspberry Pi?
The LCD Screen is too small for the standard font, need to make the login text larger for others to be able to read and see diagnostic messages.
- sudo dpkg-reconfigure console-setup
- UTF-8 for the console’s encoding step
- Guess optimal character set for the character set for the console step
- TerminusBold
- 8×13 to 8×18
- OK back to console.
- sudo reboot to take effect.
Q: How to use LCD-show without pulling data from China?
Purchased https://core-electronics.com.au/raspberry-pi-4-metal-case-with-3-5-480x320-tft-touch-screen.html aka https://wiki.dfrobot.com/Raspberry_Pi_4_Metal_Case_with_3.5_inch_480_320_TFT_Touch_Screen_SKU_FIT0820
git clone https://github.com/goodtft/LCD-show.git
cd into GIT cloned folder:
sudo cp ./usr/tft35a-overlay.dtb /boot/overlays/
sudo cp ./usr/tft35a-overlay.dtb /boot/overlays/tft35a.dtbo
sudo cp -rf ./usr/99-calibration.conf-35-90 /etc/X11/xorg.conf.d/99-calibration.conf
Next Mouse:
cp -rf /usr/share/X11/xorg.conf.d/10-evdev.conf /etc/X11/xorg.conf.d/
sudo apt-get install xserver-xorg-input-evdev``
edit /boot/config.txt Confirm the below: `` dtparam=spi=on dtparam=i2c_arm=on dtoverlay=tft35a:rotate=90 enable_uart=1 # Not sure if this is needed next time, try without it.
reboot There should be two fb devices ls -l /dev/fd*
dmesg should also show the display being detected as “graphics fb1”
I added
echo " fbcon=map:0 fbcon=font:VGA8x8" >> "/boot/cmdline.txt"
When I removed the HDMI display/monitor, the Screen magically started working. Very happy to have either FB or HDMI as the boot up option. No need to have both running.
This also works with Console Only! No need for X display. However I don’t get the touch screen, but the memory/CPU usage is less.
Reference:
- https://chrizog.com/rpi-linux-fbtft-touchscreen-setup
- https://github.com/tasanakorn/rpi-fbcp ( I didn’t need this, as it worked out of the box without HDMI connected)
Q: What window Manager does the Raspberry Pi use?
You can run raspi-config and pick X11 or Wayland Xwayland - This means that tools like xdotool and wmctrl won’t work under Raspberry Pi. X11 - more compatible with existing tools. If you don’t intend to use the screen controlling tools, then the default Wayland is fine.
Q: How to open Webbrowser from command line on Raspberry Pi?
chromium-browser www.example.com
Q: How do I change the active window from Terminal
xdotool search -name “title of window” windowactivate
Q: How do I open a new page without address bar etc?
chromium-browser –app=http://www.example.com
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
Q: Enable SSH from the command line
- sudo raspi-config
- Interface Options
- SSH
- Yes
- Close
- ifconfig (To get the IP Address)
- then ssh in from another machine.
Q: Using python3 venv on Raspberry Pi
To create a folder for the project
- python3 -m venv led
- cd led
- source bin/activate
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.