Elegant Departure Boards - Guide for the using your own Raspberry Pi
If you haven't already - do check out our main guide for information on physically connecting and using your Elegant Departure Board sign.
This guide shows how to install and upgrade the code if you already have a Raspberry Pi and want to use that to run the board.
The Elegant Departure Board system is a compact computer screen that shows train departure information - either live or realistic fake data. Making it work is a combination of three or four things:
1) One of our Elegant Departure Board screens.
2) A Raspberry Pi computer to run it. Our screens come with cables - your Raspberry Pi will need pins to connect these to. These pins are the grid of 40 connectors called a GPIO header on a Pi. The wiring diagram pictures will make that more clear.
3) Our code. This is a script which runs on the Raspberry Pi and makes the screen work. It must be run the whole time.
4) (Optional) Internet Access. Realistically you want your Reaspberry Pi to be on your network so you can connect to it and configure the display. It doesn't have to be wifi - All of the full size Raspberry Pis have a physical network connection socket. Most have Wifi too. The Raspberry Pi Zero only has Wifi on specific models so make sure you have a "W" version.
First Time Install
If you want to run the display on your own Raspberry Pi you need to open a shell and execute these commands:
sudo apt-get install python3-dev python3-pip libfreetype6-dev --fix-missing -y
sudo apt-get install libjpeg-dev build-essential --fix-missing -y
sudo apt install libtiff5 libopenjp2-7-dev --fix-missing -y
sudo -H pip3 install --upgrade luma.oled
sudo -H pip3 install xmltodict
sudo -H pip3 install requests
sudo -H pip3 install msgpack
These commands update the installed application repositories and then call the installation of a few base libraries including Python and the PIP installer for Python.
Don't worry if you might already have some of these components - the apt-get system is smart and won't re-download unless things are missing.
Downloading the Code
Run the following the code to create the elegant-departures folder, move into it, and then download and extract our code files:
unzip -j master.zip
Configuring the Pi Itself
You've probably already done these steps, but if you are using a fresh Pi have a read below.
The Raspberry Pi is pretty locked down by default. So you need to use the Raspberry Pi Config utility to set some basic parameters. This includes enabling the 'SPI' interface we use to control the display which is pretty critical.
At a prompt, run the following command:
The application is a simple menu system and you use the cursor keys and enter key to get around.
Check out these options first :
1 Change User Password. Highly recommended!
3 Boot Options. Set 'B2 Wait for Network at Boot' to make sure your Pi connects to the network before running our script.
4 Localisation Options. If your display boards are showing the wrong time you need to set the timezone in here.
And most important of all:
5 Interfacing Options. You need to enable SPI Interface. It's also a good idea to enable SSH so you can connect to your Pi more easily.
Once done, exit the utility and reboot using the following command:
shutdown -r now
Running the Code Automatically
Your departure board should run without any human intervention so we need to set it up to run automatically.
At the shell prompt, enter the following command:
If you are prompted to select an editor, select the option mentioning 'nano' as it's a good safe choice!
You will see the editor with a whole load of comments with a # symbol at the bottom. Copy the following text down underneath that.
@reboot sudo python3 /home/pi/elegant-departures/elegant-departures.py -i spi -d ssd1322 --width 256 --height 64
Then save and exit with 'Ctrl+X' to exit, enter 'Y' to confirm saving, and then just 'Enter' to finish off.
Now you have configured the code to run on boot, reboot your Pi and see it come to life.
Either pull the power and plug it back in again (yes, really, it's not Microsoft Windows and won't break!) or enter this command again to reboot the Pi.
shutdown -r now