Raspberry Pi 2 3 Setup Guide - acm-uiuc/display GitHub Wiki

These instructions are for setting up an ARMv7 Raspberry Pi as a production display which automatically launches the display on boot. The autostart implementation is based in part off of this blog post.

Install operating system

Download the Raspbian Lite image and follow the installation guide to write it to a microSD card.

Configure OS (log in as pi)

Log in as pi with password raspberry. Run sudo raspi-config and make the following changes:

  1. Expand filesystem
  2. Change the password
  3. Under Internationalisation, change the locale/timezone/keyboard layout/Wi-Fi Country appropriately from the UK defaults.
  4. Under Advanced Options:
    1. Disable overscan
    2. Set hostname (Admin should assign a hostname for the device)

Upgrade installed packages:

sudo apt-get update
sudo apt-get upgrade

Open /boot/config.txt as root and edit the following lines:

# Uncomment and edit these lines
hdmi_group=2 # Use DMT
hdmi_mode=82 # Set resolution to 1080p 60Hz

# Add this line
framebuffer_depth=32

Restart the Raspberry Pi when done.

Install packages

Install the following packages:

# X11 things
sudo apt-get install xorg -y
sudo apt-get install --no-install-recommends lightdm -y 
sudo apt-get install matchbox-window-manager fonts-liberation -y

# Electron dependencies
sudo apt-get install libgtk2.0-0 libxss1 libgconf-2-4 libnss3 -y

# Goodies
sudo apt-get install vim git htop -y

Install Node.js

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs

Set up display user

Create a user which will be automatically logged into on boot:

sudo adduser display

Set up display (log in as display)

Download the latest ARM build of Electron from here:

sudo su display
cd
wget https://github.com/electron/electron/releases/download/v1.6.15/electron-v1.6.15-linux-arm.zip
unzip electron-v1.6.15-linux-arm.zip -d electron

Download and build ACM Display

cd
git clone https://github.com/acm-uiuc/display.git
cd display
cp src/secrets.js.sample src/secrets.js
vim src/secrets.js
# Configure secrets.js with required API keys
npm install # This may take a long time the first time around to do some compilation
npm run build # Build JS and CSS files. This may take a minute or longer on the Pi.

Set up .xsession

Create file ~/.xsession with the following contents:

xset s off
xset -dpms
matchbox-window-manager &
while true; do
    $HOME/electron/electron $HOME/display >> $HOME/display.log 2>&1
done

Autostart configuration (log in as pi)

Open /etc/lightdm/lightdm.conf as root and uncomment and edit the following lines:

xserver-command=X -nocursor
autologin-user=display

Add user display to the group autologin:

sudo groupadd -r autologin
sudo gpasswd -a display autologin

Run sudo raspi-config and go to Boot Options and select Desktop Autologin.

Open /etc/systemd/system/[email protected] as root and comment the following line:

#ExecStart=-/sbin/agetty --autologin pi --noclear %I $TERM

Updating display

cd display
git pull
npm run build
pkill electron # Electron will automatically restart