Skip to content

Offline GTFS based transit schedule for a raspberry pi with an Papirus e-ink display

Notifications You must be signed in to change notification settings

Scarysize/transit-pi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

transit-pi

A raspberry pi offline transit schedule, showing the upcoming departures for selected train & bus stations on a 2" e-ink display.

https://twitter.com/Scarysize/status/942024967562162176

Prerequisites

You need:

Hardware

  1. Solder the Header to your Pi (or use solderless headers)
  1. Setup the display

Software

  1. Install an operating system on your Pi:
  1. Headless Pi setup (Wifi & SSH)
  1. Install the PaPirus library, including the python 2 API

Create the SQLite3 database

Copy your GTFS files into the input/ directory. Then in the project root run:

sqlite3 server/gtfs.db < import-gtfs.sql

This will import the CSV files into a databse and create some indices. It may take a few minutes.

Config file

In python/ you will find a config.json file. This is configured for some stations in Hamburg, Germany. Adapt this file depending on what you want to display. You need to supply a route, stop, direction and type (bus, ferry, train) for each "query". To figure out the correct values, you can simply search around in your GTFS CSV files. If you want to learn more about the GTFS format, check out my blog post: https://medium.com/@Scarysize/gently-gutting-gtfs-part-1-7a7f54a36ba0

Deploying

Just rsync everything over to the pi. If your pi broadcasts itself on the local network as raspberrypi.local, you can just use the deploy.sh script to copy the files over. Once everything is on the pi, open up a ssh session:

ssh [email protected]
cd transit-pi
npm install # this will take a long f*cking time (~2 hrs), because the sqlite3 module needs to be re-compiled

Running

Start up the node server:

node server/index.js

Start up the python program, responsible for rendering on the display

python python/main.py

You can just use something like forever to run both as background tasks.

Done.

Both the node server & pyhton script consist of very few lines of code, I encourage you to read and understand it. It isn't thoroughly tested, so if an issue arrises, you should be able to fix it on your own. I won't respond to any issues/PRs in this repository.

About

Offline GTFS based transit schedule for a raspberry pi with an Papirus e-ink display

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published