Difference between revisions of "12.48inch e-Paper Module (B)"
(Created page with "{{infobox item| |name=12.48inch e-Paper |name2=12.48inch e-Paper Module |img=link=https://www.waveshare.com/12.48inch-e-paper.htm |img2=...") |
(No difference)
|
Revision as of 08:45, 13 November 2019
Contents
特点
- Dimension: 12.48inch
- Outline dimension (raw panel):261.5mm × 211mm × 0.3mm
- Outline dimension (Acrylic case):280mm x 229.5mm
- Display size:252.976mm × 190.896mm
- Working voltage:3.3V/5V
- Interface:SPI
- Dot pitch:0.194mm × 0.194mm
- Resolution:1304 x 984
- Display color:Black, white
- Grey level:2
- Full refresh time :8s
- Refresh power : 26.4mW(typ.)
- Standby power :<=0.017mW
【Note】:
Refresh time:The data provided is experimental data, the actual time may be a little different.It is normal that the e-Paper blink when full updating.
Power:The power data is experimental data.
SPI timing
- CS is slave chip select, when CS is low, the chip is enabled.
- DC is data/command control pin, when DC = 0, write command, when DC = 1, write data.
- SCLK is the SPI communication clock.
- SDIN is the data line from the master to the slave in SPI communication.
SPI communication has data transfer timing, which is combined by CPHA and CPOL.
- 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.
- CPHA determines whether data is collected at the first clock edge or at the second clock edge of serial synchronous clock; when CPHL = 0, data is collected at the first clock edge.
- There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.
As you can see from the figure above, data transmission starts at the first falling edge of SCLK, and 8 bits of data are transferred in one clock cycle. Here, SPI0 is in used, and data is transferred by bits, MSB first.
How do e-Paper display
As we know, this display uses the SPI interface, however, there are two FPC cables. In fact, the 12.48inch e-Paper is combined by four small e-Paper, therefore, to control the e-Paper, you should use four chip select pin.
- Update essence
It works as below:
We name the four areas as S2, M2, M1 and S1 respectively, in demo codes, we will send data to these four area in order.
The resolution of S2 and M1 are same 648*492, and the resolution of M2 and S1 are the same 656*492.
Combine the four display we get the resolution of 12.48inch e-Paper: 1304*984
- Control principle
They are four display indeed, therefore, we need to control four SPI salves:
Generally, the control pins of e-Paper are MOSI, SCLK, CS and DC
And power and reset pins: VCC, GND, RST
Because e-Paper will flash when updating, there is a busy pin:BUSY
To reduce pins, four displays use the same VCC, GND, MOSI and SCK pins. Every two displays use the same DC and RST pins.
Therefore, there are total 16 pins for controlling the e-Paper:
- Codes analysis
To control the e-Paper, you should first reset and initialize registers. And then transmit image data to e-Paper and update.
Here we show you how to transmit the image data:
We take Black-white or Red-white image as a monochrome bitmap. One byte stands for 8 pixels.
S2 and M1: There are 648 pixels per raw, It needs 648/8 = 81 bytes. One display has 492 column,totally have 81 * 492 = 39852 bytes. The same as the M2 and S1: They totally have 40344 per display。
Registers 0x13 and 0x10 are used to control Black-white image data and Red image data transmitting, here we take two-color display as example
Color | 0x10 | 0x13 |
White | 0xFF | 0x00 |
Black | 0x00 | 0x00 |
Red | 0xFF/0x00 | 0xFF |
void EPD_12in48_Display(const UBYTE *Image) { int x,y; //S1 part 648*492 EPD_S2_SendCommand(0x13); for(y = 0; y < 492; y++) for(x = 0; x < 81; x++) { EPD_S2_SendData(*(Image + (y*163 + x))); } //M2 part 656*492 EPD_M2_SendCommand(0x13); for(y = 0; y < 492; y++) for(x = 81; x < 163; x++) { EPD_M2_SendData(*(Image+ (y*163) +x)); } //S1 part 656*492 EPD_S1_SendCommand(0x13); for(y = 492; y < 984; y++) for(x = 81; x < 163; x++) { EPD_S1_SendData(*(Image+ (y*163) +x)); } //M1 part 648*492 EPD_M1_SendCommand(0x13); for(y = 492; y < 984; y++) for(x = 0; x < 81; x++) { EPD_M1_SendData(*(Image+ (y*163) +x)); } EPD_12in48_TurnOnDisplay(); }
We provide demo codes for four popular hardware platforms, Raspberry Pi, Arduino UNO, STM32 and the ESP32. The product you receive may be pre-assembled, you need to remove the back panel and connect your device like Raspberry Pi.
Raspberry Pi
Hardware connection
The pins used can be found on schematic according to codes
Enable SPI interface
Open terminal and type command
sudo raspi-config
Choose Interfacing Options -> SPI -> Yes. Then reboot the Raspberry Pi
sudo reboot
Libraries installation
- Install BCM2835
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz tar zxvf bcm2835-1.60.tar.gz cd bcm2835-1.60/ sudo ./configure sudo make sudo make check sudo make install
- Install wiringPi
sudo apt-get install wiringpi cd /tmp wget https://project-downloads.drogon.net/wiringpi-latest.deb sudo dpkg -i wiringpi-latest.deb gpio -v
- Install python2
sudo apt-get update sudo apt-get install python-pip sudo apt-get install python-pil sudo pip install RPi.GPIO sudo pip install spidev
- Install python3
sudo apt-get update sudo apt-get install python3-pip sudo apt-get install python3-pil sudo pip3 install RPi.GPIO sudo pip3 install spidev
Download
Open terminal and run commands to download codes
sudo apt-get install p7zip-full wget http://www.waveshare.net/w/upload/9/9a/12.48inch_e-Paper_Module_Code_RPI.7z 7z x 12.48inch_e-Paper_Module_Code_RPI.7z -r -o./12.48inch_e-Paper_Module_Code sudo chmod 777 -R 12.48inch_e-Paper_Module_Code cd 12.48inch_e-Paper_Module_Code
Run codes
- C codes
cd c sudo nano examples/main.c
- Confirm that which kind of 12.48inch e-Paper do you use. If you use the two-color display, modify the file as below
- If you use the tree-color display, modify the file as below
- Save then compile and run the code
sudo make clean sudo make sudo ./epd
- Python codes
- Open terminal and run the demo codes by commands:
cd python/examples
- For two-color version
sudo python epd_12in48_test.py
- For three-color version
sudo python epd_12in48_test.py
- Python codes-Weather
cd python/examples
- For two-color display
sudo python Show_EN_Weather.py
- For three-color display
sudo python Show_EN_Weather.py B
- For help information
sudo python Show_EN_Weather.py help
Arduino
Hardware connection
You can directly insert the Arduino UNO to PCB
About the pins used:
Run codes
- Download demo codes from wiki and unzio it.
- Copy the 12in48 folder to the libraries directory which is under the installation directory of Arduino IDE.(The installation directory generally is C:\Program Files (x86)\Arduino\libraries)
- Open Ardunin IDE software, choose Tool->Board->Arduino UNO:
- Click File -> Examples -> EPD12in48 to opem demo cods
- If your e-Paper is two-color version, use the epd12in48-demo, otherwise, use the epd12in48b-demo
- Compile and download the codes to board
STM32
The development board we use is Waveshare Open103Z. The project is developed based on STM32 HAL libraries.
Hardware connection
To assemble the Open32, you should connect it by wires provided.
About the pins used, you can refer to e-paper.ioc file.
Run codes
Open the project (~\STM32\NUCLEO-F103RB\MDK-ARM\e-paper.uvprojx), compile and download to developmen board. It requires about 10s for the two-color version and 20s for three-color display.
ESP32
The demo codes for ESP32 are developed with Arduino IDE as well.
Software setup
To develop ESP32, you should first set up the environment.
- Download the newest Arduino IDE from Arduino website: https://www.arduino.cc/en/Main/Software
- Download ESP32 pack from github: https://codeload.github.com/espressif/arduinoesp32/zip/master . Unzip the achieve to [Arduino IDE installation direcotry]/Hardare/espressif/esp32 directory. (If you didn't find the path under the installation directory, please create the folders manually)
- Enter the tools folder, and run the get.exe file as administrator. After installing, Copy the esp32-epd-12in48 folder of ESP32 demo codes to [Arduino IDE installation directory]/Hardware/espressif/esp32/libraries
Hardware connection
Here we use Waveshare e-Paper ESP32 Driver Board as an example. Attach it on PCB.
About the pins used, you can refer to schematic and codes
Examples 1
Open Arduino IDE software, and find the examples on File->Examples
If you use two-color e-Paper, choose the epd12in48-demo, otherwise, use the epd12in48B-demo
WiFi example
As we know, ESP32 features WIFI, you can set it as master or slave. Here we provide demo codes that control the e-Paper on the web by WIFI.
- You need to first modify the wifi connection information. Open the Web_App.cpp file and modify the line 50 and line 51:
- Open wifi.ino file, compile and download it to your ESP32 board. Open Serial monitor to query the IP address
- Open the Chrome browser, and enter the web with the IP address
- Select the display type, here we take 12.48inch e-Paper (two-color version) as example:
- Click 12.48 e-Paper, and there are six functions provided. You can use them to draw points, lines and so on. On the top of the webpage, the type of e-Paper and display color are shown.
-
- The corresponding coordination of display is as below.
- Draw points
- Draw lines
- Draw Rectangle
- Draw circle
- Draw String
- Display picture
- Finally, click the upload image button on left to upload image to e-Paper for displaying.
- You can open the Serial monitor of IDE to check the debug information
-
- You can also press F12 button to open the debug console of browser
Resources
Document
Demo codes
- Demo codes (full)
- Demo codes (Pi)
- [ Github]
Datasheet
FAQ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Supports
|