Raspberry Pi Tricks and Tips





I am working on Raspberry Pi 3B /3B+ models from some quite time. Below are the tricks and tips to work different feature on Pi.
NOTE: I will update this article when I work on the other features of Pi

Change Splash Image 

  • Disable the Raspberry Pi ‘Color Test’ by adding the line disable_splash=1 to /boot/config.txt
  • Disable the Raspberry Pi logo in the corner of the screen by adding logo.nologo to /boot/cmdline.txt
  • Disable the various bits of output from the kernel and friends by adding consoleblank=0 loglevel=1 quiet to /boot/cmdline.txt
  • Install the framebuffer image viewer by this command sudo apt install fbi
  • Create the file /etc/systemd/system/splashscreen.service with the below content
[Unit]
Description=Splash Screen
DefaultDependencies=no
After=local-fs.target
[Service]
ExecStart=/usr/bin/fbi -d /dev/fb0 --noverbose -a /home/pi/splash.png
StandardInput=tty
StandardOutput=tty
[Install]
WantedBy=sysinit.target
  • Replace /home/pi/splash.png with your desired image
  • Enable the service to be run at boot by running sudo systemctl enable splashscreen & sudo systemctl start splashscreen 
  • Reboot the Pi and check the image at boot 

 Hide Boot Messages 

After the implementation of Splash Image, some of the boot message still appears. Below is the process to hide the messages behind the splash image
#sudo vim /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=18ec4b0a-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait console=null quiet fbcon=map:2
  • fbcon=map:2 (FrameBuffer is the main trick to hide the boot messages behind the logo image)
  • If you want to run the tty console then use - con2fbmap 1 0

Setup Kiosk Mode

  • Install the below package for X server and windows manager
# sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox
  • Install the chromium browser with the below command
# sudo apt-get install --no-install-recommends chromium-browser

 Configuration

  • Open the file [/etc/xdg/openbox/autostart] and paste the below content
Disable any form of screen saver / screen blanking / power management
xset s off
xset s noblank
xset -dpms
# Allow quitting the X server with CTRL-ATL-Backspace
setxkbmap -option terminate:ctrl_alt_bksp
# Start Chromium in kiosk mode
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
chromium-browser --disable-infobars --kiosk 'http://your-url.co'
  • To check whether it is working 
# startx -- -nocursor 
  • To run chromium automatically after boot add the below command in .bash_profile of user pi and after saving the file reboot the Pi
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor

Remove Pinch Zoom on Kiosk Mode (Chromium)

#sudo vim /etc/xdg/openbox/autostart
chromium-browser --disable-pinch --disable-infobars --kiosk 'https://your-url.co'
disable-pinch: It will disable the pinch zoom option on the chromium

Ignore Self-Signed Certificate warning in Browser

chromium-browser --disable-pinch --ignore-certificate-errors --disable-infobars --kiosk 'https://your-url.co'
ignore-certificate-errors: It will disable the warning of ssl certificate errors

Change SwapFile Size

sudo vim /etc/dphys-swapfile
The default value of Raspbian is: CONF_SWAPSIZE=100
We need to change this to: CONF_SWAPSIZE=2048
Restart the service of swapfile to effect the changes

sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start

Enabling Camera

After enabling the camera from the raspi-config option. We have to load the driver of the camera into kernel. Below is the little script which enable the camera on boot.
#sudo modprobe bcm2835-v412 (It will load the module of hardware into kernel)
#vim /opt/picam.sh (Create this file and paste the below lines and make it executable)

#!/bin/bash
sudo modprobe bcm2835-v412

Now open the rc.local [/etc/rc.local] file and paste the script path [/opt/picam.sh] in the end before exit 0. The camera will work automatically when the system boots.




















Comments