• sales

    +86-0755-88291180

RPi-Zero-PhotoPainter-ACCE User Guide

Overview

Parameters

Display Size160.0mm × 96.0mm
Outline Dimensions154.0mm × 214.0mm × 32.0mm
Screen Pixel Pitch0.2mm × 0.2mm
Screen Resolution800 × 480
Display ColorBlack, White, Green, Blue, Red, Yellow
Grayscale2
Refresh Time12s
Charging Voltage/Operating Voltage5V
  • Refresh time: The refresh time is based on experimental test data, and there may be errors in the actual refresh time. The actual results shall prevail. There will be a flickering effect during the global refresh process, which is a normal phenomenon.

Picture Production

  • To make a scatter plot with PS and other tools, please refer to: E-Paper Floyd-Steinberg
  • Use the tools we have written to convert images, applications and source codes: Six-color dithering image conversion tool
    • The program converts images to appropriate resolutions and optimizes them using dithering algorithms, supports most formats of images, recognizes the orientation of images and automatically stretches and crops them
    • How to use: Drag and drop the picture directly onto "convert.exe" to convert a single image, or put all the images into a folder and then double-click "converterTo6color_all.cmd" for batch conversion
    • Note: This program is developed and open source for the convenience of customers only, and we do not provide technical support for it

Tools for Windows

  • Conversion of a single image

Drag the image onto convert.exe

  • Batch conversion of images

Put the images, convert.exe, and converterTo6color_all.cmd in a folder, and then double-click converterTo6color_all.cmd

Tools for MAC

Put the images, convert, and converterTo6color_all in a folder
Open the terminal and enter the corresponding folder

cd xxxx/xxx/xxx/
  • Conversion of a single image

Enter the command to grant the convert executable permission

sudo chmod +x convert

Image conversion

./convert image name
  • Batch conversion of images

You need to perform permission operations on the convert file first
Enter a command to give converterTo6color_all.sh executable permissions

sudo chmod +x converterTo6color_all.sh

Image conversion

./converterTo6color_all.sh

Introduction to Pre-built Systems

  • The large AI models are pre-set up and ready to use
  • The default time zone 0 is used, which can be modified through the Time Zone Settings section
  • The default update time is 8 o'clock sharp, which can be modified through the Scheduled Refresh section
  • It is recommended to clear the corresponding logs regularly, refer to Script Usage and Scheduled Refresh
  • Username: pi
  • Password: raspberry
  • Host name: zero2w

AI Model Construction

Refer to Dylan's open-source program on GitHub for building: https://github.com/dylski/PaperPiAI
The construction is relatively complex, and the process requires networking. You can also use the system we have already built

Hardware Preparation

  • 32GB memory card, about 20GB of content will be added during the construction process
  • Recommended system: Raspberry Pi OS (64-bit)
  • Raspberry Pi Zero 2 W (PS: I used this directly for installation)
  • ETH/USB HUB HAT (Optional, PS: Mainly used for accessing the network cable, downloading via WiFi is not as stable as downloading via the network cable)

Software Construction

  • Flash the system to the memory card
  • Update the source and update the software
sudo apt-get update
sudo apt-get upgrade
  • Install git, download the repository
sudo apt install git
  • Download reference repository (optional)
git clone https://github.com/dylski/PaperPiAI.git
cd PaperPiAI
scripts/install.sh  # You can install it directly using the installation script, or by executing the commands in the shell file step by step
  • Install the necessary tools
