Giter Site home page Giter Site logo

kvv's Introduction

Update 11.05.2022: The KVV time table service this project made use of is gone. This code has been updated to support the newer API.

KVV

We recently (Nov 2020) got a new tram extension in Karlsruhe, Germany. To celebrate the fact that there's now a station pretty close to our home I decided to build a virtual timetable. And since I had some spare ESP8266 powered Wemos D1 and a 2.9" tricolor e-paper display I decided to use these.

Final setup

Breadboard setup

The whole setup is pretty simple and can be wired on a breadboard as depicted.

Wiring

Since the epaper display keeps the data even if not powered at all the ESP8266 simply boots up, connects to the (hardcoded) WiFi network, downloads the live data, updates the display and then powers down/goes into deep sleep. The whole setup can thus be run from a battery with the reset button exposed so it can be pushed to boot the ESP8266 and to update the display.

Breadboard setup

Final setup

For the final setup depicted above I unsoldered the connector on the displays rear and used double sided tape to stick the Wemos D1 to the display. A total of eight short wires are needed to connect both PCBs. The resulting setup is sufficiently small and robust.

Final setup rear view

Where does the data come from?

The KVV offers a live timetable. A quick look at the network traffic (or at the embedded Javascript code) reveals that some easy to handle JSON can be downloaded e.g. for the tram stop "Pionierstraße" using this http get request.

The station ID of the station to be displayed is hardcoded into the sketch. By default this is set to 7000238 which is the ID of the station named Pionierstraße. The API allows to search for IDs by station names and even parts of it. E.g. to search for any station including "Pionier" in its name use the following search: https://www.kvv.de/tunnelEfaDirect.php?action=XSLT_STOPFINDER_REQUEST&name_sf=pionier&outputFormat=JSON&type_sf=any. For other stations replace "Pionier" with the phrase you are searching for. The station IDs can then be read from the '''stateless''' field in the JSON reply.

The sketch

The sketch is based on the BasicHttpsClient.ino for the ESP8266. The display is driven using the Adafruit EPD library. And finally the JSON parsing is done using the ArduinoJson library. All these dependencies can be installed from the library manager within the Arduino IDE.

A custom generated font is being used since the fonts distributed by Adafruit with the Adafruit GFX library only include 7 bit fonts and we need an 8 bit font for the german umlauts used by the KVV.

Related projects

kvv's People

Contributors

harbaum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.