Difference between revisions of "Template:12.48e-Paper-connecting-settings"

From Waveshare Wiki
Jump to: navigation, search
Line 70: Line 70:
 
gpio -v
 
gpio -v
 
# Run gpio -v and version 2.60 will appear. If it does not appear, it means that there is an installation error
 
# Run gpio -v and version 2.60 will appear. If it does not appear, it means that there is an installation error
</pre>
 
*Install python2
 
<pre>
 
sudo apt-get update
 
sudo apt-get install python-pip
 
sudo apt-get install python-pil
 
sudo pip install RPi.GPIO
 
sudo pip install spidev
 
 
</pre>
 
</pre>
 
*Install python3
 
*Install python3
Line 90: Line 82:
 
Open terminal and run commands to download codes.
 
Open terminal and run commands to download codes.
 
<pre>
 
<pre>
sudo apt-get install p7zip-full
+
git clone https://github.com/waveshare/12.48inch-e-paper.git
wget https://www.waveshare.com/w/upload/9/9a/12.48inch_e-Paper_Module_Code_RPI.7z
+
cd 12.48inch-e-paper/RaspberryPi
7z x 12.48inch_e-Paper_Module_Code_RPI.7z  -r -o./12.48inch_e-Paper_Module_Code
 
sudo chmod 777 -R 12.48inch_e-Paper_Module_Code
 
cd 12.48inch_e-Paper_Module_Code
 
 
</pre>
 
</pre>
  
Line 124: Line 113:
 
: For two-color version
 
: For two-color version
 
<pre>
 
<pre>
sudo python epd_12in48_test.py
+
sudo python3 epd_12in48_test.py
 
</pre>
 
</pre>
  
 
: For three-color version
 
: For three-color version
 
<pre>
 
<pre>
sudo python epd_12in48B_test.py
+
sudo python3 epd_12in48B_test.py
 
</pre>
 
</pre>
 
*Python codes-Weather
 
*Python codes-Weather
Line 138: Line 127:
 
: For two-color display
 
: For two-color display
 
<pre>
 
<pre>
sudo python Show_EN_Weather.py
+
sudo python3 Show_EN_Weather.py
 
</pre>
 
</pre>
 
: For three-color display
 
: For three-color display
 
<pre>
 
<pre>
sudo python Show_EN_Weather.py B
+
sudo python3 Show_EN_Weather.py B
 
</pre>
 
</pre>
 
: For help information
 
: For help information

Revision as of 07:22, 28 November 2022

We provide demo codes for four popular hardware platforms, Raspberry Pi, Arduino UNO, STM32 and the ESP32. The product you receive may be pre-assembled, you need to remove the back panel and connect your device like Raspberry Pi.

Preface

How to Install

Since it was assembled by us when you got the product, it has a bottom plate, you need to take the screwdriver delivered to unscrew the screws on the back and put it into the main control.

  • The Raspberry Pi, Arduino UNO, and ESP32 directly provide interface connections, and the specific control pins are introduced in the following sections.
  • For STM32, the demo is based on the STM32F103ZET6 chip, which was tested using our Open103Z, and connected using the pin headers of the board.

Software Description

Raspberry Pi Programs

We provide two program drivers, C and Python.
It takes about 8S to brush a frame of a picture in C language, and about 10S in python. In addition to the basic brushing effect, python also adds the ability to crawl the weather:

Arduino UNO

We provide a C program, and the .c suffix is ​​changed to .cpp to be compatible with CPP.
Because the RAM of UNO is too small, 3 23LC1024 chips are used onboard to expand the memory of UNO. You need to build a picture of the whole picture and initialize it. For black and white pictures, you need 1304/8*984=160392 pieces Bytes, and a 23LC1024 can only have a maximum size of 128K. For black and white red, it needs 160392*2 = 320784 bytes, so 3 chips are needed, so the display speed of the whole frame picture is very slow, about 1 minute. to display a black and white image.

  • The jumper cap needs to be connected to 5V.

STM32

We provide a C program.

  • Since STM32F103ZET6 has no interface for direct use, it needs to be connected with the delivered Dupont cable. For the specific connection method, please refer to the pin connection diagram below. There are only some examples here, because the STM32F103ZET6 cannot establish a complete image cache, only part of the screen demos.

ESP32

We provide a C program for the Arduino test program and an example that can be controlled using the web page.

  • Arduino: It can be used according to the corresponding ESP32 chapters. ESP32 cannot create a 1304/8*984 cache, so it is refreshed in a different way, 4304/8*492 data is transmitted at one time, and black and white needs to be transmitted twice. Black and white red transmission 4 times. The refresh speed of black and white is about 8S, and the refresh speed of black and white is about 16S.
  • Web page control: Due to my limited skills, I develop web pages while learning the front-end. There may be some bugs in web page control, and you may not be able to complain, but the function can be completed in the end. The IP address will be displayed on the serial port. Under the same wifi, you can use the web page to open the IP address to control it, which will be described in detail in the subsequent chapters.

Raspberry Pi

Hardware Connection

12in48-epaper-RPIconnet012.JPG

The pins used can be found on schematic according to codes.

12in48-epaper-rpi1.png

Enable SPI interface

PS: If you are using the system of the Bullseye branch, you need to change "apt-get" to "apt", the system of the Bullseye branch only supports Python3, and there is no wiringPi.
The communication interface of e-Paper is SPI, to use it, we should first 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
And then reboot the Raspberry Pi:

sudo reboot

You can check whether the SPI is occupied by other devices in /boot/config.txt.

Libraries installation

  • Install BCM2835
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
  • Install wiringPi
#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
  • Install python3
sudo apt-get update
sudo apt-get install python3-pip
sudo apt-get install python3-pil
sudo pip3 install RPi.GPIO
sudo pip3 install spidev

