The purpose of this project is to display various data points on an Waveshare 5.83in V2 e-ink display powered by a Raspberry Pi.
This project contains two parts:
/pythoncontains all the files needed to retrieve and print all the data for the display./webappcontains a web app and node.js server that can be used to remotely trigger commands on the display.
Review the READMEs in those respective directories to learn more.
This set-up guide assumes you are running Rasberry Pi OS Lite on your Pi and have already set up internet access.
-
Complete the Waveshare instructions under the Working With Raspberry Pi Hardware Connection and Python sections.
-
Install Node Version Manager (NVM).
-
Install NodeJS 14 via nvm on the Pi. Note the unofficial build needs to be used to support the proper architecture of the Pi Zero.
NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release nvm install 14 -
Install git
sudo apt update sudo apt install git -
Clone this repo to your Pi. For this example, the repo will be stored under a
reposdirectory under the home directory.cd ~/repos git clone https://github.com/rbitting/pi-display.git -
Complete all prerequisites listed in python/README.md
-
Set up a cron job to run the display refresh at regular intervals. Enter the command
crontab -eto edit the crontab file. Then add the following line (this will run the script every 30 minutes):*/30 * * * * cd /absolute/path/to/python && python3 main.pyExample:
*/30 * * * * cd /home/pi/repos/pi-display/python && python3 main.py -
Set up a cron job to run the display refresh on Pi start-up. Enter the command
crontab -eto edit the crontab file. Then add the following line:@reboot sleep 30 && cd /absolute/path/to/python && python3 main.py &Example:
@reboot sleep 30 && cd /home/pi/repos/pi-display/python && python3 main.py & -
Run
npm installandnpm run buildfrom in thewebappdirectory. -
To launch the web app on Pi start-up, enter the command
crontab -eto edit the crontab file. Then save the following line in the file (be sure to update thenode-versionto what you have installed):@reboot sleep 30 && cd /absolute/path/to/webapp && /home/pi/.nvm/versions/node/node-version/bin/node server.js >> /absolute/path/to/where/you/want/logs 2>&1 &@reboot sleep 30 && cd /home/pi/repos/pi-display/webapp && /home/pi/.nvm/versions/node/v14.18.2/bin/node server.js >> /home/pi/logs/server.log 2>&1 & -
Set up a static IP address for your Pi.
-
Install Apache web server on your pi:
sudo apt install apache2 -
Update the Apache configuration file to proxy port 3000 requests. This will allow access to the webapp at the Pi's direct IP. Open the file:
sudo nano /etc/apache2/sites-available/000-default.confthen append the following within
<VirtualHost *:80>under theDocumentRoot /var/www/htmlline:ProxyRequests off <Proxy *> Order deny,allow Allow from all </Proxy> <Location /> ProxyPass http://localhost:3000/ ProxyPassReverse https://localhost:3000/ </Location> -
Enable the Apache proxy:
sudo a2enmod proxy sudo a2enmod proxy_http systemctl restart apache2 -
Reboot the Pi for all updates to take effect:
sudo reboot
- All logs are stored under the
/logsdirectory on your Pi
-
If display is printing incorrect times, you may need to update the timezone of your Pi:
sudo raspi-config->Internationalisation Options->Change Timezone-> Follow screen directions to change country and time zone -
If you receive errors around the font files, update the font permissions:
chmod 744 python/assets/fonts
If you've found this code helpful and would like to provide some support, consider buying me a coffee!
