June 15, 2019

Updating the Kitchen Clock with New Stations

Since the stations of my wall clock with public transport schedule are hard coded, it is a bit of a hassle to set it up after moving to a new apartment. Here I document the steps to update the list of public transports on the device.

Updating the Kitchen Clock with New Stations

Checkout the GIT repo to a folder and open in Arduino IDE. I am using Arduino IDE because it gives me simple access to change a different memory partitioning scheme. I am using the "No OTA" partitioning scheme. Otherwise the upload process will fail with an out of application memory error message.

The application that is running on the central device is rather big. The central device is querying the public transport api, prepares the departure times in minutes and pushes new information to the peripheral device, ie. the clock with the e-ink display. The memory footprint of the application is rather large mainly due to the parsing of the full json response from the public transport api. This is also the weakest point of the system and causes numerous hickups. If I ever want to spend another weekend with this code, I would change the json parsing to stream processing, which I was promised would reduce the memeory footprint substentially.

Change the home station of the central device. Here the URL string needs to be adapted with the technical id of the new home public transport station. In the case of the MVG this technical id can be found with a request like this:

GET: http://www.mvg.de/fahrinfo/api/location/query?q=Messestadt

Change the end stops of the connections that you are interested in. The public transport connections will be identified by their end stop id and not by their connection id. These end stops and the technical ids of those stops need to be changed to your liking, like:

void initStationMap()
{
  stationMap[0].stationId = 34;
  stationMap[0].name = "Nordbad";
  stationMap[1].stationId = 670;
  stationMap[1].name = "Arabellapark";
  stationMap[2].stationId = 1250;
  stationMap[2].name = "Messestadt West";
}

This map needs to be identical on the central and the peripheral (ie. display) device. So you need to copy over the initStationMap to the display.ino file.