Guide for the Elegant Departure Boards
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) Internet Access. This is required so the Raspberry Pi can update its clock - otherwise you will find the time is always wrong! Realistically you also want your Raspberry 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.
This guide takes you through getting this system up and running. If you are using your own Raspberry Pi to run the display, we have a separate guide about how to download and install our code to your Pi. Read this guide first to get the basics then follow the other guide to set up your Pi.
Unpacking and Plugging In
There's two critical steps you need to do first:
1) Configuring the Raspberry Pi for WiFi
2) Physically connecting the screen.
Then you're good to go with powering it up, and you should then be able to connect to the Pi and configure further details such as Live Mode vs Fantasy Mode.
Once you power the board up for the first time it'll run in Fantasy mode by default.
Configuring the Pi for Wifi
This is vital to ensure your board shows correct time! Plus if you want to use Live Mode to show real train station data you will also need to have Wifi access configured.
Take the Micro SD card that came pre-installed in your Raspberry Pi and connect it to your computer. You may need a Micro SD adaptor for this! They're easily and cheaply available from eBay or similar.
When plugging in the card you should find a new drive on you computer called 'boot'. In Windows it will have a drive letter assigned but you'll easily identify it by name.
Open the file titled 'wpa_supplicant' or 'wpa_supplicant.conf' using Notepad or similar.
If the file isn't present then you can download a copy from us and save that to the 'boot' drive instead. Then open it using Notepad or similar. Don't try and create it from scratch as it has to be in the correct Unix file format!
You'll find the file contains these lines:
ssid="your wifi network name"
psk="your wifi password"
Simply enter your home Wifi network name between the quotes where it says "ssid". And your home Wifi network password where it says "psk".
If you're outside the UK you should enter your two character country code too, in the Country field. For the UK it's GB which we have pre-configured.
Save the file and pop the Micro SD back into the Pi.
Note : if you check the card again you'll find the file has vanished. It gets used to configure wifi and then automatically deleted - don't worry this is normal behaviour so your wifi key isn't stored on the card!
Physical Wiring for the Display
We've provided handy guides to doing this in PDF format.
Our boards come with around 40cm of ribbon cable with 7 thin black sockets on the end.
Orient the Raspberry Pi to match our diagrams and very carefully connect each black socket to one of the pins on your Raspberry Pi.
NOTE : The Raspberry Pi boards are sometimes sold without pins. They have holes in the circuit board where pins could be soldered. If this is yours then you will need to get a pin header strip and solder it in place, or find someone to help you do this. It's not that hard, but requires a soldering iron and some practice!
Here's a quick visual guide to connecting the cables:
The default username and password for a Raspberry Pi are:
Username : pi
Password : raspberry
All in lower case. We recommend you change the password!
You can change the password in the Rasberry Pi Config utility (we get to that later) or by entering the passwd command at the shell prompt.
Connecting to your Raspberry Pi over the network
There's plenty of reasons you might need to do this. If you run the board in 'Live' mode you -must- enter a National Rail Enquiries key or it won't work. You will probably want to configure the Train Station used too.
If you run in 'Fantasy' mode there's loads of settings and the defaults look fine but you will probably want to tweak them!
In Windows you can normally find the "SSH" command works. Use the Start Menu and type 'cmd' to find the Command Prompt app. A black prompt window should appear. Then enter this command to connect to your Pi.
Note : if you have more than one Pi then this is a bit random - we hope that folk with multiple Raspberry PIs will be able to find and connect to them!
The better version of this is to download and install Putty which is a fabulous and free SSH tool and you can save your connection details etc. to make connecting to your Pi easy in future. If you download Putty try connecting to 'raspberrypi.local' and then logging in.
If these options fail because the Pi can't be detected we can suggest the steps here to help locate the Pi. Your ISP Router is (very likely) providing DHCP services so the router interface might show what devices have recently been added (typically it's often the highest number too!)
If you can determine the IP address you can just try this command to connect and go through all the active IPs on your network until one works! After that it'll generally keep the same address.
(replace the number with your own, of course)
Configuring your Departure Board
The settings for the board are stored in the script file "elegant-departures.py", so run the following command to edit the script file
sudo nano /home/pi/elegant-depatures/elegant-departures.py
The file will open in Nano - a linux based text editor program. Use the cursor keys to move around. You'll see at the top of the file there are many rows of comments (starting with a # symbol) which tell you about the script.
There are three sections of settings:
Section 1 : Set the mode to either 'fantasy' or 'live'.
Section 2 : Settings which control live mode.
Section 3 : Settings which control fantasy mode.
We'll go through sections 2 and 3 next.
Three values are required.
"key" is a developer key needed to access the National Rail Enquiries system. We can't provide this - you need to apply for one yourself. It's quite painless and free - just register here.
When filling in the form, enter a Usage type of 'Personal', a User Type of 'Other' and Proposed Usage of 'Other'. For the description you could write "Displaying train data in my LEGO city".
Once you get the key emailed to you it will look something like this:
So enter your value in the "key"
"url" is an Internet Address for the API we use to get data. This should never change, but it has done so rarely in the past so it's configurable here. Don't change this unless you're told to!
"crs" is a three letter code for the station you want to display data for. There's a huge list of them available, Enter the code in capital letters and the board will show departure data for that station. For example this line:
crs = "WNR"
Will show departures from Windsor & Eton Riverside - the station next to Legoland in the UK.
That's it - close the file (Hit Ctrl-X, then Y to confirm you want to save, then hit enter to confirm the filename) and you're good to go!
In Fantasy mode (Section 3) there are a few more options.
"towns" is a list of destination town names. It must have square brackets around it, and the list of town names each with quotes and a comma to separate them. e.g. ["Stud City","Brickston","Attic Brick City"]
"platforms" is similar but with platform numbers. No quotes needed for numbers! e.g. [1, 2, 3, 4]
"latetrainpercent" is badly worded - it's actually the percentage of trains which run on time! So a value of 70 means 30% of trains run late.
"latetrainmax" is a single number meaning the maximum amount of time in minutes that each train could run late. When a train is selected as running late, it could be between 1 minute and 'latetrainmax' minutes late.
"preventduplicates" is a new option as we saw the 'random' logic sometimes put the same destination name twice on the screen. You MUST have at least 3 station names listed in the "towns" variable for this to work. This will double check each new departure board entry to ensure you never see the same name twice on a board at one time!
"magic" is very special. It's a number from 0 to 100 which is the percentage of times that trains are diverted to Hogwarts School of Witchcraft and Wizardry. Set to zero to disable this function. Set to 100 and every train will go to Hogwarts from Platform 9¾ - which is probably a bit much! The default is 3 so just 3% of trains go to Hogwarts.
Saving the Script File
Once you have made changes to the script file, save and close the file with 'Ctrl+X' to exit, enter 'Y' to confirm saving, and then just 'Enter' to finish off.
Reboot the Pi (easiest just to pull the power and plug it back in!) and see the difference!