Introduction and use of ink screen (electronic paper) (with STM32 program ~ ~ ~)

Electronic ink screen is also known as electronic paper display technology. Electronic paper display technology (EPD) has been successfully developed by Joseph Jacobson, Professor of MIT and his R & D team for more than 30 years.

The principle of the ink screen is very simple. The electronic ink screen is composed of many electronic inks, which can be seen as capsules. Each capsule contains a liquid charge, in which the positive charge is dyed white and the negative charge is dyed black. When we apply a positive and negative voltage to one side, the charged liquid will be attracted and repulsed respectively. In this way, each pixel can display white or black.

Because the refresh of e-ink is discontinuous, the current graphics can be maintained after each refresh, even if the battery is removed. Some people may ask why the ink screen always displays the last picture when the battery is dead. That is because the e-ink has a bistable hysteresis effect. Therefore, even if the battery is dead, the ball will not return to its original state or enter a random chaotic state, but maintain the state of the last picture. At this time, the power consumption is 0.

The ink screen model used this time is QYEG0420BNS19A, the overall dimension is 91.0 x77.0x 1.2mm, the display area size is 84.8 x 63.6mm, the resolution is 400 x 300, supports the display of black and white colors, supports full screen refresh and local refresh modes, and the refresh power consumption is 12.6mW.

Here is the difference between full brush and partial brush

1) Full brush: electronic paper refresh requires the screen to flash for many times, and finally display the required screen. The purpose of flashing is to remove the display residual shadow, so as to achieve the best display effect.

2) Local brush: when the electronic paper is refreshed, there is no picture flickering. The local brush requires the user to refresh several times and then conduct a full brush operation to remove the residual image of the display.

In addition, the temperature range for normal use of the ink screen: 0 ~ 50 ℃, humidity range: 35%~65%RH. Avoid direct sunlight on the display surface for a long time.

It has the following characteristics

● built in driver IC, without additional driver, only a small number of peripheral devices are needed to control the display through MCU, saving resources.

● ultra wide viewing angle of nearly 180 °

● ultra low power consumption (the display content can be maintained after power failure)

● pure reflection mode

● front surface of anti glare hard coating

● low current deep sleep mode

● COG package with IC thickness of 300um

● service life (failure free refresh times): more than 1 million times

Developers can refer to the following circuit schematic diagram

The main pin functions are as follows

NameDescription
GDRGate drive control pin of N-hook FET
RESECurrent detection input pin of control circuit
VSH2Positive source driving voltage
TSCLClock signal interface of I2C digital temperature sensor
TSDAData signal interface of I2C digital temperature sensor
BS1Bus interface selection pin
BUSYBusy state output pin
RES#Reset signal input pin, low level active
D/C#Data / command control pin
CS#Chip selection pin
SCLSPI interface clock pin
SDASPI interface data pin
VDDIOThe power pin of logic interface shall be connected with VCI pin
VCIChip power pin
VSSReference place
VDDCore logic power pin
VPPTest the pin and keep the open circuit
VSH1Positive source driving voltage
VGHPositive gate drive voltage and power pin of VSH1
VSLNegative source driving voltage
VGLNegative gate drive voltage, VCOM and VSL power pins
VCOMVCOM drive voltage

Read the data manual as follows. It can be seen that the typical voltage values of the source drive voltage VSH pin and the gate drive voltage VGH pin are much greater than the chip power pin. Therefore, a boost processing is required for this pin.

As shown in the schematic diagram, the 3.3V input source, inductance L1, MOS transistor Q1, capacitor C1, diode D3 and resistance R2 constitute the most basic boost boost circuit. The on or off state of MOS transistor Q1 is determined by E_GDR control.

When the MOS transistor Q1 is turned on, the input voltage directly returns to GND through the current limiting resistor R2 after passing through the inductor L1, which leads to a linear increase in the current passing through the inductor L1. At this time, the output filter capacitor C1 discharges to the load.

When MOS transistor Q1 is cut off, since the current of inductor L1 cannot suddenly change, a reverse electromotive force Vs is generated on inductor L1 to maintain the passing current unchanged. At this time, diode D3 is turned on. After 3.3V and Vs are connected in series, power is supplied to the load at a voltage greater than 3.3V, and the output filter capacitor C1 is charged. In this cycle, e is realized_ Boost operation of prevgh pin.

