Downloading & Installing the Software

Time to make this a depture board!

easy web maker

Step 1: Installing Program Dependices

First we need to download the packages needed by the departure board.

  • Once again turn on your pi wait 2min and then open putty and SSH into it, being sure to now use your new password you set eariler. Once you have logged into your Pi type in the following commands.
  • Each command must be typed in one at a time and then executed indiviudally; waiting for each to complete before doing the next. You may be prompted to press 'y' to accept at points. Some stages will take longer than others and some may output error messages, so long as the whole command does not fail this is okay.
  • sudo apt-get install git 
  • sudo apt-get install python
  • sudo apt-get install python-pip
  • sudo pip install -U pip setuptools
  • sudo usermod -a -G spi,gpio pi
  • sudo apt-get install python-dev libfreetype6-dev libjpeg-dev build-essential
  • sudo apt install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev
  • sudo apt-get install python-smbus python-sdl2 i2c-tools libsdl2-dev libatlas-base-dev libtiff-dev
  • sudo -H pip install --upgrade luma.oled 
  • sudo apt-get install python-lxml
  • sudo apt-get install python-pygame
  • sudo pip install luma.emulator
  • sudo pip install inflect
  • sudo pip install nre-darwin-py
  • cd ~
  • git clone https://github.com/jfoot/Bus-Departure-Board.git
  • cd  Bus-Departure-Board/
  • python Demo.py

If everything has worked correctly you should now see the demo program running. This is not actually live data but it allows us to check that your pi is working correctly. In which case you can now press Ctrl-C to exit out of it and continue onto the next stage. 

Step 2: Get Your API Keys

To get live data you'll need your own keys, don't worry, they're free!

Depending upon what program you want to run will depend upon what API Keys you are going to need. Currently the following programs are included:
  • Reading Buses - If you would like to create a bus display board specifically for Reading Buses you should goto the following site and create an API account here: http://rtl2.ods-live.co.uk/cms/register 
  • NationalBuses (Any UK Bus Stop)- If you would like to create a bus display board for any UK bus stop you should goto the following site and create an API account here:
    https://developer.transportapi.com/signup This API also includes all Reading bus stops but does not contain the same level of detial, also note some stops in the UK are only timetabled data and not real live data; data quality will vary region to region.
  • NationalRail (Any UK Train Station)- If you would like to create a train station display board for any UK train station (excluding tube stations) you should goto the following site and create an API account: http://realtime.nationalrail.co.uk/OpenLDBWSRegistration/
Once you have an API account you will have your own API Key (and API App ID If needed) so that you can access the data yourself. Make sure you find these values and record them down, they will be needed next.

Step 3: Autostart Program On Boot

Tell the program to start everytime you power on your Pi.

To run the program automatically each time you plug in your pi we need to create a start up service. Before continuing ensure you have your API credentials and you know which bus stop or station you wish to view. If you do not know the ID for the bus stop or train station which you wish to display goto the documentation page here, for more information. Once ready type each on of the commands out one at a time.

  • cd ~
  • nano startupDisplay.sh
  • Once nano (text file writing program) has loaded write at the top of the new file:
  • #!/bin/bash 
  • Now depending upon which program you want to run on start up will depend on the command you write. Below will give you examples of all three prorgams included, only write out ONE of these commands and make sure you replace any API credentials with your own API keys.
  • sudo python ~/Bus-Departure-Board/ReadingBuses.py -k [YOUR KEY HERE] -s [YOUR BUS STOP ID HERE]
  • sudo python ~/Bus-Departure-Board/NationalBuses.py -a [YOUR ID HERE] -k [YOUR KEY HERE] -s [YOUR BUS STOP ID HERE]
  • sudo python ~/Bus-Departure-Board/NationalRail.py -k [YOUR KEY HERE] -s [YOUR STATION ID HERE]
  • Ensure spacing and capitalisation is identical to the above. If done correctly you should have something which looks similar to the bellow:
Mobirise
  • Press 'Ctrl' + 'x', then 'y' and 'Enter' to save the file.
  •  chmod u+x startupDisplay.sh
  • sudo systemctl edit --force --full startupDisplay.service
  • Then once nano has loaded simply copy and paste the below text into the empty new file.

[Unit] Description=Starts up the bus or rail display once pi is powered on and connectedWants=network-online.target After=network-online.target [Service] Type=simple User=pi WorkingDirectory=/home/pi ExecStart=/home/pi/startupDisplay.sh [Install] WantedBy=multi-user.target

  • Once again save and exit the file by pressing, 'Ctrl' + 'x', then 'y' and 'Enter'.
  • sudo systemctl enable startupDisplay.service
  • sudo systemctl start startupDisplay.service
If everything has been done correctly you should now see the display showing the bus stop or station that you wished to view. If the screen turns on but shows a 'No Services Found' message you have incorrectly entered your API detials, go back and check them with 'sudo nano startupDisplay.sh'. If you just get a black screen run 'systemctl status startupDisplay.service' and see what error message is displayed. If you are still having issues try repeating the stage above or read more about it here.

You're up and running!

Awsome! If you've made it this far you should have a fully working bus or train display. Every time you plug in your new device the display will start running. You can stop here, or you can customise your display and go further!

FACEBOOK COMMENTS WILL BE SHOWN ONLY WHEN YOUR SITE IS ONLINE

© Copyright 2019 Jonathan Foot - All Rights Reserved

Cookie Policy  • Terms & Conditions  •  Contact Me