Download

Open terminal and run commands to download codes.

git clone https://github.com/waveshare/12.48inch-e-paper.git
cd 12.48inch-e-paper/RaspberryPi

Run codes

Black White
  • C codes
cd c
sudo nano examples/main.c
Confirm which kind of 12.48inch e-Paper you use. If you use the two-color display, modify the file as below.
If you use the tree-color display, modify the file as below.
Black White Red
Save then compile and run the code.
sudo make clean
sudo make
sudo ./epd
  • Python codes
Open a terminal and run the demo codes by commands:
cd python/examples
12in48-epaper-rpi-weather1.jpg
12in48-epaper-rpi-weather2.jpg
For two-color version
sudo python3 epd_12in48_test.py
For three-color version
sudo python3 epd_12in48B_test.py
  • Python codes-Weather
cd python/examples
For two-color display
sudo python3 Show_EN_Weather.py
For three-color display
sudo python3 Show_EN_Weather.py B
For help information
sudo python Show_EN_Weather.py help

Arduino

Hardware connection

You can directly insert the Arduino UNO to PCB.

12in48-epaper-Arduinoconne.JPG

About the pins used:

12in48-epaper-arduino1.png

Run codes

Download demo codes from the wiki and unzip them.
Copy the 12in48 folder to the libraries directory which is under the installation directory of Arduino IDE. (The installation directory generally is C:\Program Files (x86)\Arduino\libraries)
Open Arduino IDE software, choose Tool->Board->Arduino UNO:
12in48-epaper-arduino2.png
Click File -> Examples -> EPD12in48 to open demo code.
12in48-epaper-arduino3.png
If your e-Paper is a two-color version, use the epd12in48-demo, otherwise, use the epd12in48b-demo.
Compile and download the codes to the board.

If you are using a black and white screen, select epd12in48-demo on the right.
If you are using a black and white red screen, select epd12in48b-demo on the right.
Finally, select the corresponding COM port, and then click Compile and Download.

  • Note that the refresh process may take a long time. You can open the serial monitor to check the progress. Generally, it takes 1 minute for black and white, and 2 minutes for black and white.

STM32

The development board we use is Waveshare Open103Z. The project is developed based on STM32 HAL libraries.

Hardware connection

To assemble the Open32, you should connect it to the wires provided.

12in48-epaper-STM32conne0t.jpg

About the pins used, you can refer to e-paper.ioc file.

12in48-epaper-STM32-5.png
12in48-epaper-STM32-6.png

Run codes

Open the project (~\STM32\NUCLEO-F103RB\MDK-ARM\e-paper.uvprojx), compile and download to developmen board. It requires about 10s for the two-color version and 20s for three-color display.

ESP32

The demo codes for ESP32 are developed with Arduino IDE as well.

Software setup

To develop ESP32, you should first set up the environment.

12in48-epaper-esp32-1.png
  • Enter the tools folder, and run the get.exe file as administrator. After installing, Copy the esp32-epd-12in48 folder of ESP32 demo codes to [Arduino IDE installation directory]/Hardware/espressif/esp32/libraries
12in48-epaper-esp32-2.png

Hardware connection

Here we use Waveshare e-Paper ESP32 Driver Board as an example. Attach it on PCB.

12in48-epaper-esp32connet.JPG

About the pins used, you can refer to schematic and codes

12in48-epaper-esp32-connet1.png

Arduino Example

Open Arduino IDE software, and find the examples on File->Examples.

12in48-epaper-esp32-3.png

If you use two-color e-Paper, choose the epd12in48-demo, otherwise, please use the epd12in48B-demo.

WiFi Example

As we know, ESP32 features WIFI, you can set it as master or slave. Here we provide demo codes that control the e-Paper on the web by WIFI.

  • You need to first modify the wifi connection information. Open the Web_App.cpp file and modify line 50 and line 51:

12in48-epaper-esp32-4.png

  • Open wifi.ino file, compile and download it to your ESP32 board. Open the Serial monitor to query the IP address.
12in48-epaper-esp32-5.png
  • Open the Chrome browser, and enter the web with the IP address.
12in48-epaper-esp32-html0.png
  • Select the display type, here we take 12.48inch e-Paper (two-color version) as an example:
Click 12.48 e-Paper, and there are six functions provided. You can use them to draw points, lines and so on. On the top of the webpage, the type of e-Paper and display color are shown.
12in48-epaper-esp32-html1.png
  • The corresponding coordination of display is as below:
12in48-epaper-esp32-html2.png
  1. Draw points
    Click Draw point then you will get the window as below:
    12in48-epaper-esp32-html3.png
  2. Draw lines
    Click Draw Line, you will get the window below:
    12in48-epaper-esp32-html4.png
  3. Draw Rectangle
    Click Draw Rectangle, you will get the window below:
    12in48-epaper-esp32-html5.png
  4. Draw circle
    Click Draw Circle, and you will get the window below:
    12in48-epaper-esp32-html6.png
  5. Draw String
    Click Draw String, and you will get the windows below:
    12in48-epaper-esp32-html7.png
  6. Display picture
    Click Show picture, you will get the window like below. Click upload image to choose a picture.
    12in48-epaper-esp32-html8.png
    Draw the page to the bottom to check the original picture.
    12in48-epaper-esp32-html9.png
    Select a process algorithm, for a two-color display, only the mono methods work.
    12in48-epaper-esp32-html10.png
    12in48-epaper-esp32-html11.png
  7. Finally, click the upload image button on left to upload the image to the e-Paper for displaying.
    12in48-epaper-esp32-html12.png
You can open the Serial monitor of IDE to check the debug information.
12in48-epaper-esp32-html13.png
You can also press the F12 button to open the debug console of the browser.
12in48-epaper-esp32-html14.png