E-Paper ESP32 Driver Board

From Waveshare Wiki
Jump to: navigation, search
E-Paper ESP32 Driver Board
E-Paper-ESP32-Driver-Board-1.jpg

Universal e-Paper Driver HAT, supports various Waveshare SPI e-Paper raw panels
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Primary Attribute
Category: Expansions, e-Paper, Raspberry Pi
{{{userDefinedInfo}}}: {{{userdefinedvalue}}}
Brand: Waveshare
Website
International: Waveshare website
Chinese:
Onboard Interfaces
Related Products

Introduction

Universal e-Paper Driver HAT, Onboard ESP32, supports various Waveshare SPI interface e-Paper raw panels. Supports refreshing image to e-paper via WIFI or Bluetooth

More

Hardware connection

  • Connect the ESP32 driver board or the Cloud display to your PC by OTG USB cable

.

Download examples

Three examples were provided for the display, Bluetooth example, WiFi example and the offline example. You can find the archive in Resources tabber. Or directly download the link here to download
Unzip the arvhive and you will get the following examples:
Epd esp32 download 1.png

  • ePape_Esp32_Loader_APP:Souces code of Bluetooth APP.(Android Studio)
  • examples:Offline example
  • Loader_esp32bt:Bluetooth Example
  • Loader_esp32wf:WiFi Example
  • app-release.apk:APK of Bluetooth APP(Android only)

Setup Arduino IDE

  • Download the newest Arduino IDE and install from Arduino website:https://www.arduino.cc/en/Main/Software
  • Open the IDE and choose File->Preferences and add the link to the Additional Boards Manager URLs box:
    https://dl.espressif.com/dl/package_esp32_index.json
  • Open Tools -> Boards -> Boards Manager, find the ESP32 by Espressif Systems package, and install it
  • Enter tools directory, and run the get.exe file as administrator.
  • After installing, you can find the ESP32 Dev Module option in Tools - Boards of Arduino IDE Menu.

Image Process Algorithm

In the Bluetooth example and the WiFi example, we use two kinds of Image algorithms, Level and Dithering.

Level

An image can be divided into several large color gamuts. Each pixel on the image is classified into the corresponding color gamuts according to how close the color is to these color gamuts. This method is more suitable for images that have few colors, such as bright or three-color shapes or text images. Take the black, white and red ink screen as an example. When processing the image, we hope to process it into black, white, and red. Therefore, for an image, we can divide all the colors of the image into three color areas: black area, white area, and red area.
For example, according to the figure below, if the value of a certain pixel in the grayscale image is equal to or less than 127, we regard this pixel as a black pixel, otherwise, it is white
Epd esp32 lever 1.png
As we know, color images have three color channels called RGB. Compared with the red channel, we can collectively call blue and green the blue-green channel or the non-red channel. According to the figure below, if a pixel on a color image has a high red channel value but a low blue-green channel value, we classify it as a red pixel; if the value of both the red and blue-green channels are very low, we classify it as a black pixel; if the values of the red and blue-green channels are both high, we classify it as white.
Epd esp32 lever 2.png
In the algorithm, the color definition is calculated based on the difference between the RGB value and the sum of squares of the expected color value. The expected color value refers to the color value that the pixel is closest to, and these values are stored in the curPal array.
400px

=Dithering

For images with more colors or more gradient areas, the above color scale method is not suitable. In many cases, the pixels in the gradient area in the image may be very close to all color gamuts. If you use the Level method, the image will lose a lot of image details. Many pictures taken by cameras use the method of mixing colors to draw shadows and transition areas. In these images, the gradual area accounts for most of them.
For the human eye, it is easy to confuse very small colors. For example, set two colors red and blue side by side, if it is reduced to a small enough size, it will become a mixture color of red and blue to the human eye. The defect of the human eye means that we can deceive the human eye and use the "mixing" method to obtain more colors that can be expressed. The dithering algorithm uses this phenomenon.
The Floyd-Steinberg algorithm is based on the error diffusion method(published by Robert Floy and Louis Steinberg in 1976). The formula is based on the error diffusion of the image below
Epd esp32 dithering 1.png
X is the error (a scalar (vector) difference between the original color and the gray-scale value (the color value)), and the error spreads to the right, bottom right, bottom, and bottom left, adding weights of 7/16, 1/16, 5/16, and 3/16, respectively, to the values of the four pixels. If you are interested in the algorithm, you can search online for more resources

Expected result of two methods

Original picture

Epd esp32 compare 1.png

"Black/White-Level" and "Colors-Level"

Epd esp32 compare 2.png Epd esp32 compare 2-2.png

"Black/White-Dithering" and "Colors-Ditherring"

Epd esp32 compare 3.png Epd esp32 compare 3-2.png

Download example

  • Go to the Loader_esp32bt directory, double click the Loader_esp32bt.ino file to open the example.
  • Choose Tools->Boards->ESP32 Dev Module and select the correct Port according to Device Manager: Tools->Port

Epd esp32 bluetooth 1.png

  • Click the Upload icon to build the project and upload it to the ESP32 driver board.
  • Install the APP to Android board and open it:

