_|_|_| _|_| _|_|
_|_| _|_|_| _|_|_| _| _| _| _|_| _| _|_|_|
_|_|_|_| _|_| _| _| _|_| _| _|_|_|_| _|_|_|_| _| _|
_| _|_| _| _| _| _| _| _| _| _|
_|_|_| _|_|_| _|_|_| _|_|_| _|_|_|_| _|_|_| _| _|_|_|
_|
_|
The aim of this project is to display the departure data of one or more VVS stations (Haltestellenmonitor) on an ESP32 microcontroller equipped with an Oled SSD1306 display. VVS is the Stuttgart public transport system. VVS provides the current timetable of relevant stations by a public available REST endpoint. Micropython is the programming language of choice for this project.
Here is what you get when you deploy the application on your ESP32 board:
The top line contains the current time. The other lines hold the tram/bus line number, the departure time, the delay and the short name of the station (RH, SMi). (The relevant tram/bus lines and stations are configurable within a configuration resource)
Please note that the hosted version of the public REST endpoint (metaEFA) used by this project is not available anymore. Information on hosting a MetaEFA server yourself can be found at https://github.com/opendata-stuttgart/metaEFA.
Links:
- http://www.vvs.de/
- https://github.com/opendata-stuttgart/metaEFA
- https://www.espressif.com/en/products/socs/esp32
- https://www.aliexpress.com/item/Lolin-ESP32-OLED-wemos-for-Arduino-ESP32-OLED-WiFi-Modules-Bluetooth-Dual-ESP-32-ESP-32S/32807531243.html
- http://micropython.org/
This is just a brief description of what steps have to be performed to enable the development of this application. Please consult Google to get in-depth details.
- Install the USB driver to enable board access: https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
- Install python 3.x
- Clone the repository
git clone https://github.com/aschuma/esp32_ssd1306_metaefa.git
- Create a virtual environment, you may obtain more information about the steps below here: http://docs.python-guide.org/en/latest/dev/virtualenvs/
cd esp32_ssd1306_metaefa/ virtualenv py3 -p $(which python3) source py3/bin/activate
- Install development tools (
ampy
,rshell
)pip3 install -r requirements.txt
- Download the latest ESP32 micropython image from https://micropython.org/download
- Prepare the board
esptool.py --port /dev/cu.SLAB_USBtoUART flash_id esptool.py --port /dev/cu.SLAB_USBtoUART erase_flash esptool.py --port /dev/cu.SLAB_USBtoUART write_flash -z 0x1000 <path-to-downloaded-image>
- The subsequent command is for MacOS only. Similar tools are available for Linux and Windows.
After that, you will be connected to the micropython shell running on the board. You may leave the shell by typing
screen /dev/cu.SLAB_USBtoUART 115200
Ctrl-A
,K
andy.
- File explorer
The files on the board should be available locally at
rshell -p /dev/cu.SLAB_USBtoUART
/pyboard
on your dev machine. You may copy files to the board by using thecp
command. More details are available here: https://github.com/dhylands/rshell
Please be aware that you can not use multiple shells simultaneously to the access the board.
- Copy
src/config.py.template
tosrc/config.py
and adjust at least the wifi settings. - Copy recursively all files of
src
to the root directory of the board using thershell
tool or theampy
tool. - The board should reboot itself. If not unplug the USB cord and plug it back again.
- In case of problems to connect to the board via
screen /dev/cu.SLAB_USBtoUART 115200
pressCTRL-C
andCTRL-D
to trigger a reboot. Then you should see some log messages.
Be aware that my primary coding language is not python. So please forgive me my bad coding style. I'm still learning python and ESP32 development.
Please feel free to issue a bug report or submit a PR. Any helping hand is welcome.