Difference between revisions of "1.54inch e-Paper Module"

From Waveshare Wiki
Jump to: navigation, search
Line 241: Line 241:
=== Demo code ===
=== Demo code ===
* [[:File:1.54inch_e-Paper_Module_code.7z|Demo code]]
* [[:File:1.54inch_e-Paper_Module_code.7z|Demo code]]
=== Demo video ===
* [https://youtu.be/-XbwDC2AOOw 1.54inch e-paper demo video]
=== Datasheets ===
=== Datasheets ===
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]

Revision as of 06:01, 2 August 2017

1.54inch e-Paper Module
200x200, 1.54inch E-Ink display module

200x200, 1.54inch E-Ink display module, SPI interface





200x200, 1.54inch E-Ink display module, SPI interface



VCC 3.3V
CS SPI chip select (Low active)
DC Data/Command control pin (High for data, and low for command)
RST External reset pin (Low for reset)
BUSY Busy state output pin (Low for busy)

Working principle


This product is an E-paper device adopting the image display technology of Microencapsulated Electrophoretic Display, MED. The initial approach is to create tiny spheres, in which the charged color pigments are suspending in the transparent oil and would move depending on the electronic charge. The E-paper screen display patterns by reflecting the ambient light, so it has no background light requirement. Under sunshine, the E-paper screen still has high visibility with a wide viewing angle of 180 degree. It is the ideal choice for E-reading.

Communication protocol

SPI timing

Note: Different from the traditional SPI protocol, the data line from the slave to the master is hidden since the device only has display requirement.

  • CS is slave chip select, when CS is low, the chip is enabled.
  • DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.
  • SCLK is the SPI communication clock.
  • SDIN is the data line from the master to the slave in SPI communication.

SPI communication has data transfer timing, which is combined by CPHA and CPOL.

  1. CPOL determines the level of the serial synchronous clock at idle state. When CPOL = 0, the level is Low. However, CPOL has little effect to the transmission.
  2. CPHA determines whether data is collected at the first clock edge or at the second clock edge of serial synchronous clock; when CPHL = 0, data is collected at the first clock edge.
  • There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.

As you can see from the figure above, data transmission starts at the first falling edge of SCLK, and 8 bits of data are transferred in one clock cycle. In here, SPI0 is in used, and data is transferred by bits, MSB first.

How to use

Working with Raspberry Pi

Installing libraries required

If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the Demo (click to download) below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: Libraries Installation for RPi.

You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.

Hardware connection

Here is the connection between Raspberry Pi 3B and E-paper.

e-Paper Raspberry Pi 3B
3.3V 3.3V
DC 25
RST 17

Compiling project

After installed the corresponding libraries, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.

  • BCM2835: Execute the command: make, to compile the code and generate a file main. Execute the command: sudo ./main, the program will run.
  • WringPi: Execute the command: make, to compile the code and generate a file main. Execute the command: sudo ./main, the program will run.
  • Python: Execute the command: sudo python main.py

Expected result

  1. Refresh the whole screen
  2. Refresh part of the screen
  3. Display the Logo of Waveshare
  4. Draw cycles and lines, display two different sizes of characters
  5. Display progress bar and time. This function can demonstrate the partial refreshing capability.

Working with Arduino

Hardware connection

e-Paper Arduino
3.3V 3V3
CS D10

Expected result

Since the development board UNO PLUS only has 2Kb storage space for global variables, the image display example is not provided in the Demos. When working with UNO PLUS, the method for calling the image display program is the same as the one when working with other main board. Because of the inadequate storage space for global variables, there is no Demo about image display here.

  1. Drawing: cycle and line only;
  2. String: display characters;


Working with the STM32 development board

Here we use the development board XNUCLEO-F103RB. The Demo is base on the library HAL.

Hardware connection

Here is the hardware connection between the development board XNUCLEO-F103RB and E-paper:

e-Paper XNUCLEO-F103RB
3.3V 3V3

Expected result

  1. Refresh the whole screen
  2. Refresh part of the screen
  3. Display the Logo of Waveshare
  4. Draw cycles and lines, display two different sizes of characters
  5. Display progress bar. This function can demonstrate the partial refreshing capability.

