awesomelionel/singapore-bus-timing-edisplay
About
The code for the bus timing app on an e-ink display
Other ProjectsMeasured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- +1
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalE-Ink Bus Picture Frame
Living in Singapore, I'm truly blessed having access to public transportation that is cheap, 'reliable' and consistent. As much as most of us would complain about it everyday, it is a constant necessity that most of us take for granted.
Based on the idea from Weatherman Dashboard for ESPHome, I wanted to make something similar but using a Raspberry Pi Zero with a Waveshare 7.5inch E-Ink display.
This project creates an E-Ink display that shows real-time bus arrival times and train disruption information using data from Singapore's Land Transport Authority (LTA) DataMall API. Request for access here: LTA DataMall
Things you will need
- Raspberry Pi Zero W
- Waveshare 7.5inch E-Ink Display (EPD 7in5 V2) make sure you get the one with the HAT to connect to the Pi
- 40-pin GPIO headers for the Raspberry Pi Zero. I chose to solder it onto the board
- 3D Printed Case or an IKEA Ribba 7x5 picture frame
- 5V 3A power supply
- Micro USB flat cable
- 4GB or more SD card
Setup
Clone this repository to your Raspberry Pi.
Install the required packages:
pip install -r requirements.txtRename the
.env.examplefile to.envin the project rootReplace
your_lta_api_keywith your LTA DataMall API key, andyour_first_bus_stop_codeandyour_second_bus_stop_codewith the desired bus stop codes.API_KEY=your_lta_api_key //Get this from LTA DataMall BUS_STOP_CODE_A=your_first_bus_stop_code BUS_STOP_CODE_B=your_second_bus_stop_code
Usage
Run the main script:
python3 app/main.py
Alternatively, you can run the script automatically every time the system boots, you can set it up as a startup service using systemd on Linux-based systems, such as Raspberry Pi or Ubuntu. Here’s how you can do it:
Create a systemd service file:
Open a terminal.
Use a text editor like
nanoto create a new service file:sudo nano /etc/systemd/system/bus_display.service
Add the following content to the service file:
[Unit] Description=E-Ink Bus Display Service After=multi-user.target [Service] ExecStart=/usr/bin/python3 /path/to/your/app/main.py WorkingDirectory=/path/to/your/ StandardOutput=inherit StandardError=inherit Restart=always User=pi [Install] WantedBy=multi-user.target- ExecStart: Replace
/path/to/your/script.pywith the full path to your Python script. - WorkingDirectory: Replace
/path/to/your/with the directory containing your script. - User: Replace
piwith the username under which the script should run, if different. Restart=alwaysensures that the service restarts if it fails.
- ExecStart: Replace
Save and exit:
- Press
Ctrl + X, thenY, and thenEnterto save and exitnano.
- Press
Step 2: Enable the Service
Reload systemd to recognize the new service:
sudo systemctl daemon-reloadEnable the service to start on boot:
sudo systemctl enable bus_display.serviceStart the service immediately (optional):
sudo systemctl start bus_display.serviceCheck the status of the service:
sudo systemctl status bus_display.serviceThis command will show whether the service is active and running.
License
MIT License
Copyright (c) 2024 Lionel Tan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Explore related projects
Loading…