Similarly, for E_PREVGL pin,

When MOS transistor Q1 is off, capacitor C2 is charged, diode D1 is on and D2 is off, and the current flows to GND through D1. Ideally, the voltage difference between two ends of capacitor C2 is 3.3V+Vs.

When MOS transistor Q1 is turned on, the drain of Q1 is close to 0V. Since the voltage of capacitor C2 cannot change suddenly, it can be considered that the K-pole potential of diode D2 is - (3.3V+Vs). Capacitor C2 discharges, diode D1 is cut off, D2 is turned on, and the current flows through D2 to C2, so as to realize E_PREVGL pin negative voltage "boost" operation.

After introducing the driving circuit of the ink screen, we will introduce the use method of the ink screen to the developers.

The operation process of the ink screen is also relatively simple as follows.


The ink screen adopts SPI communication. This part of the program is completed by ourselves. The small series mainly introduces the application program to you.
The first is the initialization function
The initialization process involves full screen refresh and local refresh
Full screen refresh: refresh the whole page once, and flash the whole screen several times. The advantage is that there is no residual image, but the disadvantage is to brush the screen a few more times.
Local refresh: every time the display content is refreshed, the whole screen will not be refreshed, only those places with pictures and words will be refreshed. The advantage is that the screen will not flash, but there will be residual shadows. (the residual image can be removed by brushing the white screen several times, or by performing a full brush)

When realizing the global refresh and local refresh functions of the ink screen, you must first enter initialization and then refresh after switching from local brush to full brush sleep.

// refresh_mode = Full screen refresh
// refresh_mode = Partial local refresh

void EPD_HW_Init(const unsigned char refresh_mode)
{
	EPD_W21_Init();							//hard reset 

	Epaper_READBUSY();
	Epaper_Write_Command(0x12); // soft reset
	Epaper_READBUSY();

	Epaper_Write_Command(0x01); //Driver output control      
	Epaper_Write_Data(0x2B);
	Epaper_Write_Data(0x01);
	Epaper_Write_Data(0x00);

	Epaper_Write_Command(0x11); //data entry mode       
	Epaper_Write_Data(0x03);		//Y increment, X increment

	Epaper_Write_Command(0x44); //set Ram-X address start/end position   
	Epaper_Write_Data(0x00);		//0x00-->0
	Epaper_Write_Data(0x31);    //0x31-->(49+1)*8=400

	Epaper_Write_Command(0x45); //set Ram-Y address start/end position          
	Epaper_Write_Data(0x00);   	
	Epaper_Write_Data(0x00);
	Epaper_Write_Data(0x2B);		//0x012B-->(299+1)=300
	Epaper_Write_Data(0x01); 

	Epaper_Write_Command(0x3C); //BorderWavefrom
	Epaper_Write_Data(0x01);	

    Epaper_Write_Command(0x18); //Temperature Sensor Selection
	Epaper_Write_Data(0x80);	  //Internal temperature sensor
	
    Epaper_Write_Command(0x22); 
	if(refresh_mode==Full)
		Epaper_Write_Data(0xB1);//Call full brush LUT  
	if(refresh_mode==Partial)
		Epaper_Write_Data(0xB9);//Call local brush LUT   
    Epaper_Write_Command(0x20); 
    Epaper_READBUSY(); 	

	Epaper_Write_Command(0x4E);   // set RAM x address count
	Epaper_Write_Data(0x00);
	Epaper_Write_Command(0x4F);   // set RAM y address count
	Epaper_Write_Data(0x00);
	Epaper_Write_Data(0x00);
	Epaper_READBUSY();
	
}

EPD_ W21_ The function of init is to pull the reset pin of the ink screen low and then high
You can refer to the following

void EPD_W21_Init(void)
{
	EPD_W21_RST_0;     
	driver_delay_xms(100); 
	EPD_W21_RST_1; 							//hard reset  
	driver_delay_xms(100); 
}

EPaper in program_ The readbusy function can be defined as follows

