Skip to content

Installation

captncode edited this page Apr 27, 2021 · 6 revisions

Set up a Raspberry Pi 2 or later. This has been tested on a Raspberry Pi 3B+ running Raspberry Pi OS Lite (32-bit).

Verify it is on the network.

Log in and configure the system:

sudo raspi-config
Choose Interfacing Options -> SPI -> Yes  to enable SPI interface
Choose System Options -> Password  to change the default password for user pi
Choose System Options -> Hostname  to change the system hostname
Choose Localisation Options -> Locale  to set up your locale
Choose Localisation Options -> Timezone  to set up your timezone

Shut down the system:

sudo shutdown -h now

Remove power from the system and install a Waveshare E-Paper display with HAT. The currently supported versions can be found here:

Power the system up and log back in.

Install libgdiplus and fontconfig packages:

sudo apt update
sudo apt install libgdiplus
sudo apt install fontconfig

The tzdata package is also required but automatically installed with Raspberry PI OS Lite.

Update/Upgrade to the latest versions of all packages:

sudo apt upgrade

Copy any desired TrueType or OpenType fonts to /usr/local/share/fonts.

Update the font cache after installing any font:

sudo fc-cache

You can verify font installation using fc-list. If the iotdisplay service is running, it will need to be stopped and restarted (or the system rebooted) in order to use any new font.

Deploy the project to the Raspberry Pi into its own folder such as /usr/local/iotdisplay. If the Console app is desired, it can be deployed to the same folder as the Web API.
See https://docs.microsoft.com/en-us/dotnet/iot/deployment

Create a folder for the service to store its state files such as /home/iotdisplay. /tmp will not work as the folder is flushed after reboot.

Make sure the state folder can be accessed:

sudo chown pi.pi /home/iotdisplay

Update the appsettings.json file with the desired settings including state folder, driver type and driver name. The E-Paper driver names can be found here.

Test the web API by running:

/usr/local/iotdisplay/IoTDisplay.Api

Your E-Paper screen should flash black and white while it is starting.

See if it is running by opening a browser to http://[host name]:5000/swagger/index.html

Back on the Raspberry Pi, stop the web API with Ctrl-C

Set up API to run as a service:

Create the following as a file in /etc/systemd/system named iotdisplay.service

[Unit]
Description=IoT Display service

[Service]
ExecStart=/usr/local/iotdisplay/IoTDisplay.Api
WorkingDirectory=/usr/local/iotdisplay/
User=pi
Group=pi
Restart=on-failure
SyslogIdentifier=iotdisplay

[Install]
WantedBy=multi-user.target

Make sure the paths above match the path the project was deployed to.

Set up to start automatically:

sudo chmod 644 /etc/systemd/system/iotdisplay.service
sudo systemctl enable iotdisplay

Start the web API:

sudo systemctl start iotdisplay

Watch the E-Paper screen to make sure it flashes black and white. Test the web API one more time in a browser.

Hopefully success!

Clone this wiki locally