https://www.waveshare.com/w/api.php?action=feedcontributions&user=Wiki+Editorial+Team&feedformat=atomWaveshare Wiki - User contributions [en]2024-03-28T10:04:31ZUser contributionsMediaWiki 1.35.5https://www.waveshare.com/w/index.php?title=7.5inch_e-Paper_HAT_(B)&diff=135237.5inch e-Paper HAT (B)2017-09-20T11:45:56Z<p>Wiki Editorial Team: Created page with "{{Infobox item|colorscheme=blue |brief=640x384, 7.5inch E-Ink display HAT for Raspberry Pi, three-color |img=File:7.5inch-e-paper-hat-b-4.jpg|300px|link=http://www.waveshare..."</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=640x384, 7.5inch E-Ink display HAT for Raspberry Pi, three-color<br />
|img=[[File:7.5inch-e-paper-hat-b-4.jpg|300px|link=http://www.waveshare.com/7.5inch-e-paper-hat-b.htm]]<br />
|caption=640x384, 7.5inch E-Ink display HAT for Raspberry Pi, three-color, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/7.5inch-e-paper-hat-b.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/7.5inch-e-paper-hat-b.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
640x384, 7.5inch E-Ink display HAT for Raspberry Pi, three-color, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/7.5inch-e-paper-hat-b.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:7.5inch-e-paper-hat-code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow (about 31s), and it will flicker for several times during refreshing. Please be patient.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3 (if the display doesn't work on 3.3V, you can try 5V in most cases.)<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow (about 31s), and it will flicker for several times during refreshing. Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow (about 31s), and it will flicker for several times during refreshing. Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> power setting --> panel setting --> booster soft start --> PLL control --> temperature calibration --> VCOM and data interval setting --> TCON setting --> TCON resolution --> VCM DC setting --> power on.<br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to the module, and the screen will refresh and display it.<br />
<br />
Process: Send command data start transmission 1 --> Send data of an image to display --> Refresh the screen.<br />
<br />
Note:<br />
* About the image data: 4 bits = 1 pixel, doesn’t support Gray scale (can only display black and white). 0000 (binary) stands for a black pixel, 0011 (binary) stands for a white pixel, 0100 (binary) stands for a red pixel.<br />
<br />
For example:<br />
: 0x00: 2 pixels ■■<br />
: 0x03: 2 pixels ■□<br />
: 0x30: 2 pixels □■<br />
: 0x33: 2 pixels □□<br />
: 0x04: 2 pixels ■<font color=red>■</font><br />
: 0x43: 2 pixels <font color=red>■</font>□<br />
: but 0x66: the state of pixels is uncertain<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow (about 31s), and it will flicker for several times during refreshing. Please be patient.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
Process: power off --> deep sleep<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 640x384.<br />
# Because this module can only display black, white and red, we need to convert a picture to an array in 4-level-grayscale. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/640x384.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: 4-level-grayscale<br />
#* Maximum width and height: 640 and 384<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click "Save", to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
Note: <br />
* The module decodes the image data as: 4 bits = 1 pixel, but due to Gray scale unsupported, a 4-level-grayscale array (2 bits = 1 pixel) is enough. Once the program finds 00 (binary) in a bitmap table, it will send 0011 (binary); but if finds 11 (binary), it will send 0011 (binary); in other cases, 01 or 10 (binary), it will send 0100 (binary). For example, if the program decodes a byte 0x4C in a bitmap table, it will send 0x0430 in fact.<br />
* Raspberry Pi has enough RAM, therefore in the imagedata of the C program for Raspberry Pi, 4 bits = 1 pixel, of which bit wide is like the one of a 16-color bitmap (not 16-bit bitmap). However, the hex of the color of a 16-color bitmap is unlike the one of the imagedate for the e-paper display. (2 bits = 1 pixel in the imagedate for Arduino and STM32)<br />
<br />
Comparison between the color hex in 16-color bitmap and the module.<br />
{|class="wikitable"<br />
|-<br />
| Hex || pixel color of 16-color bitmap || pixel color of the module<br />
|-<br />
| 0x0 || [[File:7.5inch-e-paper-hat-b-manual-1.jpg]] || Black<br />
|-<br />
| 0x3 || [[File:7.5inch-e-paper-hat-b-manual-2.jpg]] || White<br />
|-<br />
| 0x4 || [[File:7.5inch-e-paper-hat-b-manual-3.jpg]] || Red<br />
|}<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:7.5inch-e-paper-hat-schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:7.5inch-e-paper-hat-code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:7.5inch-e-paper-hat-specification.pdf|Datasheet]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-b-manual-3.jpg&diff=13522File:7.5inch-e-paper-hat-b-manual-3.jpg2017-09-20T11:45:19Z<p>Wiki Editorial Team: MsUpload</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-b-manual-2.jpg&diff=13521File:7.5inch-e-paper-hat-b-manual-2.jpg2017-09-20T11:45:18Z<p>Wiki Editorial Team: MsUpload</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-b-manual-1.jpg&diff=13520File:7.5inch-e-paper-hat-b-manual-1.jpg2017-09-20T11:45:17Z<p>Wiki Editorial Team: MsUpload</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-b-manual-3.bmp&diff=13519File:7.5inch-e-paper-hat-b-manual-3.bmp2017-09-20T11:40:55Z<p>Wiki Editorial Team: Wiki Editorial Team uploaded a new version of &quot;File:7.5inch-e-paper-hat-b-manual-3.bmp&quot;</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-b-manual-2.bmp&diff=13518File:7.5inch-e-paper-hat-b-manual-2.bmp2017-09-20T11:40:55Z<p>Wiki Editorial Team: Wiki Editorial Team uploaded a new version of &quot;File:7.5inch-e-paper-hat-b-manual-2.bmp&quot;</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-b-manual-1.bmp&diff=13517File:7.5inch-e-paper-hat-b-manual-1.bmp2017-09-20T11:40:55Z<p>Wiki Editorial Team: Wiki Editorial Team uploaded a new version of &quot;File:7.5inch-e-paper-hat-b-manual-1.bmp&quot;</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-b-manual-2.bmp&diff=13516File:7.5inch-e-paper-hat-b-manual-2.bmp2017-09-20T11:37:05Z<p>Wiki Editorial Team: MsUpload</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-b-manual-1.bmp&diff=13515File:7.5inch-e-paper-hat-b-manual-1.bmp2017-09-20T11:37:04Z<p>Wiki Editorial Team: MsUpload</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-b-manual-3.bmp&diff=13514File:7.5inch-e-paper-hat-b-manual-3.bmp2017-09-20T11:37:04Z<p>Wiki Editorial Team: MsUpload</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=7.5inch_e-Paper_HAT&diff=135137.5inch e-Paper HAT2017-09-20T10:51:52Z<p>Wiki Editorial Team: </p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=640x384, 7.5inch E-Ink display HAT for Raspberry Pi<br />
|img=[[File:7.5inch-e-paper-hat-4.jpg|300px|link=http://www.waveshare.com/7.5inch-e-paper-hat.htm]]<br />
|caption=640x384, 7.5inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/7.5inch-e-paper-hat.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/7.5inch-e-paper-hat.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
640x384, 7.5inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/7.5inch-e-paper-hat.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:7.5inch-e-paper-hat-code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow (about 6s), and it will flicker for several times during refreshing. Please be patient.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3 (if the display doesn't work on 3.3V, you can try 5V in most cases.)<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow (about 6s), and it will flicker for several times during refreshing. Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow (about 6s), and it will flicker for several times during refreshing. Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> power setting --> panel setting --> booster soft start --> power on --> PLL control --> temperature calibration --> VCOM and data interval setting --> TCON setting --> TCON resolution --> VCM DC setting.<br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to the module, and the screen will refresh and display it.<br />
<br />
Process: Send command data start transmission 1 --> Send data of an image to display --> Refresh the screen.<br />
<br />
Note:<br />
* About the image data: 4 bits = 1 pixel, doesn’t support Gray scale (can only display black and white). 0000 (binary) stands for a black pixel, otherwise 0011 (binary) stands for a white pixel.<br />
<br />
For example:<br />
<pre><br />
0x00: 2 pixels ■■<br />
0x03: 2 pixels ■□<br />
0x30: 2 pixels □■<br />
0x33: 2 pixels □□<br />
but 0x66: the state of pixels is uncertain<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow (about 6s), and it will flicker for several times during refreshing. Please be patient.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
Process: power off --> deep sleep<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 640x384.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 640 and 384<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
* Note: the module decodes the image data as: 4 bits = 1 pixel, but due to Gray scale unsupported, a monochrome bitmap array (1 bit = 1 pixel) is enough. Once the program finds a bit set in a bitmap table, it will send 0x3; but if a bit reset, it will send 0x0. For example, if the program decodes a byte 0xAA in a bitmap table, it will send 0x30303030 in fact.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:7.5inch-e-paper-hat-schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:7.5inch-e-paper-hat-code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:7.5inch-e-paper-hat-specification.pdf|Datasheet]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-b-4.jpg&diff=13512File:7.5inch-e-paper-hat-b-4.jpg2017-09-20T10:48:33Z<p>Wiki Editorial Team: MsUpload</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=7.5inch_e-Paper_HAT&diff=135117.5inch e-Paper HAT2017-09-20T10:46:43Z<p>Wiki Editorial Team: Created page with "{{Infobox item|colorscheme=blue |brief=640x384, 7.5inch E-Ink display HAT for Raspberry Pi |img=File:7.5inch-e-paper-hat-4.jpg|300px|link=http://www.waveshare.com/7.5inch-e-..."</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=640x384, 7.5inch E-Ink display HAT for Raspberry Pi<br />
|img=[[File:7.5inch-e-paper-hat-4.jpg|300px|link=http://www.waveshare.com/7.5inch-e-paper-hat.htm]]<br />
|caption=640x384, 7.5inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/7.5inch-e-paper-hat.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/7.5inch-e-paper-hat.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
640x384, 7.5inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/7.5inch-e-paper-hat.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:4.2inch_e-paper_module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow (about 6s), and it will flicker for several times during refreshing. Please be patient.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3 (if the display doesn't work on 3.3V, you can try 5V in most cases.)<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow (about 6s), and it will flicker for several times during refreshing. Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow (about 6s), and it will flicker for several times during refreshing. Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> power setting --> panel setting --> booster soft start --> power on --> PLL control --> temperature calibration --> VCOM and data interval setting --> TCON setting --> TCON resolution --> VCM DC setting.<br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to the module, and the screen will refresh and display it.<br />
<br />
Process: Send command data start transmission 1 --> Send data of an image to display --> Refresh the screen.<br />
<br />
Note:<br />
* About the image data: 4 bits = 1 pixel, doesn’t support Gray scale (can only display black and white). 0000 (binary) stands for a black pixel, otherwise 0011 (binary) stands for a white pixel.<br />
<br />
For example:<br />
<pre><br />
0x00: 2 pixels ■■<br />
0x03: 2 pixels ■□<br />
0x30: 2 pixels □■<br />
0x33: 2 pixels □□<br />
but 0x66: the state of pixels is uncertain<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow (about 6s), and it will flicker for several times during refreshing. Please be patient.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
Process: power off --> deep sleep<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 640x384.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 640 and 384<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
* Note: the module decodes the image data as: 4 bits = 1 pixel, but due to Gray scale unsupported, a monochrome bitmap array (1 bit = 1 pixel) is enough. Once the program finds a bit set in a bitmap table, it will send 0x3; but if a bit reset, it will send 0x0. For example, if the program decodes a byte 0xAA in a bitmap table, it will send 0x30303030 in fact.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:7.5inch-e-paper-hat-schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:7.5inch-e-paper-hat-code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:7.5inch-e-paper-hat-specification.pdf|Datasheet]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.9inch_e-Paper_Module&diff=135102.9inch e-Paper Module2017-09-20T09:49:49Z<p>Wiki Editorial Team: /* Set the frame memory (SetFrameMemory) */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=296x128, 2.9inch E-Ink display module<br />
|img=[[File:2.9inch-e-paper-module-4.jpg|300px|link=http://www.waveshare.com/2.9inch-e-paper-module.htm]]<br />
|caption=296x128, 2.9inch E-Ink display module, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.9inch-e-paper-module.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/product/2.9inch-e-paper-module.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
296x128, 2.9inch E-Ink display module, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/2.9inch-e-paper-module.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-Paper_Module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25<br />
|-<br />
| RST || 17<br />
|-<br />
| BUSY || 24<br />
|}<br />
==== Expected result ====<br />
# After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
#* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the files from the directory arduino/libraries of the demo package to documents/arduino/libraries, where can be specified by Arduino IDE --> File --> Preferences --> Sketchbook location.<br />
# Click the button '''Upload''' to compile and upload the program to your Arduino board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with the STM32 development board ===<br />
Here we use the development board XNUCLEO-F103RB. The Demo is base on the library HAL.<br />
==== Hardware connection ====<br />
Here is the hardware connection between the development board XNUCLEO-F103RB and E-paper:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! XNUCLEO-F103RB<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7<br />
|-<br />
| CLK || PA5<br />
|-<br />
| CS || PB6<br />
|-<br />
| DC || PC7<br />
|-<br />
| RST || PA9<br />
|-<br />
| BUSY || PA8<br />
|}<br />
==== Expected result ====<br />
# Open the Keil project (MDK-ARM/epd-demo.uvprojx)<br />
# Click '''Build''' to compile the project.<br />
# Click '''Download''' to download the program to the target board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
Init has 3 effects: <br />
# Set the arguments at power up. <br />
# Awaken the module from deep sleep. <br />
# Set the mode to Full update or Partial update.<br />
Process of initialization: reset --> driver output control --> booster soft start control --> write VCOM register --> set dummy line period --> set gate time --> data entry mode setting --> look-up table setting<br />
<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is used to set the update mode of the module. This table is provided by us but it may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Set the frame memory (SetFrameMemory) ===<br />
SetFrameMemory is used to write image data to the memory. <br />
* Process: <br />
:: Set the area size (see the function SetMemoryArea) --> set the start point (see the function SetMemoryPointer) --> send the command ''Write RAM'' --> start image data transfer. <br />
* The module has two memory areas. Once DisplayFrame is invoked, the following action of SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* About the image to be sent: 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for a black pixel.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
<br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to display the data from the frame memory.<br />
<br />
Note:<br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* The module will flicker during full update.<br />
* The module won't flicker during partial update, however, it may retain a "ghost image" of the last page.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== Private function: Set the memory area (SetMemoryArea) ===<br />
SetMemoryArea is used to specify the memory area, the arguments are the start/end points. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== Private function: Set the memory pointer (SetMemoryPointer) ===<br />
SetMemoryPointer is used to set the start point of the following image to be sent. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 128x296.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 128 and 296<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be converted to 1, and black is converted to 0)<br />
# Click '''Save''', to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
[[File:1.54inch-e-paper-manual-3.png|400px]]<br />
<br />
[[File:1.54inch-e-paper-manual-4.png|400px]]<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.9inch_e-Paper_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.9inch_e-Paper_Module_code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.13inch_e-Paper_HAT&diff=135092.13inch e-Paper HAT2017-09-20T09:49:26Z<p>Wiki Editorial Team: /* Set the frame memory (SetFrameMemory) */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=250x122, 2.13inch E-Ink display HAT for Raspberry Pi<br />
|img=[[File:2.13inch-e-paper-hat-intro.jpg|300px|link=http://www.waveshare.com/2.13inch-e-paper-hat.htm]]<br />
|caption=250x122, 2.13inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.13inch-e-paper-hat.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/product/2.13inch-e-paper-hat.htm Waveshare website]<br />
|interface1=SPI<br />
|interface2=RPi<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
250x122, 2.13inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/2.13inch-e-paper-hat.htm More]}}<br />
== Interfaces ==<br />
[[File:2.13inch-e-paper-hat.png|thumb|left|400px|Interfaces]]<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-Paper_Module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25<br />
|-<br />
| RST || 17<br />
|-<br />
| BUSY || 24<br />
|}<br />
==== Expected result ====<br />
# After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
#* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
[[File:2.13inch-e-paper-hat.png|thumb|400px]]<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the files from the directory arduino/libraries of the demo package to documents/arduino/libraries, where can be specified by Arduino IDE --> File --> Preferences --> Sketchbook location.<br />
# Click the button '''Upload''' to compile and upload the program to your Arduino board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with the STM32 development board ===<br />
Here we use the development board XNUCLEO-F103RB. The Demo is base on the library HAL.<br />
==== Hardware connection ====<br />
Here is the hardware connection between the development board XNUCLEO-F103RB and E-paper:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! XNUCLEO-F103RB<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7<br />
|-<br />
| CLK || PA5<br />
|-<br />
| CS || PB6<br />
|-<br />
| DC || PC7<br />
|-<br />
| RST || PA9<br />
|-<br />
| BUSY || PA8<br />
|}<br />
==== Expected result ====<br />
# Open the Keil project (MDK-ARM/epd-demo.uvprojx)<br />
# Click '''Build''' to compile the project.<br />
# Click '''Download''' to download the program to the target board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
Init has 3 effects:<br />
# Set the arguments at power up.<br />
# Awaken the module from deep sleep.<br />
# Set the mode to Full update or Partial update.<br />
<br />
Process of initialization: reset --> driver output control --> booster soft start control --> write VCOM register --> set dummy line period --> set gate time --> data entry mode setting --> look-up table setting<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is used to set the update mode of the module. This table is provided by us but it may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Set the frame memory (SetFrameMemory) ===<br />
SetFrameMemory is used to write image data to the memory. <br />
* Process: <br />
:: Set the area size (see the function SetMemoryArea) --> set the start point (see the function SetMemoryPointer) --> send the command ''Write RAM'' --> start image data transfer. <br />
* The module has two memory areas. Once DisplayFrame is invoked, the following action of SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* About the image to be sent: 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for a black pixel.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
<br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to display the data from the frame memory.<br />
<br />
Note:<br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* The module will flicker during full update.<br />
* The module won't flicker during partial update, however, it may retain a "ghost image" of the last page.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== Private function: Set the memory area (SetMemoryArea) ===<br />
SetMemoryArea is used to specify the memory area, the arguments are the start/end points. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== Private function: Set the memory pointer (SetMemoryPointer) ===<br />
SetMemoryPointer is used to set the start point of the following image to be sent. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 128x250 (real resolution: 122x250; logic resolution: 128x250).<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 128 and 250<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be converted to 1, and black is converted to 0)<br />
# Click '''Save''', to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
[[File:1.54inch-e-paper-manual-3.png|400px]]<br />
<br />
[[File:1.54inch-e-paper-manual-4.png|400px]]<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.13inch_e-Paper_HAT_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.13inch_e-Paper_HAT-code.7z|Demo code]]<br />
=== Demo video ===<br />
* [https://youtu.be/y5XdNrZ6AtY 2.13inch e-paper Demo video]<br />
=== Datasheets ===<br />
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=1.54inch_e-Paper_Module&diff=135081.54inch e-Paper Module2017-09-20T09:48:46Z<p>Wiki Editorial Team: /* Set the frame memory (SetFrameMemory) */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=200x200, 1.54inch E-Ink display module<br />
|img=[[File:1.54inch-e-paper-module-6.jpg|300px|link=http://www.waveshare.com/1.54inch-e-Paper-Module.htm]]<br />
|caption=200x200, 1.54inch E-Ink display module, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/1.54inch-e-Paper-Module.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/product/1.54inch-e-Paper-Module.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
200x200, 1.54inch E-Ink display module, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/1.54inch-e-Paper-Module.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-Paper_Module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25<br />
|-<br />
| RST || 17<br />
|-<br />
| BUSY || 24<br />
|}<br />
==== Expected result ====<br />
# After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
#* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the files from the directory arduino/libraries of the demo package to documents/arduino/libraries, where can be specified by Arduino IDE --> File --> Preferences --> Sketchbook location.<br />
# Click the button '''Upload''' to compile and upload the program to your Arduino board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with the STM32 development board ===<br />
Here we use the development board XNUCLEO-F103RB. The Demo is base on the library HAL.<br />
==== Hardware connection ====<br />
Here is the hardware connection between the development board XNUCLEO-F103RB and E-paper:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! XNUCLEO-F103RB<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7<br />
|-<br />
| CLK || PA5<br />
|-<br />
| CS || PB6<br />
|-<br />
| DC || PC7<br />
|-<br />
| RST || PA9<br />
|-<br />
| BUSY || PA8<br />
|}<br />
==== Expected result ====<br />
# Open the Keil project (MDK-ARM/epd-demo.uvprojx)<br />
# Click '''Build''' to compile the project.<br />
# Click '''Download''' to download the program to the target board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
Init has 3 effects: 1, Set the arguments at power up. 2, Awaken the module from deep sleep. 3, Set the mode to Full update or Partial update.<br />
<br />
Process of initialization: reset --> driver output control --> booster soft start control --> write VCOM register --> set dummy line period --> set gate time --> data entry mode setting --> look-up table setting<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is used to set the update mode of the module. This table is provided by us but it may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Set the frame memory (SetFrameMemory) ===<br />
SetFrameMemory is used to write image data to the memory. <br />
* Process: <br />
:: Set the area size (see the function SetMemoryArea) --> set the start point (see the function SetMemoryPointer) --> send the command ''Write RAM'' --> start image data transfer. <br />
* The module has two memory areas. Once DisplayFrame is invoked, the following action of SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* About the image to be sent: 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for a black pixel.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
<br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to display the data from the frame memory.<br />
<br />
Note:<br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* The module will flicker during full update.<br />
* The module won't flicker during partial update, however, it may retain a "ghost image" of the last page.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== Private function: Set the memory area (SetMemoryArea) ===<br />
SetMemoryArea is used to specify the memory area, the arguments are the start/end points. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== Private function: Set the memory pointer (SetMemoryPointer) ===<br />
SetMemoryPointer is used to set the start point of the following image to be sent. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 200x200.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 200 and 200<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be converted to 1, and black is converted to 0)<br />
# Click '''Save''', to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
[[File:1.54inch-e-paper-manual-3.png|400px]]<br />
<br />
[[File:1.54inch-e-paper-manual-4.png|400px]]<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:1.54inch_e-Paper_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:1.54inch_e-Paper_Module_code.7z|Demo code]]<br />
=== Demo video ===<br />
* [https://youtu.be/-XbwDC2AOOw 1.54inch e-paper demo video]<br />
=== Datasheets ===<br />
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-4.jpg&diff=13507File:7.5inch-e-paper-hat-4.jpg2017-09-20T09:40:21Z<p>Wiki Editorial Team: MsUpload</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-code.7z&diff=13504File:7.5inch-e-paper-hat-code.7z2017-09-19T09:26:02Z<p>Wiki Editorial Team: Wiki Editorial Team uploaded a new version of &quot;File:7.5inch-e-paper-hat-code.7z&quot;</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-b-code.7z&diff=13503File:7.5inch-e-paper-hat-b-code.7z2017-09-19T09:25:33Z<p>Wiki Editorial Team: MsUpload</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:7.5inch-e-paper-hat-code.7z&diff=13502File:7.5inch-e-paper-hat-code.7z2017-09-19T09:24:56Z<p>Wiki Editorial Team: MsUpload</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=Template:Product_List&diff=13501Template:Product List2017-09-19T09:20:49Z<p>Wiki Editorial Team: </p>
<hr />
<div><noinclude><br />
This template is embedded into the main page of this Wiki or the info boxes in several pages.<br />
</noinclude><br />
{{#switch: {{{1|}}}<br />
| Robotics/AlphaBot/Kits =<br />
* [[AlphaBot]]<br />
| Robotics/AlphaBot/Modules =<br />
* [[Photo Interrupter Sensor]]<br />
* [[Infrared Proximity Sensor]]<br />
* [[Tracker Sensor]]<br />
| Robotics/AlphaBot2/Kits =<br />
* [[AlphaBot2]]<br />
* [[AlphaBot2-Ar]]<br />
* [[AlphaBot2-Pi]]<br />
* [[AlphaBot2-PiZero]]<br />
| Mini PC/Raspberry Pi/Boards =<br />
* [[RPi3 B]]<br />
* [[RPi3 B (with rainbow case)]]<br />
*{{Retired|RPi2 B}}<br />
*{{Retired|RPi2 B (with rainbow case)}}<br />
*{{Retired|RPi B+ (CN)}}<br />
| Mini PC/Raspberry Pi/Packages =<br />
* [[RPi3 B Package B]]<br />
* [[RPi3 B Package C]]<br />
* [[RPi3 B Package D]]<br />
* [[RPi3 B Package E]]<br />
* [[RPi3 B Package F]]<br />
* [[RPi Acce A]]<br />
* [[RPi Acce B]]<br />
* [[RPi Acce C]]<br />
* [[RPi Acce D]]<br />
* [[RPi Acce E]]<br />
* [[RPi Acce F]]<br />
* {{Retired|RPi2 B Package A}}<br />
* {{Retired|RPi2 B Package C}}<br />
* {{Retired|RPi2 B Package D}}<br />
* {{Retired|RPi2 B Package E}}<br />
* {{Retired|RPi2 B Package F}}<br />
* {{Retired|RPi B+ (CN) Package A}}<br />
* {{Retired|RPi B+ (CN) Package B}}<br />
* {{Retired|RPi B+ (CN) Package C}}<br />
* {{Retired|RPi B+ (CN) Package D}}<br />
* {{Retired|RPi B+ Acce B}}<br />
* {{Retired|RPi A+ Package A}}<br />
* {{Retired|RPi A+ Package C}}<br />
* {{Retired|RPi A+ Package D}}<br />
* {{Retired|RPi A+ Acce C}}<br />
| Mini PC/Raspberry Pi/Expansions =<br />
* [[RGB LED HAT (B)]]<br />
* [[RGB LED HAT]]<br />
* [[USB HUB HAT]]<br />
* [[RPi Motor Driver Board]]<br />
* [[RPi Relay Board]]<br />
* [[ARPI600]]<br />
* [[Pioneer600]]<br />
* [[DVK512]]<br />
* [[High-Precision AD/DA Board]]<br />
* [[GSM/GPRS/GNSS HAT]]<br />
* [[RPi Touch Keypad]]<br />
* [[10.1inch HDMI LCD]]<br />
* [[10.1inch HDMI LCD (B) (with case)]]<br />
* [[10.1inch HDMI LCD (H) (with case)]]<br />
* [[7inch HDMI LCD (C)]]<br />
* [[7inch HDMI LCD (B)]]<br />
* [[7inch HDMI LCD]]<br />
* [[7inch LCD for Pi]]<br />
* [[5inch HDMI LCD (B)]]<br />
* [[5inch HDMI LCD]]<br />
* [[4.3inch HDMI LCD]]<br />
* [[4inch HDMI LCD]]<br />
* [[4inch RPi LCD (A)]]<br />
* [[3.5inch HDMI LCD]]<br />
* [[3.5inch RPi LCD (B)]]<br />
* [[3.5inch RPi LCD (A)]]<br />
* [[3.2inch RPi LCD (B)]]<br />
* [[2.8inch RPi LCD (A)]]<br />
* [[RPi IR-CUT Camera]]<br />
* [[RPi NoIR Camera V2]]<br />
* [[RPi Camera V2]]<br />
* [[RPi Camera (J)]]<br />
* [[RPi Camera (I)]]<br />
* [[RPi Camera (H)]]<br />
* [[RPi Camera (G)]]<br />
* [[RPi Camera (F)]]<br />
* [[RPi Camera (E)]]<br />
* [[RPi Camera (D)]]<br />
* [[RPi Camera (C)]]<br />
* [[RPi Camera (B)]]<br />
* [[RPi Camera]]<br />
* [[RPi Zero V1.3 Camera]]<br />
* [[RPi LED Matrix]]<br />
| Mini PC/BeagleBone/Boards =<br />
* [[BB Black]]<br />
| Mini PC/BeagleBone/Packages =<br />
* [[BB Black Package C]]<br />
* [[BB Black Package D]]<br />
* [[BB Black Package E]]<br />
* [[BB Black Acce C]]<br />
* [[BB Black Acce D]]<br />
* [[BB Black Acce E]]<br />
| Mini PC/BeagleBone/Expansions =<br />
* [[LCD CAPE (7inch)]]<br />
* [[LCD CAPE (4.3inch)]]<br />
* [[MISC CAPE]]<br />
* [[RS485 CAN CAPE]]<br />
* [[CAPE for Arduino]]<br />
| Mini PC/Cubie Series/Boards =<br />
* [[Cubietruck]]<br />
* [[Cubieboard2]]<br />
* {{Retired|Cubieboard}}<br />
| Mini PC/Cubie Series/Packages =<br />
* [[Cubietruck Package A]]<br />
* [[Cubieboard2 Package A]]<br />
* [[Cubieboard2 Package C]]<br />
* [[Cubietruck Acce A]]<br />
* [[Cubieboard Acce C]]<br />
* {{Retired|Cubieboard Package A}}<br />
* {{Retired|Cubieboard Package C}}<br />
| Mini PC/Cubie Series/Expansions =<br />
* [[DVK522]]<br />
* [[DVK570]]<br />
* [[DVK571]]<br />
| Mini PC/Misc/Boards =<br />
* [[MarsBoard AM335X]]<br />
* [[MarsBoard AM335X Package A]]<br />
* [[MarsBoard AM335X Package B]]<br />
* [[MarsBoard RK3066 Pro]]<br />
* [[E9 mini PC]]<br />
| Mini PC/Misc/Expansions =<br />
* [[AM335X Adapter for Arduino]]<br />
* [[AM335X LCD Board]]<br />
* [[DVK720]]<br />
| MCU Tools/STM32/Core =<br />
* [[Core746I]]<br />
* [[XCore407I]]<br />
* [[Core429I]]<br />
* [[Core407I]]<br />
* [[Core407Z]]<br />
* [[Core407V]]<br />
* [[Core405R]]<br />
* [[Core205R]]<br />
* [[Core103Z]]<br />
* [[Core107V]]<br />
* [[Core103V]]<br />
* [[Core103R]]<br />
| MCU Tools/STM32/Open =<br />
* [[Open746I-C]]<br />
* [[Open429I-C]]<br />
* [[Open429Z-D]]<br />
* [[Open407I-C]]<br />
* [[Open407Z-C]]<br />
* [[Open407V-D]]<br />
* [[Open407V-C]]<br />
* [[Open405R-C]]<br />
* [[Open32F3-D]]<br />
* [[Open205R-C]]<br />
* [[Open103Z]]<br />
* [[Open107V]]<br />
* [[Open103V]]<br />
* [[Open103R]]<br />
* [[Open103C]]<br />
* [[Open32F0-D]]<br />
* [[Open051C]]<br />
* {{Retired|Open32L-D}}<br />
| Arduino Compatible/Main Board/STM32 NUCLEO<br />
| MCU Tools/STM32/NUCLEO =<br />
* [[NUCLEO-F767ZI]]<br />
* [[NUCLEO-F746ZG]]<br />
* [[NUCLEO-F446ZE]]<br />
* [[NUCLEO-F446RE]]<br />
* [[NUCLEO-F429ZI]]<br />
* [[NUCLEO-F411RE]]<br />
* [[NUCLEO-F410RB]]<br />
* [[NUCLEO-F401RE]]<br />
* [[NUCLEO-F334R8]]<br />
* [[NUCLEO-F303ZE]]<br />
* [[NUCLEO-F303RE]]<br />
* [[NUCLEO-F303K8]]<br />
* [[NUCLEO-F302R8]]<br />
* [[NUCLEO-F207ZG]]<br />
* [[NUCLEO-F103RB]]<br />
* [[NUCLEO-F091RC]]<br />
* [[NUCLEO-F072RB]]<br />
* [[NUCLEO-F070RB]]<br />
* [[NUCLEO-F042K6]]<br />
* [[NUCLEO-F031K6]]<br />
* [[NUCLEO-F030R8]]<br />
* [[NUCLEO-L476RG]]<br />
* [[NUCLEO-L152RE]]<br />
* [[NUCLEO-L073RZ]]<br />
* [[NUCLEO-L053R8]]<br />
| Arduino Compatible/Main Board/STM32 XNUCLEO<br />
| MCU Tools/STM32/XNUCLEO =<br />
* [[XNUCLEO-F411RE]]<br />
* [[XNUCLEO-F401RE]]<br />
* [[XNUCLEO-F302R8]]<br />
* [[XNUCLEO-F103RB]]<br />
* [[XNUCLEO-F030R8]]<br />
| MCU Tools/STM32/Discovery =<br />
* [[STM32F746G-DISCO]]<br />
* [[STM32F469I-DISCO]]<br />
* [[STM32F429I-DISCO]]<br />
* [[STM32F411E-DISCO]]<br />
* [[STM32F4DISCOVERY]]<br />
* [[STM32F3DISCOVERY]]<br />
* [[STM32F0DISCOVERY]]<br />
* [[STM32F072B-DISCO]]<br />
* [[STM32VLDISCOVERY]]<br />
* [[STM32L476G-DISCO]]<br />
* [[STM32L152C-DISCO]]<br />
* [[STM32L100C-DISCO]]<br />
* [[M24LR-DISCOVERY]]<br />
* {{Retired|STM32L-DISCOVERY}}<br />
| MCU Tools/STM32/EVK / Port =<br />
* [[EVK407I]]<br />
* {{Retired|Port407Z}}<br />
* {{Retired|Port103Z}}<br />
| MCU Tools/STM32/Programmers / Debuggers =<br />
* [[ST-LINK/V2 (EN)]]<br />
* [[ST-LINK/V2 (CN)]]<br />
* [[ST-LINK]]<br />
* [[ST-LINK/V2 (mini)]]<br />
* [[ARM Debugger]]<br />
* [[STX-RLINK]]<br />
| MCU Tools/STM32/Adapters =<br />
* [[STM32-QFP176]]<br />
* [[STM32-QFP144]]<br />
* [[STM32-QFP100]]<br />
* [[STM32-QFP64]]<br />
* [[STM32-QFP48]]<br />
| MCU Tools/LPC/Core =<br />
* [[Core4357]]<br />
* [[Core4337]]<br />
* [[Core1788]]<br />
| MCU Tools/LPC/Open =<br />
* [[Open4357-C]]<br />
* [[Open4337-C]]<br />
* [[Open1788]]<br />
* [[Open1768]]<br />
* {{Retired|Open1343}}<br />
* {{Retired|Open11C14}}<br />
* {{Retired|Open1114}}<br />
| MCU Tools/STM8/Open =<br />
* [[Open8S208Q80]]<br />
| MCU Tools/STM8/Discovery =<br />
* [[STM8A-DISCOVERY]]<br />
* [[STM8L-DISCOVERY]]<br />
* [[STM8S-DISCOVERY]]<br />
* [[STM8SVLDISCOVERY]]<br />
* [[M24LR-DISCOVERY]]<br />
| MCU Tools/STM8/Adapters =<br />
* [[STM8-QFP64-0.8]]<br />
* [[STM8-QFP64-0.5]]<br />
* [[STM8-QFP48]]<br />
* [[STM8-QFP44]]<br />
* [[STM8-QFP32]]<br />
* [[STM8-TSSOP20]]<br />
| MCU Tools/STM8/Programmers / Debuggers =<br />
* [[ST-LINK/V2 (EN)]]<br />
* [[ST-LINK/V2 (CN)]]<br />
* [[ST-LINK]]<br />
* [[ST-LINK/V2 (mini)]]<br />
* [[STX-RLINK]]<br />
| Arduino Compatible/Main Board/AVR<br />
| MCU Tools/AVR/Arduino =<br />
* [[UNO PLUS]]<br />
| MCU Tools/AVR/Open =<br />
* [[OpenM128]]<br />
| MCU Tools/AVR/Programmers / Debuggers =<br />
* [[Atmel-ICE]]<br />
* [[USB AVR JTAGICE XPII]]<br />
* [[USB AVRISP XPII]]<br />
* [[USB AVRISP]]<br />
* [[USB AVRISP PL]]<br />
* {{Retired|AVRISP mkII}}<br />
| MCU Tools/AVR/Adapters =<br />
* [[M64+ ADP]]<br />
* [[M16+ ADPII]]<br />
* [[M48+ ADP]]<br />
* [[T2313+ ADP]]<br />
* [[T26+ ADP]]<br />
* [[T24+ ADP]]<br />
* [[T13+ ADPII]]<br />
* [[T13+ ADP]]<br />
| MCU Tools/PIC / C8051F/Boards =<br />
* [[Open18F4520]]<br />
* [[Open16F877A]]<br />
| MCU Tools/PIC / C8051F/Programmers / Debuggers =<br />
* [[PICkit3]]<br />
* [[USB C8051F Debugger]]<br />
| FPGA Tools/ALTERA/Core =<br />
* [[CoreEP4CE10]]<br />
* [[CoreEP4CE6]]<br />
* [[CoreEP3C16]]<br />
* [[CoreEP3C5]]<br />
* [[CoreEP2C8]]<br />
* [[CoreEP2C5]]<br />
| FPGA Tools/ALTERA/Open =<br />
* [[OpenEP4CE10-C]]<br />
* [[OpenEP4CE6-C]]<br />
* [[OpenEP3C16-C]]<br />
* [[OpenEP3C5-C]]<br />
* [[OpenEP2C8-C]]<br />
* [[OpenEP2C5-C]]<br />
* [[OpenEPM1270]]<br />
| FPGA Tools/ALTERA/Programmers / Debuggers =<br />
* [[USB Blaster V2]]<br />
* [[USB Blaster]]<br />
| FPGA Tools/ALTERA/Expansions =<br />
* [[DVK600]]<br />
* [[DVK601]]<br />
| FPGA Tools/XILINX/Core =<br />
* [[Core3S500E]]<br />
* [[Core3S250E]]<br />
| FPGA Tools/XILINX/Open =<br />
* [[Open3S500E]]<br />
* [[Open3S250E]]<br />
| FPGA Tools/XILINX/Programmers / Debuggers =<br />
* [[Platform Cable USB]]<br />
| FPGA Tools/XILINX/Expansions =<br />
* [[DVK600]]<br />
* [[DVK601]]<br />
| Arduino Compatible/Shields / Adapters/WAVESHARE =<br />
* [[2.8inch TFT Touch Shield]]<br />
* [[GSM/GPRS/GPS Shield (B)]]<br />
* [[IO Expansion Shield]]<br />
* [[Motor Control Shield]]<br />
* [[Accessory Shield]]<br />
* [[RS485 CAN Shield]]<br />
* [[Analog Test Shield]]<br />
* [[Music Shield]]<br />
* {{retired|GSM/GPRS/GPS Shield}}<br />
| Arduino Compatible/Shields / Adapters/ST X-Nucleo =<br />
* [[X-NUCLEO-6180XA1]]<br />
* [[X-NUCLEO-CCA02M1]]<br />
* [[X-NUCLEO-IDB04A1]]<br />
* [[X-NUCLEO-IDS01A4]]<br />
* [[X-NUCLEO-IDS01A5]]<br />
* [[X-NUCLEO-IHM01A1]]<br />
* [[X-NUCLEO-IHM03A1]]<br />
* [[X-NUCLEO-IKS01A1]]<br />
* [[X-NUCLEO-NFC01A1]]<br />
| Arduino Compatible/Shields / Adapters/Adapters =<br />
* [[ARPI600]]<br />
* [[DVK571]]<br />
* [[CAPE for Arduino]]<br />
| OLEDs / LCDs/OLED =<br />
* [[1.3inch OLED (A)]]<br />
* [[1.3inch OLED (B)]]<br />
* [[0.96inch OLED (A)]]<br />
* [[0.96inch OLED (B)]]<br />
* [[0.95inch RGB OLED (A)]]<br />
* [[0.95inch RGB OLED (B)]]<br />
| OLEDs / LCDs/Raspberry Pi LCD =<br />
* [[10.1inch HDMI LCD]]<br />
* [[10.1inch HDMI LCD (B) (with case)]]<br />
* [[10.1inch HDMI LCD (H) (with case)]]<br />
* [[7inch HDMI LCD (C)]]<br />
* [[7inch HDMI LCD (B)]]<br />
* [[7inch HDMI LCD]]<br />
* [[7inch LCD for Pi]]<br />
* [[5inch HDMI LCD]]<br />
* [[5inch HDMI LCD (B)]]<br />
* [[4.3inch HDMI LCD]]<br />
* [[4inch HDMI LCD]]<br />
* [[4inch RPi LCD (A)]]<br />
* [[3.5inch HDMI LCD]]<br />
* [[3.5inch RPi LCD (B)]]<br />
* [[3.5inch RPi LCD (A)]]<br />
* [[3.2inch RPi LCD (B)]]<br />
* [[2.8inch RPi LCD (A)]]<br />
| OLEDs / LCDs/General Multi Color LCD =<br />
* [[10.1inch Capacitive Touch LCD (D)]]<br />
* [[7inch Capacitive Touch LCD (F)]]<br />
* [[7inch Capacitive Touch LCD (E)]]<br />
* [[7inch Capacitive Touch LCD (D)]]<br />
* [[7inch Capacitive Touch LCD (C)]]<br />
* [[7inch Capacitive Touch LCD (B)]]<br />
* [[7inch Capacitive Touch LCD]]<br />
* [[7inch Resistive Touch LCD (C)]]<br />
* [[7inch Resistive Touch LCD]]<br />
* [[4.3inch 480x272 Touch LCD (B)]]<br />
* [[4.3inch 480x272 Touch LCD (A)]]<br />
* [[3.2inch 320x240 Touch LCD (C)]]<br />
* [[2.2inch 320x240 Touch LCD (A)]]<br />
| OLEDs / LCDs/e-Paper =<br />
* [[4.3inch e-Paper UART Module]]<br />
* [[7.5inch e-Paper HAT]]<br />
* [[7.5inch e-Paper HAT (B)]]<br />
* [[4.2inch e-Paper Module]]<br />
* [[4.2inch e-Paper Module (B)]]<br />
* [[2.9inch e-Paper Module]]<br />
* [[2.9inch e-Paper Module (B)]]<br />
* [[2.7inch e-Paper HAT]]<br />
* [[2.7inch e-Paper HAT (B)]]<br />
* [[2.13inch e-Paper HAT]]<br />
* [[2.13inch e-Paper HAT (B)]]<br />
* [[1.54inch e-Paper Module]]<br />
* [[1.54inch e-Paper Module (B)]]<br />
| Modules/Wireless Communication/WiFi =<br />
* [[EMW3162]]<br />
* [[EMW3162 (B)]]<br />
* [[WIFI-LPB100-A]]<br />
* [[WIFI-LPB100-B]]<br />
* [[WIFI-LPT100]]<br />
* [[WIFI232-A]]<br />
* [[WIFI232-B]]<br />
* [[EMW3162 WIFI Shield]]<br />
* [[WIFI-LPB100-A Eval Kit]]<br />
* [[WIFI-LPB100-B Eval Kit]]<br />
* [[WIFI-LPT100 Eval Kit]]<br />
* [[WIFI232 Eval Kit]]<br />
* [[WIFI400]]<br />
* [[WIFI501]]<br />
| Modules/Wireless Communication/ZigBee =<br />
* [[Core2530 (B)]]<br />
* [[Core2530]]<br />
* [[XCore2530]]<br />
* [[CC2530 Eval Kit]]<br />
* [[CC2530 Eval Kit2]]<br />
* [[CC2530 Eval Kit3]]<br />
* [[CC2530 Eval Kit4]]<br />
* [[CC2530 Eval Kit5]]<br />
* [[XBee USB Adapter]]<br />
* [[ZB502]]<br />
* [[ZB600]]<br />
* [[CC Debugger]]<br />
| Modules/Wireless Communication/Bluetooth =<br />
* [[Dual-mode Bluetooth]]<br />
* [[Core51822 (B)]]<br />
* [[Core51822]]<br />
* [[Bluetooth Slave UART Board]]<br />
* [[Bluetooth Master UART Board]]<br />
* [[NRF51822 Eval Kit]]<br />
* [[BLE400]]<br />
| Modules/Wireless Communication/RF =<br />
* [[CC1101 RF Board]]<br />
* [[NRF24L01 RF Board (A)]]<br />
* [[NRF24L01 RF Board (B)]]<br />
* [[NRF24L01 RF Board (C)]]<br />
| Modules/Wireless Communication/GPS / GSM =<br />
* [[UART GPS NEO-7M-C (B)]]<br />
* [[UART GPS NEO-7M-C]]<br />
* [[UART GPS NEO-6M (B)]]<br />
* [[UART GPS NEO-6M-C]]<br />
* [[UART GPS NEO-6M]]<br />
* [[NEO-7M-C]]<br />
* [[NEO-6M-C]]<br />
* [[NEO-6M]]<br />
* [[GSM/GPRS/GPS Shield (B)]]<br />
* [[GSM/GPRS/GNSS HAT]]<br />
* {{retired|GSM/GPRS/GPS Shield}}<br />
| Modules/Wired Communication/USB =<br />
* [[USB3300 USB HS Board]]<br />
* [[SL811 USB Board]]<br />
* [[CY7C68013A USB Board (type A)]]<br />
* [[CY7C68013A USB Board (mini)]]<br />
| Modules/Wired Communication/USB to UART / FIFO =<br />
* [[FT245 EVAL BOARD]]<br />
* [[FT232 EVAL BOARD]]<br />
* [[CP2102 EVAL BOARD]]<br />
* [[FT245 USB FIFO Board (type A)]]<br />
* [[FT245 USB FIFO Board (mini)]]<br />
* [[FT232 USB UART Board (Type A)]]<br />
* [[FT232 USB UART Board (mini)]]<br />
* [[FT232 USB UART Board (micro)]]<br />
* [[CP2102 USB UART Board (type A)]]<br />
* [[CP2102 USB UART Board (mini)]]<br />
* [[CP2102 USB UART Board (micro)]]<br />
* [[PL2303 USB UART Board (type A)]]<br />
* [[PL2303 USB UART Board (mini)]]<br />
* [[PL2303 USB UART Board (micro)]]<br />
| Modules/Wired Communication/Ethernet =<br />
* [[LAN8720 ETH Board]]<br />
* [[DP83848 Ethernet Board]]<br />
* [[ENC28J60 Ethernet Board]]<br />
| Modules/Wired Communication/Ethernet to UART =<br />
* [[UART TO ETH]]<br />
* {{Retired|UART ETH E001}}<br />
* {{Retired|ETH TO 232 (A)}}<br />
* {{Retired|UART ETH E401}}<br />
| Modules/Wired Communication/RS232 / RS485 / CAN =<br />
* [[RS232 Board]]<br />
* [[RS485 Board (3.3V)]]<br />
* [[RS485 Board (5V)]]<br />
* [[SN65HVD230 CAN Board]]<br />
| Modules/Cameras/General Camera =<br />
* [[OV2640 Camera Board]]<br />
* [[OV9655 Camera Board]]<br />
* [[OV7670 Camera Board]]<br />
* [[OV7670 Camera Board (B)]]<br />
| Modules/Cameras/Raspberry Pi Camera =<br />
* [[RPi IR-CUT Camera]]<br />
* [[RPi NoIR Camera V2]]<br />
* [[RPi Camera V2]]<br />
* [[RPi Camera (J)]]<br />
* [[RPi Camera (I)]]<br />
* [[RPi Camera (H)]]<br />
* [[RPi Camera (G)]]<br />
* [[RPi Camera (F)]]<br />
* [[RPi Camera (E)]]<br />
* [[RPi Camera (D)]]<br />
* [[RPi Camera (C)]]<br />
* [[RPi Camera (B)]]<br />
* [[RPi Camera]]<br />
* [[RPi Zero V1.3 Camera]]<br />
| Modules/Sensors/Accelerometer / Angular rate / Compass =<br />
* [[10 DOF IMU Sensor (C)]]<br />
* [[10 DOF IMU Sensor (B)]]<br />
* [[LSM303DLHC Board]]<br />
* [[L3G4200D Board]]<br />
* [[MAG3110 Board]]<br />
* {{Retired|10 DOF IMU Sensor}}<br />
| Modules/Sensors/Fingerprint / Sound =<br />
* [[Sound Sensor]]<br />
* [[UART Fingerprint Reader]]<br />
| Modules/Sensors/Gas =<br />
* [[Dust Sensor]]<br />
* [[MQ-2 Gas Sensor]]<br />
* [[MQ-3 Gas Sensor]]<br />
* [[MQ-5 Gas Sensor]]<br />
* [[MQ-7 Gas Sensor]]<br />
* [[MQ-135 Gas Sensor]]<br />
| Modules/Sensors/Light =<br />
* [[Light Sensor]]<br />
* [[Photo Interrupter Sensor]]<br />
* [[Infrared Proximity Sensor]]<br />
* [[Tracker Sensor]]<br />
* [[Infrared Reflective Sensor]]<br />
* [[UV Sensor]]<br />
* [[Laser Sensor]]<br />
| Modules/Sensors/Temperature / Humidity =<br />
* [[Moisture Sensor]]<br />
* [[DHT11 Temperature-Humidity Sensor]]<br />
* [[DHT22 Temperature-Humidity Sensor]]<br />
* [[Infrared Temperature Sensor]]<br />
| Modules/Sensors/Others =<br />
* [[Color Sensor]]<br />
* [[Hall Sensor]]<br />
* [[Rotation Sensor]]<br />
* [[Tilt Sensor]]<br />
* [[Liquid Level Sensor]]<br />
* [[Sensors Pack]]<br />
* [[Flame Sensor]]<br />
| Modules/Storage/SD / TF Card Storage =<br />
* [[Micro SD Storage Board]]<br />
* [[SD Storage Board]]<br />
| Modules/Storage/Flash =<br />
* [[AT45DBXX DataFlash Board]]<br />
* [[FM24CLXX FRAM Board]]<br />
* [[FM24CXX FRAM Board]]<br />
* [[AT24CXX EEPROM Board]]<br />
* [[NandFlash Board (A)]]<br />
* [[NorFlash Board (A)]]<br />
* [[NorFlash Board (B)]]<br />
* [[W25QXX DataFlash Board]]<br />
| Modules/Storage/RAM =<br />
* [[IS62WV12816BLL SRAM Board]]<br />
* [[IS62WV51216BLL SRAM Board]]<br />
* [[SDRAM Board (B)]]<br />
| Modules/Others/AD / DA =<br />
* [[AD Keypad]]<br />
* [[Analog Test Board]]<br />
* [[Analog Test Shield]]<br />
* [[TLC1543 ADC Board]]<br />
* [[PCF8591 AD DA Board]]<br />
| Modules/Others/Motor =<br />
* [[Motor Control Shield]]<br />
* [[Motor Control Board]]<br />
* [[X-NUCLEO-IHM01A1]]<br />
* [[X-NUCLEO-IHM03A1]]<br />
| Modules/Others/Key / Button =<br />
* [[Capacitive Touch Keypad (B)]]<br />
* [[Capacitive Touch Keypad]]<br />
* [[RPi Touch Keypad]]<br />
* [[AD Keypad]]<br />
* [[5 IO Keypad]]<br />
* [[4x4 Keypad]]<br />
* [[8 Push Buttons]]<br />
| Modules/Others/LED =<br />
* [[RPi LED Matrix]]<br />
* [[8 SEG LED Board]]<br />
| Modules/Others/RTC =<br />
* [[DS1302 RTC Board]]<br />
* [[PCF8563 RTC Board]]<br />
| Modules/Others/Decoder =<br />
* [[VS1003B MP3 Board]]<br />
* [[UDA1380 Board]]<br />
| Modules/Others/Misc =<br />
* [[PCF8574 IO Expansion Board]]<br />
* [[Logic Level Converter]]<br />
* [[Mix Board]]<br />
* [[VGA PS2 Board]]<br />
* {{Retired|DoWatch}}<br />
}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:2.9inch_e-Paper_Module_code.7z&diff=13500File:2.9inch e-Paper Module code.7z2017-09-19T07:04:43Z<p>Wiki Editorial Team: Wiki Editorial Team uploaded a new version of &quot;File:2.9inch e-Paper Module code.7z&quot;</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:2.13inch_e-Paper_HAT-code.7z&diff=13499File:2.13inch e-Paper HAT-code.7z2017-09-19T07:03:54Z<p>Wiki Editorial Team: Wiki Editorial Team uploaded a new version of &quot;File:2.13inch e-Paper HAT-code.7z&quot;</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:2.13inch_e-Paper_HAT-code.7z&diff=13498File:2.13inch e-Paper HAT-code.7z2017-09-19T07:01:56Z<p>Wiki Editorial Team: Wiki Editorial Team uploaded a new version of &quot;File:2.13inch e-Paper HAT-code.7z&quot;</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:1.54inch_e-Paper_Module_code.7z&diff=13497File:1.54inch e-Paper Module code.7z2017-09-19T07:01:03Z<p>Wiki Editorial Team: Wiki Editorial Team uploaded a new version of &quot;File:1.54inch e-Paper Module code.7z&quot;</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=4.2inch_e-Paper_Module&diff=134964.2inch e-Paper Module2017-09-19T05:55:13Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=400x300, 4.2inch E-Ink display module<br />
|img=[[File:4.2inch-e-paper-module-5.jpg|300px|link=http://www.waveshare.com/4.2inch-e-paper-module.htm]]<br />
|caption=400x300, 4.2inch E-Ink display module, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/4.2inch-e-Paper-Module.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/4.2inch-e-paper-module.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
400x300, 4.2inch E-Ink display module, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/4.2inch-e-paper-module.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:4.2inch_e-paper_module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow, and it will flicker for several times during refreshing. Please be patient.<br />
<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3 (if the display doesn't work on 3.3V, you can try 5V in most cases.)<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing. Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing. Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> power setting --> booster soft start --> power on --> panel setting --> PLL control.<br />
<br />
For detailed explanation of commands, please refer to [[File:4.2inch-e-paper-specification.pdf]]<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is stored in the module, which is provided by us. So the table may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: resolution setting --> VCM DC setting --> VCOM and data interval setting --> Send command data start transmission 1 --> Send data of an white image (send 0xFF 15000 times) --> Send command data start transmission 2 --> Send data of an image to display --> set LUT --> Refresh the screen.<br />
<br />
Note:<br />
* You have to send a white frame before the frame to display.<br />
* 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for black.<br />
<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing. Please be patient.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
Process: VCOM and data interval setting --> VCM DC setting --> panel setting --> power setting --> power off --> deep sleep<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 400x300.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 400 and 300<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:4.2inch_e-Paper_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:4.2inch_e-paper_module_code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:4.2inch-e-paper-specification.pdf|Datasheets]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.9inch_e-Paper_Module&diff=134952.9inch e-Paper Module2017-09-19T05:54:57Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=296x128, 2.9inch E-Ink display module<br />
|img=[[File:2.9inch-e-paper-module-4.jpg|300px|link=http://www.waveshare.com/2.9inch-e-paper-module.htm]]<br />
|caption=296x128, 2.9inch E-Ink display module, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.9inch-e-paper-module.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/product/2.9inch-e-paper-module.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
296x128, 2.9inch E-Ink display module, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/2.9inch-e-paper-module.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-Paper_Module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25<br />
|-<br />
| RST || 17<br />
|-<br />
| BUSY || 24<br />
|}<br />
==== Expected result ====<br />
# After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
#* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the files from the directory arduino/libraries of the demo package to documents/arduino/libraries, where can be specified by Arduino IDE --> File --> Preferences --> Sketchbook location.<br />
# Click the button '''Upload''' to compile and upload the program to your Arduino board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with the STM32 development board ===<br />
Here we use the development board XNUCLEO-F103RB. The Demo is base on the library HAL.<br />
==== Hardware connection ====<br />
Here is the hardware connection between the development board XNUCLEO-F103RB and E-paper:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! XNUCLEO-F103RB<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7<br />
|-<br />
| CLK || PA5<br />
|-<br />
| CS || PB6<br />
|-<br />
| DC || PC7<br />
|-<br />
| RST || PA9<br />
|-<br />
| BUSY || PA8<br />
|}<br />
==== Expected result ====<br />
# Open the Keil project (MDK-ARM/epd-demo.uvprojx)<br />
# Click '''Build''' to compile the project.<br />
# Click '''Download''' to download the program to the target board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
Init has 3 effects: <br />
# Set the arguments at power up. <br />
# Awaken the module from deep sleep. <br />
# Set the mode to Full update or Partial update.<br />
Process of initialization: reset --> driver output control --> booster soft start control --> write VCOM register --> set dummy line period --> set gate time --> data entry mode setting --> look-up table setting<br />
<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is used to set the update mode of the module. This table is provided by us but it may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Set the frame memory (SetFrameMemory) ===<br />
SetFrameMemory is used to write image data to the memory. <br />
* Process: <br />
:: Set the area size (see the function SetMemoryArea) --> set the start point (see the function SetMemoryPointer) --> send the command ''Write RAM'' --> start image data transfer. <br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* About the image to be sent: 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for a black pixel.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to display the data from the frame memory.<br />
<br />
Note:<br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* The module will flicker during full update.<br />
* The module won't flicker during partial update, however, it may retain a "ghost image" of the last page.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== Private function: Set the memory area (SetMemoryArea) ===<br />
SetMemoryArea is used to specify the memory area, the arguments are the start/end points. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== Private function: Set the memory pointer (SetMemoryPointer) ===<br />
SetMemoryPointer is used to set the start point of the following image to be sent. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 128x296.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 128 and 296<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be converted to 1, and black is converted to 0)<br />
# Click '''Save''', to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
[[File:1.54inch-e-paper-manual-3.png|400px]]<br />
<br />
[[File:1.54inch-e-paper-manual-4.png|400px]]<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.9inch_e-Paper_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.9inch_e-Paper_Module_code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.9inch_e-Paper_Module_(B)&diff=134942.9inch e-Paper Module (B)2017-09-19T05:54:48Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=296x128, 2.9inch E-Ink display module, three-color<br />
|img=[[File:2.9inch-e-paper-module-b-4.jpg|300px|link=http://www.waveshare.com/2.9inch-e-paper-module-b.htm]]<br />
|caption=296x128, 2.9inch E-Ink display module, three-color, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.9inch-e-Paper-Module-B.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/2.9inch-e-paper-module-b.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
296x128, 2.9inch E-Ink display module, three-color, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/2.9inch-e-paper-module-b.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:2.9inch_e-paper_module_b_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> booster soft start --> power on --> panel setting --> VCOM and data interval setting --> resolution setting --> VCM DC setting.<br />
<br />
For detailed explanation of commands, please refer to [[File:2.9inch-e-paper-b-specification.pdf]]<br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: Send command data start transmission 1 --> Send data of dark area --> Send command data start transmission 2 --> Send data of red area --> Refresh the screen.<br />
Note:<br />
* One frame consist of images of black area and red area, so we need to send two images for displaying one frame,<br />
* 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for black/red.<br />
<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
Process: VCM DC setting --> power setting --> power off<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 128x296.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/black.bmp and raspberrypi/python/red.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 128 and 296<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.9inch_e-Paper_module_b_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.9inch_e-paper_module_b_code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:2.9inch-e-paper-b-specification.pdf|Datasheets]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.7inch_e-Paper_HAT&diff=134932.7inch e-Paper HAT2017-09-19T05:54:40Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=264x176, 2.7inch E-Ink display HAT for Raspberry Pi<br />
|img=[[File:2.7inch-e-paper-hat-3.jpg|300px|link=http://www.waveshare.com/2.7inch-e-paper-hat.htm]]<br />
|caption=264x176, 2.7inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.7inch-e-Paper-HAT.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/2.7inch-e-paper-hat.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
264x176, 2.7inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/2.7inch-e-paper-hat.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:2.7inch-e-paper-hat-code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 6s). Please be patient.<br />
<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3 (if the display doesn't work on 3.3V, you can try 5V in most cases.)<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE --> File --> Preferences --> Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 6s). Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 6s). Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> power setting --> booster soft start --> power optimization --> power on --> panel setting --> PLL control --> VCM DC setting.<br />
=== Configuration of LUT table (SetLut) ===<br />
Look-up table is stored in the module, which is provided by us. So the table may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: resolution setting --> VCM DC setting --> VCOM and data interval setting --> Send command data start transmission 1 --> Send data of an white image (send 0xFF 5808 times) --> Send command data start transmission 2 --> Send data of an image to display --> Refresh the screen.<br />
<br />
Note:<br />
* You have to send a white frame before the frame to display.<br />
* 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for black.<br />
<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 6s). Please be patient.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 176x264.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 176 and 264<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.7inch-e-paper-hat-schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.7inch-e-paper-hat-code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:2.7inch-e-paper-hat-specification.7z|Datasheets]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.7inch_e-Paper_HAT_(B)&diff=134922.7inch e-Paper HAT (B)2017-09-19T05:54:29Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=264x176, 2.7inch E-Ink display HAT for Raspberry Pi, three-color<br />
|img=[[File:2.7inch-e-paper-hat-b-4.jpg|300px|link=http://www.waveshare.com/2.7inch-e-paper-hat-b.htm]]<br />
|caption=264x176, 2.7inch E-Ink display HAT for Raspberry Pi, three-color<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.7inch-e-Paper-HAT-B.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/2.7inch-e-paper-hat-b.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
264x176, 2.7inch E-Ink display HAT for Raspberry Pi, three-color<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/2.7inch-e-paper-hat-b.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:2.7inch_e-paper_hat_b_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> power on --> panel setting --> PLL control --> power setting --> booster soft start --> power optimization --> VCM DC setting --> VCOM and data interval setting --> look-up table setting.<br />
<br />
For detailed explanation of commands, please refer to [[File:2.7inch-e-paper-b-specification.pdf]]<br />
=== Configuration of LUT table(SetLutBw and SetLutRed) ===<br />
Look-up table is stored in the module, which is provided by us. So the table may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: Send command data start transmission 1 --> Send data of dark area --> Send command data start transmission 2 --> Send data of red area --> Refresh the screen.<br />
<br />
Note:<br />
* One frame consist of images of black area and red area, so we need to send two images for displaying one frame,<br />
* 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for black/red pixel, otherwise a bit reset stands for white.<br />
<br />
For example:<br />
<pre><br />
0xC3:8 pixels ■■□□□□■■<br />
0x00:8 pixels □□□□□□□□<br />
0xFF:8 pixels ■■■■■■■■<br />
0x66:8 pixels □■■□□■■□<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 176x264.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/black.bmp and raspberrypi/python/red.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 176 and 264<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.7inch_e-Paper_HAT_b_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.7inch_e-paper_hat_b_code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:2.7inch-e-paper-b-specification.pdf|Datasheets]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.13inch_e-Paper_HAT&diff=134912.13inch e-Paper HAT2017-09-19T05:54:20Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=250x122, 2.13inch E-Ink display HAT for Raspberry Pi<br />
|img=[[File:2.13inch-e-paper-hat-intro.jpg|300px|link=http://www.waveshare.com/2.13inch-e-paper-hat.htm]]<br />
|caption=250x122, 2.13inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.13inch-e-paper-hat.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/product/2.13inch-e-paper-hat.htm Waveshare website]<br />
|interface1=SPI<br />
|interface2=RPi<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
250x122, 2.13inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/2.13inch-e-paper-hat.htm More]}}<br />
== Interfaces ==<br />
[[File:2.13inch-e-paper-hat.png|thumb|left|400px|Interfaces]]<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-Paper_Module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25<br />
|-<br />
| RST || 17<br />
|-<br />
| BUSY || 24<br />
|}<br />
==== Expected result ====<br />
# After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
#* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
[[File:2.13inch-e-paper-hat.png|thumb|400px]]<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the files from the directory arduino/libraries of the demo package to documents/arduino/libraries, where can be specified by Arduino IDE --> File --> Preferences --> Sketchbook location.<br />
# Click the button '''Upload''' to compile and upload the program to your Arduino board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with the STM32 development board ===<br />
Here we use the development board XNUCLEO-F103RB. The Demo is base on the library HAL.<br />
==== Hardware connection ====<br />
Here is the hardware connection between the development board XNUCLEO-F103RB and E-paper:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! XNUCLEO-F103RB<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7<br />
|-<br />
| CLK || PA5<br />
|-<br />
| CS || PB6<br />
|-<br />
| DC || PC7<br />
|-<br />
| RST || PA9<br />
|-<br />
| BUSY || PA8<br />
|}<br />
==== Expected result ====<br />
# Open the Keil project (MDK-ARM/epd-demo.uvprojx)<br />
# Click '''Build''' to compile the project.<br />
# Click '''Download''' to download the program to the target board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
Init has 3 effects:<br />
# Set the arguments at power up.<br />
# Awaken the module from deep sleep.<br />
# Set the mode to Full update or Partial update.<br />
<br />
Process of initialization: reset --> driver output control --> booster soft start control --> write VCOM register --> set dummy line period --> set gate time --> data entry mode setting --> look-up table setting<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is used to set the update mode of the module. This table is provided by us but it may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Set the frame memory (SetFrameMemory) ===<br />
SetFrameMemory is used to write image data to the memory. <br />
* Process: <br />
:: Set the area size (see the function SetMemoryArea) --> set the start point (see the function SetMemoryPointer) --> send the command ''Write RAM'' --> start image data transfer. <br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* About the image to be sent: 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for a black pixel.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to display the data from the frame memory.<br />
<br />
Note:<br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* The module will flicker during full update.<br />
* The module won't flicker during partial update, however, it may retain a "ghost image" of the last page.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== Private function: Set the memory area (SetMemoryArea) ===<br />
SetMemoryArea is used to specify the memory area, the arguments are the start/end points. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== Private function: Set the memory pointer (SetMemoryPointer) ===<br />
SetMemoryPointer is used to set the start point of the following image to be sent. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 128x250 (real resolution: 122x250; logic resolution: 128x250).<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 128 and 250<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be converted to 1, and black is converted to 0)<br />
# Click '''Save''', to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
[[File:1.54inch-e-paper-manual-3.png|400px]]<br />
<br />
[[File:1.54inch-e-paper-manual-4.png|400px]]<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.13inch_e-Paper_HAT_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.13inch_e-Paper_HAT-code.7z|Demo code]]<br />
=== Demo video ===<br />
* [https://youtu.be/y5XdNrZ6AtY 2.13inch e-paper Demo video]<br />
=== Datasheets ===<br />
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.13inch_e-Paper_HAT_(B)&diff=134902.13inch e-Paper HAT (B)2017-09-19T05:54:11Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=212x104, 2.13inch E-Ink display HAT for Raspberry Pi, three-color<br />
|img=[[File:2.13inch-e-paper-hat-b-5_1.jpg|300px|link=http://www.waveshare.com/2.13inch-e-paper-hat-b.htm]]<br />
|caption=212x104, 2.13inch E-Ink display HAT for Raspberry Pi, three-color, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.13inch-e-Paper-HAT-B.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/2.13inch-e-paper-hat-b.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
212x104, 2.13inch E-Ink display HAT for Raspberry Pi, three-color, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/2.13inch-e-paper-hat-b.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:2.13inch-e-paper-hat-b-code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
* The RAM of Arduino UNO is only 2K. However, it need at least 10K storage space for completely update one frame and couldn’t refresh partially (That is, unable to completely update one frame by refreshing partial of it for several times). So the Arduino example we provide can only displaying static image.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: :reset --> booster soft start --> power on --> panel setting --> VCOM and data interval setting --> resolution setting.<br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: Send command data start transmission 1 --> Send data of black area --> Send command data start transmission 2 --> Send data of red area --> Refresh the screen.<br />
<br />
Note:<br />
* One frame consist of images of black area and red area, so we need to send two images for displaying one frame,<br />
* 1 byte = 8 pixels, doesn’t support Gray scale (can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for black/red.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
Process: power off --> deep sleep<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 104x212.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/black.bmp and raspberrypi/python/red.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 104 and 212<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.13inch-e-paper-hat-b-schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.13inch-e-paper-hat-b-code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:2.13inch-e-paper-hat-b-specification.pdf|Datasheets]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=1.54inch_e-Paper_Module_(B)&diff=134891.54inch e-Paper Module (B)2017-09-19T05:53:57Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=200x200, 1.54inch E-Ink display module, three-color, SPI interface<br />
|img=[[File:1.54inch-e-paper-module-b-4.jpg|300px|link=http://www.waveshare.com/1.54inch-e-paper-module-b.htm]]<br />
|caption=200x200, 1.54inch E-Ink display module, three-color, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/1.54inch-e-Paper-Module-B.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/1.54inch-e-paper-module-b.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
200x200, 1.54inch E-Ink display module, three-color, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/1.54inch-e-Paper-Module-B.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-paper_module_b_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 8s). Please be patient.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 8s). Please be patient.<br />
* The RAM of Arduino UNO is only 2K. However, it need at least 10K storage space for completely update one frame and couldn’t refresh partially (That is, unable to completely update one frame by refreshing partial of it for several times). So the Arduino example we provide can only displaying static image.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 8s). Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> power setting --> booster soft start --> power on --> panel setting --> VCOM and data interval setting --> PLL control --> resolution setting --> VCM DC setting --> look-up table setting.<br />
<br />
For detailed explanation of commands, please refer to [[File:1.54inch-e-paper-b-specification.pdf]]<br />
=== Configuration of LUT table(SetLutBw and SetLutRed) ===<br />
Look-up table is stored in the module, which is provided by us. So the table may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: Send command data start transmission 1 --> Send data of dark area --> Send command data start transmission 2 --> Send data of red area --> Refresh the screen.<br />
Note:<br />
* One frame consist of images of black area and red area, so we need to send two images for displaying one frame,<br />
* The image of black part: 2 bits = 1 pixel, doesn’t support Gray scale (Can only display black and white). 00b stand for black pixel, and 11b stand for white.<br />
<br />
For example:<br />
<pre><br />
0xC3:4 pixels □■■□<br />
0x00:4 pixels ■■■■<br />
0xFF:4 pixels □□□□<br />
0x66:The state of pixels is uncertain<br />
</pre><br />
* The image of red area: 1 bit = 1 pixel, doesn’t support Gray scale (Can only display red and white). The pixel is white if Bit is set, and it is red on the contrary.<br />
<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 8s). Please be patient.<br />
<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
Process:VCOM and data interval setting --> VCM DC setting --> power setting --> power off<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 200x200.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/black.bmp and raspberrypi/python/red.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 200 and 200<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:1.54inch_e-Paper_module_b_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:1.54inch_e-paper_module_b_code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:1.54inch-e-paper-b-specification.pdf|Datasheets]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=4.2inch_e-Paper_Module_(B)&diff=134884.2inch e-Paper Module (B)2017-09-19T05:53:44Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=400x300, 4.2inch E-Ink display module, three-color, SPI interface<br />
|img=[[File:4.2inch-e-paper-module-b-3.jpg|300px|link=http://www.waveshare.com/4.2inch-e-paper-module-b.htm]]<br />
|caption=400x300, 4.2inch E-Ink display module, three-color, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/4.2inch-e-Paper-Module-B.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/4.2inch-e-paper-module-b.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
400x300, 4.2inch E-Ink display module, three-color, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/4.2inch-e-paper-module-b.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:4.2inch-e-paper-module-b-code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3 (if the display doesn't work on 3.3V, you can try 5V in most cases.)<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> booster soft start --> power on --> panel setting.<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is stored in the module, which is provided by us. So the table may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: Send command data start transmission 1 --> Send data of the black part of the image --> Send command data start transmission 2 --> Send data of the red part of the image --> Refresh the screen.<br />
<br />
Note:<br />
* 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for black.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
Process: VCOM and data interval setting --> power off --> deep sleep <br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 400x300.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/black.bmp and raspberrypi/python/red.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 400 and 300<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:4.2inch-e-paper-module-b-schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:4.2inch-e-paper-module-b-code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:4.2inch-e-paper-b-specification.pdf|Datasheets]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=1.54inch_e-Paper_Module&diff=134871.54inch e-Paper Module2017-09-19T05:53:15Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=200x200, 1.54inch E-Ink display module<br />
|img=[[File:1.54inch-e-paper-module-6.jpg|300px|link=http://www.waveshare.com/1.54inch-e-Paper-Module.htm]]<br />
|caption=200x200, 1.54inch E-Ink display module, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/1.54inch-e-Paper-Module.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/product/1.54inch-e-Paper-Module.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
200x200, 1.54inch E-Ink display module, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/1.54inch-e-Paper-Module.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-Paper_Module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25<br />
|-<br />
| RST || 17<br />
|-<br />
| BUSY || 24<br />
|}<br />
==== Expected result ====<br />
# After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
#* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the files from the directory arduino/libraries of the demo package to documents/arduino/libraries, where can be specified by Arduino IDE --> File --> Preferences --> Sketchbook location.<br />
# Click the button '''Upload''' to compile and upload the program to your Arduino board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with the STM32 development board ===<br />
Here we use the development board XNUCLEO-F103RB. The Demo is base on the library HAL.<br />
==== Hardware connection ====<br />
Here is the hardware connection between the development board XNUCLEO-F103RB and E-paper:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! XNUCLEO-F103RB<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7<br />
|-<br />
| CLK || PA5<br />
|-<br />
| CS || PB6<br />
|-<br />
| DC || PC7<br />
|-<br />
| RST || PA9<br />
|-<br />
| BUSY || PA8<br />
|}<br />
==== Expected result ====<br />
# Open the Keil project (MDK-ARM/epd-demo.uvprojx)<br />
# Click '''Build''' to compile the project.<br />
# Click '''Download''' to download the program to the target board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
Init has 3 effects: 1, Set the arguments at power up. 2, Awaken the module from deep sleep. 3, Set the mode to Full update or Partial update.<br />
<br />
Process of initialization: reset --> driver output control --> booster soft start control --> write VCOM register --> set dummy line period --> set gate time --> data entry mode setting --> look-up table setting<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is used to set the update mode of the module. This table is provided by us but it may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Set the frame memory (SetFrameMemory) ===<br />
SetFrameMemory is used to write image data to the memory. <br />
* Process: <br />
:: Set the area size (see the function SetMemoryArea) --> set the start point (see the function SetMemoryPointer) --> send the command ''Write RAM'' --> start image data transfer. <br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* About the image to be sent: 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for a black pixel.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to display the data from the frame memory.<br />
<br />
Note:<br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* The module will flicker during full update.<br />
* The module won't flicker during partial update, however, it may retain a "ghost image" of the last page.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== Private function: Set the memory area (SetMemoryArea) ===<br />
SetMemoryArea is used to specify the memory area, the arguments are the start/end points. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== Private function: Set the memory pointer (SetMemoryPointer) ===<br />
SetMemoryPointer is used to set the start point of the following image to be sent. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 200x200.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use [[:File:Image2Lcd.7z|Image2Lcd.exe]] software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 200 and 200<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be converted to 1, and black is converted to 0)<br />
# Click '''Save''', to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
[[File:1.54inch-e-paper-manual-3.png|400px]]<br />
<br />
[[File:1.54inch-e-paper-manual-4.png|400px]]<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:1.54inch_e-Paper_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:1.54inch_e-Paper_Module_code.7z|Demo code]]<br />
=== Demo video ===<br />
* [https://youtu.be/-XbwDC2AOOw 1.54inch e-paper demo video]<br />
=== Datasheets ===<br />
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=File:Image2Lcd.7z&diff=13486File:Image2Lcd.7z2017-09-19T05:52:51Z<p>Wiki Editorial Team: MsUpload</p>
<hr />
<div>MsUpload</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=4.2inch_e-Paper_Module_(B)&diff=134854.2inch e-Paper Module (B)2017-09-19T04:02:38Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=400x300, 4.2inch E-Ink display module, three-color, SPI interface<br />
|img=[[File:4.2inch-e-paper-module-b-3.jpg|300px|link=http://www.waveshare.com/4.2inch-e-paper-module-b.htm]]<br />
|caption=400x300, 4.2inch E-Ink display module, three-color, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/4.2inch-e-Paper-Module-B.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/4.2inch-e-paper-module-b.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
400x300, 4.2inch E-Ink display module, three-color, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/4.2inch-e-paper-module-b.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:4.2inch-e-paper-module-b-code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3 (if the display doesn't work on 3.3V, you can try 5V in most cases.)<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> booster soft start --> power on --> panel setting.<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is stored in the module, which is provided by us. So the table may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: Send command data start transmission 1 --> Send data of the black part of the image --> Send command data start transmission 2 --> Send data of the red part of the image --> Refresh the screen.<br />
<br />
Note:<br />
* 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for black.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
Process: VCOM and data interval setting --> power off --> deep sleep <br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 400x300.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/black.bmp and raspberrypi/python/red.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 400 and 300<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:4.2inch-e-paper-module-b-schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:4.2inch-e-paper-module-b-code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:4.2inch-e-paper-b-specification.pdf|Datasheets]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=1.54inch_e-Paper_Module&diff=134841.54inch e-Paper Module2017-09-19T04:01:42Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=200x200, 1.54inch E-Ink display module<br />
|img=[[File:1.54inch-e-paper-module-6.jpg|300px|link=http://www.waveshare.com/1.54inch-e-Paper-Module.htm]]<br />
|caption=200x200, 1.54inch E-Ink display module, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/1.54inch-e-Paper-Module.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/product/1.54inch-e-Paper-Module.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
200x200, 1.54inch E-Ink display module, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/1.54inch-e-Paper-Module.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-Paper_Module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25<br />
|-<br />
| RST || 17<br />
|-<br />
| BUSY || 24<br />
|}<br />
==== Expected result ====<br />
# After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
#* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the files from the directory arduino/libraries of the demo package to documents/arduino/libraries, where can be specified by Arduino IDE --> File --> Preferences --> Sketchbook location.<br />
# Click the button '''Upload''' to compile and upload the program to your Arduino board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with the STM32 development board ===<br />
Here we use the development board XNUCLEO-F103RB. The Demo is base on the library HAL.<br />
==== Hardware connection ====<br />
Here is the hardware connection between the development board XNUCLEO-F103RB and E-paper:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! XNUCLEO-F103RB<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7<br />
|-<br />
| CLK || PA5<br />
|-<br />
| CS || PB6<br />
|-<br />
| DC || PC7<br />
|-<br />
| RST || PA9<br />
|-<br />
| BUSY || PA8<br />
|}<br />
==== Expected result ====<br />
# Open the Keil project (MDK-ARM/epd-demo.uvprojx)<br />
# Click '''Build''' to compile the project.<br />
# Click '''Download''' to download the program to the target board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
Init has 3 effects: 1, Set the arguments at power up. 2, Awaken the module from deep sleep. 3, Set the mode to Full update or Partial update.<br />
<br />
Process of initialization: reset --> driver output control --> booster soft start control --> write VCOM register --> set dummy line period --> set gate time --> data entry mode setting --> look-up table setting<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is used to set the update mode of the module. This table is provided by us but it may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Set the frame memory (SetFrameMemory) ===<br />
SetFrameMemory is used to write image data to the memory. <br />
* Process: <br />
:: Set the area size (see the function SetMemoryArea) --> set the start point (see the function SetMemoryPointer) --> send the command ''Write RAM'' --> start image data transfer. <br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* About the image to be sent: 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for a black pixel.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to display the data from the frame memory.<br />
<br />
Note:<br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* The module will flicker during full update.<br />
* The module won't flicker during partial update, however, it may retain a "ghost image" of the last page.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== Private function: Set the memory area (SetMemoryArea) ===<br />
SetMemoryArea is used to specify the memory area, the arguments are the start/end points. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== Private function: Set the memory pointer (SetMemoryPointer) ===<br />
SetMemoryPointer is used to set the start point of the following image to be sent. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 200x200.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 200 and 200<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be converted to 1, and black is converted to 0)<br />
# Click '''Save''', to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
[[File:1.54inch-e-paper-manual-3.png|400px]]<br />
<br />
[[File:1.54inch-e-paper-manual-4.png|400px]]<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:1.54inch_e-Paper_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:1.54inch_e-Paper_Module_code.7z|Demo code]]<br />
=== Demo video ===<br />
* [https://youtu.be/-XbwDC2AOOw 1.54inch e-paper demo video]<br />
=== Datasheets ===<br />
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.7inch_e-Paper_HAT&diff=134832.7inch e-Paper HAT2017-09-19T04:01:11Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=264x176, 2.7inch E-Ink display HAT for Raspberry Pi<br />
|img=[[File:2.7inch-e-paper-hat-3.jpg|300px|link=http://www.waveshare.com/2.7inch-e-paper-hat.htm]]<br />
|caption=264x176, 2.7inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.7inch-e-Paper-HAT.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/2.7inch-e-paper-hat.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
264x176, 2.7inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/2.7inch-e-paper-hat.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:2.7inch-e-paper-hat-code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 6s). Please be patient.<br />
<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3 (if the display doesn't work on 3.3V, you can try 5V in most cases.)<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE --> File --> Preferences --> Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 6s). Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 6s). Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> power setting --> booster soft start --> power optimization --> power on --> panel setting --> PLL control --> VCM DC setting.<br />
=== Configuration of LUT table (SetLut) ===<br />
Look-up table is stored in the module, which is provided by us. So the table may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: resolution setting --> VCM DC setting --> VCOM and data interval setting --> Send command data start transmission 1 --> Send data of an white image (send 0xFF 5808 times) --> Send command data start transmission 2 --> Send data of an image to display --> Refresh the screen.<br />
<br />
Note:<br />
* You have to send a white frame before the frame to display.<br />
* 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for black.<br />
<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 6s). Please be patient.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 176x264.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 176 and 264<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.7inch-e-paper-hat-schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.7inch-e-paper-hat-code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:2.7inch-e-paper-hat-specification.7z|Datasheets]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.9inch_e-Paper_Module&diff=134822.9inch e-Paper Module2017-09-19T04:00:52Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=296x128, 2.9inch E-Ink display module<br />
|img=[[File:2.9inch-e-paper-module-4.jpg|300px|link=http://www.waveshare.com/2.9inch-e-paper-module.htm]]<br />
|caption=296x128, 2.9inch E-Ink display module, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.9inch-e-paper-module.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/product/2.9inch-e-paper-module.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
296x128, 2.9inch E-Ink display module, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/2.9inch-e-paper-module.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-Paper_Module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25<br />
|-<br />
| RST || 17<br />
|-<br />
| BUSY || 24<br />
|}<br />
==== Expected result ====<br />
# After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
#* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the files from the directory arduino/libraries of the demo package to documents/arduino/libraries, where can be specified by Arduino IDE --> File --> Preferences --> Sketchbook location.<br />
# Click the button '''Upload''' to compile and upload the program to your Arduino board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with the STM32 development board ===<br />
Here we use the development board XNUCLEO-F103RB. The Demo is base on the library HAL.<br />
==== Hardware connection ====<br />
Here is the hardware connection between the development board XNUCLEO-F103RB and E-paper:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! XNUCLEO-F103RB<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7<br />
|-<br />
| CLK || PA5<br />
|-<br />
| CS || PB6<br />
|-<br />
| DC || PC7<br />
|-<br />
| RST || PA9<br />
|-<br />
| BUSY || PA8<br />
|}<br />
==== Expected result ====<br />
# Open the Keil project (MDK-ARM/epd-demo.uvprojx)<br />
# Click '''Build''' to compile the project.<br />
# Click '''Download''' to download the program to the target board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
Init has 3 effects: <br />
# Set the arguments at power up. <br />
# Awaken the module from deep sleep. <br />
# Set the mode to Full update or Partial update.<br />
Process of initialization: reset --> driver output control --> booster soft start control --> write VCOM register --> set dummy line period --> set gate time --> data entry mode setting --> look-up table setting<br />
<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is used to set the update mode of the module. This table is provided by us but it may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Set the frame memory (SetFrameMemory) ===<br />
SetFrameMemory is used to write image data to the memory. <br />
* Process: <br />
:: Set the area size (see the function SetMemoryArea) --> set the start point (see the function SetMemoryPointer) --> send the command ''Write RAM'' --> start image data transfer. <br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* About the image to be sent: 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for a black pixel.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to display the data from the frame memory.<br />
<br />
Note:<br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* The module will flicker during full update.<br />
* The module won't flicker during partial update, however, it may retain a "ghost image" of the last page.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== Private function: Set the memory area (SetMemoryArea) ===<br />
SetMemoryArea is used to specify the memory area, the arguments are the start/end points. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== Private function: Set the memory pointer (SetMemoryPointer) ===<br />
SetMemoryPointer is used to set the start point of the following image to be sent. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 128x296.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 128 and 296<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be converted to 1, and black is converted to 0)<br />
# Click '''Save''', to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
[[File:1.54inch-e-paper-manual-3.png|400px]]<br />
<br />
[[File:1.54inch-e-paper-manual-4.png|400px]]<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.9inch_e-Paper_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.9inch_e-Paper_Module_code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=4.2inch_e-Paper_Module&diff=134814.2inch e-Paper Module2017-09-19T04:00:25Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=400x300, 4.2inch E-Ink display module<br />
|img=[[File:4.2inch-e-paper-module-5.jpg|300px|link=http://www.waveshare.com/4.2inch-e-paper-module.htm]]<br />
|caption=400x300, 4.2inch E-Ink display module, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/4.2inch-e-Paper-Module.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/4.2inch-e-paper-module.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
400x300, 4.2inch E-Ink display module, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/4.2inch-e-paper-module.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:4.2inch_e-paper_module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow, and it will flicker for several times during refreshing. Please be patient.<br />
<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3 (if the display doesn't work on 3.3V, you can try 5V in most cases.)<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing. Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing. Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> power setting --> booster soft start --> power on --> panel setting --> PLL control.<br />
<br />
For detailed explanation of commands, please refer to [[File:4.2inch-e-paper-specification.pdf]]<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is stored in the module, which is provided by us. So the table may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: resolution setting --> VCM DC setting --> VCOM and data interval setting --> Send command data start transmission 1 --> Send data of an white image (send 0xFF 15000 times) --> Send command data start transmission 2 --> Send data of an image to display --> set LUT --> Refresh the screen.<br />
<br />
Note:<br />
* You have to send a white frame before the frame to display.<br />
* 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for black.<br />
<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing. Please be patient.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
Process: VCOM and data interval setting --> VCM DC setting --> panel setting --> power setting --> power off --> deep sleep<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 400x300.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 400 and 300<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:4.2inch_e-Paper_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:4.2inch_e-paper_module_code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:4.2inch-e-paper-specification.pdf|Datasheets]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.13inch_e-Paper_HAT&diff=134802.13inch e-Paper HAT2017-09-19T03:59:39Z<p>Wiki Editorial Team: /* How to display an image */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=250x122, 2.13inch E-Ink display HAT for Raspberry Pi<br />
|img=[[File:2.13inch-e-paper-hat-intro.jpg|300px|link=http://www.waveshare.com/2.13inch-e-paper-hat.htm]]<br />
|caption=250x122, 2.13inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.13inch-e-paper-hat.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/product/2.13inch-e-paper-hat.htm Waveshare website]<br />
|interface1=SPI<br />
|interface2=RPi<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
250x122, 2.13inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/2.13inch-e-paper-hat.htm More]}}<br />
== Interfaces ==<br />
[[File:2.13inch-e-paper-hat.png|thumb|left|400px|Interfaces]]<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-Paper_Module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25<br />
|-<br />
| RST || 17<br />
|-<br />
| BUSY || 24<br />
|}<br />
==== Expected result ====<br />
# After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
#* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
[[File:2.13inch-e-paper-hat.png|thumb|400px]]<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the files from the directory arduino/libraries of the demo package to documents/arduino/libraries, where can be specified by Arduino IDE --> File --> Preferences --> Sketchbook location.<br />
# Click the button '''Upload''' to compile and upload the program to your Arduino board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with the STM32 development board ===<br />
Here we use the development board XNUCLEO-F103RB. The Demo is base on the library HAL.<br />
==== Hardware connection ====<br />
Here is the hardware connection between the development board XNUCLEO-F103RB and E-paper:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! XNUCLEO-F103RB<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7<br />
|-<br />
| CLK || PA5<br />
|-<br />
| CS || PB6<br />
|-<br />
| DC || PC7<br />
|-<br />
| RST || PA9<br />
|-<br />
| BUSY || PA8<br />
|}<br />
==== Expected result ====<br />
# Open the Keil project (MDK-ARM/epd-demo.uvprojx)<br />
# Click '''Build''' to compile the project.<br />
# Click '''Download''' to download the program to the target board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
Init has 3 effects:<br />
# Set the arguments at power up.<br />
# Awaken the module from deep sleep.<br />
# Set the mode to Full update or Partial update.<br />
<br />
Process of initialization: reset --> driver output control --> booster soft start control --> write VCOM register --> set dummy line period --> set gate time --> data entry mode setting --> look-up table setting<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is used to set the update mode of the module. This table is provided by us but it may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Set the frame memory (SetFrameMemory) ===<br />
SetFrameMemory is used to write image data to the memory. <br />
* Process: <br />
:: Set the area size (see the function SetMemoryArea) --> set the start point (see the function SetMemoryPointer) --> send the command ''Write RAM'' --> start image data transfer. <br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* About the image to be sent: 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for a black pixel.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to display the data from the frame memory.<br />
<br />
Note:<br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* The module will flicker during full update.<br />
* The module won't flicker during partial update, however, it may retain a "ghost image" of the last page.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== Private function: Set the memory area (SetMemoryArea) ===<br />
SetMemoryArea is used to specify the memory area, the arguments are the start/end points. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== Private function: Set the memory pointer (SetMemoryPointer) ===<br />
SetMemoryPointer is used to set the start point of the following image to be sent. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 128x250 (real resolution: 122x250; logic resolution: 128x250).<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There is a monochrome bitmap on examples pack for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 128 and 250<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be converted to 1, and black is converted to 0)<br />
# Click '''Save''', to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
[[File:1.54inch-e-paper-manual-3.png|400px]]<br />
<br />
[[File:1.54inch-e-paper-manual-4.png|400px]]<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.13inch_e-Paper_HAT_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.13inch_e-Paper_HAT-code.7z|Demo code]]<br />
=== Demo video ===<br />
* [https://youtu.be/y5XdNrZ6AtY 2.13inch e-paper Demo video]<br />
=== Datasheets ===<br />
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=1.54inch_e-Paper_Module_(B)&diff=134791.54inch e-Paper Module (B)2017-09-19T03:04:27Z<p>Wiki Editorial Team: /* Reset (Reset) */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=200x200, 1.54inch E-Ink display module, three-color, SPI interface<br />
|img=[[File:1.54inch-e-paper-module-b-4.jpg|300px|link=http://www.waveshare.com/1.54inch-e-paper-module-b.htm]]<br />
|caption=200x200, 1.54inch E-Ink display module, three-color, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/1.54inch-e-Paper-Module-B.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/1.54inch-e-paper-module-b.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
200x200, 1.54inch E-Ink display module, three-color, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/1.54inch-e-Paper-Module-B.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-paper_module_b_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 8s). Please be patient.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 8s). Please be patient.<br />
* The RAM of Arduino UNO is only 2K. However, it need at least 10K storage space for completely update one frame and couldn’t refresh partially (That is, unable to completely update one frame by refreshing partial of it for several times). So the Arduino example we provide can only displaying static image.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 8s). Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> power setting --> booster soft start --> power on --> panel setting --> VCOM and data interval setting --> PLL control --> resolution setting --> VCM DC setting --> look-up table setting.<br />
<br />
For detailed explanation of commands, please refer to [[File:1.54inch-e-paper-b-specification.pdf]]<br />
=== Configuration of LUT table(SetLutBw and SetLutRed) ===<br />
Look-up table is stored in the module, which is provided by us. So the table may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: Send command data start transmission 1 --> Send data of dark area --> Send command data start transmission 2 --> Send data of red area --> Refresh the screen.<br />
Note:<br />
* One frame consist of images of black area and red area, so we need to send two images for displaying one frame,<br />
* The image of black part: 2 bits = 1 pixel, doesn’t support Gray scale (Can only display black and white). 00b stand for black pixel, and 11b stand for white.<br />
<br />
For example:<br />
<pre><br />
0xC3:4 pixels □■■□<br />
0x00:4 pixels ■■■■<br />
0xFF:4 pixels □□□□<br />
0x66:The state of pixels is uncertain<br />
</pre><br />
* The image of red area: 1 bit = 1 pixel, doesn’t support Gray scale (Can only display red and white). The pixel is white if Bit is set, and it is red on the contrary.<br />
<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 8s). Please be patient.<br />
<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
Process:VCOM and data interval setting --> VCM DC setting --> power setting --> power off<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 200x200.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/black.bmp and raspberrypi/python/red.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 200 and 200<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:1.54inch_e-Paper_module_b_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:1.54inch_e-paper_module_b_code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:1.54inch-e-paper-b-specification.pdf|Datasheets]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=1.54inch_e-Paper_Module&diff=134781.54inch e-Paper Module2017-09-19T03:04:16Z<p>Wiki Editorial Team: /* Reset (Reset) */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=200x200, 1.54inch E-Ink display module<br />
|img=[[File:1.54inch-e-paper-module-6.jpg|300px|link=http://www.waveshare.com/1.54inch-e-Paper-Module.htm]]<br />
|caption=200x200, 1.54inch E-Ink display module, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/1.54inch-e-Paper-Module.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/product/1.54inch-e-Paper-Module.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
200x200, 1.54inch E-Ink display module, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/1.54inch-e-Paper-Module.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-Paper_Module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25<br />
|-<br />
| RST || 17<br />
|-<br />
| BUSY || 24<br />
|}<br />
==== Expected result ====<br />
# After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
#* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the files from the directory arduino/libraries of the demo package to documents/arduino/libraries, where can be specified by Arduino IDE --> File --> Preferences --> Sketchbook location.<br />
# Click the button '''Upload''' to compile and upload the program to your Arduino board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with the STM32 development board ===<br />
Here we use the development board XNUCLEO-F103RB. The Demo is base on the library HAL.<br />
==== Hardware connection ====<br />
Here is the hardware connection between the development board XNUCLEO-F103RB and E-paper:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! XNUCLEO-F103RB<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7<br />
|-<br />
| CLK || PA5<br />
|-<br />
| CS || PB6<br />
|-<br />
| DC || PC7<br />
|-<br />
| RST || PA9<br />
|-<br />
| BUSY || PA8<br />
|}<br />
==== Expected result ====<br />
# Open the Keil project (MDK-ARM/epd-demo.uvprojx)<br />
# Click '''Build''' to compile the project.<br />
# Click '''Download''' to download the program to the target board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
Init has 3 effects: 1, Set the arguments at power up. 2, Awaken the module from deep sleep. 3, Set the mode to Full update or Partial update.<br />
<br />
Process of initialization: reset --> driver output control --> booster soft start control --> write VCOM register --> set dummy line period --> set gate time --> data entry mode setting --> look-up table setting<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is used to set the update mode of the module. This table is provided by us but it may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Set the frame memory (SetFrameMemory) ===<br />
SetFrameMemory is used to write image data to the memory. <br />
* Process: <br />
:: Set the area size (see the function SetMemoryArea) --> set the start point (see the function SetMemoryPointer) --> send the command ''Write RAM'' --> start image data transfer. <br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* About the image to be sent: 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for a black pixel.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to display the data from the frame memory.<br />
<br />
Note:<br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* The module will flicker during full update.<br />
* The module won't flicker during partial update, however, it may retain a "ghost image" of the last page.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== Private function: Set the memory area (SetMemoryArea) ===<br />
SetMemoryArea is used to specify the memory area, the arguments are the start/end points. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== Private function: Set the memory pointer (SetMemoryPointer) ===<br />
SetMemoryPointer is used to set the start point of the following image to be sent. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 200x200.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/black.bmp and raspberrypi/python/red.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 200 and 200<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be converted to 1, and black is converted to 0)<br />
# Click '''Save''', to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
[[File:1.54inch-e-paper-manual-3.png|400px]]<br />
<br />
[[File:1.54inch-e-paper-manual-4.png|400px]]<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:1.54inch_e-Paper_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:1.54inch_e-Paper_Module_code.7z|Demo code]]<br />
=== Demo video ===<br />
* [https://youtu.be/-XbwDC2AOOw 1.54inch e-paper demo video]<br />
=== Datasheets ===<br />
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.13inch_e-Paper_HAT&diff=134772.13inch e-Paper HAT2017-09-19T03:03:56Z<p>Wiki Editorial Team: /* Reset (Reset) */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=250x122, 2.13inch E-Ink display HAT for Raspberry Pi<br />
|img=[[File:2.13inch-e-paper-hat-intro.jpg|300px|link=http://www.waveshare.com/2.13inch-e-paper-hat.htm]]<br />
|caption=250x122, 2.13inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.13inch-e-paper-hat.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/product/2.13inch-e-paper-hat.htm Waveshare website]<br />
|interface1=SPI<br />
|interface2=RPi<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
250x122, 2.13inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/2.13inch-e-paper-hat.htm More]}}<br />
== Interfaces ==<br />
[[File:2.13inch-e-paper-hat.png|thumb|left|400px|Interfaces]]<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-Paper_Module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25<br />
|-<br />
| RST || 17<br />
|-<br />
| BUSY || 24<br />
|}<br />
==== Expected result ====<br />
# After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
#* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
[[File:2.13inch-e-paper-hat.png|thumb|400px]]<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the files from the directory arduino/libraries of the demo package to documents/arduino/libraries, where can be specified by Arduino IDE --> File --> Preferences --> Sketchbook location.<br />
# Click the button '''Upload''' to compile and upload the program to your Arduino board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with the STM32 development board ===<br />
Here we use the development board XNUCLEO-F103RB. The Demo is base on the library HAL.<br />
==== Hardware connection ====<br />
Here is the hardware connection between the development board XNUCLEO-F103RB and E-paper:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! XNUCLEO-F103RB<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7<br />
|-<br />
| CLK || PA5<br />
|-<br />
| CS || PB6<br />
|-<br />
| DC || PC7<br />
|-<br />
| RST || PA9<br />
|-<br />
| BUSY || PA8<br />
|}<br />
==== Expected result ====<br />
# Open the Keil project (MDK-ARM/epd-demo.uvprojx)<br />
# Click '''Build''' to compile the project.<br />
# Click '''Download''' to download the program to the target board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
Init has 3 effects:<br />
# Set the arguments at power up.<br />
# Awaken the module from deep sleep.<br />
# Set the mode to Full update or Partial update.<br />
<br />
Process of initialization: reset --> driver output control --> booster soft start control --> write VCOM register --> set dummy line period --> set gate time --> data entry mode setting --> look-up table setting<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is used to set the update mode of the module. This table is provided by us but it may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Set the frame memory (SetFrameMemory) ===<br />
SetFrameMemory is used to write image data to the memory. <br />
* Process: <br />
:: Set the area size (see the function SetMemoryArea) --> set the start point (see the function SetMemoryPointer) --> send the command ''Write RAM'' --> start image data transfer. <br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* About the image to be sent: 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for a black pixel.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to display the data from the frame memory.<br />
<br />
Note:<br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* The module will flicker during full update.<br />
* The module won't flicker during partial update, however, it may retain a "ghost image" of the last page.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== Private function: Set the memory area (SetMemoryArea) ===<br />
SetMemoryArea is used to specify the memory area, the arguments are the start/end points. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== Private function: Set the memory pointer (SetMemoryPointer) ===<br />
SetMemoryPointer is used to set the start point of the following image to be sent. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 128x250 (real resolution: 122x250; logic resolution: 128x250).<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/black.bmp and raspberrypi/python/red.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 128 and 250<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be converted to 1, and black is converted to 0)<br />
# Click '''Save''', to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
[[File:1.54inch-e-paper-manual-3.png|400px]]<br />
<br />
[[File:1.54inch-e-paper-manual-4.png|400px]]<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.13inch_e-Paper_HAT_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.13inch_e-Paper_HAT-code.7z|Demo code]]<br />
=== Demo video ===<br />
* [https://youtu.be/y5XdNrZ6AtY 2.13inch e-paper Demo video]<br />
=== Datasheets ===<br />
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.7inch_e-Paper_HAT_(B)&diff=134762.7inch e-Paper HAT (B)2017-09-19T03:03:46Z<p>Wiki Editorial Team: /* Reset (Reset) */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=264x176, 2.7inch E-Ink display HAT for Raspberry Pi, three-color<br />
|img=[[File:2.7inch-e-paper-hat-b-4.jpg|300px|link=http://www.waveshare.com/2.7inch-e-paper-hat-b.htm]]<br />
|caption=264x176, 2.7inch E-Ink display HAT for Raspberry Pi, three-color<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.7inch-e-Paper-HAT-B.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/2.7inch-e-paper-hat-b.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
264x176, 2.7inch E-Ink display HAT for Raspberry Pi, three-color<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/2.7inch-e-paper-hat-b.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:2.7inch_e-paper_hat_b_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> power on --> panel setting --> PLL control --> power setting --> booster soft start --> power optimization --> VCM DC setting --> VCOM and data interval setting --> look-up table setting.<br />
<br />
For detailed explanation of commands, please refer to [[File:2.7inch-e-paper-b-specification.pdf]]<br />
=== Configuration of LUT table(SetLutBw and SetLutRed) ===<br />
Look-up table is stored in the module, which is provided by us. So the table may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: Send command data start transmission 1 --> Send data of dark area --> Send command data start transmission 2 --> Send data of red area --> Refresh the screen.<br />
<br />
Note:<br />
* One frame consist of images of black area and red area, so we need to send two images for displaying one frame,<br />
* 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for black/red pixel, otherwise a bit reset stands for white.<br />
<br />
For example:<br />
<pre><br />
0xC3:8 pixels ■■□□□□■■<br />
0x00:8 pixels □□□□□□□□<br />
0xFF:8 pixels ■■■■■■■■<br />
0x66:8 pixels □■■□□■■□<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 176x264.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/black.bmp and raspberrypi/python/red.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 176 and 264<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.7inch_e-Paper_HAT_b_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.7inch_e-paper_hat_b_code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:2.7inch-e-paper-b-specification.pdf|Datasheets]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.7inch_e-Paper_HAT&diff=134752.7inch e-Paper HAT2017-09-19T03:03:35Z<p>Wiki Editorial Team: /* Reset (Reset) */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=264x176, 2.7inch E-Ink display HAT for Raspberry Pi<br />
|img=[[File:2.7inch-e-paper-hat-3.jpg|300px|link=http://www.waveshare.com/2.7inch-e-paper-hat.htm]]<br />
|caption=264x176, 2.7inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.7inch-e-Paper-HAT.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/2.7inch-e-paper-hat.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
264x176, 2.7inch E-Ink display HAT for Raspberry Pi, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/2.7inch-e-paper-hat.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:2.7inch-e-paper-hat-code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 6s). Please be patient.<br />
<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3 (if the display doesn't work on 3.3V, you can try 5V in most cases.)<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE --> File --> Preferences --> Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 6s). Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 6s). Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> power setting --> booster soft start --> power optimization --> power on --> panel setting --> PLL control --> VCM DC setting.<br />
=== Configuration of LUT table (SetLut) ===<br />
Look-up table is stored in the module, which is provided by us. So the table may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: resolution setting --> VCM DC setting --> VCOM and data interval setting --> Send command data start transmission 1 --> Send data of an white image (send 0xFF 5808 times) --> Send command data start transmission 2 --> Send data of an image to display --> Refresh the screen.<br />
<br />
Note:<br />
* You have to send a white frame before the frame to display.<br />
* 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for black.<br />
<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 6s). Please be patient.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 176x264.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 176 and 264<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.7inch-e-paper-hat-schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.7inch-e-paper-hat-code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:2.7inch-e-paper-hat-specification.7z|Datasheets]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=2.9inch_e-Paper_Module&diff=134742.9inch e-Paper Module2017-09-19T03:03:07Z<p>Wiki Editorial Team: /* Reset (Reset) */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=296x128, 2.9inch E-Ink display module<br />
|img=[[File:2.9inch-e-paper-module-4.jpg|300px|link=http://www.waveshare.com/2.9inch-e-paper-module.htm]]<br />
|caption=296x128, 2.9inch E-Ink display module, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/2.9inch-e-paper-module.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/product/2.9inch-e-paper-module.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
296x128, 2.9inch E-Ink display module, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/2.9inch-e-paper-module.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:1.54inch_e-Paper_Module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25<br />
|-<br />
| RST || 17<br />
|-<br />
| BUSY || 24<br />
|}<br />
==== Expected result ====<br />
# After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
#* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
#* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the files from the directory arduino/libraries of the demo package to documents/arduino/libraries, where can be specified by Arduino IDE --> File --> Preferences --> Sketchbook location.<br />
# Click the button '''Upload''' to compile and upload the program to your Arduino board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
=== Working with the STM32 development board ===<br />
Here we use the development board XNUCLEO-F103RB. The Demo is base on the library HAL.<br />
==== Hardware connection ====<br />
Here is the hardware connection between the development board XNUCLEO-F103RB and E-paper:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! XNUCLEO-F103RB<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7<br />
|-<br />
| CLK || PA5<br />
|-<br />
| CS || PB6<br />
|-<br />
| DC || PC7<br />
|-<br />
| RST || PA9<br />
|-<br />
| BUSY || PA8<br />
|}<br />
==== Expected result ====<br />
# Open the Keil project (MDK-ARM/epd-demo.uvprojx)<br />
# Click '''Build''' to compile the project.<br />
# Click '''Download''' to download the program to the target board.<br />
# The screen displays strings and shapes after whole screen refresh.<br />
# The screen displays images and the time after partial screen refresh. This demonstrates the partial refreshing capability.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
Init has 3 effects: <br />
# Set the arguments at power up. <br />
# Awaken the module from deep sleep. <br />
# Set the mode to Full update or Partial update.<br />
Process of initialization: reset --> driver output control --> booster soft start control --> write VCOM register --> set dummy line period --> set gate time --> data entry mode setting --> look-up table setting<br />
<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is used to set the update mode of the module. This table is provided by us but it may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Set the frame memory (SetFrameMemory) ===<br />
SetFrameMemory is used to write image data to the memory. <br />
* Process: <br />
:: Set the area size (see the function SetMemoryArea) --> set the start point (see the function SetMemoryPointer) --> send the command ''Write RAM'' --> start image data transfer. <br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* About the image to be sent: 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for a black pixel.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to display the data from the frame memory.<br />
<br />
Note:<br />
* The module has two memory areas. Once DisplayFrame is invoked, the following function SetFrameMemory will set the other memory area, e.g. to set all the two memory areas, the process is: SetFrameMemory --> DisplayFrame --> SetFrameMemory --> DisplayFrame, i.e. set and update twice.<br />
* The data from SPI interface is first saved into the memory and then updated if the module received the update command.<br />
* The module will flicker during full update.<br />
* The module won't flicker during partial update, however, it may retain a "ghost image" of the last page.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== Private function: Set the memory area (SetMemoryArea) ===<br />
SetMemoryArea is used to specify the memory area, the arguments are the start/end points. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== Private function: Set the memory pointer (SetMemoryPointer) ===<br />
SetMemoryPointer is used to set the start point of the following image to be sent. Because 1 byte = 8 pixels of the image data to be sent, the x coordinates must be the multiple of 8, or else the last 3 bits will be ignored.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 128x296.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/black.bmp and raspberrypi/python/red.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 128 and 296<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be converted to 1, and black is converted to 0)<br />
# Click '''Save''', to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
[[File:1.54inch-e-paper-manual-3.png|400px]]<br />
<br />
[[File:1.54inch-e-paper-manual-4.png|400px]]<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:2.9inch_e-Paper_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:2.9inch_e-Paper_Module_code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:1.54inch_e-Paper_Datasheet.pdf|1.54inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.13inch_e-Paper_Datasheet.pdf|2.13inch_e-Paper_Datasheet.pdf]]<br />
* [[:File:2.9inch_e-Paper_Datasheet.pdf|2.9inch_e-Paper_Datasheet.pdf]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=4.2inch_e-Paper_Module_(B)&diff=134734.2inch e-Paper Module (B)2017-09-19T03:02:55Z<p>Wiki Editorial Team: /* Reset (Reset) */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=400x300, 4.2inch E-Ink display module, three-color, SPI interface<br />
|img=[[File:4.2inch-e-paper-module-b-3.jpg|300px|link=http://www.waveshare.com/4.2inch-e-paper-module-b.htm]]<br />
|caption=400x300, 4.2inch E-Ink display module, three-color, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/4.2inch-e-Paper-Module-B.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/4.2inch-e-paper-module-b.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
400x300, 4.2inch E-Ink display module, three-color, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/4.2inch-e-paper-module-b.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:4.2inch-e-paper-module-b-code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3 (if the display doesn't work on 3.3V, you can try 5V in most cases.)<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> booster soft start --> power on --> panel setting.<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is stored in the module, which is provided by us. So the table may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: Send command data start transmission 1 --> Send data of the black part of the image --> Send command data start transmission 2 --> Send data of the red part of the image --> Refresh the screen.<br />
<br />
Note:<br />
* 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for black.<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
Process: VCOM and data interval setting --> power off --> deep sleep <br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 400x300.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 400 and 300<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:4.2inch-e-paper-module-b-schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:4.2inch-e-paper-module-b-code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:4.2inch-e-paper-b-specification.pdf|Datasheets]]<br />
<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Teamhttps://www.waveshare.com/w/index.php?title=4.2inch_e-Paper_Module&diff=134724.2inch e-Paper Module2017-09-19T03:02:45Z<p>Wiki Editorial Team: /* Reset (Reset) */</p>
<hr />
<div>{{Infobox item|colorscheme=blue<br />
|brief=400x300, 4.2inch E-Ink display module<br />
|img=[[File:4.2inch-e-paper-module-5.jpg|300px|link=http://www.waveshare.com/4.2inch-e-paper-module.htm]]<br />
|caption=400x300, 4.2inch E-Ink display module, SPI interface<br />
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]]<br />
|brand=Waveshare<br />
|{{#urlget:amazon|default}}=display<br />
|website_cn=[http://www.waveshare.net/shop/4.2inch-e-Paper-Module.htm 官方中文站点]<br />
|website_en=[http://www.waveshare.com/4.2inch-e-paper-module.htm Waveshare website]<br />
|interface1=SPI<br />
|related=<br />
{{Product List|OLEDs / LCDs/e-Paper}}<br />
}}<br />
== Introduction ==<br />
400x300, 4.2inch E-Ink display module, SPI interface<br />
<br />
{{Amazon|{{#urlget:amazon|default}}=display<br />
|More = [http://www.waveshare.com/product/4.2inch-e-paper-module.htm More]}}<br />
== Interfaces ==<br />
{|class="wikitable"<br />
|-<br />
| VCC || 3.3V <br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || SPI MOSI <br />
|-<br />
| CLK || SPI SCK<br />
|-<br />
| CS || SPI chip select (Low active)<br />
|-<br />
| DC || Data/Command control pin (High for data, and low for command)<br />
|-<br />
| RST || External reset pin (Low for reset)<br />
|-<br />
| BUSY || Busy state output pin (Low for busy)<br />
|}<br />
== Working principle ==<br />
=== Introduction ===<br />
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. <br />
=== Communication protocol ===<br />
[[File:1.54inch-e-paper-manual-1.png|400px|thumb|SPI timing]]<br />
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. <br />
* CS is slave chip select, when CS is low, the chip is enabled.<br />
* DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.<br />
* SCLK is the SPI communication clock. <br />
* SDIN is the data line from the master to the slave in SPI communication. <br />
SPI communication has data transfer timing, which is combined by CPHA and CPOL. <br />
# 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.<br />
# 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.<br />
* There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.<br />
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.<br />
<br />
== How to use ==<br />
=== Working with Raspberry Pi ===<br />
==== Installing libraries required ====<br />
If you want to connect your E-paper screen to Raspberry Pi, you should install some necessary libraries, or else the [[:File:4.2inch_e-paper_module_code.7z|Demo (click to download)]] below may work improperly. For more information about how to install the Raspberry Pi libraries, please visit the website: [[Pioneer600#Libraries_Installation_for_RPi|Libraries Installation for RPi]].<br />
<br />
You can find the detailed presentation about the installations of libraries wiringPi, bcm2835 and python.<br />
==== Hardware connection ====<br />
Here is the connection between Raspberry Pi 3B and E-paper.<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Raspberry Pi 3B<br />
|-<br />
| 3.3V || 3.3V<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || MOSI<br />
|-<br />
| CLK || SCLK<br />
|-<br />
| CS || CE0<br />
|-<br />
| DC || 25 (BCM)<br />
|-<br />
| RST || 17 (BCM)<br />
|-<br />
| BUSY || 24 (BCM)<br />
|}<br />
<br />
==== Expected result ====<br />
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.<br />
* '''BCM2835:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''WringPi:''' Execute the command: <code>make</code>, to compile the code and generate a file <code>epd</code>. Execute the command: <code>sudo ./epd</code>, the program will run. <br />
* '''Python:''' Execute the command: <code>sudo python main.py</code><br />
2) Image will be displayed on the screen.<br />
* Note:The refresh rate of this module is slow, and it will flicker for several times during refreshing. Please be patient.<br />
<br />
=== Working with Arduino ===<br />
==== Hardware connection ====<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! Arduino<br />
|-<br />
| 3.3V || 3V3 (if the display doesn't work on 3.3V, you can try 5V in most cases.)<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || D11<br />
|-<br />
| CLK || D13<br />
|-<br />
| CS || D10<br />
|-<br />
| DC || D9<br />
|-<br />
| RST || D8<br />
|-<br />
| BUSY || D7<br />
|}<br />
==== Expected result ====<br />
# Copy the libraries file of Arduino demo code to the libraries folder which is under the installation directory of Arduino IDE, it usually is C:\users\username\documents\arduino\libraries. You can also designate the location on Arduino IDE--> File -->Preferences -->Sketchbook location<br />
# Upload the project.<br />
# E-paper will display the image.<br />
Note:<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing. Please be patient.<br />
=== Working with the STM32 development board ===<br />
* Here we use STM32F103ZE development board.<br />
* The demo code is based on HAL, so you can port the demo code to other STM board with STM32CubeMX.<br />
* The demo code can be compiled successfully in Keil v5<br />
==== Hardware connection ====<br />
Connecting to the STM32F103ZE:<br />
{|class="wikitable"<br />
|-<br />
! e-Paper !! STM32F103ZE<br />
|-<br />
| 3.3V || 3V3<br />
|-<br />
| GND || GND<br />
|-<br />
| DIN || PA7 (MOSI)<br />
|-<br />
| CLK || PA5 (SCK)<br />
|-<br />
| CS || PA4<br />
|-<br />
| DC || PA2<br />
|-<br />
| RST || PA1<br />
|-<br />
| BUSY || PA3<br />
|}<br />
<br />
==== Expected result ====<br />
# Open the project (epd-demo.uvprojx), which is under the MDK-ARM directory.<br />
# Click Build to compile the project.<br />
# Click Download to load the code to your board.<br />
* Reset, the screen will display image.<br />
*: Note: The refresh rate of this module is slow, and it will flicker for several times during refreshing. Please be patient.<br />
== Code analysis ==<br />
Here, we will analyze the driving code and take the demos for Raspberry Pi based on WiringPi library as examples. <br />
=== Hardware interface function ===<br />
The functions of drive code like DigitalWrite, DigitalRead, SendCommand, SenData and DelayMs call the interface functions which are provided by hardware device (epdif.h, epdif.c, epdif.cpp) to respectively implements the functions that Control IO Level, Read IO Level, Send SPI Command, Send SPI Data and Delay For Millisecond. If you want to port the demo code, you need to implement all the interfaces of epdif (e-paper display interface) according to the corresponding hardware device.<br />
<br />
Note that Raspberry Pi uses hardware chip select while transmitting SPI data. So we needn’t set the CS pin to LOW before transmitting data, and the code will set it automatically while transmitting. However, for Arduino and STM32, etc. you need to explicitly set the CS pin to LOW with codes to start the SPI transmission of module.<br />
=== Send Commands and Data (SendCommand and SendData) ===<br />
SendCommand and SendData are used to send commands and data to module respectively. What the difference between them is that, D/C pin is set to LOW for sending commands and HIGH for sending data. If the D/C pin is LOW, the data transmitted from SPI interface to module will be recognized as commands and executed. If the D/C pin is HIGH, the data will be recognized as normal data. Generally, normal data will follow the command, works as parameter or image data.<br />
=== Reset (Reset) ===<br />
Module will reset if RST pin is LOW. It is used to restart the module after powered on or awakened. After restarting, you need to initialize module with initialization function (Init) for working properly.<br />
<br />
=== Initialization (Init) ===<br />
After powering on the module, initialization function (Init) will configure the parameters of module. It can also wake up module from sleep mode. Process of initialization: reset --> power setting --> booster soft start --> power on --> panel setting --> PLL control.<br />
<br />
For detailed explanation of commands, please refer to [[File:4.2inch-e-paper-specification.pdf]]<br />
=== Configuration of LUT table(SetLut) ===<br />
Look-up table is stored in the module, which is provided by us. So the table may be different among different batches. If the table changed, we will update the demo code as soon as possible. <br />
=== Display a Frame (DisplayFrame) ===<br />
DisplayFrame is used to send a frame to module, and the screen will refresh and display it.<br />
<br />
Process: resolution setting --> VCM DC setting --> VCOM and data interval setting --> Send command data start transmission 1 --> Send data of an white image (send 0xFF 15000 times) --> Send command data start transmission 2 --> Send data of an image to display --> set LUT --> Refresh the screen.<br />
<br />
Note:<br />
* You have to send a white frame before the frame to display.<br />
* 1 byte = 8 pixels, doesn’t support Gray scale (Can only display black and white). A bit set stands for a white pixel, otherwise a bit reset stands for black.<br />
<br />
For example:<br />
<pre><br />
0xC3:8 pixels □□■■■■□□<br />
0x00:8 pixels ■■■■■■■■<br />
0xFF:8 pixels □□□□□□□□<br />
0x66:8 pixels ■□□■■□□■<br />
</pre><br />
* This module doesn’t support partial refresh.<br />
* The refresh rate of this module is slow, and it will flicker for several times during refreshing. Please be patient.<br />
=== Sleep mode (Sleep) ===<br />
Sleep can make the module go into sleep mode to reduce the consumption.<br />
<br />
Process: VCOM and data interval setting --> VCM DC setting --> panel setting --> power setting --> power off --> deep sleep<br />
<br />
If you want to wake up the module from sleep mode, you need to give a LOW pulse to RST pin. Then maybe you need to reconfigure the parameter of power (According to the batches, some of them need to reconfigure, some needn’t). So if you want to wake up module, you had better use the Init function instead of Reset. Reset function and relative commands will be executed while executing the Init function.<br />
=== How to display an image === <br />
There are two ways to display pictures. One is display directly and other is indirectly.<br />
<br />
Display directly: Read the data of pictures with library functions, and decode. Then convert it to arrays and send to module. About how to implement it, you can refer to the python examples of Raspberry Pi. (The C demo doesn’t display pictures directly)<br />
<br />
Display indirectly: Converting pictures to relative arrays on PC and save as c file. Then you can use the c file on your project. This chapter we will talk about how to convert a picture to array.<br />
<br />
# Open a picture with drawing tool comes with Windows system, create a new image, and set the pixel to 400x300.<br />
# Because this module can only display two gray level (Only black and white), we need to convert picture to monochrome bitmap before converting it to array. That is, File --> BMP picture --> Monochrome Bitmap.<br />
#: There are two monochrome bitmap on examples pack, which are used for demonstration (raspberrypi/python/monocolor.bmp).<br />
# Use Image2Lcd.exe software to generate corresponding array for picture (.c file). Open picture with this software, set the parameters:<br />
#* Output data type: C language array<br />
#* Scanning mode: vertical scanning<br />
#* Output gray: single color (gray level of two)<br />
#* Maximum width and height: 400 and 300<br />
#* Include the data of Image Header: Don’t check<br />
#* Inverse color: Check (Check: the white on image will be inversed to 1, and black is inversed to 0)<br />
# Click “Save”, to generate .c file. Copy the corresponding array into your project, and you can display picture by calling this array.<br />
<br />
== Resources ==<br />
=== Documentation ===<br />
* [[:File:4.2inch_e-Paper_Schematic.pdf|Schematic]]<br />
=== Demo code ===<br />
* [[:File:4.2inch_e-paper_module_code.7z|Demo code]]<br />
=== Datasheets ===<br />
* [[:File:4.2inch-e-paper-specification.pdf|Datasheets]]<br />
==Support==<br />
{{Service00}}</div>Wiki Editorial Team