Micropython code for Pimoroni's Interstate 75w RP2040 board to display departure times of Munich public transport. It uses MVG API to fetch departure information for a predetermined set of stations
The code was developed for Pimoroni's Interstate 75 W (Pico W Aboard) - RGB LED Matrix Driver and uses Pimoroni's Micropython libraries to drive a generic RGB LED Madrix Panel
You can also use a RP Pico W directly connected to the LED Panel, check this schema for the connections
This code was developed using a 64x32 pixels panel, but other panel sizes (compositions) are also possible (hopefully with minimal changes)
- Check these instructions to setup your board with Pimoroni's Micropython libraries
- Include your WIFI and desired stations information in
CONFIG.py
- Move
main.py
,network_manager.py
andCONFIG.py
to pico's flash memory using Thonny
Now everytime the board is turned on it will automatically run the code
The code will update the departure information for the predetermined stations in the CONFIG.py
file
You can append multiple stations to the stations
list with the station information that you want to display (be aware of the memory limitations of rp pico w)
- Get station information from https://www.mvg.de/.rest/zdm/stations
stations.append( # First station
{
"id": ["de:09162:2"], #station IDs, used to fetch departures
"name": "Marienplatz", #station name, not used
"tariffZones":"m", #tariffZones (m, m+1, etc..), not used
"products":["UBAHN","BUS","SBAHN"], #transportation type, used in the station screen
"abbreviation":"MP", #short name, used in the station screen "filter":["S8","S1"], #only show departures with these labels (if present)
"departures": initial_departures #structure that will hold departure data
})
stations.append( # Second station
{....}
)
It is possible to include more than one id
in the station information. This will make the configured station to display departure information for multiple stations. In this case, you can use an abbreviation
name that makes sense for you.
You can use the onboard button A of i75w to change between the available stations.
There are multiple variables controling the behaviour regarding delays. These are the most important ones:
DEPARTURES_UPDATE_DELAY
: How often should we update departure information using the MVG APISTATION_DEFAULT_WAIT
: How long the station screen should be visible after startup and during station change (button A)DEPARTURES_DEFAULT_WAIT
: How long before every departure screen refreshOFFSET_DEFAULT_WAIT
: How long to wait before scrolling the departure name (for long departure names)
DISABLE_SCROLL
: Disables the scrolling of the departure name totally
departures.mp4
- MVG for the API.
- FaisalBinAhmed/MVGFahrinfo for the inspiration for this project
MIT
Due to the hardware limitations of pico w, the board will soft reset itself when facing any issues (when connecting to the wifi, when connecting to the API, etc..) Luckily, the current station will be preserved between the resets.