Template: E-paper for RPI use IT8951
- Step 3: Install the C function library, open the Raspberry Pi terminal, and execute the following codes:
1. Install bcm2835 libraries (Recommended for Pi4 (faster))
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz tar zxvf bcm2835-1.60.tar.gz cd bcm2835-1.60 ./configure make sudo make check sudo make install #For more details, you can refer to http://www.airspayce.com/mikem/bcm2835/
2. Install lg library (Recommended for Pi5, BCM library currently does not support Pi5):
#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 details, you can refer to: https://github.com/gpiozero/lg
3. Install gpiod library (optional):
#Open the Raspberry Pi terminal and run the following commands: sudo apt-get update sudo apt install gpiod libgpiod-dev
- Step 4: Enable SPI interface
The Raspberry Pi adopts SPI driver IT8951 for driving the e-Paper, hence, you need to open the SPI first:
Open the terminal command line and input:
sudo raspi-config
Choose Interfacing Options -> P4 -> SPI -> Yes.
If you use lg or gpiod library, you need to execute the following commands:
# Input the commands: sudo nano /boot/config.txt # Command out dtparam=spi=on and add dtoverlay=spi0-0cs
Input " sudo reboot " to reboot the Raspberry Pi to activate the configuration.
- Step 5: Download demo codes and compile them.
Method 1: Download from our website. (Recommended)
sudo apt-get install p7zip-full sudo wget https://files.waveshare.com/upload/8/80/IT8951_20200319_Release.7z 7z x IT8951_20200319_Release.7z -O./IT8951 cd IT8951/ sudo make clean sudo make -j4 # The BCM library is used by default, if you want to use other libraries, please change them in the Makefile or use the following commands: make -j4 LIB=LGPIO # for using lg library make -j4 LIB=GPIOD # for using gpiod library
Method 2: Download from GitHub:
git clone https://github.com/waveshare/IT8951-ePaper.git cd IT8951-ePaper/Raspberry sudo make clean sudo make -j4 # The BCM library is used by default, if you want to use other libraries, please change them in the Makefile or use the following commands: make -j4 LIB=LGPIO # for using lg library make -j4 LIB=GPIOD # for using gpiod library
- Check the VCOM value on the FPC.
Add the VCOM value as a parameter and test the e-Paper, and this model is mode 0.
sudo ./epd -1.50 0
- Demo execution phenomenon:
1) First, the e-paper will refresh the 16 gray bars partially in sequence.
2) Then demonstrate the demo of drawing lines, circles, rectangles, characters, and numbers.
3) Then respectively demonstrate the demo of displaying BMP pictures in 1bp, 2bp, and 4bp modes.
4) Next, demonstrate the effect of fast refresh in A2 mode.
5) Then display a gif animation.
6) Then demonstrate a Demo that counts the frame rate.
7) Finally, the e-paper is whitened in Init mode for long-term storage.