Working with Raspberry Pi
Hardware Connection
- When connecting to the Raspberry Pi, you can directly plug the board onto the 40PIN header, ensuring the pins are aligned correctly.
- If using a 9PIN cable, please refer to the pin mapping table below:
- Raspberry Pi pin mapping
e-Paper Raspberry Pi Pin Mapping BCM2835 Pin Board Physical Pin Number VCC 3.3V 3.3V GND GND GND DIN MOSI 19 CLK SCLK 23 CS CE0 24 DC 25 22 RST 17 11 BUSY 24 18 PWR 18 12
- Raspberry Pi pin mapping
Enabling the SPI Interface
-
Open the Raspberry Pi terminal and enter the following command to access the configuration interface:
sudo raspi-configSelect Interfacing Options -> SPI -> Yes to enable the SPI interface

-
Reboot the Raspberry Pi:
sudo reboot -
Check
/boot/config.txt, you should see thatdtparam=spi=onhas been written -
To ensure SPI is not occupied, it is recommended to temporarily disable other driver overlays. Use
ls /dev/spi*to check the SPI occupancy. The terminal output/dev/spidev0.0and/dev/spidev0.1indicates that SPI is functioning normally.
Running the C Example
-
Install the lg library
#Open the Raspberry Pi terminal and run the following commands:
wget https://github.com/joan2937/lg/archive/master.zip
unzip master.zip
cd lg-master
make
sudo make install
# For more information, please refer to the source code: https://github.com/gpiozero/lgInstall gpiod library (optional)
#Open the Raspberry Pi terminal and run the following commands:
sudo apt-get update
sudo apt install gpiod libgpiod-devInstall BCM2835 (optional)
#Open the Raspberry Pi terminal and run the following commands:
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
tar zxvf bcm2835-1.71.tar.gz
cd bcm2835-1.71/
sudo ./configure && sudo make && sudo make check && sudo make install
# For more information, please refer to the official website: http://www.airspayce.com/mikem/bcm2835/Install wiringPi (optional)
#Open the Raspberry Pi terminal and run the following commands:
sudo apt-get install wiringpi
#For Raspberry Pi systems after May 2019 (those earlier may not require execution), an upgrade may be necessary:
wget https://files.waveshare.com/wiki/common/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v
# Run gpio -v and version 2.52 will appear. If it does not appear, there is an installation error.
#Bullseye branch system uses the following command:
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
gpio -v
# Run gpio -v and version 2.60 will appear. If it does not appear, there is an installation error. -
Download the demo (skip if already downloaded)
wget https://files.waveshare.com/wiki/5inch_e-Paper/5inch_e-Paper.zip
unzip 5inch_e-Paper.zip -d 5inch_e-Paper
cd 5inch_e-Paper/RaspberryPi_JetsonNano/Alternative extraction method
git clone https://github.com/waveshare/e-Paper.git
cd e-Paper/E-paper_Separate_Program/5inch_e-Paper/RaspberryPi_JetsonNanoDownload the program via GitHub (alternative method, skip if already downloaded)
- Accessing GitHub may not be very smooth at present. It is recommended to use the above method to download from our official website.
sudo apt-get install p7zip-full
7z x 5inch_e-Paper.zip -O./5inch_e-Paper
cd 5inch_e-Paper/RaspberryPi_JetsonNano/
- Accessing GitHub may not be very smooth at present. It is recommended to use the above method to download from our official website.
-
Compile the program (Note:
-j4uses 4 threads for compilation; you can modify the number)# It is now in 5inch_e-Paper/RaspberryPi_JetsonNano position
cd c
sudo make clean
sudo make -j4 -
Run the program
sudo ./epd
Running the Python Example
-
Install libraries
sudo apt-get update
sudo apt-get install python3-pip
sudo apt-get install python3-pil
sudo apt-get install python3-numpy
sudo pip3 install spidevInstall libraries (python2)
sudo apt-get update
sudo apt-get install python-pip
sudo apt-get install python-pil
sudo apt-get install python-numpy
sudo pip install spidevInstall gpiozero library (pre-installed by default, if not, install using the following commands)
sudo apt-get update
# python3
sudo apt install python3-gpiozero
# python2
sudo apt install python-gpiozero -
Download the demo (skip if already downloaded)
wget https://files.waveshare.com/wiki/5inch_e-Paper/5inch_e-Paper.zip
unzip 5inch_e-Paper.zip -d 5inch_e-Paper
cd 5inch_e-Paper/RaspberryPi_JetsonNano/Alternative extraction method
sudo apt-get install p7zip-full
7z x 5inch_e-Paper.zip -O./5inch_e-Paper
cd 5inch_e-Paper/RaspberryPi_JetsonNano/Download the program via GitHub (alternative method, skip if already downloaded)
- Accessing GitHub may not be very smooth at present. It is recommended to use the above method to download from our official website.
git clone https://github.com/waveshare/e-Paper.git
cd e-Paper/E-paper_Separate_Program/5inch_e-Paper/RaspberryPi_JetsonNano
- Accessing GitHub may not be very smooth at present. It is recommended to use the above method to download from our official website.
-
Run the program
# Make sure it is in 5inch_e-Paper/RaspberryPi_JetsonNano/ position
cd python/examples/
python3 epd_5in0_test.py