Skip to content

Instantly share code, notes, and snippets.

@jadwigo
Last active October 31, 2022 08:21
Show Gist options
  • Save jadwigo/f54d8793805a07dd2aa173682bb1fb61 to your computer and use it in GitHub Desktop.
Save jadwigo/f54d8793805a07dd2aa173682bb1fb61 to your computer and use it in GitHub Desktop.
Installation procedure for the pictureframe

Picture screen installation

cleanup installation and remove unused big programs

sudo apt purge wolfram-engine scratch scratch2 nuscratch sonic-pi idle3 -y
sudo apt purge smartsim java-common minecraft-pi libreoffice* geany -y
sudo apt clean
sudo apt autoremove -y

install missing tools

sudo apt install unclutter xscreensaver ssmtp mailutils ufw

update the pi

sudo apt update
sudo apt upgrade

configure the pi

Enable SSH and VNC Check display resolution Disable screen blanking

sudo raspi-config

install logtoram

echo "deb http://packages.azlux.fr/debian/ bullseye main" | sudo tee /etc/apt/sources.list.d/azlux.list
wget -qO - https://azlux.fr/repo.gpg.key | sudo apt-key add -
sudo apt update
sudo apt install log2ram

configure logtoram

sudo nano /etc/log2ram.conf

Log2ram info

This service helps you extend your SD card’s potential life span by reducing the amount of data being written to it.

Your Raspberry Pi’s logs will now be written to the temporary disk located within the RAM. When you shut down, Log2RAM will save these files by synchronizing them back to the disk.

If you want to find the log files that are synchronized to your SD Card, you can find them at /var/hdd.log/.

Log2RAM will also synchronize these files daily if a restart or shutdown has not happened in the meantime.

https://pimylifeup.com/raspberry-pi-log2ram/

configure the ufw firewall

Enable openssh and vnc rules

  • sudo ufw allow OpenSSH
  • sudo ufw allow VNC
  • sudo ufw enable
  • sudo ufw status

install tailscale

curl -fsSL https://tailscale.com/install.sh | sh

And authenticate with jadwigo@gmail,.com

configure ssmtp

sudo nano /etc/ssmtp/ssmtp.conf

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
# root=postmaster
root=pictureframe@immerblei.space

# The place where the mail goes. The actual machine name is required no 
# MX records are consulted. Commonly mailhosts are named mail.domain.com
# mailhub=mail
mailhub=mail.gandi.net:587

# Where will the mail seem to come from?
#rewriteDomain=

# The full hostname
hostname=pictureframezero.immerblei.space

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
# FromLineOverride=YES

FromLineOverride=NO

AuthUser=pictureframe@immerblei.space
AuthPass={YOURPASSWORDHERE}

UseSTARTTLS=YES

add chromium to LXDE-pi/autostart

disable screensaver in LXDE-pi/autostart and start chromium in kiosk mode

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xset -display :0 s off
@xset -display :0 -dpms 
@xset -display :0 s noblank
@xscreensaver -no-splash
@chromium-browser --kiosk https://pictureframe.immerblei.space

add chromium restart script

note Make sure this is done as the pi user and not as root.

nano /home/pi/chromium_restart.sh; chmod +x /home/pi/chromium_restart.sh

#!/bin/bash
echo "Subject: `date` Restarting pictureframe" > log.txt
echo "From: pictureframe@immerblei.space" >> log.txt
echo "To: pictureframe_log@jadwigo.nl" >> log.txt

echo "" >> log.txt
echo "" >> log.txt

echo "`date` restarting chromium" >> log.txt
echo "IP adresses IPV6" >> log.txt
wget -qO- icanhazip.com  2>&1 >> log.txt
echo "IP adresses IPV4" >> log.txt
wget -qO- http://ipecho.net/plain 2>&1 >> log.txt
echo "" >> log.txt
echo "killing old chromes" >> log.txt
pkill chromium 2>&1 >> log.txt
echo "setting up display" >> log.txt
export DISPLAY=:0 
echo "start chromium browser" >> log.txt
chromium-browser \
  --check-for-update-interval=1 \
  --simulate-critical-update \
  --kiosk https://pictureframe.immerblei.space -- 2>&1 >> log.txt &
echo "`date` chromium restarted" >> log.txt
echo "" >> log.txt

add daily chromium restart to crontab

note Make sure this is done as the pi user and not as root.

MAILTO=pictureframe_log@jadwigo.nl

# m h  dom mon dow   command
15 0 * * * /bin/bash /home/pi/chromium_restart.sh >/home/pi/chromium_restart.log 2>&1
18 0 * * * /usr/sbin/ssmtp pictureframe_log@jadwigo.nl < /home/pi/log.txt

Add known networks to WIFI config

Edit /etc/wpa_supplicant/wpa_supplicant.cfg

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=NL

network={
	ssid="jadwigo-ax"
	psk=""
	key_mgmt=WPA-PSK
}

network={
	ssid="jadwigonet"
	psk=""
	key_mgmt=WPA-PSK
}

network={
	ssid="KPN5991B6"
	psk=""
	key_mgmt=WPA-PSK
}

network={
	ssid="GGzBreburgClienten"
	psk=""
	key_mgmt=WPA-PSK
}

rotate screen

On raspian bullseye the screen needs to be rotated from within the graphical UI:

  • Preferences => Screen configuration
  • right click on the hdmi1
  • select rotation
  • select left
  • confirm in the dialog

on older raspians

The screen rotation is set in /boot/config.txt

sudo nano /boot/config.txt

Add the following

# screen rotation (0 = normal, 1 = 90, 2 = 180, 3 = 270)
display_hdmi_rotate=3

reboot the pi

sudo reboot now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment