1.54inch e-Paper Module

From Waveshare Wiki
Jump to: navigation, search
1.54inch e-Paper Module
200x200, 1.54inch E-Ink display module
1.54inch-e-paper-module-6.jpg

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

{{{name3}}}

{{{name4}}}

{{{name5}}}

Introduction

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

More

Interfaces

VCC 3.3V
GND GND
DIN SPI MOSI
CLK SPI SCK
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

Introduction

This product is an E-paper device adopting the image display technology of Microencapsulated Electropho-retic 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 hided 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 serial synchronous clock is Low. However, CPOL has little effect to the transmission protocol.
  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 failing 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 Demos below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: http://www.waveshare.net/wiki/Pioneer600_Datasheets

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
GND GND
DIN MOSI
CLK SCLK
CS CE0
DC 25
RST 17
BUSY 24

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.exe. Execute the command: sudo./main, the program will run.
  • WringPi: Execute the command: make, to compile the code and generate a file main.exe. 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
GND GND
DIN D11
CLK D13
CS D10
DC D9
RST D8
BUSY D7

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;

1.54inch-e-paper-manual-2.png

Working with the development board STM32

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
GND GND
DIN PA7
CLK PA5
CS PB6
DC PC7
RST PA9
BUSY PA8

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.

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
driver_delay_xms(100);
EPD_RST_1;
driver_delay_xms(100); 

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);

For partial refresh, it need a 0.5s delay before writing the same data into the display area.

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, the program 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.

1.54inch-e-paper-manual-3.png

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

1.54inch-e-paper-manual-4.png

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.

Resources

Documentation

Demo code

Datasheets

Support

Support

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