Difference between revisions of "9.7inch e-Paper HAT"
m (Text replacement - "https://www.waveshare.com/w/upload/" to "https://files.waveshare.com/upload/") |
|||
(41 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | <div class="wiki-pages jet-green-color"> | ||
{{Infobox item | {{Infobox item | ||
|name=9.7inch e-Paper raw Panel | |name=9.7inch e-Paper raw Panel | ||
Line 4: | Line 5: | ||
|img=[[File:9.7inch-ePaper.JPG|300px|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}|url=link=https://www.waveshare.com/9.7inch-e-paper.htm}}]] | |img=[[File:9.7inch-ePaper.JPG|300px|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}|url=link=https://www.waveshare.com/9.7inch-e-paper.htm}}]] | ||
|img2=[[File:9.7inch-e-Paper-HAT.JPG|300px|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}|url=link=http://www.waveshare.com/9.7inch-e-paper-hat.htm}}]] | |img2=[[File:9.7inch-e-Paper-HAT.JPG|300px|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}|url=link=http://www.waveshare.com/9.7inch-e-paper-hat.htm}}]] | ||
− | |caption= | + | |caption=1200 × 825, 9.7inch EPD panel without the driver board |
− | |caption2= | + | |caption2=1200 × 825, 9.7inch EPD HAT for Raspberry Pi, USB/SPI/I80/I2C interface |
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]] | |category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]] | ||
|brand=Waveshare | |brand=Waveshare | ||
Line 20: | Line 21: | ||
=Introduction= | =Introduction= | ||
− | *9.7inch EPD (Electronic Paper Display) HAT for Raspberry Pi, | + | *9.7inch EPD (Electronic Paper Display) HAT for Raspberry Pi, 1200 × 825 resolution, 16 gray scale, USB/SPI/I80/I2C interface. |
− | *It has the advantages of low power consumption, wide viewing angle, and clear display under direct sunlight | + | *It has the advantages of low power consumption, wide viewing angle, and clear display under direct sunlight. It is often used in display applications such as shelf labels and industrial instruments. |
{{Amazon|{{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}=display | {{Amazon|{{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}=display | ||
|More = [http://www.waveshare.com/9.7inch-e-paper-hat.htm More]}} | |More = [http://www.waveshare.com/9.7inch-e-paper-hat.htm More]}} | ||
==Features== | ==Features== | ||
− | *No backlight, keeps displaying last content for a long time even when | + | *No backlight, keeps displaying last content for a long time even when powered down. |
− | *Low power consumption, basically power is only required for refreshing | + | *Low power consumption, basically power is only required for refreshing. |
− | *Compatible with Raspberry Pi Zero/Zero W/Zero WH/2B/3B/3B+ | + | *Compatible with Raspberry Pi Zero/Zero W/Zero WH/2B/3B/3B+. |
*USB/SPI/I80/I2C interface, for connecting with host boards like Raspberry Pi/Nucleo, etc. | *USB/SPI/I80/I2C interface, for connecting with host boards like Raspberry Pi/Nucleo, etc. | ||
− | *Comes with development resources and manual (examples for Raspberry Pi/STM32) | + | *Comes with online development resources and manual (examples for Raspberry Pi/STM32). |
+ | |||
==Specifications== | ==Specifications== | ||
*Operating voltage: 5V | *Operating voltage: 5V | ||
Line 40: | Line 42: | ||
*Resolution: 1200 × 825 | *Resolution: 1200 × 825 | ||
*Display color: black, white | *Display color: black, white | ||
− | * | + | *Grayscale: 2-16 (1-4 bit) |
*Full refresh time: <1s | *Full refresh time: <1s | ||
− | *Total refresh power: 0.6W(typ.) | + | *Total refresh power: 0.6W (typ.) |
− | *Total standby power: 0.3W(typ.) | + | *Total standby power: 0.3W (typ.) |
*Viewing angle: >170° | *Viewing angle: >170° | ||
Line 50: | Line 52: | ||
== Working principle == | == 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 | + | 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 suspended 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 ambient light, the E-paper screen still has high visibility with a wide viewing angle of 180 degrees. It is the ideal choice for E-reading. (Note that the e-Paper cannot support updating directly under sunlight). |
= How to use = | = How to use = | ||
==Working with Windows PC== | ==Working with Windows PC== | ||
− | *Connect 9.7inch e-paper to IT8951 driver board as below | + | *Connect 9.7inch e-paper to IT8951 driver board as below. |
[[File:9.7inch-e-Paper-HAT-Manual-09.jpg|center|500px]] | [[File:9.7inch-e-Paper-HAT-Manual-09.jpg|center|500px]] | ||
− | *Connect driver board to PC by USB cable | + | *Connect driver board to PC by USB cable. |
− | *Download and open test software [[:File:E-LINK-TCON-DEMO.zip | E-LINK-TCON-DEMO]] | + | *Download and open test software. [[:File:E-LINK-TCON-DEMO.zip | E-LINK-TCON-DEMO]] |
− | *Click connect as below | + | *Click connect as below. |
[[File:9.7inch-e-Paper-HAT-Manual-10.jpg|center|600px]] | [[File:9.7inch-e-Paper-HAT-Manual-10.jpg|center|600px]] | ||
− | *Check option "AutoSet", then click "Open File" to open one picture for display. | + | *Check option "AutoSet", then click "Open File" to open one picture for display. The browse diagram will be opened, and you should click "OK". |
[[File:9.7inch-e-Paper-HAT-Manual-11.jpg|center|600px]] | [[File:9.7inch-e-Paper-HAT-Manual-11.jpg|center|600px]] | ||
− | *Click "display" to refresh the picture | + | *Click "display" to refresh the picture. |
[[File:9.7inch-e-Paper-HAT-Manual-12.jpg|center|600px]] | [[File:9.7inch-e-Paper-HAT-Manual-12.jpg|center|600px]] | ||
− | + | <font color="#FF0000"> | |
− | + | Note: If you want to use the USB interface to develop the e-Paper on Windows, you need to contact the Waveshare team and sign the NDA before you can get the E-LINK-TCON-DEMO source code.<br/></font> | |
+ | <font color="#FF0000">Note: Currently not available for individual users.</font> | ||
==Working with Raspberry Pi== | ==Working with Raspberry Pi== | ||
− | * Hardware connection | + | * Hardware connection: |
[[File:9.7inch-e-Paper-HAT-Manual-13.jpg|center|600px]] | [[File:9.7inch-e-Paper-HAT-Manual-13.jpg|center|600px]] | ||
− | :You can also | + | : You can also connect by wires. |
{|border="1" width="700px" | {|border="1" width="700px" | ||
|+Connect to Raspberry Pi via SPI | |+Connect to Raspberry Pi via SPI | ||
Line 91: | Line 94: | ||
|RST||P17||Reset pin (Low active) | |RST||P17||Reset pin (Low active) | ||
|-align="center" | |-align="center" | ||
− | |HRDY||P24||Busy | + | |HRDY||P24||Busy status pin (Low when busy) |
|} | |} | ||
− | *Make sure you have switched the sail switch to SPI mode | + | *Make sure you have switched the sail switch to SPI mode. |
[[File:9.7inch-e-Paper-HAT-Manual-14.jpg|center|400px]] | [[File:9.7inch-e-Paper-HAT-Manual-14.jpg|center|400px]] | ||
*Install BCM2835 libraries to your Raspberry Pi, you can download the newest bcm2835 library from its official website http://www.airspayce.com/mikem/bcm2835/ | *Install BCM2835 libraries to your Raspberry Pi, you can download the newest bcm2835 library from its official website http://www.airspayce.com/mikem/bcm2835/ | ||
− | Copy the library you download to Raspberry Pi and install it | + | Copy the library you download to Raspberry Pi and install it with the commands below. You can also follow the instruction on its website above. |
<pre> | <pre> | ||
Line 106: | Line 109: | ||
sudo make install | sudo make install | ||
</pre> | </pre> | ||
− | * Download [ | + | * Download [https://files.waveshare.com/upload/1/15/IT8951.tar.gz Demo code] and copy it to your Raspberry Pi. Extract and run it with the commands below in your Raspberry Pi. |
<pre> | <pre> | ||
git clone https://github.com/waveshare/IT8951-ePaper.git | git clone https://github.com/waveshare/IT8951-ePaper.git | ||
Line 115: | Line 118: | ||
heck the VCOM value on the FPC | heck the VCOM value on the FPC | ||
:[[File:6inch-HD-e-Paper-HAT-Manual-06.png |500px]] | :[[File:6inch-HD-e-Paper-HAT-Manual-06.png |500px]] | ||
− | Add the VCOM value as | + | Add the VCOM value as a parameter and test the e-Paper, and this model is mode 0. |
<pre> | <pre> | ||
sudo ./epd -2.51 0 | sudo ./epd -2.51 0 | ||
Line 136: | Line 139: | ||
==Working with STM32== | ==Working with STM32== | ||
− | Because IT8951 will cost big size of RAM, some | + | Because IT8951 will cost a big size of RAM, some STM32 cannot support without an external SDRAM device. So we here use [https://www.waveshare.com/open429i-c-standard.htm Open429I] as a test board, Open429I integrates IS42S16400J (64-MBIT) SDRAM and has full memory to drive the 9.7inch e-paper. |
− | |||
− | |||
− | + | Working with STM32, you can use SPI, I80, or I2C interface. SPI is simple and needs a few GPIO, its speed can also meet the requirement of most applications. I80 is also simple and fast, however, it needs to use lots of GPIO. I2C is very slow, which we don't recommend. | |
− | |||
+ | ===SPI=== | ||
1) Hardware connection | 1) Hardware connection | ||
Line 169: | Line 170: | ||
[[File:9.7inch-e-Paper-HAT-Manual-14.jpg]] | [[File:9.7inch-e-Paper-HAT-Manual-14.jpg]] | ||
− | 3) Download demo code to refresh picture | + | 3) Download the demo code to refresh the picture |
− | You can download the demo code [https:// | + | You can download the demo code [https://files.waveshare.com/upload/0/08/9.7-IT8951.zip here] |
− | Open the project with | + | Open the project with Keil: Open429I-C-IT8951-Demo\Project\9.7-IT8951\MDK-ARM\Project.uvproj |
− | Compile | + | Click on "Compile", then open IT8951.h and make sure that IT8951_Interface_SPI is defined. Click on "Recompile" and download. After a few seconds, you should be able to see the e-paper start displaying images in a loop. |
[[File:9.7inch-e-Paper-HAT-Manual-15.jpg]] | [[File:9.7inch-e-Paper-HAT-Manual-15.jpg]] | ||
Line 183: | Line 184: | ||
[[File:9.7inch-e-Paper-HAT-Manual-16.jpg]] | [[File:9.7inch-e-Paper-HAT-Manual-16.jpg]] | ||
− | + | ===I80=== | |
− | |||
1) Hardware connection | 1) Hardware connection | ||
Line 203: | Line 203: | ||
|CSEL|| PC6||Chip select (Low active) | |CSEL|| PC6||Chip select (Low active) | ||
|- | |- | ||
− | |HRD||PC3||Read | + | |HRD||PC3||Read enabled (Low for active) |
|- | |- | ||
|RST||PC0||Reset (Low for reset) | |RST||PC0||Reset (Low for reset) | ||
Line 216: | Line 216: | ||
3) Display with demo code | 3) Display with demo code | ||
− | You can download the demo code [https:// | + | You can download the demo code [https://files.waveshare.com/upload/0/08/9.7-IT8951.zip here] |
+ | |||
+ | After downloading, extract the files and open the project using Keil. The project directory address is Open429I-C-IT8951-Demo\Project\9.7-IT8951\MDK-ARM\Project.uvproj. | ||
− | + | Click on "Compile", then open IT8951.h and make sure that IT8951_Interface_I80 is defined. Click on "Recompile" and download. After a few seconds, you should be able to see the e-paper start displaying images in a loop. | |
[[File:9.7inch-e-Paper-HAT-Manual-18.jpg]] | [[File:9.7inch-e-Paper-HAT-Manual-18.jpg]] | ||
+ | |||
+ | *Step 4: View the serial port print information, where the serial port print information is as follows (baud rate 115200): | ||
+ | [[File: 9.7inch-e-Paper-HAT-Manual-16.jpg]] | ||
===Display pictures=== | ===Display pictures=== | ||
− | For easy porting our demo code, we display | + | For easy porting of our demo code, we display pictures with a data matrix instead of the file system. |
− | We should first convert BMP picture to data matrix (arrays), and use it in demo code. | + | We should first convert the BMP picture to a data matrix (arrays), and use it in demo code. |
− | 1) Prepare a BMP image, resize the picture to 1200*825 (the resolution of this e-Paper) | + | 1) Prepare a BMP image, and resize the picture to 1200*825 (the resolution of this e-Paper) |
− | 2) Open [ | + | 2) Open [https://files.waveshare.com/upload/b/b3/BmpCvt.zip BMP convert software], Click File -> Open..-> to open the picture as below: |
[[File:9.7inch-e-Paper-HAT-Manual-19.jpg]] | [[File:9.7inch-e-Paper-HAT-Manual-19.jpg]] | ||
− | 3) Click Image -> Convert to ->Gray256(8 BPP) | + | 3) Click Image -> Convert to -> Gray256(8 BPP) |
[[File:9.7inch-e-Paper-HAT-Manual-20.jpg]] | [[File:9.7inch-e-Paper-HAT-Manual-20.jpg]] | ||
− | 4) Click File ->Save As... ->Choose "C" bitmap file (*.c) -> input file name and click Save. | + | 4) Click File -> Save As... -> Choose "C" bitmap file (*.c) -> input file name and click Save. |
− | 5) Choose 8 | + | 5) Choose 8 bits per pixel, and click OK. A C file will be saved to your PC |
[[File:9.7inch-e-Paper-HAT-Manual-21.jpg]] | [[File:9.7inch-e-Paper-HAT-Manual-21.jpg]] | ||
− | 6) Add the C file to keil project, detect unusable information | + | 6) Add the C file to the keil project, detect unusable information |
<source lang="c"> | <source lang="c"> | ||
Line 379: | Line 384: | ||
</source> | </source> | ||
− | to this one. (You can change the name of the array to | + | to this one. (You can change the name of the array to the one you like) |
Line 421: | Line 426: | ||
} | } | ||
</source> | </source> | ||
+ | |||
+ | =Precautions= | ||
+ | ===Connection=== | ||
+ | Due to updating, the hardware connection of e-Paper may be different as the picture showed, please connect the e-Paper according to the screen silk printing. | ||
+ | *Example 1 | ||
+ | :[[File:20191213143317.png|700px]] | ||
+ | *Example 2 | ||
+ | :[[File:20191213141630.png|700px]] | ||
+ | |||
+ | ===DIP switch=== | ||
+ | *We recommend you to use USB, I80 and SPI interfaces | ||
+ | *Whether you use USB, SPI or I80 interface, you should turn the switch to ON as below | ||
+ | :[[File:20191213160132.png|500px]] | ||
+ | *If E-LINK software didn't recognize the e-Paper when you use USB interface, please check if the pins marked in red are accessible. | ||
+ | |||
+ | =Codes description= | ||
+ | ==New Features== | ||
+ | * 1. Using 4bpp to refresh the 16-level grayscale image, the amount of SPI transmission data is reduced to half of the original one, avoiding the waste of RAM and transmission time caused by the previous version using 8bpp to refresh the 16-level grayscale image. | ||
+ | * 2. The SPI transmission speed is doubled, which is valid in the 3rd generation of Raspberry Pi, but ineffective in the 4th generation of Raspberry Pi due to the increase in CPU frequency. | ||
+ | * 3. The time interval for refreshing the picture is reduced to 1/4 of the original. It is measured that the previous version of the program uses GC16 mode to refresh a BMP picture with 16-level grayscale in full screen to 10.3inch e-Paper (D). It takes about 10S. And this routine only needs about 3S. | ||
+ | * 4. Avoid the memory leak caused by the previous version opening the BMP file after allocating the cache but not releasing it. | ||
+ | * 5. Add 1bpp, 2bpp, 4bpp, 8bpp mode support. | ||
+ | * 6. Add the A2 mode refresh demo, you can feel the A2 mode refresh speed. | ||
+ | * 7. Add support for drawing dots, lines, circles, rectangles, writing characters, etc., supports grayscale selection of characters and patterns, supports 1bpp, 2bpp, 4bpp, 8bpp, if you choose 1bpp, it also supports A2 mode refresh. | ||
+ | * 8. Add 1bpp, 2bpp, 4bpp, and 8bpp refresh support for bmp pictures, if you choose 1bpp, it also supports A2 mode refresh. | ||
+ | * 9. Add a demo for displaying GIF pictures, which can write multiple pictures into the IT8951 cache, and directly swipe the data of different addresses in the cache into the ink screen for display, eliminating the data transmission process between RPi and IT8951, refresh frame rate up to 7fps.<br> | ||
+ | * 10. Add a frame rate test routine, which is convenient for testing and refreshing areas of different sizes, 1bpp, 2bpp, 4bpp, 8bpp, and A2 mode, GC16 mode, and refreshed frame rate. | ||
+ | * 11. Support to enhance the driving ability to avoid partial blurring of the screen display in some cases. | ||
+ | * 12. Support 4-byte alignment for 6inch ePaper HAT and 6inch HD ePaper HAT, to avoid abnormal display during 1bp refresh. | ||
+ | * 13. You need to input VCOM when the demo is running, and it will be completely white when the routine is running to protect the screen and prolong its life of the screen. | ||
+ | * 14. Optimize the program structure, reduce the coupling of the program, standardize some functions, and name variables. | ||
+ | |||
+ | ==Codes== | ||
+ | ===Locally refresh 16 grayscale bars from light to dark grayscale in turn=== | ||
+ | *Function name: DisplayColorPaletteExample | ||
+ | *This demo demonstrates how to refresh 16 grayscale bars from light to dark grayscale in turn with 4bp and GC16. | ||
+ | |||
+ | ===Draw Dots, Lines, Circles, Rectangles, and characters=== | ||
+ | *Function name: DisplayCharacterPatternExample | ||
+ | *This demo demonstrates how to draw dots, lines, circles, and characters, and supports 1bpp, 2bpp, 4bpp, and 8bpp. If you use 1bpp, it also supports A2 mode to refresh. | ||
+ | |||
+ | ===Display BMP Picture=== | ||
+ | *Function name: DisplayBMPExample | ||
+ | *This demo demonstrates how to refresh a BMP picture, and supports 1bpp, 2bpp, 4bpp, and 8bpp. If you use 1bpp, it also supports A2 to refresh. | ||
+ | ===A2 Mode Refresh Example=== | ||
+ | *Function name: DynamicRefreshExample | ||
+ | *This demo demonstrates how to use A2 mode to refresh. In this demo, the refresh area will be refreshed several times, and the area of the refresh area will gradually become larger. After refreshing several times, an afterimage will appear. The afterimage will be cleared using INIT mode. Through this demo, you can intuitively feel the refresh speed of the A2 mode. | ||
+ | ===Display GIF Picture=== | ||
+ | *Function name: DynamicGIFExample | ||
+ | *This Demo demonstrates how to refresh a GIF image. In this demo, a GIF image is divided into 7 bmp images in advance, and the 7bmp images are written to the cache of a continuous address of IT8951 first. During display, the image data will be read from the cache of the corresponding address of IT8951 in turn and refreshed on the e-paper screen. Because there is no process of data transmission between RPi and IT8951, the refresh speed will be very fast. This Demo also demonstrates the limit speed of the IT8951 refreshing the ink screen is about 7. | ||
+ | ===Test frame rate=== | ||
+ | *Function name: CheckFrameRateExample | ||
+ | *This demo is for testing: when refreshing areas of different sizes, 1bpp, 2bpp, 4bpp, 8bpp, as well as A2 mode, GC16 mode, and refreshed frame rate, in this demo, the time to refresh 10 frames of images will be automatically counted, and Frame rate (fps) is automatically calculated. | ||
+ | ==Related Description== | ||
+ | ===Mode Description=== | ||
+ | IT8951 has flashed different firmware for different resolution screens. Different firmware has different refresh modes. See the [[:File:E-paper-mode-declaration.pdf|mode description]] for details. The modes used in the demo are INIT mode, GC16 mode, and A2 mode.<br/> | ||
+ | Below is a brief description of the relevant modes:<br/> | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Mode!! Features!! 6inch/6inch HD!! 7.8inch/9.7inch/10.3inch | ||
+ | |- | ||
+ | | INIT|| is used to erase the display content and clear the screen. It is recommended to use INIT mode to clear the screen after multiple A2 mode refreshes.|| Mode0|| Mode0 | ||
+ | |- | ||
+ | |GC16|| Use 16-level grayscale to update the screen display content, and the display effect is the best.|| Mode2|| Mode2 | ||
+ | |- | ||
+ | | A2|| Can only update black and white 2-level grayscale, but the refresh speed is the fastest.|| Mode4|| Mode6 | ||
+ | |} | ||
+ | <syntaxhighlight lang="c"> | ||
+ | //basic mode definition | ||
+ | UBYTE INIT_Mode = 0; | ||
+ | UBYTE GC16_Mode = 2; | ||
+ | //A2_Mode's value is not fixed, is decided by firmware's LUT | ||
+ | UBYTE A2_Mode = 6;</syntaxhighlight> | ||
+ | <syntaxhighlight lang="c"> | ||
+ | if( strcmp(LUT_Version, "M641") == 0 ){ | ||
+ | //6inch e-Paper HAT(800,600), 6inch HD e-Paper HAT(1448,1072), 6inch HD touch e-Paper HAT(1448,1072) | ||
+ | A2_Mode = 4; | ||
+ | Four_Byte_Align = true; | ||
+ | }else if( strcmp(LUT_Version, "M841") == 0 ){ | ||
+ | //9.7inch e-Paper HAT(1200,825) | ||
+ | A2_Mode = 6; | ||
+ | }else if( strcmp(LUT_Version, "M841_TFA2812") == 0 ){ | ||
+ | //7.8inch e-Paper HAT(1872,1404) | ||
+ | A2_Mode = 6; | ||
+ | }else if( strcmp(LUT_Version, "M841_TFA5210") == 0 ){ | ||
+ | //10.3inch e-Paper HAT(1872,1404) | ||
+ | A2_Mode = 6; | ||
+ | }else{ | ||
+ | //default set to 6 as A2 Mode | ||
+ | A2_Mode = 6; | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ===About bpp=== | ||
+ | bpp is Bits per pixel, it is the data that show the number of bits per pixel. Currently, all the gray e-Paper supports 1bpp, 2bpp, 4bpp, and 8bpp. | ||
+ | *1bpp | ||
+ | **Evey pixel use 1 bit | ||
+ | **It supports 2 (2^1=2) gray, it is used for A2 mode | ||
+ | **Evey byte contains 8 pixels | ||
+ | **Save in RAM in big-endian format | ||
+ | **IT8951 uses little-endian format by default, you should convert it when using. | ||
+ | :[[File:20191219164855.png|400px]] | ||
+ | *2bpp | ||
+ | **Every pixel uses 2 bits | ||
+ | **Support 4(2^2=4) grays | ||
+ | **Every byte contains 4 pixels | ||
+ | **Save in RAM in big-endian format | ||
+ | **IT8951 uses little-endian format by default, you should convert it when using. | ||
+ | [[File:20191219164916.png|400px]] | ||
+ | *4bpp | ||
+ | **Every pixel uses 4 bits | ||
+ | **Support 16(2^4=16) grays | ||
+ | **Every byte contains 2 pixels | ||
+ | **Save in RAM in big-endian format | ||
+ | **IT8951 uses little-endian format by default, you should convert it when using. | ||
+ | [[File:20191219164949.png|400px]] | ||
+ | *8bpp | ||
+ | **Every pixel uses 8 bits. | ||
+ | **Support 256(2^8=256) grays, however, IT8951 only uses the high four bits, only supports 16 grays. | ||
+ | **Every byte contains 1 pixel. | ||
+ | **Save in RAM in big-endian format. | ||
+ | **IT8951 uses little-endian format by default, you should convert it when using. | ||
+ | [[File:20191219165020.png|400px]] | ||
+ | |||
+ | Every pixel of the original image contains 8 bits (1 byte). To convert it to BMP, you can only get the high bits. For example, if you want to get pixels for 2bpp, you can just get 2 high bits from the 8bpp(8bits) image. | ||
+ | <pre> | ||
+ | UDOUBLE Addr = X * (Paint.BitsPerPixel) / 8 + Y * Paint.WidthByte; | ||
+ | switch( Paint.BitsPerPixel ){ | ||
+ | case 8:{ | ||
+ | Paint.Image[Addr] = Color & 0xF0; | ||
+ | break; | ||
+ | } | ||
+ | case 4:{ | ||
+ | Paint.Image[Addr] &= ~( (0xF0) >> (7 - (X*4+3)%8 ) ); | ||
+ | Paint.Image[Addr] |= (Color & 0xF0) >> (7 - (X*4+3)%8 ); | ||
+ | break; | ||
+ | } | ||
+ | case 2:{ | ||
+ | Paint.Image[Addr] &= ~( (0xC0) >> (7 - (X*2+1)%8 ) ); | ||
+ | Paint.Image[Addr] |= (Color & 0xC0) >> (7 - (X*2+1)%8 ); | ||
+ | break; | ||
+ | } | ||
+ | case 1:{ | ||
+ | Paint.Image[Addr] &= ~( (0x80) >> (7 - X%8) ); | ||
+ | Paint.Image[Addr] |= (Color & 0x80) >> (7 - X%8); | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | ===Align bytes=== | ||
+ | During the test, we find that when we use 1bpp mode to update the 6inch e-Paper and 6inch HD e-Paper, we should align the X (begin point) and W (width) of the update area to four bytes (32bits), otherwise, the image cannot be displayed. | ||
+ | <pre> | ||
+ | if( strcmp(LUT_Version, "M641") == 0 ){ | ||
+ | //6inch e-Paper HAT(800,600), 6inch HD e-Paper HAT(1448,1072), 6inch HD touch e-Paper HAT(1448,1072) | ||
+ | A2_Mode = 4; | ||
+ | Four_Byte_Align = true; | ||
+ | }else if( strcmp(LUT_Version, "M841") == 0 ){ | ||
+ | ... | ||
+ | } | ||
+ | if(Four_Byte_Align == true){ | ||
+ | In_4bp_Refresh_Area_Width = Panel_Width - (Panel_Width % 32); | ||
+ | }else{ | ||
+ | In_4bp_Refresh_Area_Width = Panel_Width; | ||
+ | } | ||
+ | X_Start = Min_X < 32 ? 0 : Min_X - (Min_X % 32); | ||
+ | Debug("X_Start:%d\r\n",X_Start); | ||
+ | X_End = ( Max_X + (32 - (Max_X % 32)) ) > Touch_Pannel_Area_Width ? ( Max_X - (Max_X % 32) ) : ( Max_X + (32 - (Max_X % 32)) ); | ||
+ | Debug("X_End:%d\r\n",X_End); | ||
+ | Y_Start = Min_Y; | ||
+ | Debug("Y_Start:%d\r\n",Y_Start); | ||
+ | Y_End = Max_Y; | ||
+ | Debug("Y_Start:%d\r\n",Y_End); | ||
+ | Width = X_End - X_Start; | ||
+ | if(Width<=0){ | ||
+ | Width = 32; | ||
+ | } | ||
+ | Debug("Width:%d\r\n",Width); | ||
+ | Height = Y_End-Y_Start; | ||
+ | if(Height<=0){ | ||
+ | Height = 32; | ||
+ | } | ||
+ | Debug("Height:%d\r\n",Height); | ||
+ | </pre> | ||
+ | ===About the speed of SPI=== | ||
+ | The CPU of Raspberry Pi 3 is different from Raspberry Pi 4. | ||
+ | *For Raspberry Pi, it could use a maximum of 16 clock dividers. | ||
+ | *For Raspberry Pi, it could use a maximum of 32 clock dividers. | ||
+ | *You can refer to the description of BCM2835 libraries about the clock divider. | ||
+ | :[[File:20191219173204.png|600px]] | ||
+ | *You can modify the clock divider according to the board you use: | ||
+ | <pre> | ||
+ | bcm2835_spi_begin();//Start spi interface, set spi pin for the reuse function | ||
+ | bcm2835_spi_setBitOrder(BCM2835_SPI_BIT_ORDER_MSBFIRST);//High first transmission | ||
+ | bcm2835_spi_setDataMode(BCM2835_SPI_MODE0);//spi mode 0 | ||
+ | |||
+ | //bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_16);//For RPi 3/3B/3B+ | ||
+ | bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_32);//For RPi 4B | ||
+ | |||
+ | /* SPI clock reference link:*/ | ||
+ | /*http://www.airspayce.com/mikem/bcm2835/group__constants.html#gaf2e0ca069b8caef24602a02e8a00884e*/ | ||
+ | </pre> | ||
+ | |||
+ | ===Enhance driving capability=== | ||
+ | Sometimes, the e-Paper displays abnormally because of the long FPC cable, in this case, you can try to enhance the driving capability: | ||
+ | <pre> | ||
+ | #if(Enhance) | ||
+ | Debug("Attention! Enhanced driving ability, only used when the screen is blurred\r\n"); | ||
+ | Enhance_Driving_Capability(); | ||
+ | #endif | ||
+ | /****************************************************************************** | ||
+ | function : Enhanced driving capability | ||
+ | parameter: Enhanced driving capability for IT8951, in case the blurred display effect | ||
+ | ******************************************************************************/ | ||
+ | void Enhance_Driving_Capability(void) | ||
+ | { | ||
+ | UWORD RegValue = EPD_IT8951_ReadReg(0x0038); | ||
+ | Debug("The reg value before writing is %x\r\n", RegValue); | ||
+ | EPD_IT8951_WriteReg(0x0038, 0x0602); | ||
+ | RegValue = EPD_IT8951_ReadReg(0x0038); | ||
+ | Debug("The reg value after writing is %x\r\n", RegValue); | ||
+ | } | ||
+ | </pre> | ||
+ | *If you are using the USB interface with a PC, you can try to configure: | ||
+ | :*Read the data of 0x18000038 register. | ||
+ | :[[File:6inch-e-Paper-HAT-Manual-11.png|500px]] | ||
+ | :*Modify the data to 602. | ||
+ | :[[File:6inch-e-Paper-HAT-Manual-12.png|500px]] | ||
+ | :*Check the data. | ||
+ | :[[File:6inch-e-Paper-HAT-Manual-13.png|500px]] | ||
+ | |||
+ | ===About VCOM=== | ||
+ | The VCOM voltages of every e-Paper panel are different and they are printed on FPC cable. Please make sure that you use the correct VCOM. | ||
+ | ===Development Note=== | ||
+ | The above only illustrates how to use the 9.7-inch e-Paper HAT (D). For details on how to modify and perform secondary development, you need to consult the relevant code by yourself.<br/> | ||
+ | |||
+ | Please refer to the IT8951-related information provided in the information section. | ||
=Resources= | =Resources= | ||
===Schematic=== | ===Schematic=== | ||
− | *[ | + | *[https://files.waveshare.com/upload/f/f6/E-Paper-IT8951-Driver-HAT-Schematic.pdf Schematic of IT8951 Driver Board] |
− | *[ | + | *[https://files.waveshare.com/upload/1/1b/9.7inch-e-Paper-Adapter-Schematic.pdf Schematic of 9.7inch e-Paper Adapter board] |
===Demo code=== | ===Demo code=== | ||
*[https://github.com/waveshare/IT8951-ePaper Github link] | *[https://github.com/waveshare/IT8951-ePaper Github link] | ||
− | *[ | + | *[https://files.waveshare.com/upload/1/15/IT8951.tar.gz Demo code for Raspberry Pi] |
− | *[ | + | *[https://files.waveshare.com/upload/0/08/9.7-IT8951.zip Demo code for STM32 (Open429I)] |
===Datasheet=== | ===Datasheet=== | ||
− | *[https:// | + | *[https://files.waveshare.com/upload/f/ff/9.7inch_E-paper_Specification.PDF 9.7inch e-Paper Specification] |
− | *[https:// | + | *[https://files.waveshare.com/upload/1/18/IT8951_D_V0.2.4.3_20170728.pdf IT8951 Specifications] |
===Software=== | ===Software=== | ||
− | *[ | + | *[https://files.waveshare.com/upload/2/2d/E-LINK-TCON-DEMO.zip E-LINK-TCON-DEMO] |
===Other documents=== | ===Other documents=== | ||
− | *[ | + | *[https://files.waveshare.com/upload/b/b0/IT8951_I80%2BProgrammingGuide_16bits_20170904_v2.7_common_CXDX.zip IT8951 I80/SPi/I2C Programming Guide] |
− | *[ | + | *[https://files.waveshare.com/upload/c/c9/IT8951_USB_ProgrammingGuide_v.0.4_20161114.pdf IT851 USB Programming Guide] |
− | *[ | + | *[https://files.waveshare.com/upload/c/c4/E-paper-mode-declaration.pdf Mode description] |
===Related Resources=== | ===Related Resources=== | ||
Notice:<br /> | Notice:<br /> | ||
− | The projects listed are all made and shared by the project owners, Waveshare isn't responsible for project | + | The projects listed are all made and shared by the project owners, Waveshare isn't responsible for the project or the update.<br /> |
*[https://forum.arduino.cc/index.php?topic=487007.0 Waveshare e-Paper display with SPI] | *[https://forum.arduino.cc/index.php?topic=487007.0 Waveshare e-Paper display with SPI] | ||
− | :This is a post in Arduino Form about our SPI e-Paper thanks to ZinggJM, maybe you want to refer to. | + | : This is a post in Arduino Form about our SPI e-Paper thanks to ZinggJM, which maybe you want to refer to. |
*[https://github.com/aceisace/Inkycal Inkycal Project] | *[https://github.com/aceisace/Inkycal Inkycal Project] | ||
− | :This is the Inkycal project for reference. | + | : This is the Inkycal project for reference. |
+ | {{IT8951 Epaper FAQ}} | ||
+ | <!-- | ||
=FAQ= | =FAQ= | ||
{{FAQ|Why can't I refresh the picture with E-LINK-TCON-DEMO? How can I check if the wiring is correct? | {{FAQ|Why can't I refresh the picture with E-LINK-TCON-DEMO? How can I check if the wiring is correct? | ||
Line 466: | Line 709: | ||
Note: Do not plug and unplug the e-paper with power on, otherwise the driver board and e-paper may be damaged. | Note: Do not plug and unplug the e-paper with power on, otherwise the driver board and e-paper may be damaged. | ||
}} | }} | ||
− | + | --> | |
− | + | =Support= | |
− | {{ | + | {{Servicebox1}} |
Latest revision as of 14:37, 31 August 2023
| ||
| ||
Introduction
- 9.7inch EPD (Electronic Paper Display) HAT for Raspberry Pi, 1200 × 825 resolution, 16 gray scale, USB/SPI/I80/I2C interface.
- It has the advantages of low power consumption, wide viewing angle, and clear display under direct sunlight. It is often used in display applications such as shelf labels and industrial instruments.
More |
Features
- No backlight, keeps displaying last content for a long time even when powered down.
- Low power consumption, basically power is only required for refreshing.
- Compatible with Raspberry Pi Zero/Zero W/Zero WH/2B/3B/3B+.
- USB/SPI/I80/I2C interface, for connecting with host boards like Raspberry Pi/Nucleo, etc.
- Comes with online development resources and manual (examples for Raspberry Pi/STM32).
Specifications
- Operating voltage: 5V
- Interface: USB/SPI/I80/I2C
- Outline dimension: 218.8mm × 156.425mm × 1.15mm
- Display size: 202.8mm × 139.425mm
- Dot pitch: 0.169 × 0.169
- Resolution: 1200 × 825
- Display color: black, white
- Grayscale: 2-16 (1-4 bit)
- Full refresh time: <1s
- Total refresh power: 0.6W (typ.)
- Total standby power: 0.3W (typ.)
- Viewing angle: >170°
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 suspended 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 ambient light, the E-paper screen still has high visibility with a wide viewing angle of 180 degrees. It is the ideal choice for E-reading. (Note that the e-Paper cannot support updating directly under sunlight).
How to use
Working with Windows PC
- Connect 9.7inch e-paper to IT8951 driver board as below.
- Connect driver board to PC by USB cable.
- Download and open test software. E-LINK-TCON-DEMO
- Click connect as below.
- Check option "AutoSet", then click "Open File" to open one picture for display. The browse diagram will be opened, and you should click "OK".
- Click "display" to refresh the picture.
Note: If you want to use the USB interface to develop the e-Paper on Windows, you need to contact the Waveshare team and sign the NDA before you can get the E-LINK-TCON-DEMO source code.
Note: Currently not available for individual users.
Working with Raspberry Pi
- Hardware connection:
- You can also connect by wires.
IT8951 Driver HAT | Raspberry Pi (BCM) | Description' |
5V | 5V | 5V power input |
GND | GND | Ground |
MISO | P9 | MISO Pin of SPI |
MOSI | P10 | MOSI Pin of SPI |
SCK | P11 | SCK Pin of SPI |
CS | P8 | Chip selection of SPI (Low active) |
RST | P17 | Reset pin (Low active) |
HRDY | P24 | Busy status pin (Low when busy) |
- Make sure you have switched the sail switch to SPI mode.
- Install BCM2835 libraries to your Raspberry Pi, you can download the newest bcm2835 library from its official website http://www.airspayce.com/mikem/bcm2835/
Copy the library you download to Raspberry Pi and install it with the commands below. You can also follow the instruction on its website above.
tar zxvf bcm2835-1.xx.tar.gz cd bcm2835-1.xx ./configure make sudo make check sudo make install
- Download Demo code and copy it to your Raspberry Pi. Extract and run it with the commands below in your Raspberry Pi.
git clone https://github.com/waveshare/IT8951-ePaper.git cd IT8951-ePaper/Raspberry sudo make clean sudo make -j4
heck the VCOM value on the FPC
Add the VCOM value as a parameter and test the e-Paper, and this model is mode 0.
sudo ./epd -2.51 0
- Demo execution phenomenon:
1) First, the r-paper will refresh the 16 gray bars partially in sequence.
2) Then demonstrate the demo of drawing lines, circles, rectangles, characters, and numbers
3) Then respectively demonstrate the demo of displaying bmp pictures in 1bp, 2bp, and 4bp modes
4) Next, demonstrate the effect of fast refresh in A2 mode
5) Then display a gif animation
6) Then demonstrate a Demo that counts the frame rate
7) Finally, the e-paper is whitened in Init mode for long-term storage.
Working with STM32
Because IT8951 will cost a big size of RAM, some STM32 cannot support without an external SDRAM device. So we here use Open429I as a test board, Open429I integrates IS42S16400J (64-MBIT) SDRAM and has full memory to drive the 9.7inch e-paper.
Working with STM32, you can use SPI, I80, or I2C interface. SPI is simple and needs a few GPIO, its speed can also meet the requirement of most applications. I80 is also simple and fast, however, it needs to use lots of GPIO. I2C is very slow, which we don't recommend.
SPI
1) Hardware connection
IT8951 | STM32 | Description |
---|---|---|
5V | 5V | 5V Power input |
GND | GND | Ground |
MISO | PE13 | Data output |
MOSI | PE14 | Data input |
SCK | PE12 | Clock input |
CS | PE11 | Chip select (Low active) |
RST | PC5 | Reset (Low for reset) |
HRDY | PA7 | BUSY state output (Low for busy) |
2) Set the switch to SPI mode
3) Download the demo code to refresh the picture
You can download the demo code here
Open the project with Keil: Open429I-C-IT8951-Demo\Project\9.7-IT8951\MDK-ARM\Project.uvproj
Click on "Compile", then open IT8951.h and make sure that IT8951_Interface_SPI is defined. Click on "Recompile" and download. After a few seconds, you should be able to see the e-paper start displaying images in a loop.
The information will be printed as below (115200, 8N1)
I80
1) Hardware connection
IT8951 | STM32 | Description |
---|---|---|
Vcc | 5V | 5V Power input |
GND | GND | Ground |
DBUS0~DBUS15 | PB0~PB15 | Data pins |
HWE | PC1 | Write enable (Low active) |
D/C | PC7 | Data/Command (Low for command) |
CSEL | PC6 | Chip select (Low active) |
HRD | PC3 | Read enabled (Low for active) |
RST | PC0 | Reset (Low for reset) |
BUSY | PA7 | Busy state output (Low for busy) |
2) Set the switch to I80 mode
3) Display with demo code
You can download the demo code here
After downloading, extract the files and open the project using Keil. The project directory address is Open429I-C-IT8951-Demo\Project\9.7-IT8951\MDK-ARM\Project.uvproj.
Click on "Compile", then open IT8951.h and make sure that IT8951_Interface_I80 is defined. Click on "Recompile" and download. After a few seconds, you should be able to see the e-paper start displaying images in a loop.
- Step 4: View the serial port print information, where the serial port print information is as follows (baud rate 115200):
Display pictures
For easy porting of our demo code, we display pictures with a data matrix instead of the file system.
We should first convert the BMP picture to a data matrix (arrays), and use it in demo code.
1) Prepare a BMP image, and resize the picture to 1200*825 (the resolution of this e-Paper)
2) Open BMP convert software, Click File -> Open..-> to open the picture as below:
3) Click Image -> Convert to -> Gray256(8 BPP)
4) Click File -> Save As... -> Choose "C" bitmap file (*.c) -> input file name and click Save.
5) Choose 8 bits per pixel, and click OK. A C file will be saved to your PC
6) Add the C file to the keil project, detect unusable information
/********************************************************************* * SEGGER Microcontroller GmbH & Co. KG * * Solutions for real time microcontroller applications * * www.segger.com * ********************************************************************** * * * C-file generated by * * * * Bitmap Converter for emWin V5.22. * * Compiled Jul 4 2013, 12:18:24 * * (c) 1998 - 2013 Segger Microcontroller GmbH && Co. KG * * * ********************************************************************** * * * Source file: zoo * * Dimensions: 1200 * 825 * * NumColors: 256 * * * ********************************************************************** */ #include <stdlib.h> #include "GUI.h" #ifndef GUI_CONST_STORAGE #define GUI_CONST_STORAGE const #endif extern GUI_CONST_STORAGE GUI_BITMAP bmzoo; /********************************************************************* * * Palette * * Description * The following are the entries of the palette table. * The entries are stored as a 32-bit values of which 24 bits are * actually used according to the following bit mask: 0xBBGGRR * * The lower 8 bits represent the Red component. * The middle 8 bits represent the Green component. * The highest 8 bits represent the Blue component. */ static GUI_CONST_STORAGE GUI_COLOR _Colorszoo[] = { 0x000000, 0x010101, 0x020202, 0x030303, 0x040404, 0x050505, 0x060606, 0x070707, 0x080808, 0x090909, 0x0A0A0A, 0x0B0B0B, 0x0C0C0C, 0x0D0D0D, 0x0E0E0E, 0x0F0F0F, 0x101010, 0x111111, 0x121212, 0x131313, 0x141414, 0x151515, 0x161616, 0x171717, 0x181818, 0x191919, 0x1A1A1A, 0x1B1B1B, 0x1C1C1C, 0x1D1D1D, 0x1E1E1E, 0x1F1F1F, 0x202020, 0x212121, 0x222222, 0x232323, 0x242424, 0x252525, 0x262626, 0x272727, 0x282828, 0x292929, 0x2A2A2A, 0x2B2B2B, 0x2C2C2C, 0x2D2D2D, 0x2E2E2E, 0x2F2F2F, 0x303030, 0x313131, 0x323232, 0x333333, 0x343434, 0x353535, 0x363636, 0x373737, 0x383838, 0x393939, 0x3A3A3A, 0x3B3B3B, 0x3C3C3C, 0x3D3D3D, 0x3E3E3E, 0x3F3F3F, 0x404040, 0x414141, 0x424242, 0x434343, 0x444444, 0x454545, 0x464646, 0x474747, 0x484848, 0x494949, 0x4A4A4A, 0x4B4B4B, 0x4C4C4C, 0x4D4D4D, 0x4E4E4E, 0x4F4F4F, 0x505050, 0x515151, 0x525252, 0x535353, 0x545454, 0x555555, 0x565656, 0x575757, 0x585858, 0x595959, 0x5A5A5A, 0x5B5B5B, 0x5C5C5C, 0x5D5D5D, 0x5E5E5E, 0x5F5F5F, 0x606060, 0x616161, 0x626262, 0x636363, 0x646464, 0x656565, 0x666666, 0x676767, 0x686868, 0x696969, 0x6A6A6A, 0x6B6B6B, 0x6C6C6C, 0x6D6D6D, 0x6E6E6E, 0x6F6F6F, 0x707070, 0x717171, 0x727272, 0x737373, 0x747474, 0x757575, 0x767676, 0x777777, 0x787878, 0x797979, 0x7A7A7A, 0x7B7B7B, 0x7C7C7C, 0x7D7D7D, 0x7E7E7E, 0x7F7F7F, 0x808080, 0x818181, 0x828282, 0x838383, 0x848484, 0x858585, 0x868686, 0x878787, 0x888888, 0x898989, 0x8A8A8A, 0x8B8B8B, 0x8C8C8C, 0x8D8D8D, 0x8E8E8E, 0x8F8F8F, 0x909090, 0x919191, 0x929292, 0x939393, 0x949494, 0x959595, 0x969696, 0x979797, 0x989898, 0x999999, 0x9A9A9A, 0x9B9B9B, 0x9C9C9C, 0x9D9D9D, 0x9E9E9E, 0x9F9F9F, 0xA0A0A0, 0xA1A1A1, 0xA2A2A2, 0xA3A3A3, 0xA4A4A4, 0xA5A5A5, 0xA6A6A6, 0xA7A7A7, 0xA8A8A8, 0xA9A9A9, 0xAAAAAA, 0xABABAB, 0xACACAC, 0xADADAD, 0xAEAEAE, 0xAFAFAF, 0xB0B0B0, 0xB1B1B1, 0xB2B2B2, 0xB3B3B3, 0xB4B4B4, 0xB5B5B5, 0xB6B6B6, 0xB7B7B7, 0xB8B8B8, 0xB9B9B9, 0xBABABA, 0xBBBBBB, 0xBCBCBC, 0xBDBDBD, 0xBEBEBE, 0xBFBFBF, 0xC0C0C0, 0xC1C1C1, 0xC2C2C2, 0xC3C3C3, 0xC4C4C4, 0xC5C5C5, 0xC6C6C6, 0xC7C7C7, 0xC8C8C8, 0xC9C9C9, 0xCACACA, 0xCBCBCB, 0xCCCCCC, 0xCDCDCD, 0xCECECE, 0xCFCFCF, 0xD0D0D0, 0xD1D1D1, 0xD2D2D2, 0xD3D3D3, 0xD4D4D4, 0xD5D5D5, 0xD6D6D6, 0xD7D7D7, 0xD8D8D8, 0xD9D9D9, 0xDADADA, 0xDBDBDB, 0xDCDCDC, 0xDDDDDD, 0xDEDEDE, 0xDFDFDF, 0xE0E0E0, 0xE1E1E1, 0xE2E2E2, 0xE3E3E3, 0xE4E4E4, 0xE5E5E5, 0xE6E6E6, 0xE7E7E7, 0xE8E8E8, 0xE9E9E9, 0xEAEAEA, 0xEBEBEB, 0xECECEC, 0xEDEDED, 0xEEEEEE, 0xEFEFEF, 0xF0F0F0, 0xF1F1F1, 0xF2F2F2, 0xF3F3F3, 0xF4F4F4, 0xF5F5F5, 0xF6F6F6, 0xF7F7F7, 0xF8F8F8, 0xF9F9F9, 0xFAFAFA, 0xFBFBFB, 0xFCFCFC, 0xFDFDFD, 0xFEFEFE, 0xFFFFFF }; static GUI_CONST_STORAGE GUI_LOGPALETTE _Palzoo = { 256, // Number of entries 0, // No transparency &_Colorszoo[0] }; GUI_CONST_STORAGE GUI_BITMAP bmzoo = { 1200, // xSize 825, // ySize 1200, // BytesPerLine 8, // BitsPerPixel _aczoo, // Pointer to picture data (indices) &_Palzoo // Pointer to palette };
7) Modify the codes
static GUI_CONST_STORAGE unsigned char _aczoo[] = {
to this one. (You can change the name of the array to the one you like)
const unsigned char zoo_1200_825[] = {
8) Modify related codes in IT8951.C as below
extern const unsigned char zoo_1200_825[]; void IT8951DisplayExample3() { IT8951LdImgInfo stLdImgInfo; IT8951AreaImgInfo stAreaImgInfo; TWord width = gstI80DevInfo.usPanelW; TWord high = gstI80DevInfo.usPanelH; TDWord i; for (i = 0;i < width*high;i++) { gpFrameBuf[i] = zoo_1200_825[i]; } IT8951WaitForDisplayReady(); //Setting Load image information stLdImgInfo.ulStartFBAddr = (TDWord)gpFrameBuf; stLdImgInfo.usEndianType = IT8951_LDIMG_L_ENDIAN; stLdImgInfo.usPixelFormat = IT8951_8BPP; stLdImgInfo.usRotate = IT8951_ROTATE_0; stLdImgInfo.ulImgBufBaseAddr = gulImgBufAddr; //Set Load Area stAreaImgInfo.usX = 0; stAreaImgInfo.usY = 0; stAreaImgInfo.usWidth = width; stAreaImgInfo.usHeight = high; IT8951HostAreaPackedPixelWrite(&stLdImgInfo, &stAreaImgInfo);//Display function 2 IT8951DisplayArea(0,0, gstI80DevInfo.usPanelW, gstI80DevInfo.usPanelH, 2); }
Precautions
Connection
Due to updating, the hardware connection of e-Paper may be different as the picture showed, please connect the e-Paper according to the screen silk printing.
- Example 1
- Example 2
DIP switch
- We recommend you to use USB, I80 and SPI interfaces
- Whether you use USB, SPI or I80 interface, you should turn the switch to ON as below
- If E-LINK software didn't recognize the e-Paper when you use USB interface, please check if the pins marked in red are accessible.
Codes description
New Features
- 1. Using 4bpp to refresh the 16-level grayscale image, the amount of SPI transmission data is reduced to half of the original one, avoiding the waste of RAM and transmission time caused by the previous version using 8bpp to refresh the 16-level grayscale image.
- 2. The SPI transmission speed is doubled, which is valid in the 3rd generation of Raspberry Pi, but ineffective in the 4th generation of Raspberry Pi due to the increase in CPU frequency.
- 3. The time interval for refreshing the picture is reduced to 1/4 of the original. It is measured that the previous version of the program uses GC16 mode to refresh a BMP picture with 16-level grayscale in full screen to 10.3inch e-Paper (D). It takes about 10S. And this routine only needs about 3S.
- 4. Avoid the memory leak caused by the previous version opening the BMP file after allocating the cache but not releasing it.
- 5. Add 1bpp, 2bpp, 4bpp, 8bpp mode support.
- 6. Add the A2 mode refresh demo, you can feel the A2 mode refresh speed.
- 7. Add support for drawing dots, lines, circles, rectangles, writing characters, etc., supports grayscale selection of characters and patterns, supports 1bpp, 2bpp, 4bpp, 8bpp, if you choose 1bpp, it also supports A2 mode refresh.
- 8. Add 1bpp, 2bpp, 4bpp, and 8bpp refresh support for bmp pictures, if you choose 1bpp, it also supports A2 mode refresh.
- 9. Add a demo for displaying GIF pictures, which can write multiple pictures into the IT8951 cache, and directly swipe the data of different addresses in the cache into the ink screen for display, eliminating the data transmission process between RPi and IT8951, refresh frame rate up to 7fps.
- 10. Add a frame rate test routine, which is convenient for testing and refreshing areas of different sizes, 1bpp, 2bpp, 4bpp, 8bpp, and A2 mode, GC16 mode, and refreshed frame rate.
- 11. Support to enhance the driving ability to avoid partial blurring of the screen display in some cases.
- 12. Support 4-byte alignment for 6inch ePaper HAT and 6inch HD ePaper HAT, to avoid abnormal display during 1bp refresh.
- 13. You need to input VCOM when the demo is running, and it will be completely white when the routine is running to protect the screen and prolong its life of the screen.
- 14. Optimize the program structure, reduce the coupling of the program, standardize some functions, and name variables.
Codes
Locally refresh 16 grayscale bars from light to dark grayscale in turn
- Function name: DisplayColorPaletteExample
- This demo demonstrates how to refresh 16 grayscale bars from light to dark grayscale in turn with 4bp and GC16.
Draw Dots, Lines, Circles, Rectangles, and characters
- Function name: DisplayCharacterPatternExample
- This demo demonstrates how to draw dots, lines, circles, and characters, and supports 1bpp, 2bpp, 4bpp, and 8bpp. If you use 1bpp, it also supports A2 mode to refresh.
Display BMP Picture
- Function name: DisplayBMPExample
- This demo demonstrates how to refresh a BMP picture, and supports 1bpp, 2bpp, 4bpp, and 8bpp. If you use 1bpp, it also supports A2 to refresh.
A2 Mode Refresh Example
- Function name: DynamicRefreshExample
- This demo demonstrates how to use A2 mode to refresh. In this demo, the refresh area will be refreshed several times, and the area of the refresh area will gradually become larger. After refreshing several times, an afterimage will appear. The afterimage will be cleared using INIT mode. Through this demo, you can intuitively feel the refresh speed of the A2 mode.
Display GIF Picture
- Function name: DynamicGIFExample
- This Demo demonstrates how to refresh a GIF image. In this demo, a GIF image is divided into 7 bmp images in advance, and the 7bmp images are written to the cache of a continuous address of IT8951 first. During display, the image data will be read from the cache of the corresponding address of IT8951 in turn and refreshed on the e-paper screen. Because there is no process of data transmission between RPi and IT8951, the refresh speed will be very fast. This Demo also demonstrates the limit speed of the IT8951 refreshing the ink screen is about 7.
Test frame rate
- Function name: CheckFrameRateExample
- This demo is for testing: when refreshing areas of different sizes, 1bpp, 2bpp, 4bpp, 8bpp, as well as A2 mode, GC16 mode, and refreshed frame rate, in this demo, the time to refresh 10 frames of images will be automatically counted, and Frame rate (fps) is automatically calculated.
Related Description
Mode Description
IT8951 has flashed different firmware for different resolution screens. Different firmware has different refresh modes. See the mode description for details. The modes used in the demo are INIT mode, GC16 mode, and A2 mode.
Below is a brief description of the relevant modes:
Mode | Features | 6inch/6inch HD | 7.8inch/9.7inch/10.3inch |
---|---|---|---|
INIT | is used to erase the display content and clear the screen. It is recommended to use INIT mode to clear the screen after multiple A2 mode refreshes. | Mode0 | Mode0 |
GC16 | Use 16-level grayscale to update the screen display content, and the display effect is the best. | Mode2 | Mode2 |
A2 | Can only update black and white 2-level grayscale, but the refresh speed is the fastest. | Mode4 | Mode6 |
//basic mode definition UBYTE INIT_Mode = 0; UBYTE GC16_Mode = 2; //A2_Mode's value is not fixed, is decided by firmware's LUT UBYTE A2_Mode = 6;
if( strcmp(LUT_Version, "M641") == 0 ){ //6inch e-Paper HAT(800,600), 6inch HD e-Paper HAT(1448,1072), 6inch HD touch e-Paper HAT(1448,1072) A2_Mode = 4; Four_Byte_Align = true; }else if( strcmp(LUT_Version, "M841") == 0 ){ //9.7inch e-Paper HAT(1200,825) A2_Mode = 6; }else if( strcmp(LUT_Version, "M841_TFA2812") == 0 ){ //7.8inch e-Paper HAT(1872,1404) A2_Mode = 6; }else if( strcmp(LUT_Version, "M841_TFA5210") == 0 ){ //10.3inch e-Paper HAT(1872,1404) A2_Mode = 6; }else{ //default set to 6 as A2 Mode A2_Mode = 6; }
About bpp
bpp is Bits per pixel, it is the data that show the number of bits per pixel. Currently, all the gray e-Paper supports 1bpp, 2bpp, 4bpp, and 8bpp.
- 1bpp
- Evey pixel use 1 bit
- It supports 2 (2^1=2) gray, it is used for A2 mode
- Evey byte contains 8 pixels
- Save in RAM in big-endian format
- IT8951 uses little-endian format by default, you should convert it when using.
- 2bpp
- Every pixel uses 2 bits
- Support 4(2^2=4) grays
- Every byte contains 4 pixels
- Save in RAM in big-endian format
- IT8951 uses little-endian format by default, you should convert it when using.
- 4bpp
- Every pixel uses 4 bits
- Support 16(2^4=16) grays
- Every byte contains 2 pixels
- Save in RAM in big-endian format
- IT8951 uses little-endian format by default, you should convert it when using.
- 8bpp
- Every pixel uses 8 bits.
- Support 256(2^8=256) grays, however, IT8951 only uses the high four bits, only supports 16 grays.
- Every byte contains 1 pixel.
- Save in RAM in big-endian format.
- IT8951 uses little-endian format by default, you should convert it when using.
Every pixel of the original image contains 8 bits (1 byte). To convert it to BMP, you can only get the high bits. For example, if you want to get pixels for 2bpp, you can just get 2 high bits from the 8bpp(8bits) image.
UDOUBLE Addr = X * (Paint.BitsPerPixel) / 8 + Y * Paint.WidthByte; switch( Paint.BitsPerPixel ){ case 8:{ Paint.Image[Addr] = Color & 0xF0; break; } case 4:{ Paint.Image[Addr] &= ~( (0xF0) >> (7 - (X*4+3)%8 ) ); Paint.Image[Addr] |= (Color & 0xF0) >> (7 - (X*4+3)%8 ); break; } case 2:{ Paint.Image[Addr] &= ~( (0xC0) >> (7 - (X*2+1)%8 ) ); Paint.Image[Addr] |= (Color & 0xC0) >> (7 - (X*2+1)%8 ); break; } case 1:{ Paint.Image[Addr] &= ~( (0x80) >> (7 - X%8) ); Paint.Image[Addr] |= (Color & 0x80) >> (7 - X%8); break; } }
Align bytes
During the test, we find that when we use 1bpp mode to update the 6inch e-Paper and 6inch HD e-Paper, we should align the X (begin point) and W (width) of the update area to four bytes (32bits), otherwise, the image cannot be displayed.
if( strcmp(LUT_Version, "M641") == 0 ){ //6inch e-Paper HAT(800,600), 6inch HD e-Paper HAT(1448,1072), 6inch HD touch e-Paper HAT(1448,1072) A2_Mode = 4; Four_Byte_Align = true; }else if( strcmp(LUT_Version, "M841") == 0 ){ ... } if(Four_Byte_Align == true){ In_4bp_Refresh_Area_Width = Panel_Width - (Panel_Width % 32); }else{ In_4bp_Refresh_Area_Width = Panel_Width; } X_Start = Min_X < 32 ? 0 : Min_X - (Min_X % 32); Debug("X_Start:%d\r\n",X_Start); X_End = ( Max_X + (32 - (Max_X % 32)) ) > Touch_Pannel_Area_Width ? ( Max_X - (Max_X % 32) ) : ( Max_X + (32 - (Max_X % 32)) ); Debug("X_End:%d\r\n",X_End); Y_Start = Min_Y; Debug("Y_Start:%d\r\n",Y_Start); Y_End = Max_Y; Debug("Y_Start:%d\r\n",Y_End); Width = X_End - X_Start; if(Width<=0){ Width = 32; } Debug("Width:%d\r\n",Width); Height = Y_End-Y_Start; if(Height<=0){ Height = 32; } Debug("Height:%d\r\n",Height);
About the speed of SPI
The CPU of Raspberry Pi 3 is different from Raspberry Pi 4.
- For Raspberry Pi, it could use a maximum of 16 clock dividers.
- For Raspberry Pi, it could use a maximum of 32 clock dividers.
- You can refer to the description of BCM2835 libraries about the clock divider.
- You can modify the clock divider according to the board you use:
bcm2835_spi_begin();//Start spi interface, set spi pin for the reuse function bcm2835_spi_setBitOrder(BCM2835_SPI_BIT_ORDER_MSBFIRST);//High first transmission bcm2835_spi_setDataMode(BCM2835_SPI_MODE0);//spi mode 0 //bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_16);//For RPi 3/3B/3B+ bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_32);//For RPi 4B /* SPI clock reference link:*/ /*http://www.airspayce.com/mikem/bcm2835/group__constants.html#gaf2e0ca069b8caef24602a02e8a00884e*/
Enhance driving capability
Sometimes, the e-Paper displays abnormally because of the long FPC cable, in this case, you can try to enhance the driving capability:
#if(Enhance) Debug("Attention! Enhanced driving ability, only used when the screen is blurred\r\n"); Enhance_Driving_Capability(); #endif /****************************************************************************** function : Enhanced driving capability parameter: Enhanced driving capability for IT8951, in case the blurred display effect ******************************************************************************/ void Enhance_Driving_Capability(void) { UWORD RegValue = EPD_IT8951_ReadReg(0x0038); Debug("The reg value before writing is %x\r\n", RegValue); EPD_IT8951_WriteReg(0x0038, 0x0602); RegValue = EPD_IT8951_ReadReg(0x0038); Debug("The reg value after writing is %x\r\n", RegValue); }
- If you are using the USB interface with a PC, you can try to configure:
About VCOM
The VCOM voltages of every e-Paper panel are different and they are printed on FPC cable. Please make sure that you use the correct VCOM.
Development Note
The above only illustrates how to use the 9.7-inch e-Paper HAT (D). For details on how to modify and perform secondary development, you need to consult the relevant code by yourself.
Please refer to the IT8951-related information provided in the information section.
Resources
Schematic
Demo code
Datasheet
Software
Other documents
Related Resources
Notice:
The projects listed are all made and shared by the project owners, Waveshare isn't responsible for the project or the update.
- This is a post in Arduino Form about our SPI e-Paper thanks to ZinggJM, which maybe you want to refer to.
- This is the Inkycal project for reference.
FAQ
Questions About Software & Hardware
{{{5}}}
2. Try changing the USB interface. It is recommended to use the USB interface on the back of the PC. Relatively speaking, the power supply current will be larger.
3. Turn the DIP switch to the end. During shipping, the DIP switches may be loosened, and the floating configuration pins cannot put the IT8951 into USB mode.
{{{5}}}
If you fail to refresh, check whether the hard link is normal, use the USB port on the back of the PC (most of the USB ports on the front of the PC have weak power supply capability), and replace the e-paper test.
Note: Do not plug and unplug the e-paper with power on, otherwise the driver board and e-paper may be damaged.
{{{5}}}
Questions About Screen
- 【Operating condition】Temperature range: 0~50°C; Humidity range: 35%~65%RH
- 【Storage condition】Temperature range: below 30°C; Humidity range: below 55%RH; Maximum storage time: 6 months
- 【Transportation condition】Temperature range:-25~70°C; Maximum shipping time: 10 days
- 【After unpacking】Temperature range: 20°C±5°C; Humidity range: 50±5%RH; Maximum storage time: Assembled within 72 hours
{{{5}}}
- Refresh mode:
- Full refresh: The e-paper screen will flicker several times during refreshing (the flicking times depend on the refresh time), and the flicker is to remove the ghosting to achieve the best display effect.
- Partial refresh: The e-paper screen has no flickering effect during refreshing. Users who use partial flashing should pay attention to performing a full flashing operation to remove the ghosting after refreshing several times, otherwise, the ghosting problem will become more and more serious, or even damage the screen. (At present, only some black and white e-paper screens support local brushing, please refer to the product page for details).
- Refresh frequency:
- During use, it is recommended that customers set the refresh interval of the e-ink screen to at least 180 seconds. (Except for products that support the partial refreshing function)
- During the standby process (that is, after the refresh operation), it is recommended that the customer set the e-paper screen to sleep mode, or power off (the power supply part of the e-paper screen can be disconnected with an analog switch) to reduce power consumption and prolong the life of the e-paper screen. (If some e-paper screens are powered on for a long time, the screen will be damaged beyond repair.)
- During the use of the e-paper screen, it is recommended that customers update the display screen at least every 24 hours. (If the screen keeps the same picture for a long time, there will be a burn-in situation that is difficult to repair).
- Application scenarios:
- The e-paper screen is recommended for indoor use. If it is used outdoors, it is necessary to prevent the e-paper screen from being exposed to direct sunlight, and at the same time, it is necessary to take ultraviolet protection measures, because charged particles will dry out under strong light for a long time, resulting in loss of activity and failure to refresh. This situation is irreversible. When designing electronic ink screen products, customers should pay attention to determine whether the use environment meets the requirements of electronic ink screens.
{{{5}}}
{{{5}}}
{{{5}}}
{{{5}}}
{{{5}}}
Support
Technical Support
If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 AM GMT+8 (Monday to Friday)