Code analysis

We will analyze the driving code by taking the Demos of the Raspberry Pi library BCM2835 as examples. The Demos support three different screens, including 1.54 inch, 2.13 inch and 2.9 inch. If you want to port the demo to a new hardware or modify it, please find out the one of the module you need and modify the corresponding macro.

1) Initialization: Reset the screen directly:

EPD_RST_0;		// Module reset

Then, send out the initialization screen data stored at the register:

EPD_Write(GDOControl, sizeof(GDOControl));	//GDO control 
EPD_Write(softstart, sizeof(softstart));  //soft start
EPD_Write(VCOMVol, sizeof(VCOMVol));  //VCOM voltage
EPD_Write(DummyLine, sizeof(DummyLine));..//dummy line
EPD_Write(Gatetime, sizeof(Gatetime));  //gate time
EPD_Write(RamDataEntryMode, sizeof(RamDataEntryMode));  //set RAM
EPD_SetRamArea(0x00,(xDot-1)/8,(yDot-1)%256,(yDot-1)/256,0x00,0x00);  //set RAM area
EPD_SetRamPointer(0x00,(yDot-1)%256,(yDot-1)/256);  //set RAM pointer

In another word, set the comparison voltage and the size of the whole screen.

2) Set LUT register: The E-paper screen has two refresh modes, full screen refresh and partial screen refresh.

EPD_WirteLUT((unsigned char *)LUTDefault_full,sizeof(LUTDefault_full));

The difference is that the parameters LUTDefault for two modes are two different values;

After setting the basic register, you can go to the next part, display data transmission. Clear the whole screen:

EPD_WriteDispRamMono(xDot, yDot, 0xff);

Global display data:

EPD_WriteDispRam(xDot, yDot, (unsigned char *)DisBuffer);

For partial screen display, there are many commands should be used.

part_display(xStart/8,xEnd/8,yEnd%256,yEnd/256,yStart%256,yStart/256);// set the address start/end bit of RAM X and Y, and the address counter of RAM X and Y.
EPD_WriteDispRamMono(xEnd-xStart, yEnd-yStart+1, DisBuffer); //the data on display buffers are written into a same display area.
EPD_Update_Part(); //Display update
driver_delay_xms(500); part_display(xStart/8,xEnd/8,yEnd%256,yEnd/256,yStart%256,yStart/256);
EPD_WriteDispRamMono(xEnd-xStart, yEnd-yStart+1, DisBuffer);

About code porting and compatibility

The provided Demo can be compatible to three kinds of screen. The main difference among them is that the display area size to be initialized, the time for stable display after partial refresh, and the value written into LUT register are all different.

You can select the initialization setting you want by defining corresponding macro.

The macros EPD2X9, EPD02X13 and EPD1X54 are corresponding to 2.9 inch screen, 2.13 inch screen and 1.54 inch screen, respectively. By setting the corresponding macro to 1 or 0, you can select the initialization setting you need. For example

#define EPD2X9 0
#define EPD02X13 0
#define EPD1X54 1

Select the initialization configuration of 1.54 inch screen, and save the modification. Then compile and run the program, it will display corresponding configuration and proper size of Logo on the screen.

  • Notes: Both EPD_drive.c and Display_Lib.h should be set. The former is a driver, and the later is a display library.

Image making

This module only supports the images with the gray level of two (Black and white). For the image with many gray levels, it cannot display all the colors.

1) Find an image with the gray level of two, and you can make one with a drawing tool on your PC.

2) Modify the image resolution with the drawing tool in your system.

Besides the drawing tool in your system, other graphing tools, such as Photoshop, can be used to modify the image resolution.


3) Use the software Image2Lcd.exe to generate an array for the image (a file with .c extension), as the figure shows below:


Open the image in this software, and set the parameters:

  • Output data type: C language array
  • Scanning mode: vertical scanning
  • Output gray: single color (gray level of two)
  • Maximum width and height: the size of pixel
  • Inverse color: check

Save the modification, you will get an array for the image in a file with .c extension. Copy the corresponding values into your project, then, you can display the image by calling this array.



Demo code

Demo video




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