Template: 1.9inch Raspberry Pi Guides

From Waveshare Wiki
Revision as of 06:07, 2 September 2023 by Waveshare-admin (talk | contribs) (Text replacement - "https://www.waveshare.com/w/upload/" to "https://files.waveshare.com/upload/")
Jump to: navigation, search

Raspberry Pi

Provides BCM2835, WiringPi, IO, RPI (Python) libraries and demos.

Hardwware Connection

If the e-Paper you have is the HAT version which has 40pin GPIO, you can directly attach the e-Paper HAT on Raspberry Pi, otherwise, you can connect your e-Paper to Raspberry Pi by an 8pins cable provided.
To connect the e-Paper, you can follow the table below:

Raspberry Pi Pin Connection
e-Paper Raspberry Pi
BCM2835 Board
VCC 3.3V 3.3V
GND GND GND
SDA SDA.1 3
SCL SCL.1 5
RST 4 7
BUSY 17 11

1.9inch Raspberry Pi Guides01.jpg

Enable I2C Interface

The communication interface of e-Paper is SPI, to use it, we should firstly enable the SPI interface.
Open terminal of Raspberry Pi, and open the configuration by the following command:
sudo raspi-config
Choose Interfacing Options -> SPI -> Yes
Restart Raspberry Pi
sudo reboot

RPI open spi.png

Install libraries

Note: If you use the Bullseye image, please use "apt" instead of "apt-get" to install libraries, the Bullseye image could only support ptyhon3.


Open the terminal of Raspberry Pi and run the following commands to install corresponding libraries:

  • Install BCM2835 libraries
#Open the Raspberry Pi terminal and run the following command
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 libraries
#Open the Raspberry Pi terminal and run the following command
sudo apt-get install wiringpi
#For Raspberry Pi systems after May 2019 (earlier than before, you may not need to execute), you may need to upgrade:
wget https://project-downloads.drogon.net/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, the installation is wrong
#Bullseye branch system use 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, it means that there is an installation error
  • Download demo (you can skip this step if you have downloaded it.)
sudo apt-get install p7zip-full
wget  https://files.waveshare.com/upload/f/f6/E-Paper-Segment-Code.zip
7z x E-Paper-Segment-Code.zip -O./e-Paper
cd e-Paper/RaspberryPi/
  • Compile demo (Note: -j4 is compiled with 4 threads, the number can be modified by yourself)
# Now at e-Paper/RaspberryPi location
cd c
sudo make clean
sudo make -j4
  • Run the demo
sudo ./main

Run Python Demo

  • Install library
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 RPi.GPIO
sudo apt-get install python3-smbus
  • Install function library
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 RPi.GPIO
sudo apt-get install python-smbus
  • Download demo (you can skip this step if you have downloaded it.)
sudo apt-get install p7zip-full
wget  https://files.waveshare.com/upload/f/f6/E-Paper-Segment-Code.zip
7z x E-Paper-Segment-Code.zip -O./e-Paper
cd e-Paper/RaspberryPi/
  • Run the demo
#Make sure it is in e-Paper/RaspberryPi/
cd python/examples/
sudo python3 main.py