Summary
e-Paper Photo Display
Please see the full details at the github page
Introduction
This project transforms a Raspberry Pi Zero 2 W with a Waveshare 7.5-inch e-Paper display into a dynamic photo viewer that fetches images from Firebase Storage and displays them with an overlayed clock. I created this project for my grandparents as a gift for Christmas 2024. They absolutely loved it! It's a wonderful present for anyone who is away from their loved ones and wants a meaningful way to stay connected. This e-Paper display serves as a constant reminder of your presence.
Components
Required Parts
-
Waveshare 7.5-inch e-Paper HAT
-
Raspberry Pi Zero 2 W
-
PLA Filament
- Any standard PLA filament for 3D printing.
- Screws and Nuts
- 4x M2.5 screws
- 4x M2.5 nuts
3D Printed Parts
STL Files
The project includes 3D printable files for the frame of the e-Paper display. You can find them in the STL folder:
- Frame_Base.stl
- Frame_Lid.stl
Use your preferred 3D printing software to print these parts. Ensure that your printer settings match the specifications required for your PLA filament.
Assembly
-
Print the Frame:
- Use the provided STL files to print Frame_Base.stl and Frame_Lid.stl.
-
Assemble the Display:
- Attach the Waveshare e-Paper HAT to the Raspberry Pi Zero 2 W using the M2.5 screws and nuts.
- Secure the Raspberry Pi and e-Paper display within the 3D printed frame.
- Connect Power:
- Ensure that the Raspberry Pi is connected to a reliable power source.
Software Setup
1. Prepare Your Raspberry Pi
Before proceeding, ensure that your Raspberry Pi Zero 2 W is:
-
Configured with the Latest OS:
- Install Raspberry Pi OS Lite for minimal setup.
-
Connected to the Network:
- Edit the wpa_supplicant.conf file to include your Wi-Fi credentials.
- SSH Enabled:
- Place an empty file named ssh (without any extension) in the boot partition of the SD card to enable SSH.
Example wpa_supplicant.conf:
country=USctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdevupdate_config=1network={ ssid="YOUR_WIFI_SSID" psk="YOUR_WIFI_PASSWORD"}2. Install Dependencies
Connect to your Raspberry Pi via SSH and install the required packages:
sudo apt updatesudo apt install -y python3-pip gitpip3 install firebase-admin Pillow schedule requestspip3 install waveshare-epdNotes:
-
Python 3: Ensure that Python 3 is installed on your Raspberry Pi. You can check the version using:
python3 --version -
pip3: The Python package installer should be available. If not, install it using:
sudo apt install -y python3-pip - Waveshare e-Paper Library: The waveshare-epd library is required for interfacing with the e-Paper display. Ensure compatibility with your specific e-Paper model.
3. Configure the Script
-
Clone the Repository:
Replace yourusername and your-repo-name with your actual GitHub username and repository name.
git clone https://github.com/yourusername/your-repo-name.gitcd your-repo-name -
Edit the Configuration:
Open the eink.py script and replace the placeholder paths and settings with your own.
nano eink.pyConfiguration Section:
# ============================# Configuration (replace the following with your own settings)# ============================CACHE_DIR = '/path/to/your/eink_cache' # REPLACE with your cache directory pathFONT_PATH = "/path/to/your/fonts/DejaVuSans.ttf" # REPLACE with your font file pathDISPLAY_WIDTH = 800 # REPLACE with your display's widthDISPLAY_HEIGHT = 480 # REPLACE with your display's heightIMAGE_DISPLAY_DURATION = 300CLOCK_UPDATE_INTERVAL = 60FIREBASE_CREDENTIALS_PATH = "/path/to/your/firebase-service-account.json" # REPLACE with your Firebase credentials pathFIREBASE_BUCKET_NAME = "your-firebase-bucket-name.appspot.com" # REPLACE with your Firebase Storage bucket nameFOLDER_NAME = "your_photos_folder" # REPLACE with your Firebase Storage folder nameSETTINGS_COLLECTION = "settings" # REPLACE if using a different collection nameSETTINGS_DOCUMENT = "display_settings" # REPLACE if using a different document name- CACHE_DIR: Directory to store cached images.
- FONT_PATH: Path to your TrueType font file.
- DISPLAY_WIDTH & DISPLAY_HEIGHT: Resolution of your e-Paper display.
- IMAGE_DISPLAY_DURATION: Time each image is displayed (in seconds).
- CLOCK_UPDATE_INTERVAL: Interval for clock updates (in seconds).
- FIREBASE_CREDENTIALS_PATH: Path to your Firebase service account JSON file.
- FIREBASE_BUCKET_NAME: Your Firebase Storage bucket name.
- FOLDER_NAME: Folder in Firebase Storage where images are stored.
- SETTINGS_COLLECTION & SETTINGS_DOCUMENT: Firestore collection and document names for display settings.
Save and Exit:
Press CTRL + X, then Y, and Enter to save the changes and exit the editor.
4. Upload Firebase Configuration
Securely transfer your Firebase service account JSON file to the Raspberry Pi. You can use scp from your local machine:
scp /path/to/your/firebase-service-account.json pi@your_pi_ip:/path/to/your/firebase-service-account.jsonReplace /path/to/your/firebase-service-account.json with the actual path on your local machine and /path/to/your/firebase-service-account.json with the desired path on the Raspberry Pi.
Example:
scp ~/Downloads/firebase-service-account.json pi@192.168.1.100:/home/pi/your-repo-name/firebase-service-account.jsonEnsure Permissions:
On the Raspberry Pi, set appropriate permissions for the Firebase credentials file:
chmod 600 /home/pi/your-repo-name/firebase-service-account.json5. Set Up Script to Run on Startup
To ensure the script runs automatically after the Raspberry Pi boots and connects to the network, set it up as a systemd service.
-
Create a Service File:
sudo nano /etc/systemd/system/eink.service -
Add the Following Content:
[Unit]Description=e-Paper Photo Display ServiceAfter=network-online.targetWants=network-online.target[Service]ExecStart=/usr/bin/python3 /home/pi/your-repo-name/eink.pyWorkingDirectory=/home/pi/your-repo-nameStandardOutput=inheritStandardError=inheritRestart=alwaysUser=pi[Install]WantedBy=multi-user.target- ExecStart: Path to the Python interpreter and your script.
- WorkingDirectory: Directory where your script is located.
- User: The user to run the script as (pi is default).
-
Reload systemd and Enable the Service:
sudo systemctl daemon-reloadsudo systemctl enable eink.servicesudo systemctl start eink.service -
Check Service Status:
sudo systemctl status eink.serviceEnsure that the service is active and running without errors.
Running the Project
Once assembled and configured, the e-Paper display will automatically start displaying images from Firebase Storage and updating the clock based on your settings.
Adding Images
-
Upload Images to Firebase Storage:
- Navigate to your Firebase Console.
- Go to Storage and upload images to the specified FOLDER_NAME.
- Supported Image Formats:
- Ensure that the images are in a supported format (e.g., JPEG, PNG).
Updating Settings
-
Firestore Configuration:
- Navigate to Firestore in your Firebase Console.
- Locate the SETTINGS_COLLECTION and SETTINGS_DOCUMENT.
-
Available Settings:
{"show_clock": true,"show_photos": true,"timezone": "America/New_York"}- show_clock (Boolean): Whether to display the clock.
- show_photos (Boolean): Whether to display photos.
- timezone (String): Timezone for the clock (e.g., "America/New_York").
- Modify Settings:
- You can update these settings at any time, and the script will fetch the latest settings based on the configured intervals.
Troubleshooting
-
Font Not Found:
- Ensure the FONT_PATH in the script points to a valid TrueType font file.
-
Firebase Initialization Errors:
- Verify that the Firebase credentials file exists at the specified path and has the necessary permissions.
-
Display Issues:
- Check connections between the Raspberry Pi and the e-Paper display.
- Ensure the correct e-Paper library (waveshare-epd) is installed.
-
Service Not Starting:
- Check the status of the systemd service using:
- Review logs for any errors and ensure all paths in the service file are correct.
-
Network Issues:
- Confirm that the Raspberry Pi is connected to the internet.
- Ensure Wi-Fi credentials are correctly configured in wpa_supplicant.conf.
- Image Download Failures:
- Ensure that the images in Firebase Storage are publicly accessible or that the service account has the necessary permissions.
- Check internet connectivity.
Tags
Modellquelle
