跳到主要内容

搭配 树莓派 使用

硬件连接​

连接树莓派的时候,可以直接将板子插到树莓派的 40PIN 排针上去,注意对好引脚。
如果是选择用 10PIN 排线连接的话,请参考下方的引脚对应表格:

树莓派连接引脚对应关系

e-PaperRaspberry PiRaspberry Pi
BCM2835编码Board物理引脚序号
VCC3.3V3.3V
GNDGNDGND
DINMOSI19
CLKSCLK23
CS_MCE024
CS_SCE126
DC2522
RST1711
BUSY2418
PWR1812

树莓派前置设置​

关闭SPI接口​

  • 打开树莓派终端,输入以下指令进入配置界面:

    sudo raspi-config
    选择Interfacing Options -> SPI -> No 关闭SPI接口

12 12 12

  • 重启树莓派:

    sudo reboot

config.txt 文件设置​

使用命令

sudo nano /boot/config.txt

或者

sudo nano /boot/firmware/config.txt

打开对应的 config.txt 文件
在最后面添加

gpio=7=op,dl
gpio=8=op,dl

按下 Ctrl+ O(字母 O)保存
按下 Ctrl+ X 退出

  • 重启树莓派:

    sudo reboot

运行C语言例程​

  • 安装 BCM2835 (Pi4、zero等系列)

    #打开树莓派终端,并运行以下指令:
    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
    # 更多的可以参考官网:http://www.airspayce.com/mikem/bcm2835/
  • 安装 wiringPi (Pi5)

    git clone https://github.com/WiringPi/WiringPi
    cd WiringPi
    ./build
    gpio -v
    # 运行 gpio -v 会出现对应版本,如果没有出现,说明安装出错。
  • 下载程序(已下载可跳过)

    wget https://www.waveshare.net/w/upload/e/e2/13.3inch_e-Paper_E.zip
    unzip 13.3inch_e-Paper_E.zip -d 13.3inch_e-Paper_E
    cd 13.3inch_e-Paper_E/RaspberryPi/
  • 备用解压方式

    sudo apt-get install p7zip-full
    7z x 13.3inch_e-Paper_E.zip -O./13.3inch_e-Paper_E
    cd 13.3inch_e-Paper_E/RaspberryPi/
  • 通过 GitHub 下载程序(备用方式,已下载可跳过)

目前访问 GitHub 并不是很流畅,建议使用上面的方法从我们官网下载。

git clone https://github.com/waveshare/e-Paper.git
cd e-Paper/E-paper_Separate_Program/13.3inch_e-Paper_E/RaspberryPi/
  • 编译程序(说明:-j4 为使用4线程编译,数字可自行修改)

    # 此时在 13.3inch_e-Paper_E/RaspberryPi_JetsonNano 位置
    cd c
    sudo make clean
    # Pi4 使用BCM库进行驱动
    sudo make -j4 USELIB=USE_BCM2835_LIB
    # Pi5 使用wiringPi库进行驱动
    sudo make -j4 USELIB=USE_WIRINGPI_LIB
  • 运行程序

    sudo ./epd

运行python例程​

  • 安装函数库

    sudo apt-get update
    sudo apt-get install python3-pip
    sudo apt-get install python3-pil
    sudo apt-get install python3-numpy
    sudo apt-get install python3-spidev
  • 安装函数库(python2)

    sudo apt-get update
    sudo apt-get install python-pip
    sudo apt-get install python-pil
    sudo apt-get install python-numpy
    sudo apt-get install python-spidev
  • 下载程序(已下载可跳过)

    wget https://www.waveshare.net/w/upload/e/e2/13.3inch_e-Paper_E.zip
    unzip 13.3inch_e-Paper_E.zip -d 13.3inch_e-Paper_E
    cd 13.3inch_e-Paper_E/RaspberryPi/
  • 备用解压方式

    sudo apt-get install p7zip-full
    7z x 13.3inch_e-Paper_E.zip -O./13.3inch_e-Paper_E
    cd 13.3inch_e-Paper_E/RaspberryPi/
  • 通过 GitHub 下载程序(备用方式,已下载可跳过)

目前访问 GitHub 并不是很流畅,建议使用上面的方法从我们官网下载。

git clone https://github.com/waveshare/e-Paper.git
cd e-Paper/E-paper_Separate_Program/13.3inch_e-Paper_E/RaspberryPi/
  • 运行程序

    # 确保在 13.3inch_e-Paper_E/RaspberryPi/ 位置
    cd python/examples/
    python3 epd_13in3E_test.py