sudo apt-get -y install tmux vim
sudo apt-get -y install cmake
sudo apt-get -y install python3-dev python3-venv python3-pip
sudo apt-get -y install imagemagick
sudo apt-get -y install git git-lfs
sudo apt-get -y install libopencv-dev  python3-opencv
  • Create a folder and enter (I directly downloaded the repository here, so I'm using this directly)
cd PaperPiAI
  • Create a virtual environment (only create it once; if created later, some software packages need to be re-downloaded)
python3 -m venv venv
PS: Why install a virtual environment?
    Under the official requirements of Python, some python libraries can only be installed in a virtual environment
    The latest Raspberry Pi system also did the same
  • Enter the virtual environment (exit command: deactivate)
. venv/bin/activate
  • Install some software
python -m pip install opencv_contrib_python
python -m pip install inky[rpi]==1.5.0
python -m pip install pillow

Install Large AI Models

cd  ~/PaperPiAI
git clone https://github.com/google/XNNPACK.git
cd XNNPACK
git checkout 1c8ee1b68f3a3e0847ec3c53c186c5909fa3fbd3
mkdir build
cd build
cmake -DXNNPACK_BUILD_TESTS=OFF -DXNNPACK_BUILD_BENCHMARKS=OFF ..    # Here you need to download some corresponding repositories from github
cmake --build . --config Release    # The zero 2W here compiles for more than three hours 
  • Go to the directory you created earlier and download and install OnnxStream
cd  ~/PaperPiAI
git clone https://github.com/vitoplantamura/OnnxStream.git
cd OnnxStream
cd src
mkdir build
cd build
cmake -DMAX_SPEED=ON -DOS_LLM=OFF -DOS_CUDA=OFF -DXNNPACK_DIR="${INSTALL_DIR}/XNNPACK" ..      # Here you need to download some corresponding repositories from github
cmake --build . --config Release      # Here zero 2W compilation takes about ten minutes 
  • Download large model resources
cd  ~/PaperPiAI
mkdir models
cd models
git clone --depth=1 https://huggingface.co/vitoplantamura/stable-diffusion-xl-turbo-1.0-anyshape-onnxstream
#Download about 9G

AI Model Usage

Increase Swap Size for Compilation

  • The default swap size of zero is 512, which is easy to lose WiFi and freeze when generating and parsing images
  • Enter the command
sudo nano /etc/dphys-swapfile
  • Change the value of conc_swapsize to 1024

RPi Zero PhotoPainter-16.jpg

  • Press Ctrl + O to save, Ctrl + C to exit
  • Restart dphys-swapfile
sudo /etc/init.d/dphys-swapfile restart

Self-built Models

  • Download our package
wget https://files.waveshare.com/wiki/RPi_Zero_PhotoPainter/Demo/RPi_Zero_PhotoPainter.zip
unzip -o RPi_Zero_PhotoPainter.zip -d RPi_Zero_PhotoPainter
cd RPi_Zero_PhotoPainter
cp -r Waveshare_E-Paper ~/PaperPiAI     # The path for building large models before with PaperPiAI
cd cd ~
  • Run a large model
cd PaperPiAI 
python Waveshare_E-Paper/generate_picture.py --steps 1  # Generate images using random instructions in the default configuration
python3 Waveshare_E-Paper/display_picture.py -m epd7in3e

Download Configured System

  • Run a large model
cd PaperPiAI 
python Waveshare_E-Paper/generate_picture.py --steps 1  # Generate images using random instructions in the default configuration
python3 Waveshare_E-Paper/display_picture.py -m epd7in3e

Command Parsing

generate_picture.py

  • Default output path (if you want to modify it, you need to put the directory at the end)
PaperPiAI/output_dir
  • Default JSON retrieval (for image generation prompts)
Waveshare_E-Paper/flowers.json
  • Other
--prompt     Use the prompt directly, overriding the prompt file (empty by default)
--prompts    Prompt the configuration file path (default Waveshare_E-Paper/flowers.json)
--seed	      Random seed reproduction
--steps      Number of generation steps (Higher = better quality but slower, default 5, recommended 1 step)
                 zero2w: 1 step takes about 34 minutes; 5 steps take about 1.5 hours
                 Pi5: 1 step takes about 5 minutes; 5 steps takes about 34 minutes
--width      Image width (default 800)
--height     Image height (default 480)
--sd         Stable diffusion binary path (not recommended to modify)
--model      Stable diffusion model path (not recommended to modify)
--overwrite  Overwrite existing output files
--no-copy    Do not copy to shared files

display_picture.py

  • Default image input path
PaperPiAI/output_dir/output.png
  • Default cropped image input path
PaperPiAI/output_dir
#The output name is:  processed_TIMESTAMP.png
  • Other:
-o  Output path and name
-p  Portrait mode (forced rotation 90°)
-c  Center cropping, not smart cropping
-r  Only resize the image without cropping
-s  Simulated display, no actual output
-m  Display model (e.g., epd7in3e)
--skip-fit  If the image size matches the display perfectly, skip the adjustment

Use image data at the specified location (place the image position at the end of the command, no need to input the corresponding operation command)

python3 Waveshare_E-Paper/display_picture.py -m epd7in3e ./output_dir/processed_20250729_122744.png

Script Usage

  • The command for generating images above is separate from the e-Paper screen refresh command. We have to wait for the image to be generated before refreshing the image, which is very inconvenient. Therefore, we provide a script code to automatically complete this process
  • cron_flower.log Output English logs
  • cron_flower-CN.log Output Chinese logs
#Download the demo (skip if already downloaded)
wget https://files.waveshare.com/wiki/RPi_Zero_PhotoPainter/Demo/RPi_Zero_PhotoPainter.zip
unzip -o RPi_Zero_PhotoPainter.zip -d RPi_Zero_PhotoPainter

#Enter the script directory
cd RPi_Zero_PhotoPainter/script_code
cp -r cron_flower.sh ~/PaperPiAI    # PaperPiAI is the path to building large models
#If you want to display Chinese logs, please transmit the following script
# cp -r cron_flower-CN.sh ~/PaperPiAI

# Enter the project directory (modify according to your own large model folder)
cd /home/pi/PaperPiAI
  • You must add executable permissions to the script, otherwise it cannot run:
chmod +x /home/pi/PaperPiAI/cron_flower.sh
  • Run script file
./cron_flower.sh
  • Logs will be printed normally on the terminal, and the logs will also be saved in the /home/pi/PaperPiAI/image_update.log file. It is recommended to delete them regularly
> /home/pi/PaperPiAI/image_update.log
  • If you are using cron_flower-CN.sh, the logs will be saved in the /home/pi/PaperPiAI/cron_flower.log file
  • The delete command is
> /home/pi/PaperPiAI/cron_flower.log

Scheduled Refresh

  • Make sure you have completed the above steps for installing the large model, demos, and scripts
  • Enter the command
crontab -e
  • If it's the first time entering, it will enter the compiler selection page; it is recommended to choose the nano editor; enter 1, then press Enter
Select an editor.  To change later, run 'select-editor'.
  1. /bin/nano        <---- easiest
  2. /usr/bin/vim.basic
  3. /usr/bin/vim.tiny
  4. /bin/ed

Choose 1-4 [1]: 
  • Move the cursor to the end, then enter the scheduled execution command
0 8 * * * /home/pi/PaperPiAI/cron_flower.sh >> /home/pi/PaperPiAI/cron_log.log 2>&1
  • Command parsing (which can be understood as the alarm setting of a mobile phone, presenting a similar effect)
0 8 * * *
  0: Minute
  8: Hour
  * * *: Year Month Day
/home/pi/PaperPiAI/cron_flower.sh
  Script path
>>
  Log append output → Each time the script runs, the log will be appended to the end of cron_log.log, and the file will continue to grow with each run;
/home/pi/PaperPiAI/cron_log.log
  The path where logs are saved
2>&1
  Redirect error logs to the same file as well, mixing them with normal logs;
  • It is recommended to regularly clear the corresponding log files, the command is as follows
> /home/pi/PaperPiAI/cron_log.log

Time Zone Settings

  • The system defaults to the time zone of 0, which is the time based on the Prime Meridian (0-degree longitude)
  • You can set it using the following command, taking China as an example
  • Enter the command
sudo dpkg-reconfigure tzdata
  • Select Asia, then choose Shanghai or Beijing

RPi Zero PhotoPainter-13.jpg
RPi Zero PhotoPainter-14.jpg

  • The following prompt will pop up after success

RPi Zero PhotoPainter-15.jpg

Demo Usage

e-Paper Driver

Hardware Connection

Please note that the PWR pin of this circuit is different from the PWR pin used in our general demo. If using the program from the general demo, make sure to modify it accordingly

Raspberry Pi connection pin correspondence
e-PaperRaspberry Pi
BCM2835 encodingBoard physical pin number
VCC3.3V3.3V
GNDGNDGND
DINMOSI19
CLKSCLK23
CSCE024
DC2522
RST1711
BUSY2418
PWR2713

Enable SPI Interface

  • Open the Raspberry Pi terminal and enter the following command to enter the configuration interface:
sudo raspi-config
Select Interfacing Options -> SPI -> Yes to enable the SPI interface

RPI open spi.png

  • Restart Raspberry Pi:
sudo reboot
  • Check /boot/config.txt and you can see that 'dtparam=spi=on' has been written to

RPI open spi 1.jpg

  • To ensure that SPI is not occupied, it is recommended that other driver overlays be temporarily turned off. You can use ls /dev/spi* to check the SPI occupancy. The terminal output /dev/spidev0.0 and /dev/spidev0.1 indicates that the SPI situation is normal

RPI open spi 2.jpg


Run C Demo

  • Install 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/lg

  • Install gpiod library (optional)
#Open the Raspberry Pi terminal and run the following commands:
sudo apt-get update
sudo apt install gpiod libgpiod-dev

  • Install 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 (you can skip it if you have already downloaded it)
wget https://files.waveshare.com/wiki/RPi_Zero_PhotoPainter/Demo/RPi_Zero_PhotoPainter.zip
unzip -o RPi_Zero_PhotoPainter.zip -d RPi_Zero_PhotoPainter
cd RPi_Zero_PhotoPainter/7in3_e-Paper_E
  • Compiler program (Note: -j4 means using 4 threads for compilation, the number can be modified by yourself)
# At this point in RPi_Zero_PhotoPainter/7in3_e-Paper_E location
cd c
sudo make clean
sudo make -j4
  • Run the demo
sudo ./epd

Run Python Demo

  • Install function 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 spidev

  • Install function library (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 spidev

  • Install gpiozero library (the system has installed it by default, if it is not installed, please follow the following command to install it)
sudo apt-get update
# python3
sudo apt install python3-gpiozero
# python2
sudo apt install python-gpiozero
  • Download the demo (you can skip it if you have already downloaded it)
wget https://files.waveshare.com/wiki/RPi_Zero_PhotoPainter/Demo/RPi_Zero_PhotoPainter.zip
unzip -o RPi_Zero_PhotoPainter.zip -d RPi_Zero_PhotoPainter
cd RPi_Zero_PhotoPainter/7in3_e-Paper_E
  • Run the demo
# Ensure in RPi_Zero_PhotoPainter/7in3_e-Paper_E location
cd python/examples/
python3 epd_7in3e_test.py

UPS Monitoring

  • The startup and shutdown of the UPS are controlled automatically by hardware. This demo primarily monitors the battery level, as well as the input and output

Enable I2C Interface

  • Open the Raspberry Pi terminal and input the following command to enter the configuration interface:
sudo raspi-config 
Select Interacting Options ->I2C ->yes to start the I2C kernel driver

RPI open i2c.png
Then restart Raspberry Pi:

sudo reboot

Run Demo

  • Download the demo (you can skip it if you have already downloaded it)
wget https://files.waveshare.com/wiki/RPi_Zero_PhotoPainter/Demo/RPi_Zero_PhotoPainter.zip
unzip -o RPi_Zero_PhotoPainter.zip -d RPi_Zero_PhotoPainter
cd RPi_Zero_PhotoPainter/UPS
python3 INA219.py

After the program runs, it will output battery voltage, current, power, and battery remaining percentage, etc.
RPi Zero PhotoPainter-1.jpg
Note: If the current is negative, it indicates the battery output current (which can be considered as Raspberry Pi load current), and if the current is positive, it indicates the battery charging current.

RTC Clock Usage

Enable I2C Interface

  • Open the Raspberry Pi terminal and input the following command to enter the configuration interface:
sudo raspi-config 
Select Interacting Options ->I2C ->yes to start the I2C kernel driver

RPI open i2c.png
Then restart Raspberry Pi:

sudo reboot

C

  • Install 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/lg

  • Install 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 (you can skip it if you have already downloaded it)
wget https://files.waveshare.com/wiki/RPi_Zero_PhotoPainter/Demo/RPi_Zero_PhotoPainter.zip
unzip -o RPi_Zero_PhotoPainter.zip -d RPi_Zero_PhotoPainter
cd RPi_Zero_PhotoPainter/RTC
  • Run the demo
cd c
make clean
make -j8 
sudo ./main

Python

  • Install function library
sudo apt-get update
sudo apt-get install ttf-wqy-zenhei
sudo apt-get install python3-pip
sudo pip3 install spidev
  • Download the demo (you can skip it if you have already downloaded it)
wget https://files.waveshare.com/wiki/RPi_Zero_PhotoPainter/Demo/RPi_Zero_PhotoPainter.zip
unzip -o RPi_Zero_PhotoPainter.zip -d RPi_Zero_PhotoPainter
cd RPi_Zero_PhotoPainter/RTC
  • Run the demo
 cd python
 # Set the RTC time and loop to display time, date, and temperature
 sudo python3 main.py
 # Sync the RTC time to the system, only for systems that are not connected to the internet
 sudo python3 Set_system_time.py
  • Synchronize RTC time on Raspberry Pi startup:

Note: Do not connect to the Internet during this process.

Add Kernel Driver


Note that with this method, you can't use the demo above
Add at the end of /boot/config.txt

dtoverlay=i2c-rtc,ds3231
#Reboot Raspberry Pi
sudo reboot

Synchronize system clock -> hardware clock.

sudo hwclock -w

Synchronize hardware clock -> system clock.

sudo hwclock  -s
 #Need to turn off the network, or disable network time synchronization, otherwise it will be changed back

Set the hardware clock time:

sudo hwclock --set --date="9/8/2021 16:45:05"

View the hardware clock.

sudo hwclock -r

Show version information.

sudo hwclock --verbose

WiFi Connection

  • Here is a more convenient way to connect to WiFi; it is mainly for terminal use. If you have an HDMI connection, you can directly operate using the graphical interface
  • Enter the command
sudo nmtui
  • As shown in the diagram below, select the corresponding WiFi, enter the password and wait for the connection. The appearance of an asterisk (*) before the corresponding WiFi indicates a successful connection

RPi Zero PhotoPainter-8.jpgRPi Zero PhotoPainter-9.jpgRPi Zero PhotoPainter-10.jpgRPi Zero PhotoPainter-11.jpgRPi Zero PhotoPainter-12.jpg


Resources

Pre-built Systems

Documents

Demo

Development Resources


FAQ

Question: I use the code downloaded by the program in Wiki and can't drive the e-Paper screen

 Answer:

The PWR pin usage is inconsistent; the PWR pin used on this PCB board is BCM number 27, and it needs to be modified in the program before reprogramming

  • Open the file RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.c using C; Modify according to the diagram

RPi Zero PhotoPainter-2.jpg

  • Open the file RaspberryPi_JetsonNano/python/lib/waveshare_epd/epdconfig.py using Python; Modify according to the diagram

RPi Zero PhotoPainter-3.jpg


Question: While I was generating images using AI, my WiFi disconnected, and I couldn't detect it afterward

 Answer:

This is a bug in the OnnxStream library, and currently, the only solution is to wait for Vito Plantamura to fix it. There is no better way to resolve it at the moment


Question: What should I do if I suddenly don't want the scheduled script to run anymore during its execution?

 Answer:

Use the ps command to find running script processes:

ps aux | grep cron_flower.sh

You may see output similar to the following:

pi        1234  0.0  0.1   4200  1024 pts/0    S+   10:00   0:00 /bin/bash ./cron_flower.sh
pi        1235  0.0  0.0   7220   596 pts/0    S+   10:00   0:00 sleep 600
pi        1240  0.0  0.0   6432   880 pts/1    R+   10:01   0:00 grep --color=auto cron_flower.sh

The first line is the main process of your script, and 1 2 3 4 are the process IDs (PID).
The second line is the sleep sub-process initiated by the script.
Use the kill command to terminate the script main process:

kill 1234

Among them, 1 2 3 4 are the PIDs of the script processes you found.
After terminating the main process, the sleep subprocess will also end, and the entire script will stop.


Question: My computer freezes after I continuously generate images

 Answer:

The specific reasons are as follows:
1. The executable memory of zero is relatively small. After generating an image, the memory hasn't been released yet, and new data is written, leading to insufficient memory and causing zero to crash
2. When generating images, the temperature of zero will continue to rise. If a secondary execution is performed before the temperature starts to cool down after completion, it may lead to entering overheat protection
It is recommended to wait more than half an hour after generating an image before creating another one

Support

Monday-Friday (9:30-6:30) Saturday (9:30-5:30)

Email: services01@spotpear.com

TAG: 4.26inch-e-Paper USB Binocular Camera 2MP OS02G10 Distortion Free Binocular Synchronous Frame USB 2.0 Plug and Play Milk-V Duo User Guide TTL To CAN Digital Photo Raspberry Pi LCD ESP32 S3 Development Board 2.8 inch Round LCD Display 480x480 QMI8658 Sensor / SD /MP3 Audio /Battery Port LVGL/HMI For Arduino X1015 Raspberry Pi 5 PCIe to M.2 Key-M NVMe SSD Board Pi5 2280 ESP32 P4 Development Board 7-inch LCD Display 1024×600 7inch Touchscreen ESP32-C6 WiFi6 AI Deepseek Raspberry Pi 5 Camera User Guide ESP32 MLX90640 ESP32-S3 1.28inch LCD Raspberry Pi RP2040 LoRa-HF Raspberry Pi IR Array Thermal Imaging Camera Far infrared 80&times;62 Pixels 45/90 Degree FOV Raspberry Pi 5 PCIe to 2-CH PCIe FFC Dual PCIe HAT Board Pi5 Double Raspberry Pi 5 Case Milk-V Duo HUB Raspberry Pi 5 CR2032 Raspberry Pi Pico 1024×600 Raspberry Pi Pico 2 RP2350 1.28 inch Round LCD TouchScreen Development Board 240x240 Display QMI8658 6-Axis $17.9