A collection of scripts for 7.5" Waveshare e-Ink displays
- Raspberry Pi Zero W
- Waveshare e-Paper HAT
- 7.5" Waveshare e-Ink display
-
bitcoin.py
- shows some Bitcoin info:- current price
- fear & greed index
- 7 day graph
- block time
- moscow time
- fees
-
picture.py
- loops images inpictures
folder -
fear_and_greed.py
- shows the latest Fear & Greed index gauge as image
The display hosts a small website - open http://epaper to access it.
It will show the current script (and image, if the picture script is active)
and links to refresh the display or change the script:
-
http://epaper/refresh
Refreshes the display.
When the picture script is active, it changes to the next picture. -
http://epaper/flip-the-script
Changes the current display script and refreshes the display.
Modify thescripts
variable indisplay/serve.py
to adjust included scripts.
The default scripts are thebitcoin.py
andpicture.py
script.
-
Flash dietpi to an SD card
-
Connect Raspberry Pi with HAT & display, insert SD and boot
-
SSH in with user
dietpi
-
In the home folder, clone the Waveshare e-Paper repo:
git clone https://github.com/waveshare/e-Paper.git
-
Clone this repo or download and extract it to:
/home/dietpi/e-Paper/RaspberryPi_JetsonNano/python
-
Install additional dependencies:
sudo pip3 install cairosvg
sudo pip3 install pillow
sudo pip3 install requests
-
Setup crontab:
crontab -e
- Add this line:
*/10 * * * * curl http://localhost/flip-the-script
- Press
Ctrl+X
and thenReturn
to save and exit
This will change the display script every 10 minutes, switching between bitcoin info and picture frame with the default setup.
To just refresh without changing scripts, use this in crontab:
*/10 * * * * curl http://localhost/refresh
-
Use
dietpi-config
-> Autostart options -> Custom script (background, no autologin) with this script:#!/bin/bash # DietPi-Autostart custom script # Location: /var/lib/dietpi/dietpi-autostart/custom.sh cd /home/dietpi/e-Paper/RaspberryPi_JetsonNano/python/display ./runscript.sh & python3 serve.py exit 0
-
Optional:
If you have Flic buttons you can use them to refresh the display and change the script.
A single click will refresh, double click or hold will change the script.
To set this up, open FlicHub SDK, create a new module, paste this script and start it. Then, connect a button via the app and name it
ePaper
.// main.js var buttonManager = require("buttons"); var http = require("http"); buttonManager.on("buttonSingleOrDoubleClickOrHold", function (obj) { var url = "http://epaper"; // put your hostname here if you used a different one var button = buttonManager.getButton(obj.bdaddr); var clickType = obj.isSingleClick ? "click" : obj.isDoubleClick ? "double_click" : "hold"; console.log('pressed button "' + button.name + '": ' + clickType); if (button.name === "ePaper") { switch (clickType) { case "click": url += "/refresh"; break; case "double_click": case "hold": url += "/flip-the-script"; break; default: return; } http.makeRequest( { url: url, method: "GET", }, function (err, res) { console.log("requested URL: " + url); } ); } }); console.log("Listening for ePaper button...");