uint8_t Epaper_READBUSY(void)
{ 
  uint8_t ret=1;
	uint16_t timeout=0xFFFF;
	LED2_SET;
	while(isEPD_W21_BUSY)
  {	 
		timeout--;
		if( 0 == timeout )
		{
			ret = 0;
			break;
		}			
  }
	LED2_RESET;
	return ret;
}

Next is the displayed routine, as follows

void EPD_Dis_Part(unsigned int xstart,unsigned int ystart,const unsigned char * datas,unsigned int PART_LINE,unsigned int PART_COLUMN,unsigned char mode)
{
	unsigned int i;  
	int xend,ystart_H,ystart_L,yend,yend_H,yend_L;
	
	xstart=xstart/8;//Convert to bytes
	xend=xstart+PART_LINE/8-1; 
	
	ystart_H=ystart/256;
	ystart_L=ystart%256;

	yend=ystart+PART_COLUMN-1;
		yend_H=yend/256;
		yend_L=yend%256;		
	
	Epaper_Write_Command(0x44);       // set RAM x address start/end
	Epaper_Write_Data(xstart);    		// RAM x address start;
	Epaper_Write_Data(xend);    			// RAM x address end
	Epaper_Write_Command(0x45);       // set RAM y address start/end
	Epaper_Write_Data(ystart_L);    	// RAM y address start Low
	Epaper_Write_Data(ystart_H);    	// RAM y address start High
	Epaper_Write_Data(yend_L);    		// RAM y address end Low
	Epaper_Write_Data(yend_H);    		// RAM y address end High


	Epaper_Write_Command(0x4E);   		// set RAM x address count
	Epaper_Write_Data(xstart); 
	Epaper_Write_Command(0x4F);   		// set RAM y address count
	Epaper_Write_Data(ystart_L);
	Epaper_Write_Data(ystart_H);
	
	
	 Epaper_Write_Command(0x24);   //Write Black and White image to RAM
	
		for(i=0;i<PART_COLUMN*PART_LINE/8;i++)
			{                         
				if (mode==POS)
					{
						Epaper_Write_Data(*datas);
						datas++;
					}

				if (mode==NEG)
					{
						Epaper_Write_Data(~*datas);
						datas++;
					}	

			  if (mode==OFF)
				  {
						Epaper_Write_Data(0xFF);
					}		
				
			} 	

}

among

  • xstart and ystart are the starting coordinates.
  • *Data is the incoming display array data.
  • PART_LINE can be considered as the length of the display area, which must be an integer multiple of 8 (8 bits per byte)
  • PART_COLUMN can be considered as the width of the display area
  • Mode is the mode, and the mode bit is POS, positive display; Mode is NEG, negative display; Mode is OFF, clear;

After the data is written, the display ink screen is updated

void EPD_Part_Update(void)
{
	Epaper_Write_Command(0x22); 
	Epaper_Write_Data(0xCF);   
	Epaper_Write_Command(0x20); 
	Epaper_READBUSY(); 			
}

This completes the display. If you want to reduce power consumption, you can execute the sleep function again

void EPD_DeepSleep(void)
{  	
  Epaper_Write_Command(0x10); //enter deep sleep
  Epaper_Write_Data(0x01); 
  driver_delay_xms(100);
}

The overall process can be as follows

void EPD(void)
{
	EPD_HW_Init(Full); 																		
	EPD_Dis_Part(0,0,gImage_num,8,8,NEG); 
	EPD_Part_Update();
	EPD_DeepSleep();
}

In addition, emphasize the following points with developers:

  • The refresh frequency of the ink screen is recommended to develop a refresh interval of at least 180 seconds (except for products that support the local brush function).
  • If the ink screen needs to be used in low-power scenarios, if the display screen does not refresh frequently, it is recommended that the developer set the ink screen to sleep mode or disconnect the driving power supply part of the ink screen through the analog switch. This operation can not only reduce the power consumption, but also prolong the service life of the ink screen.
  • Place of use requirements: the ink screen display is recommended to be used indoors. If it is used outdoors, the ink screen shall be protected from direct sunlight for a long time, and ultraviolet protection measures shall be taken at the same time. When designing products, developers should first consider whether the operating environment meets the temperature and humidity requirements for the normal operation of the ink screen.

If you have any questions, please leave a comment below

Tags: stm32 ARM

Posted on Mon, 08 Nov 2021 18:57:04 -0500 by dprichard