Epd esp32 bluetooth 2.jpg

  • APP has five buttons on the main page:
    • BLUETOOTH CONNECTION: This button is used to connect the ESP32 device via Bluetooth.
    • SELECT DISPLAY TYPE: This button is used to select the type of display according to what you buy.
    • LOAD IMAGE FILE: Click it and choose a picture to open. It is only available after choosing the display type.
    • SELECT IMAGE FILTER: This button is used to choose the image process method.
    • UPLOAD IMAGE: Upload the processed image to ESP32 driver board and update to e-Paper display.
  • Please first open the Bluetooth function of your phone. Click the BLUETOOTH CONNECTION button -> Click the SCAN icon on the top-right to scan the Bluetooth device.
  • Find the ESP32 device and connect. If your phone is the first time to connect this device, it requires to pair, complete the pairing process according to the prompt.(Note: The APP cannot work with pairing.)
  • Click "SELECT DISPLAY TYPE" to choose the display type.
  • Click "LOAD IMAGE FILE" To choose a picture from your phone and cut it.
  • Click " SELECT IMAGE FILTER" to choose a process algorithm and confirm.
    • "LEVEL:MONO": This option will process the picture to a monochrome image.
    • "LEVEL"COLOR": This option will process the picture to the tricolor image according to the display colors of the display (only valid for colorful displays).
    • "DITHERING:MONO": This option will process the picture to a monochrome image.
    • "DITHERING:COLOR": This option will process the picture to the tricolor image according to the display colors of the display (only valid for colorful displays).
  • Click "UPLOAD IMAGE" to upload the image to the ESP32 device and display it.

How to Use

  • Go to the Loader_esp32wf directory, double click Loader_esp32wf.ino file to open the project.
  • Choose Tools->Boards->ESP32 Dev Module in IDE menu, and select the correct COM port:Tools->Port

Epd esp32 wifi 1.png

  • Open the srvr.h file, modify the ssid and password to your actual WiFi used.

Epd esp32 wifi 2.png

  • Click the Upload icon to build the project and upload it to the ESP32 driver board.
  • Open the serial monitor, set the baud rate to 115200. Then you can get the information printed like the IP of the ESP32 board.

Epd esp32 wifi 3.png

  • Open a browser on the PC or mobile phone (Note that you should connect your PC/Phone to the same network as the ESP32 board), go to the webpage with the IP address of the ESP32 board:

Epd esp32 wifi 4.png

  • There are five areas in the webpage:
    • Image Operation
      Select Image file: Click the option to choose a picture from PC/phone

Level: mono: Black/White image level processing.
Level: color: Colorful image level processing (only valid for colorful display)
Dithering: mono: Black/White image Dithering processing
Dithering: color: Colorful image Dithering processing (only valid for colorful display)
Update image: Upload image to ESP32 board and display it.

    • IP Information: In this are, the IP information of the ESP32 board connected is listed.
    • Image Size Setting: x and y is the beginning position on the image. For example, if you select an image with 800x480 resolution, and the display you connect is the 2.13. The 2.13inch display cannot display the whole picture, the codes will crop the picture according to the resolution of displays. If you set the x and y, the codes will set the (x, y) as the being pixel where it starts to crop. w and h is the resolution of the displays choose.

Note: If you modify the x and y value, you need to click the Level or Dithering options to process the image again.

    • Display Type: You should first select the display size here according to the display used.
    • Image Preview: it will display the original image selected and the image processed.
    • PS: The upload progress value is printed at the bottom of the webpage when uploading.

For examples:

  • In area ① click Select image file to choose a picture, you can also drag the picture to the Original image area directly.
  • In area ④ choose the type according to the display, for example 1.54b
  • In area ① choose an algorithm to process the image, for example Dithering: color
  • In area ① click Upload image to upload the image and display.

Epd esp32 wifi 5.png

Download example

  • Go to examples\ directory. copy the whole esp32-waveshare-epd folder to [Installation directory of Arduino IDE]\hardware\espressif\esp32\libraries

Epd esp32 example 1.png

  • Open the Arduino IDE, Find the wareshare-e-Paper examples from File->Example, and select one according to the display type.

Epd esp32 example 2.png

  • Click Upload to build the project and upload it to the ESP32 board. You can open the Serial Monitor to check the debug information.

Documentation

Demo Code

Related Resources

This is a post in Arduino Form about our SPI e-Paper thanks to ZinggJM, maybe you want to refer to.

Question:
If you don't have a V2 logo on the back of your 2.13inch e-paper screen, how do I use it?
Answer:
  • Open epd1in13.h in the project and change the following value to 1

Epd2in13 esp chose.png



Question:
For the new version of the ESP32 Driver Board, what are the functions of the above two DIP switches?
Answer:
  • Set the model: Set the No. 1 switch according to the E-Paper model you are using. There are many models of the E-Paper. If the model you used is not listed, please use ‘A’ first to try.

ESP32 SWITCH.png

  • Turn on the serial port module: Turn the No. 2 switches to "ON", this switch controls the power supply of the CP2102 (USB to UART module). When you don’t need to use it, you can manually turn off the module to save power (if the No. 2 switch is in the OFF state, the device cannot upload the program)

Epd esp32 hard 30.png


Support

If you require technical support, please go to the Support page and open a tickets.