Difference between revisions of "Template:Jetson Nano Guides for SPI e-Paper"

From Waveshare Wiki
Jump to: navigation, search
 
(37 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
=User Guides of Jetson Nano=
 
=User Guides of Jetson Nano=
 
==Hardware connection==
 
==Hardware connection==
: Because the 40PIN GPIO of Jetson Nano are compatible with Raspberry Pi's and the Jetson.GPIO libraries are compatible with RPi.GPIO, therefore we use the same connection as Raspberry Pi
+
: Because the 40PIN GPIO of Jetson Nano are compatible with Raspberry Pi's and the Jetson.GPIO libraries are compatible with RPi.GPIO, therefore we use the same connection as Raspberry Pi.
:To connect the e-Paper, you can following the table below
+
:To connect the e-Paper, you can following the table below.
 
{|border=1; style="width:700px;" align="center"
 
{|border=1; style="width:700px;" align="center"
 
|+Jetson Nano Connection
 
|+Jetson Nano Connection
|- style="background:Black; color:white" align="center"
+
|- style="background:Green; color:white" align="center"
 
|rowspan="2"|e-Paper
 
|rowspan="2"|e-Paper
 
| colspan="2" | Jetson Nano Developer Kit
 
| colspan="2" | Jetson Nano Developer Kit
|-  style="background:Black; color:white" align="center"
+
|-  style="background:Green; color:white" align="center"
 
|BCM2835
 
|BCM2835
 
|Board  
 
|Board  
Line 53: Line 53:
 
==Download Testing Program==
 
==Download Testing Program==
 
Open a linux terminal and execute:<br/>
 
Open a linux terminal and execute:<br/>
Method 1: Download from our official website, it is recommended to use it.<br/>
+
Method 1: Using the GitHub repository<br/>
sudo apt-get install p7zip-full
 
sudo wget  https://www.waveshare.net/w/upload/3/39/E-Paper_code.7z
 
7z x E-Paper_code.7z -O./e-Paper
 
cd e-Paper/RaspberryPi_JetsonNano/
 
Method 2: Using the github repository, there may be a delay in the update of github, it is recommended to use method 1<br/>
 
 
  sudo git clone https://github.com/waveshare/e-Paper
 
  sudo git clone https://github.com/waveshare/e-Paper
cd e-Paper/RaspberryPi_JetsonNano/
+
 
 
==Run the Test Program==
 
==Run the Test Program==
Please execute the following commands under RaspberryPi_JetsonNano, otherwise, the directory will not be indexed
+
Please execute the following commands under RaspberryPi_JetsonNano, otherwise, the directory will not be indexed.
  
 
===C===
 
===C===
[[File:2.7inch E-paper.png|300px|thumb|right]]
+
[[File:RPI Guide for e-Paper02.png|thumb|right]]
*Modify the main.c file for corresponding e-Paper
+
*Modify the main.c file for corresponding e-Paper.
 
<pre>
 
<pre>
 
cd c
 
cd c
Line 72: Line 67:
 
</pre>
 
</pre>
 
If you are using 2.7inch e-paper, then remove the // in front of the EPD_2IN7_test() function, then press ctrl+c, then press Y and press Enter to save and exit, as shown:<br/>
 
If you are using 2.7inch e-paper, then remove the // in front of the EPD_2IN7_test() function, then press ctrl+c, then press Y and press Enter to save and exit, as shown:<br/>
 +
'''Supporting Types'''<br/>
 +
'''1.02inch(128×80)'''<br/>
 +
EPD_1in02d_test():Example for 1.02inch e-Paper/1.02inch e-Paper Module<br/>
  
+
'''1.54inch(1.54inch e-paper c:152×152,others:200×200)'''<br/>
====Supporting Types====
+
EPD_1in54_test(): Example for 1.54inch e-paper V1(Balck/<font color="#DCDCDC">White</font>): This version is stopped production which can be bought before 2019-11-22;<br />
;1.02inch(128×80):
+
EPD_1in54_V2_test(): Example for 1.54inch e-paper V2(Balck/<font color="#DCDCDC">White</font>): This is the current version that can be bought now (2020-07-29). The e-Paper has V2 sticker on the backside. <br />
EPD_1in02d_test():Example for 1.02inch e-Paper/1.02inch e-Paper Module
+
EPD_1in54b_test(): Example for 1.54inch e-paper B(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>). It is currently out of production.<br />
 +
EPD_1in54b_V2_test(): Example for 1.54inch e-Paper B V2 (Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>). The purchase date later than November 2019 is the V2 version, the current shipping version has the V2 logo on the back;<br />
 +
EPD_1in54c_test(): Example for 1.54inch e-paper C(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>); <br />
  
;1.54inch(1.54inch e-paper c:152×152,others:200×200):
+
'''1.64inch(168 × 168)'''<br/>
EPD_1in54_test(): Example for 1.54inch e-paper V1(Balck/White): This version is stopped production which can be bought before 2019-11-22;<br />
+
EPD_1in64g_test(): Example for 1.64inch e-paper G (Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>/<font color="#FFD700">Yellow</font>)<br/>
EPD_1in54_V2_test(): Example for 1.54inch e-paper V2(Balck/White): This is the current version that can be bought now (2020-07-29). The e-Paper has V2 sticker on the backside. <br />
 
EPD_1in54b_test(): Example for 1.54inch e-paper B(Black/White/Red);<br />
 
EPD_1in54b_V2_test(): Example for 1.54inch e-Paper B V2 (Black/White/Red);<br />
 
EPD_1in54c_test(): Example for 1.54inch e-paper C(Black/White/Red); <br />
 
  
;2.7inch(264×176):
+
'''2.7inch(264×176)'''<br/>
EPD_2in7_test()Example for 2.7inch e-paper(Black/White);<br />
+
EPD_2in7_test(): Example for 2.7inch e-paper(Black/<font color="#DCDCDC">White</font>);<br />
EPD_2in7b_test()Example for 2.7inch e-paper B(Black.White/Red);<br />
+
EPD_2in7b_test(): Example for 2.7inch e-paper B(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>);<br />
EPD_2in7b_V2_test()Example for 2.7inch e-paper B V2(Black.White/Red);<br />
+
EPD_2in7b_V2_test(): Example for 2.7inch e-paper B V2(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>);<br />
  
;2.9inch(296×128):
+
'''2.9inch(296×128)'''<br/>
EPD_2in9_test(): Example for 2.9inch e-paper(Black/White);<br />
+
EPD_2in9_test(): Example for 2.9inch e-paper (Black/<font color="#DCDCDC">White</font>), this version is stopped production.<br />
EPD_2in9_V2_test(): Example for 2.9inch e-paper V2(Black/White);<br />
+
EPD_2in9_V2_test(): Example for 2.9inch e-paper V2(Black/<font color="#DCDCDC">White</font>); The purchase date is later than December 2020 is the V2 version, the current shipping version has the V2 logo on the back;<br />
EPD_2in9bc_test()Example for 2.9inch e-paper B(Balck/White/Red) and 2.9inch e-paper C(Black/White/Yellow);<br />
+
EPD_2in9bc_test(): Example for 2.9inch e-paper B(Balck/<font color="#DCDCDC">White</font>/Red) and 2.9inch e-paper C(Black/<font color="#DCDCDC">White</font>/<font color="#FFD700">Yellow</font>);<br />
EPD_2in9b_V3_test()Example for 2.9inch e-paper B V3 (Balck/White/Red);<br />
+
EPD_2in9b_V3_test(): Example for 2.9inch e-paper B V3 (Balck/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>); Purchase date later than July 2020 is the V3 version, the current shipping version has the V3 logo on the back;<br />
EPD_2in9d_test()Example for 2.9inch e-paper D(Black/White);
+
EPD_2in9d_test(): Example for 2.9inch e-paper D(Black/<font color="#DCDCDC">White</font>);
  
;2.13inch(2.13inch e-Paper:250×122,others:212×104):
+
'''2.13inch(2.13inch e-Paper:250×122,others:212×104)''':<br/>
EPD_2in13_test()Example for 2.13inch e-paper V1(Black/White), this version is stopped production and it can be bought before 019-05-15;<br />
+
EPD_2in13_test(): Example for 2.13inch e-paper V1(Black/<font color="#DCDCDC">White</font>), this version is stopped production and it can be bought before 019-05-15;<br />
EPD_2in13_V2_test()Example for 2.13inch e-paper V2(Black/White) This is the current version with sticker V2 on the backside (2020-07-29);<br />
+
EPD_2in13_V2_test(): Example for 2.13inch e-paper V2(Black/<font color="#DCDCDC">White</font>) This is the current version with sticker V2 on the backside (2020-07-29);<br />
EPD_2in13_V3_test()Example for 2.13inch e-paper V3(Black/White) This is the current version with sticker V3 on the backside (2020-07-29);<br />
+
EPD_2in13_V3_test(): Example for 2.13inch e-paper V3(Black/<font color="#DCDCDC">White</font>) This is the current version with sticker V3 on the backside (2020-07-29);<br />
EPD_2in13bc_test():Example for 2.13inch e-paper B(Black/White/Red)and 2.13inch e-paper C(Blackj/White/Yellow);<br />
+
EPD_2in13bc_test():Example for 2.13inch e-paper B(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>)and 2.13inch e-paper C(Blackj/<font color="#DCDCDC">White</font>/Yellow);<br />
EPD_2in13b_V3_test():Example for 2.13inch e-paper B V3(Black/White/Red)<br />
+
EPD_2in13b_V3_test():Example for 2.13inch e-paper B V3(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>)Purchase date later than April 2020 is the V3 version, the current shipping version has the V3 logo on the back;<br/>
EPD_2in13d_test(): Example for 2.13inch e-paper D(Black/White);<br />
+
EPD_2in13d_test(): Example for 2.13inch e-paper D(Black/<font color="#DCDCDC">White</font>);<br />
  
;2.66inch (152 x 296):
+
'''2.66inch (152 x 296)'''<br />
EPD_2in66_test(): Example for 2.66inch e-Paper (Black/White);<br />
+
EPD_2in66_test(): Example for 2.66inch e-Paper (Black/<font color="#DCDCDC">White</font>);<br />
EPD_2in66b_test(): Example for 2.66inch e-Paper B (Black/White/Red); <br />
+
EPD_2in66b_test(): Example for 2.66inch e-Paper B (Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>); <br />
  
;3.7inch (280 x 480):
+
'''3inch (400 × 168)'''<br/>
EPD_3in7_test(): Example for 3.7inch e-Paper(Black/White); <br />
+
EPD_3in0g_test(): Example for 3inch e-Paper G(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>/<font color="#FFD700">Yellow</font>); <br />
  
;4.01inch (640x400):
+
'''3.52inch (360 × 240)'''<br/>
EPD_4in01_test(): Example for the 4.01inch e-Paper HAT (F);<br />
+
EPD_3in52_test(): Example for 3.52inch e-Paper (Black/<font color="#DCDCDC">White</font>); <br />
  
;4.2inch(400×300):
+
'''3.7inch (280 x 480)'''<br />
EPD_4in2_test(): Example for 4.2inch e-paper(Black/White);<br />
+
EPD_3in7_test(): Example for 3.7inch e-Paper(Black/<font color="#DCDCDC">White</font>); <br />
EPD_4in2bc_test()Example for 4.2inch e-paper B(Black/White/Red);<br />
 
EPD_4in2b_V2_test(): Example for 4.2inch e-paper B V2(Black/White/Red);<br />
 
  
;5.65inch (600x448):
+
'''4.01inch (640x400)'''<br />
EPD_5in65f_test(): Example for for 5.65inch e-Paper F (Seven-color);
+
EPD_4in01_test(): Example for the 4.01inch e-Paper HAT (F) (Black/<font color="#DCDCDC">White</font>/<font color="#008000">Green</font>/<font color="#0000FF">Blue</font>/<font color="#FF0000">Red</font>/<font color="#FFD700">Yellow</font>/<font color="#FFCC00">Orange</font>);<br />
  
;5.83inch(600×448):
+
'''4.2inch(400×300)'''<br />
EPD_5in83_test(): Example for 5.83inch e-paper(Black/White);<br />
+
EPD_4in2_test(): Example for 4.2inch e-paper(Black/<font color="#DCDCDC">White</font>);<br />
EPD_5in83_V2_test(): Example for 5.83inch e-paper V2(Black/White);<br />
+
EPD_4in2bc_test(): Example for 4.2inch e-paper B(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>);<br />
EPD_5in83bc_test(): Example for 5.83inch e-paper B(Black/White/Red)and 5.83inch e-paper C(Black/White/Yellow);<br />
+
EPD_4in2b_V2_test(): Example for 4.2inch e-paper B V2(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>). The purchase date is later than November 2020, it is the V2 version, and the current shipping version has the V2 logo on the back;<br />
EPD_5in83b_V2_test()Example for 5.83inch e-paper B V2(Black/White/Red)<br />
+
'''5.65inch (600x448)'''<br/>
 +
EPD_5in65f_test(): Example for for 5.65inch e-Paper F (Black/<font color="#DCDCDC">White</font>/<font color="#008000">Green</font>/<font color="#0000FF">Blue</font>/<font color="#FF0000">Red</font>/<font color="#FFD700">Yellow</font>/<font color="#FFCC00">Orange</font>);
  
;7.5inch(V1:640×384, V2:800×480):
+
'''5.83inch(600×448)'''<br />
EPD_7in5_test(): Example for 7.5inch e-paper(Black/White), this version is stopped production and it can be bought before 2019-12-07;<br />
+
EPD_5in83_test(): Example for 5.83inch e-paper(Black/<font color="#DCDCDC">White</font>), It is currently out of production.<br />
EPD_7in5bc_test(): Example for 7.5inch e-paper B(Black/White/Red)and 7.5inch e-paper C(Black/White/Yellow),7.5inch e-paper B V1 version is stop production and it can be bought before 2019-12-07;<br />
+
EPD_5in83_V2_test(): Example for 5.83inch e-paper V2(Black/<font color="#DCDCDC">White</font>), The purchase date is later than December 2020 is the V2 version, the current shipping version, with the V2 logo on the back.<br />
EPD_7in5_V2_test(): Example for 7.5inch e-paper V2(Black/White), This is the current version with V2 sticker on the backside (2020-07-29)<br />  
+
EPD_5in83bc_test(): Example for 5.83inch e-paper B(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>)and 5.83inch e-paper C(Black/<font color="#DCDCDC">White</font>/<font color="#FFD700">Yellow</font>);<br />
EPD_7in5bc_V2_test():Example for 7.5inch e-paper B V2(Black/White/Red); This is the current version with V2 sticker on the backside. (2020-07-29);<br />
+
EPD_5in83b_V2_test(): Example for 5.83inch e-paper B V2(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>). The purchase date is later than August 2020 for the V2 version, the current shipping version, with the V2 logo on the back.<br />
  
;7.5inch(HD880 x 528)
+
'''7.5inch(V1:640×384, V2:800×480)'''<br />
 +
EPD_7in5_test(): Example for 7.5inch e-paper(Black/<font color="#DCDCDC">White</font>). The purchase date is earlier than 2019-12-07 as the V1 version, which is currently discontinued.<br />
 +
EPD_7in5bc_test(): For example for 7.5inch e-paper B(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>)and 7.5inch e-paper C(Black/<font color="#DCDCDC">White</font>/<font color="#FFD700">Yellow</font>), The purchase date later than 2019-12-07 is the V2 version, and the current shipping version has the V2 logo on the back;<br />
 +
EPD_7in5_V2_test(): Example for 7.5inch e-paper V2(Black/<font color="#DCDCDC">White</font>). The purchase date of 7.5inch e-paper B is earlier than 2019-12-07, which is the V1 version, which is currently discontinued, and 7.5inch e-paper C is normally available.<br/>
 +
EPD_7in5bc_V2_test(): Example for 7.5inch e-paper B V2(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>); The purchase date is later than 2019-12-07 is the V2 version, with the V2 logo on the back; the purchase date is later than March 2021 is the V3 version, the current 7.5inch e-paper B shipping version, with the V3 logo on the back, the same use this program;<br />
  
EPD_7in5_HD_test(): Example for 7.5inch e-Paper HD (Black/White); <br />
+
'''7.5inch(HD880 x 528)'''<br />
EPD_7in5b_HD_test(): Example for 7.5inch e-Paper B HD (Black/White/Red); <br />
+
EPD_7in5_HD_test(): Example for 7.5inch e-Paper HD (Black/<font color="#DCDCDC">White</font>); <br />
 +
EPD_7in5b_HD_test(): Example for 7.5inch e-Paper B HD (Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>); <br />
  
*Note: The above time is for reference only, please refer to the screen logo for the specific version<br/>
+
<font backgound=white; color=#DD1223>*Note: The above time is for reference only, please refer to the screen logo for the specific version.</font><br/>
*Recompile, the compilation process may take a few seconds<br/>
+
*Recompile, the compilation process may take a few seconds.<br/>
 
  Return to the c directory and run the following command
 
  Return to the c directory and run the following command
 
  make clean
 
  make clean
  make
+
  make JETSON
 
  sudo ./epd
 
  sudo ./epd
  
 
===Python===
 
===Python===
[[File:E-paper rpi change python1.png|300px|thumb|right]]
+
Enter the python program directory and run the command ls -al.<br/>
Enter the python program directory and run the command ls -al<br/>
 
 
  cd python/examples
 
  cd python/examples
 
  ls -al  
 
  ls -al  
+
:[[File:E-paper_rpi_change_python012.png|500px]]
====Support Types====
+
'''Support Types'''<br/>
;1.02inch(128×80):
+
'''1.02inch(128×80)'''<br/>
epd_1in02_test.py:Example for 1.02inch e-Paper/1.02inch e-Paper Module
+
epd_1in02_test.py:Example for 1.02inch e-Paper/1.02inch e-Paper Module.<br/>
 +
 
 +
'''1.54inch(1.54inch e-paper c:152×152,others:200×200)'''<br/>
 +
epd_1in54_test.py: Example for 1.54inch e-paper V1(Balck/<font color="#DCDCDC">White</font>). This version is stopped production which can be bought before 2019-11-22;<br />
 +
epd_1in54_V2_test.py: Example for 1.54inch e-paper V2(Balck/<font color="#DCDCDC">White</font>): This is the current version which can be bought now (2020-07-29). The e-Paper has V2 sticker on the backside. <br />
 +
epd_1in54b_test.py: Example for 1.54inch e-paper B(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>). It is currently out of production.<br />
 +
epd_1in54b_V2_test.py: Example for 1.54inch e-paper B V2 (Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>). The purchase date is later than April 2020 is the V2 version, the current shipping version has the V2 logo on the back;<br />
 +
epd_1in54c_test.py: Example for 1.54inch e-paper C(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>).<br />
 +
 
 +
'''2.7inch(264×176)'''<br/>
 +
epd_2in7_test.py: Example for 2.7inch e-paper(Black/<font color="#DCDCDC">White</font>);<br />
 +
epd_2in7b_test.py: Example for 2.7inch e-paper B(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>);<br />
 +
epd_2in7b_V2_test.py: Example for 2.7inch e-paper B V2 (Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>). The purchase date is later than February 2021 is the V2 version, the current shipping version has the V2 logo on the back;<br />
  
;1.54inch(1.54inch e-paper c:152×152,others:200×200):
+
'''2.9inch(296×128)'''<br/>
epd_1in54_test.py: Example for 1.54inch e-paper V1(Balck/White): This version is stopped production which can be bought before 2019-11-22;<br />
+
epd_2in9_test.py: Example for 2.9inch e-paper(Black/<font color="#DCDCDC">White</font>); It is currently out of production.<br />
epd_1in54_V2_test.py: Example for 1.54inch e-paper V2(Balck/White): This is the current version which can be bought now (2020-07-29). The e-Paper has V2 sticker on the backside. <br />
+
epd_2in9_V2_test.py: Example for 2.9inch e-paper V2(Black/<font color="#DCDCDC">White</font>); The purchase date is later than December 2020 is the V2 version, the current shipping version, with the V2 logo on the back.<br />
epd_1in54b_test.py: Example for 1.54inch e-paper B(Black/White/Red);<br />
+
epd_2in9bc_test.py: Example for 2.9inch e-paper B(Balck/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>) and 2.9inch e-paper C(Black/White/Yellow);<br />
epd_1in54b_V2_test.py: Example for 1.54inch e-paper B V2(Black/White/Red);<br />
+
epd_2in9b_V3_test.py: Example for 2.9inch e-paper B V3(Balck/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>). The purchase date later than July 2020 is the V3 version, the current shipping version has the V3 logo on the back;<br />
epd_1in54c_test.py: Example for 1.54inch e-paper C(Black/White/Red);br />
+
epd_2in9d_test.py: Example for 2.9inch e-paper D(Black/<font color="#DCDCDC">White</font>);
  
;2.7inch(264×176):
+
'''2.13inch(2.13inch e-Paper:250×122,others:212×104)'''<br/>
epd_2in7_test.py: Example for 2.7inch e-paper(Black/White);<br />
+
epd_2in13_test.py: Example for 2.13inch e-paper V1(Black/<font color="#DCDCDC">White</font>), this version is stopped production and it can be bought before 019-05-15;<br />
epd_2in7b_test.py: Example for 2.7inch e-paper B(Black.White/Red);<br />
+
epd_2in13_V2_test.py: Example for 2.13inch e-paper V2(Black/<font color="#DCDCDC">White</font>) This is the current version with sticker V2 on the backside (2020-07-29);<br />
epd_2in7b_V2_test.py: Example for 2.7inch e-paper B V2(Black.White/Red);<br />
+
epd_2in13_V3_test.py: Example for 2.13inch e-paper V3(Black/<font color="#DCDCDC">White</font>), The purchase date later than February 2022 is the V3 version, the current shipping version, with the V3 logo on the back.<br/>
 +
epd_2in13bc_test.py: Example for 2.13inch e-paper B(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>)and 2.13inch e-paper C(Black/White/Yellow);<br />
 +
epd_2in13b_V3_test.py: Example for 2.13inch e-paper B V3(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>)<br />
 +
epd_2in13d_test.py: Example for 2.13inch e-paper D(Black/<font color="#DCDCDC">White</font>);<br />
  
;2.9inch(296×128):
+
'''2.66inch (152 x 296)'''<br/>
epd_2in9_test.py: Example for 2.9inch e-paper(Black/White);<br />
+
epd_2in66_test.py: Example for 2.66inch e-Paper (Black/<font color="#DCDCDC">White</font>); <br />
epd_2in9_V2_test.py: Example for 2.9inch e-paper V2(Black/White);<br />
+
epd_2in66b_test.py: Example for 2.66inch e-Paoer (Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>);<br />
epd_2in9bc_test.py: Example for 2.9inch e-paper B(Balck/White/Red) and 2.9inch e-paper C(Black/White/Yellow);<br />
 
epd_2in9b_V3_test.py: Example for 2.9inch e-paper B V3(Balck/White/Red;<br />
 
epd_2in9d_test.py: Example for 2.9inch e-paper D(Black/White);
 
  
;2.13inch(2.13inch e-Paper:250×122,others:212×104):
+
'''3inch (400 × 168)'''<br/>
epd_2in13_test.py: Example for 2.13inch e-paper V1(Black/White), this version is stopped production and it can be bought before 019-05-15;<br />
+
EPD_3in0g_test.py: Example for 3inch e-Paper G(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>/<font color="#FFD700">Yellow</font>); <br />
epd_2in13_V2_test.py: Example for 2.13inch e-paper V2(Black/White) This is the current version with sticker V2 on the backside (2020-07-29);<br />
 
epd_2in13bc_test.py: Example for 2.13inch e-paper B(Black/White/Red)and 2.13inch e-paper C(Black/White/Yellow);<br />
 
epd_2in13b_V3_test.py: Example for 2.13inch e-paper B V3(Black/White/Red)<br />
 
epd_2in13d_test.py: Example for 2.13inch e-paper D(Black/White);<br />
 
  
;2.66inch (152 x 296):
+
'''3.52inch (360 × 240)'''<br/>
epd_2in66_test.py: Example for 2.66inch e-Paper (Black/White); <br />
+
EPD_3in52_test.py: Example for 3.52inch e-Paper (Black/<font color="#DCDCDC">White</font>); <br />
epd_2in66b_test.py: Example for 2.66inch e-Paoer (Black/White/Red);<br />
 
  
;3.7inch (280 x 480):
+
'''3.7inch (280 x 480)'''<br/>
epd_3in7_test.py: Example for 3.7inch e-Paper (Black/White); <br />
+
epd_3in7_test.py: Example for 3.7inch e-Paper (Black/<font color="#DCDCDC">White</font>); <br />
  
;4.01inch (640x400):
+
'''4.01inch (640x400)'''<br/>
 
epd_4in01f_test.py: Example for 4.01inch e-Paper (Seven-color);<br />
 
epd_4in01f_test.py: Example for 4.01inch e-Paper (Seven-color);<br />
  
;4.2inch(400×300):
+
'''4.2inch(400×300)'''<br/>
epd_4in2_test.py: Example for 4.2inch e-paper(Black/White);<br />
+
epd_4in2_test.py: Example for 4.2inch e-paper(Black/<font color="#DCDCDC">White</font>);<br />
epd_4in2bc_test.py: Example for 4.2inch e-paper B(Black/White/Red);<br />
+
epd_4in2bc_test.py: Example for 4.2inch e-paper B(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>);<br />
epd_4in2b_V2_test.py: Example for 4.2inch e-paper B V2(Black/White/Red);<br />
+
epd_4in2b_V2_test.py: Example for 4.2inch e-paper B V2(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>). The purchase date is later than November 2020, it is the V2 version, and the current shipping version has the V2 logo on the back;<br />
  
;5.65inch (600x448):
+
'''5.65inch (600x448)'''<br/>
 
epd_5in65f_test.py: Example for 5.65inch e-Paper F (Seven-color);
 
epd_5in65f_test.py: Example for 5.65inch e-Paper F (Seven-color);
  
;5.83inch(600×448):
+
'''5.83inch(600×448)'''<br/>
epd_5in83_test.py: Example for 5.83inch e-paper(Black/White);<br />
+
epd_5in83_test.py: Example for 5.83inch e-paper(Black/<font color="#DCDCDC">White</font>). It is currently out of production.<br />
epd_5in83_V2_test.py: Example for 5.83inch e-paper V2(Black/White);<br />
+
epd_5in83_V2_test.py: Example for 5.83inch e-paper V2(Black/<font color="#DCDCDC">White</font>); The purchase date is later than December 2020 is the V2 version, the current shipping version has the V2 logo on the back;<br />
epd_5in83bc_test.py: Example for 5.83inch e-paper B(Black/White/Red)and 5.83inch e-paper C(Black/White/Yellow);<br />
+
epd_5in83bc_test.py: Example for 5.83inch e-paper B(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>)and 5.83inch e-paper C(Black/<font color="#DCDCDC">White</font>/<font color="#FFD700">Yellow</font>);<br />
epd_5in83b_V2_test.py: Example for 5.83inch e-paper B V2(Black/White/Red)<br />
+
epd_5in83b_V2_test.py: Example for 5.83inch e-paper B V2(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>). The purchase date is later than August 2020 is the V2 version, the current shipping version has the V2 logo on the back;<br />
  
;7.5inch(V1:640×384, V2:800×480):
+
'''7.5inch(V1:640×384, V2:800×480)'''<br/>
epd_7in5_test.py: Example for 7.5inch e-paper(Black/White), this version is stopped production and it can be bought before 2019-12-07;<br />
+
epd_7in5_test.py: Example for 7.5inch e-paper(Black/<font color="#DCDCDC">White</font>), this version is stopped production and it can be bought before 2019-12-07;<br />
epd_7in5_V2_test.py: Example for 7.5inch e-paper V2(Black/White), This is the current version with V2 sticker on the backside (2020-07-29)<br />  
+
epd_7in5_V2_test.py: Example for 7.5inch e-paper V2(Black/<font color="#DCDCDC">White</font>), This is the current version with V2 sticker on the backside (2020-07-29)<br />
epd_7in5bc_test.py: Example for 7.5inch e-paper B(Black/White/Red)and 7.5inch e-paper C(Black/White/Yellow),7.5inch e-paper B V1 version is stopped production and it can be bought before 2019-12-07;<br />
+
epd_7in5bc_test.py: Example for 7.5inch e-paper B(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>)and 7.5inch e-paper C(Black/<font color="#DCDCDC">White</font>/Yellow), 7.5inch e-paper B V1 version is stopped production and it can be bought before 2019-12-07;<br />
epd_7in5b_V2_test.py: Example for 7.5inch e-paper B V2(Black/White/Red); This is the current version with V2 sticker on the backside. (2020-07-29);<br />
+
epd_7in5b_V2_test.py: Example for 7.5inch e-paper B V2(Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>). The purchase date later than 2019-12-07 is the V2 version, with the V2 logo on the back; the purchase date later than March 2021 is the V3 version, the current 7.5inch e-paper B shipping version, with the V3 logo on the back, the same use this program.<br />
  
;7.5inch (HD 880 x 528):
+
'''7.5inch (HD 880 x 528)'''<br/>
epd_7in5_HD_test.py: Example for 7.5inch e-Paper HD (Black/White); <br />
+
epd_7in5_HD_test.py: Example for 7.5inch e-Paper HD (Black/<font color="#DCDCDC">White</font>); <br />
epd_7in5b_HD_test.py: Example for 7.5inch e-Paper B HD (Black/White/Red); <br />
+
epd_7in5b_HD_test.py: Example for 7.5inch e-Paper B HD (Black/<font color="#DCDCDC">White</font>/<font color="#FF0000">Red</font>); <br />
  
*Note: The above time is for reference only, please refer to the screen logo for the specific version<br/>
+
<font backgound=white; color=#DD1223>*Note: The above time is for reference only, please refer to the screen logo for the specific version</font><br/>
 
*Just run the program corresponding to the screen, the program supports python2/3, take 1.54 V2 as an example<br/>
 
*Just run the program corresponding to the screen, the program supports python2/3, take 1.54 V2 as an example<br/>
 
  # python2
 
  # python2
Line 252: Line 258:
 
</pre>
 
</pre>
 
===='''EPD '''====
 
===='''EPD '''====
e-paper driver code file, in the directory: RaspberryPi_JetsonNano\c\lib\e-Paper<br/>
+
e-paper driver code file, in the directory: RaspberryPi_JetsonNano\c\lib\e-Paper.<br/>
 
As shown below:<br/>
 
As shown below:<br/>
 
[[File:Epd-1.02inch.png]]<br/>
 
[[File:Epd-1.02inch.png]]<br/>
Open .h to see the following functions<br/>
+
Open .h to see the following functions.<br/>
*After the initialization, called when the screen starts working and after exiting sleep mode
+
*After the initialization, called when the screen starts working and after exiting sleep mode.
 
<pre>
 
<pre>
 
//1.54inch e-Paper, 1.54inch e-Paper V2, 2.13inch e-Paper, 2.13inch e-Paper V2, 2.13inch e-Paper (D), 2.9inch e-Paper, 2.9inch e-Paper (D )
 
//1.54inch e-Paper, 1.54inch e-Paper V2, 2.13inch e-Paper, 2.13inch e-Paper V2, 2.13inch e-Paper (D), 2.9inch e-Paper, 2.9inch e-Paper (D )
Line 263: Line 269:
 
void EPD_xxx_Init(void);
 
void EPD_xxx_Init(void);
 
</pre>
 
</pre>
Where xxx represents the model. If it is 2.13D, the full screen initialization is EPD_2IN13D_Init(0), the partial refresh initialization EPD_2IN13D_Init(1); if it is 1.54 V2, then EPD_1IN54_V2_Init(); if it is 7.5B, it is EPD_7IN5BC_Init(), because 7.5B and 7.5C are common The driver code, but the color displayed is different<br/>
+
Where xxx represents the model. If it is 2.13D, the full screen initialization is EPD_2IN13D_Init(0), the partial refresh initialization EPD_2IN13D_Init(1); if it is 1.54 V2, then EPD_1IN54_V2_Init(); if it is 7.5B, it is EPD_7IN5BC_Init(), because 7.5B and 7.5C are common The driver code, but the color displayed is different.<br/>
 
*Clear the screen, brush the ink screen to white
 
*Clear the screen, brush the ink screen to white
 
  void EPD_xxx_Clear(void);
 
  void EPD_xxx_Clear(void);
Where xxx represents the ink screen model. If it is 2.13D, then it is EPD_2IN9D_Clear(); if it is 7.5B, it is EPD_7IN5_Clear(), because 7.5B and 7.5C share the driver code, but the color displayed is different<br/>
+
Where xxx represents the ink screen model. If it is 2.13D, then it is EPD_2IN9D_Clear(); if it is 7.5B, it is EPD_7IN5_Clear(), because 7.5B and 7.5C share the driver code, but the color displayed is different.<br/>
*Transfer a frame of picture data and open the display
+
*Transfer a frame of picture data and open the display.
 
<pre>
 
<pre>
 
//Black and white two-color ink screen
 
//Black and white two-color ink screen
Line 280: Line 286:
 
void EPD_2IN9D_DisplayPart(UBYTE *Image);
 
void EPD_2IN9D_DisplayPart(UBYTE *Image);
 
</pre>
 
</pre>
//For 1.54inch e-paper V2 and 2.13inch e-paper V2, due to the upgrade of the control chip, for partial refresh, it is necessary to call EPD_xxx_DisplayPartBaseImage to display the static background image, that is, to perform partial refresh based on this image, and then call the dynamic EPD_xxx_DisplayPart ()
+
//For 1.54inch e-paper V2 and 2.13inch e-paper V2, due to the upgrade of the control chip, for a partial refresh, it is necessary to call EPD_xxx_DisplayPartBaseImage to display the static background image, that is, to perform partial refresh based on this image, and then call the dynamic EPD_xxx_DisplayPart ()
 
<pre>
 
<pre>
 
void EPD_1IN54_V2_DisplayPartBaseImage(UBYTE *Image);
 
void EPD_1IN54_V2_DisplayPartBaseImage(UBYTE *Image);
Line 292: Line 298:
 
</pre>
 
</pre>
 
Note that after entering sleep mode, there are only two ways to work again: the first is a hardware reset, and the second is to call the initialization function again.<br/>
 
Note that after entering sleep mode, there are only two ways to work again: the first is a hardware reset, and the second is to call the initialization function again.<br/>
Where xxx represents the ink screen model. If it is 2.13D, then it is EPD_2IN13D_Sleep(); if it is 7.5B, it is EPD_7IN5BC_Sleep(), because 7.5B and 7.5C share the driver code, but the color displayed is different<br/>
+
Where xxx represents the ink screen model. If it is 2.13D, then it is EPD_2IN13D_Sleep(); if it is 7.5B, it is EPD_7IN5BC_Sleep(), because 7.5B and 7.5C share the driver code, but the color displayed is different.<br/>
  
 
===='''GUI Functions'''====
 
===='''GUI Functions'''====
Line 559: Line 565:
  
 
===='''Testing Code'''====
 
===='''Testing Code'''====
[[File:Test code.png|600px|thumb|right]]
+
[[File:Test code.png|400px|thumb|right]]
 
The first three chapters introduce the classic linux three-layer code structure, here is a little explanation of the user test code<br/>
 
The first three chapters introduce the classic linux three-layer code structure, here is a little explanation of the user test code<br/>
 
For Raspberry Pi and Jetson Nano, in the directory: RaspberryPi_JetsonNano\c\examples, for all test codes, multiple shields can be made in main.c in this directory;<br/>
 
For Raspberry Pi and Jetson Nano, in the directory: RaspberryPi_JetsonNano\c\examples, for all test codes, multiple shields can be made in main.c in this directory;<br/>
Line 577: Line 583:
 
[[File:epd.png]]<br/>
 
[[File:epd.png]]<br/>
  
===='''Bottom Interface'''====
+
===='''<big>Bottom Interface</big>'''====
 
The epdconfig.py file in the underlying interface
 
The epdconfig.py file in the underlying interface
 
*Initialize module and exit handle:
 
*Initialize module and exit handle:
Line 599: Line 605:
 
</pre>
 
</pre>
  
====Driver Interface====
+
===='''<big>Driver Interface</big>'''====
 
epdxxx.py (xxx means size, if it is 2.13inch e-paper, it is epd2in13.py, and so on)
 
epdxxx.py (xxx means size, if it is 2.13inch e-paper, it is epd2in13.py, and so on)
*Initailize e-paper: this function should be used at the begining. It can also be used to wake up e-Paper from Sleep mode.
+
*Initialize e-paper: this function should be used at the beginning. It can also be used to wake up e-Paper from Sleep mode.
 
<pre>
 
<pre>
 
#For 2.13inch e-Paper、2.9inch e-Paper
 
#For 2.13inch e-Paper、2.9inch e-Paper
Line 655: Line 661:
  
 
===='''GUI'''====
 
===='''GUI'''====
Python has a powerful [http://effbot.org/imagingbook PIL library], which can be used directly to drawing figures. Here we use it for drawing <br />
+
Python has a powerful [http://effbot.org/imagingbook PIL library], which can be used directly to draw figures. Here we use it for drawing. <br />
  
 
*Install the library firstly
 
*Install the library firstly
Line 665: Line 671:
 
*Set image buffer for drawing.
 
*Set image buffer for drawing.
 
  image = Image.new('1', (epd.width, epd.height), 255)  # 255: clear the frame
 
  image = Image.new('1', (epd.width, epd.height), 255)  # 255: clear the frame
The first parameter is the depth of color, 1 means 2 grayscale. The second parameter is a tuple of image size. The third parameter is color of the image, 0 is black and 255 is white.
+
The first parameter is the depth of color, 1 means 2 grayscale. The second parameter is a tuple of image size. The third parameter is the color of the image, 0 is black and 255 is white.
  
 
*Create an image object.
 
*Create an image object.
Line 672: Line 678:
 
*Draw rectangle
 
*Draw rectangle
 
  draw.rectangle((0, 10, 200, 34), fill = 0)
 
  draw.rectangle((0, 10, 200, 34), fill = 0)
The first parameter is a tuple of coordination. 0, 10 is the top-left point of rectangle, 200, 34) is the right-bottom point. fille = 0 set the filled color to black.
+
The first parameter is a tuple of coordination. 0, 10 is the top-left point of the rectangle, 200, 34) is the right-bottom point. fille = 0 set the fill color to black.
  
 
*Draw line
 
*Draw line
 
  draw.line((16, 60, 56, 60), fill = 0)
 
  draw.line((16, 60, 56, 60), fill = 0)
The first parameter is a type of coordination, 16, 60 is the beginning point, 200, 34 is the endpoint. fill=0 set the line to black
+
The first parameter is a type of coordination, 16, 60 is the beginning point, and 200, 34 is the endpoint. fill=0 set the line to black
  
 
*Draw circle
 
*Draw circle
Line 683: Line 689:
 
</pre>
 
</pre>
 
This function is used to draw a encircle of a square. The first parameter is a tuple of coordination of the square.  the degree of the circle is 0 to 360 °, fille=0 set the circle to black.<br />
 
This function is used to draw a encircle of a square. The first parameter is a tuple of coordination of the square.  the degree of the circle is 0 to 360 °, fille=0 set the circle to black.<br />
If the figure is not square according to the coordination, you will get an ellipse.<br />
+
If the figure is not square according to the coordination, you will get an ellipse.<br />
  
 
Besides the arc function, you can also use the chord function for drawing a solid circle.<br />
 
Besides the arc function, you can also use the chord function for drawing a solid circle.<br />
Line 692: Line 698:
  
 
*Character
 
*Character
You can directkt import ImageFont model for drawing characters:<br />
+
You can directly import ImageFont model for drawing characters:<br />
 
<pre>
 
<pre>
 
font = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24)
 
font = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24)
Line 698: Line 704:
 
You can use the fonts of Windows or other fonts which is in ttc format.<br />
 
You can use the fonts of Windows or other fonts which is in ttc format.<br />
  
To draw English character, you can directly use the fonts; for Chinese character, you need to add a symbol u:<br />
+
To draw English characters, you can directly use the fonts; for Chinese characters, you need to add a symbol u:<br />
 
<pre>
 
<pre>
 
draw.text((8, 12), 'hello world', font = font, fill = 255)
 
draw.text((8, 12), 'hello world', font = font, fill = 255)
draw.text((8, 36), u'电子墨水屏', font = font, fill = 0)
+
draw.text((8, 36), u'微雪电子', font = font, fill = 0)
 
</pre>
 
</pre>
The first parameter is a tuple of coordination of character, the second parameter is the font and las one is set the color.<br />
+
The first parameter is a tuple of 2 elements, with (8, 12) as the left vertex, ''fill'' is the font color, and the first sentence ''fill=255'', so it seems that it will not be displayed. The second sentence shows ''微雪电子''.<br />
  
 
*Read local picture
 
*Read local picture
 
<pre>
 
<pre>
image = Image.open(os.path.join(picdir, '2in13-v2.bmp'))
+
image = Image.open(os.path.join(picdir, 'lin54.bmp'))
 
</pre>
 
</pre>
 
The parameter is the path of picture.
 
The parameter is the path of picture.
  
 
*Other functions.
 
*Other functions.
For more information about the PIL library, please refer to http://effbot.org/imagingbook.
+
For more information about the PIL library, you can search online.

Latest revision as of 02:57, 29 July 2022

User Guides of Jetson Nano

Hardware connection

Because the 40PIN GPIO of Jetson Nano are compatible with Raspberry Pi's and the Jetson.GPIO libraries are compatible with RPi.GPIO, therefore we use the same connection as Raspberry Pi.
To connect the e-Paper, you can following the table below.
Jetson Nano Connection
e-Paper Jetson Nano Developer Kit
BCM2835 Board
VCC 3.3V 3.3V
GND GND GND
DIN 10(SPI0_MOSI) 19
CLK 11(SPI0_SCK 23
CS 8(SPI0_CS0) 24
DC 25 22
RST 17 11
BUSY 24 18

Software Setting

Install Libraries

Open the terminal of Jetson Nano and run the following commands to install corresponding libraries:

sudo apt-get update
sudo apt-get install python3-pip
sudo pip3 install Jetson.GPIO
sudo groupadd -f -r gpio
sudo usermod -a -G gpio your_user_name
sudo cp /opt/nvidia/jetson-gpio/etc/99-gpio.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger
  • Install I2C libraries
sudo apt-get install python3-smbus
  • Install PIL libraries
sudo apt-get install python3-pil
sudo apt-get install python3-numpy

Download Testing Program

Open a linux terminal and execute:
Method 1: Using the GitHub repository

sudo git clone https://github.com/waveshare/e-Paper

Run the Test Program

Please execute the following commands under RaspberryPi_JetsonNano, otherwise, the directory will not be indexed.

C

RPI Guide for e-Paper02.png
  • Modify the main.c file for corresponding e-Paper.
cd c
sudo nano examples/main.c 

If you are using 2.7inch e-paper, then remove the // in front of the EPD_2IN7_test() function, then press ctrl+c, then press Y and press Enter to save and exit, as shown:
Supporting Types
1.02inch(128×80)
EPD_1in02d_test():Example for 1.02inch e-Paper/1.02inch e-Paper Module

1.54inch(1.54inch e-paper c:152×152,others:200×200)
EPD_1in54_test(): Example for 1.54inch e-paper V1(Balck/White): This version is stopped production which can be bought before 2019-11-22;
EPD_1in54_V2_test(): Example for 1.54inch e-paper V2(Balck/White): This is the current version that can be bought now (2020-07-29). The e-Paper has V2 sticker on the backside.
EPD_1in54b_test(): Example for 1.54inch e-paper B(Black/White/Red). It is currently out of production.
EPD_1in54b_V2_test(): Example for 1.54inch e-Paper B V2 (Black/White/Red). The purchase date later than November 2019 is the V2 version, the current shipping version has the V2 logo on the back;
EPD_1in54c_test(): Example for 1.54inch e-paper C(Black/White/Red);

1.64inch(168 × 168)
EPD_1in64g_test(): Example for 1.64inch e-paper G (Black/White/Red/Yellow)

2.7inch(264×176)
EPD_2in7_test(): Example for 2.7inch e-paper(Black/White);
EPD_2in7b_test(): Example for 2.7inch e-paper B(Black/White/Red);
EPD_2in7b_V2_test(): Example for 2.7inch e-paper B V2(Black/White/Red);

2.9inch(296×128)
EPD_2in9_test(): Example for 2.9inch e-paper (Black/White), this version is stopped production.
EPD_2in9_V2_test(): Example for 2.9inch e-paper V2(Black/White); The purchase date is later than December 2020 is the V2 version, the current shipping version has the V2 logo on the back;
EPD_2in9bc_test(): Example for 2.9inch e-paper B(Balck/White/Red) and 2.9inch e-paper C(Black/White/Yellow);
EPD_2in9b_V3_test(): Example for 2.9inch e-paper B V3 (Balck/White/Red); Purchase date later than July 2020 is the V3 version, the current shipping version has the V3 logo on the back;
EPD_2in9d_test(): Example for 2.9inch e-paper D(Black/White);

2.13inch(2.13inch e-Paper:250×122,others:212×104)
EPD_2in13_test(): Example for 2.13inch e-paper V1(Black/White), this version is stopped production and it can be bought before 019-05-15;
EPD_2in13_V2_test(): Example for 2.13inch e-paper V2(Black/White) This is the current version with sticker V2 on the backside (2020-07-29);
EPD_2in13_V3_test(): Example for 2.13inch e-paper V3(Black/White) This is the current version with sticker V3 on the backside (2020-07-29);
EPD_2in13bc_test():Example for 2.13inch e-paper B(Black/White/Red)and 2.13inch e-paper C(Blackj/White/Yellow);
EPD_2in13b_V3_test():Example for 2.13inch e-paper B V3(Black/White/Red)Purchase date later than April 2020 is the V3 version, the current shipping version has the V3 logo on the back;
EPD_2in13d_test(): Example for 2.13inch e-paper D(Black/White);

2.66inch (152 x 296)
EPD_2in66_test(): Example for 2.66inch e-Paper (Black/White);
EPD_2in66b_test(): Example for 2.66inch e-Paper B (Black/White/Red);

3inch (400 × 168)
EPD_3in0g_test(): Example for 3inch e-Paper G(Black/White/Red/Yellow);

3.52inch (360 × 240)
EPD_3in52_test(): Example for 3.52inch e-Paper (Black/White);

3.7inch (280 x 480)
EPD_3in7_test(): Example for 3.7inch e-Paper(Black/White);

4.01inch (640x400)
EPD_4in01_test(): Example for the 4.01inch e-Paper HAT (F) (Black/White/Green/Blue/Red/Yellow/Orange);

4.2inch(400×300)
EPD_4in2_test(): Example for 4.2inch e-paper(Black/White);
EPD_4in2bc_test(): Example for 4.2inch e-paper B(Black/White/Red);
EPD_4in2b_V2_test(): Example for 4.2inch e-paper B V2(Black/White/Red). The purchase date is later than November 2020, it is the V2 version, and the current shipping version has the V2 logo on the back;
5.65inch (600x448)
EPD_5in65f_test(): Example for for 5.65inch e-Paper F (Black/White/Green/Blue/Red/Yellow/Orange);

5.83inch(600×448)
EPD_5in83_test(): Example for 5.83inch e-paper(Black/White), It is currently out of production.
EPD_5in83_V2_test(): Example for 5.83inch e-paper V2(Black/White), The purchase date is later than December 2020 is the V2 version, the current shipping version, with the V2 logo on the back.
EPD_5in83bc_test(): Example for 5.83inch e-paper B(Black/White/Red)and 5.83inch e-paper C(Black/White/Yellow);
EPD_5in83b_V2_test(): Example for 5.83inch e-paper B V2(Black/White/Red). The purchase date is later than August 2020 for the V2 version, the current shipping version, with the V2 logo on the back.

7.5inch(V1:640×384, V2:800×480)
EPD_7in5_test(): Example for 7.5inch e-paper(Black/White). The purchase date is earlier than 2019-12-07 as the V1 version, which is currently discontinued.
EPD_7in5bc_test(): For example for 7.5inch e-paper B(Black/White/Red)and 7.5inch e-paper C(Black/White/Yellow), The purchase date later than 2019-12-07 is the V2 version, and the current shipping version has the V2 logo on the back;
EPD_7in5_V2_test(): Example for 7.5inch e-paper V2(Black/White). The purchase date of 7.5inch e-paper B is earlier than 2019-12-07, which is the V1 version, which is currently discontinued, and 7.5inch e-paper C is normally available.
EPD_7in5bc_V2_test(): Example for 7.5inch e-paper B V2(Black/White/Red); The purchase date is later than 2019-12-07 is the V2 version, with the V2 logo on the back; the purchase date is later than March 2021 is the V3 version, the current 7.5inch e-paper B shipping version, with the V3 logo on the back, the same use this program;

7.5inch(HD880 x 528)
EPD_7in5_HD_test(): Example for 7.5inch e-Paper HD (Black/White);
EPD_7in5b_HD_test(): Example for 7.5inch e-Paper B HD (Black/White/Red);

*Note: The above time is for reference only, please refer to the screen logo for the specific version.

  • Recompile, the compilation process may take a few seconds.
Return to the c directory and run the following command
make clean
make JETSON
sudo ./epd

Python

Enter the python program directory and run the command ls -al.

cd python/examples
ls -al 
E-paper rpi change python012.png

Support Types
1.02inch(128×80)
epd_1in02_test.py:Example for 1.02inch e-Paper/1.02inch e-Paper Module.

1.54inch(1.54inch e-paper c:152×152,others:200×200)
epd_1in54_test.py: Example for 1.54inch e-paper V1(Balck/White). This version is stopped production which can be bought before 2019-11-22;
epd_1in54_V2_test.py: Example for 1.54inch e-paper V2(Balck/White): This is the current version which can be bought now (2020-07-29). The e-Paper has V2 sticker on the backside.
epd_1in54b_test.py: Example for 1.54inch e-paper B(Black/White/Red). It is currently out of production.
epd_1in54b_V2_test.py: Example for 1.54inch e-paper B V2 (Black/White/Red). The purchase date is later than April 2020 is the V2 version, the current shipping version has the V2 logo on the back;
epd_1in54c_test.py: Example for 1.54inch e-paper C(Black/White/Red).

2.7inch(264×176)
epd_2in7_test.py: Example for 2.7inch e-paper(Black/White);
epd_2in7b_test.py: Example for 2.7inch e-paper B(Black/White/Red);
epd_2in7b_V2_test.py: Example for 2.7inch e-paper B V2 (Black/White/Red). The purchase date is later than February 2021 is the V2 version, the current shipping version has the V2 logo on the back;

2.9inch(296×128)
epd_2in9_test.py: Example for 2.9inch e-paper(Black/White); It is currently out of production.
epd_2in9_V2_test.py: Example for 2.9inch e-paper V2(Black/White); The purchase date is later than December 2020 is the V2 version, the current shipping version, with the V2 logo on the back.
epd_2in9bc_test.py: Example for 2.9inch e-paper B(Balck/White/Red) and 2.9inch e-paper C(Black/White/Yellow);
epd_2in9b_V3_test.py: Example for 2.9inch e-paper B V3(Balck/White/Red). The purchase date later than July 2020 is the V3 version, the current shipping version has the V3 logo on the back;
epd_2in9d_test.py: Example for 2.9inch e-paper D(Black/White);

2.13inch(2.13inch e-Paper:250×122,others:212×104)
epd_2in13_test.py: Example for 2.13inch e-paper V1(Black/White), this version is stopped production and it can be bought before 019-05-15;
epd_2in13_V2_test.py: Example for 2.13inch e-paper V2(Black/White) This is the current version with sticker V2 on the backside (2020-07-29);
epd_2in13_V3_test.py: Example for 2.13inch e-paper V3(Black/White), The purchase date later than February 2022 is the V3 version, the current shipping version, with the V3 logo on the back.
epd_2in13bc_test.py: Example for 2.13inch e-paper B(Black/White/Red)and 2.13inch e-paper C(Black/White/Yellow);
epd_2in13b_V3_test.py: Example for 2.13inch e-paper B V3(Black/White/Red
epd_2in13d_test.py: Example for 2.13inch e-paper D(Black/White);

2.66inch (152 x 296)
epd_2in66_test.py: Example for 2.66inch e-Paper (Black/White);
epd_2in66b_test.py: Example for 2.66inch e-Paoer (Black/White/Red);

3inch (400 × 168)
EPD_3in0g_test.py: Example for 3inch e-Paper G(Black/White/Red/Yellow);

3.52inch (360 × 240)
EPD_3in52_test.py: Example for 3.52inch e-Paper (Black/White);

3.7inch (280 x 480)
epd_3in7_test.py: Example for 3.7inch e-Paper (Black/White);

4.01inch (640x400)
epd_4in01f_test.py: Example for 4.01inch e-Paper (Seven-color);

4.2inch(400×300)
epd_4in2_test.py: Example for 4.2inch e-paper(Black/White);
epd_4in2bc_test.py: Example for 4.2inch e-paper B(Black/White/Red);
epd_4in2b_V2_test.py: Example for 4.2inch e-paper B V2(Black/White/Red). The purchase date is later than November 2020, it is the V2 version, and the current shipping version has the V2 logo on the back;

5.65inch (600x448)
epd_5in65f_test.py: Example for 5.65inch e-Paper F (Seven-color);

5.83inch(600×448)
epd_5in83_test.py: Example for 5.83inch e-paper(Black/White). It is currently out of production.
epd_5in83_V2_test.py: Example for 5.83inch e-paper V2(Black/White); The purchase date is later than December 2020 is the V2 version, the current shipping version has the V2 logo on the back;
epd_5in83bc_test.py: Example for 5.83inch e-paper B(Black/White/Red)and 5.83inch e-paper C(Black/White/Yellow);
epd_5in83b_V2_test.py: Example for 5.83inch e-paper B V2(Black/White/Red). The purchase date is later than August 2020 is the V2 version, the current shipping version has the V2 logo on the back;

7.5inch(V1:640×384, V2:800×480)
epd_7in5_test.py: Example for 7.5inch e-paper(Black/White), this version is stopped production and it can be bought before 2019-12-07;
epd_7in5_V2_test.py: Example for 7.5inch e-paper V2(Black/White), This is the current version with V2 sticker on the backside (2020-07-29)
epd_7in5bc_test.py: Example for 7.5inch e-paper B(Black/White/Red)and 7.5inch e-paper C(Black/White/Yellow), 7.5inch e-paper B V1 version is stopped production and it can be bought before 2019-12-07;
epd_7in5b_V2_test.py: Example for 7.5inch e-paper B V2(Black/White/Red). The purchase date later than 2019-12-07 is the V2 version, with the V2 logo on the back; the purchase date later than March 2021 is the V3 version, the current 7.5inch e-paper B shipping version, with the V3 logo on the back, the same use this program.

7.5inch (HD 880 x 528)
epd_7in5_HD_test.py: Example for 7.5inch e-Paper HD (Black/White);
epd_7in5b_HD_test.py: Example for 7.5inch e-Paper B HD (Black/White/Red);

*Note: The above time is for reference only, please refer to the screen logo for the specific version

  • Just run the program corresponding to the screen, the program supports python2/3, take 1.54 V2 as an example
# python2
sudo python2.7 epd_1in54_V2_test.py
# python3
sudo python3 epd_1in54_V2_test.py

Description of codes (API)

The libraries for Raspberry Pi and Jetson Nano are the same. Examples contain three parts, hardware interface, EPD driver, and the GUI functions.

C

Hardware interface

Two libraries are used by C example, WiringPi, and BCM2835. The codes use wiringPi by default, if you want to use BCM2835, you can modify the RaspberryPi&JetsonNano\c\Makefile file, modify lines 13 and 14. Change it as below:
E-paper Driver HAT RPI Makefile.png
  • Data type
#define UBYTE   uint8_t
#define UWORD   uint16_t
#define UDOUBLE uint32_t
  • Init and Exit
void DEV_Module_Init(void);
void DEV_Module_Exit(void);
Note: The Init() and Exit() function are used to configure GPIOs . EPD enter sleep mode after Exit() function is used, and the consumption of e-Paper should be 0 in sleep mode if the PCB is Rev2.1 version.
  • GPIO Read/Write
void DEV_Digital_Write(UWORD Pin, UBYTE Value);
UBYTE DEV_Digital_Read(UWORD Pin);
  • SPI transmit data
void DEV_SPI_WriteByte(UBYTE Value);

EPD

e-paper driver code file, in the directory: RaspberryPi_JetsonNano\c\lib\e-Paper.
As shown below:
Epd-1.02inch.png
Open .h to see the following functions.

  • After the initialization, called when the screen starts working and after exiting sleep mode.
//1.54inch e-Paper, 1.54inch e-Paper V2, 2.13inch e-Paper, 2.13inch e-Paper V2, 2.13inch e-Paper (D), 2.9inch e-Paper, 2.9inch e-Paper (D )
void EPD_xxx_Init(UBYTE Mode); // Mode = 0 global refresh initialization, Mode = 1 local refresh initialization
//other models
void EPD_xxx_Init(void);

Where xxx represents the model. If it is 2.13D, the full screen initialization is EPD_2IN13D_Init(0), the partial refresh initialization EPD_2IN13D_Init(1); if it is 1.54 V2, then EPD_1IN54_V2_Init(); if it is 7.5B, it is EPD_7IN5BC_Init(), because 7.5B and 7.5C are common The driver code, but the color displayed is different.

  • Clear the screen, brush the ink screen to white
void EPD_xxx_Clear(void);

Where xxx represents the ink screen model. If it is 2.13D, then it is EPD_2IN9D_Clear(); if it is 7.5B, it is EPD_7IN5_Clear(), because 7.5B and 7.5C share the driver code, but the color displayed is different.

  • Transfer a frame of picture data and open the display.
//Black and white two-color ink screen
void EPD_xxx_Display(UBYTE *Image);
//Black and white red or black and white yellow ink screen
void EPD_xxx_Display(const UBYTE *blackimage, const UBYTE *ryimage);

Note that the following are special cases:

//For 2.13inch e-paper (D), 2.9inch e-paper (D) two flexible screens, partial refresh
void EPD_2IN13D_DisplayPart(UBYTE *Image);
void EPD_2IN9D_DisplayPart(UBYTE *Image);

//For 1.54inch e-paper V2 and 2.13inch e-paper V2, due to the upgrade of the control chip, for a partial refresh, it is necessary to call EPD_xxx_DisplayPartBaseImage to display the static background image, that is, to perform partial refresh based on this image, and then call the dynamic EPD_xxx_DisplayPart ()

void EPD_1IN54_V2_DisplayPartBaseImage(UBYTE *Image);
void EPD_1IN54_V2_DisplayPart(UBYTE *Image);
void EPD_2IN13_V2_DisplayPart(UBYTE *Image);
void EPD_2IN13_V2_DisplayPartBaseImage(UBYTE *Image);
  • Enter sleep mode
void EPD_xxx_Sleep(void);

Note that after entering sleep mode, there are only two ways to work again: the first is a hardware reset, and the second is to call the initialization function again.
Where xxx represents the ink screen model. If it is 2.13D, then it is EPD_2IN13D_Sleep(); if it is 7.5B, it is EPD_7IN5BC_Sleep(), because 7.5B and 7.5C share the driver code, but the color displayed is different.

GUI Functions

GUI files can be found in RaspberryPi&JetsonNano\c\lib\GUI\GUI_Paint.c(.h) directory

E-paper Driver HAT GUI.png

The fonts can be found in RaspberryPi&JetsonNano\c\lib\Fonts directory

E-paper Driver HAT Fonts.png
Create an image buffer
void Paint_NewImage(UBYTE *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color)
  • Image: the Image buffer
  • Width: width of the image
  • Height: Height of the image
  • Rotate: Rotate angle
  • Color: Color of the image
Select image buffer
void Paint_SelectImage(UBYTE *image)
  • The image buffer, it is a pointer of image buffer's first address
Rotate image
This function should be used after Paint_SelectImage()
void Paint_SetRotate(UWORD Rotate)
  • Rotate: The angle rotated. It should be ROTATE_0, ROTATE_90, ROTATE_180, ROTATE_270
  • Note: For different orientation, the position of the first pixel is different, here we take 1.54inch as example

SPI-epaper-C-0.pngSPI-epaper-C-90.pngSPI-epaper-C-180.pngSPI-epaper-C-270.png

Mirroring
void Paint_SetMirroring(UBYTE mirror)
  • mirror: The type of mirroring. (MIRROR_NONE, MIRROR_HORIZONTAL、MIRROR_VERTICAL、MIRROR_ORIGIN)
Set Pixel
This function is used to set the position and types of the pixel
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
  • Xpoint: The x-axis coordination of pixel
  • Ypoint: The y-axis coordination of pixel
  • Color: The color of the pixel
Clear
This function is used to clear the e-Paper
void Paint_Clear(UWORD Color)
  • Color: The color of the display
Clear window
This function is used to clear a partial area
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color)
  • Xstart: The x-axis coordination of the start point
  • Ystart: The y-axis coordination of the start point
  • Xend: The x-axis coordination of the end point
  • Yend: The y-axis coordination of the end point
  • Color: The color of the windows
Draw point

This function is used to draw points.

void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_Style)
  • Xpoint: The x-axis coordination of point
  • Ypoint: The y-axis coordination of point
  • Dot_Pixel: The size of the point
 	 	 typedef enum {
 	 	 	 DOT_PIXEL_1X1  = 1,	// 1 x 1
 	 	 	 DOT_PIXEL_2X2  , 		// 2 X 2
 	 	 	 DOT_PIXEL_3X3  , 	 	// 3 X 3
 	 	 	 DOT_PIXEL_4X4  , 	 	// 4 X 4
 	 	 	 DOT_PIXEL_5X5  , 		// 5 X 5
 	 	 	 DOT_PIXEL_6X6  , 		// 6 X 6
 	 	 	 DOT_PIXEL_7X7  , 		// 7 X 7
 	 	 	 DOT_PIXEL_8X8  , 		// 8 X 8
 	 	} DOT_PIXEL;
  • Dot_Style: The style of the point
 	 	typedef enum {
 	 	   DOT_FILL_AROUND  = 1,		
 	 	   DOT_FILL_RIGHTUP,
 	 	} DOT_STYLE;
Drawn Line
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, LINE_STYLE Line_Style , LINE_STYLE Line_Style)

This function is used to draw a line

  • Xstart: The start x-axis coordination of the line
  • Ystart: The start y-axis coordination of the line
  • Xend: The end x-axis coordination of the line
  • Yend: The end y-axis coordination of the line
  • Line_width: The width of the line
 	 	typedef enum {
 	 	 	 DOT_PIXEL_1X1  = 1,	// 1 x 1
 	 	 	 DOT_PIXEL_2X2  , 		// 2 X 2
 	 	 	 DOT_PIXEL_3X3  ,		// 3 X 3
 	 	 	 DOT_PIXEL_4X4  ,		// 4 X 4
 	 	 	 DOT_PIXEL_5X5  , 		// 5 X 5
 	 	 	 DOT_PIXEL_6X6  , 		// 6 X 6
 	 	 	 DOT_PIXEL_7X7  , 		// 7 X 7
 	 	 	 DOT_PIXEL_8X8  , 		// 8 X 8
 	 	} DOT_PIXEL;
  • Line_style: The style of the line
 	 	typedef enum {
 	 	 	 LINE_STYLE_SOLID = 0,
 	 	 	 LINE_STYLE_DOTTED,
 	 	} LINE_STYLE;
Draw rectangle

Draw a rectangle from (Xstart, Ystart) to (Xend, Yend).

void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
  • Xstart: Start coordinate of X-axes of the rectangle
  • Ystart: Start coordinate of Y-axes of the rectangle
  • Xend: End coordinate of X-end of the rectangle
  • Yend: End coordinate of Y-end of the rectangle
  • Color: color of the rectangle
  • Line_width: The width of edges, 8 sides are available;
 	 	typedef enum {
 	 	 	 DOT_PIXEL_1X1  = 1,	// 1 x 1
 	 	 	 DOT_PIXEL_2X2  , 		// 2 X 2
 	 	 	 DOT_PIXEL_3X3  ,		// 3 X 3
 	 	 	 DOT_PIXEL_4X4  ,		// 4 X 4
 	 	 	 DOT_PIXEL_5X5  , 		// 5 X 5
 	 	 	 DOT_PIXEL_6X6  , 		// 6 X 6
 	 	 	 DOT_PIXEL_7X7  , 		// 7 X 7
 	 	 	 DOT_PIXEL_8X8  , 		// 8 X 8
 	 	} DOT_PIXEL;
 	

  • Draw_Fill: set the rectangle full or empty.
typedef enum {
 	DRAW_FILL_EMPTY = 0,
 	DRAW_FILL_FULL,
} DRAW_FILL;
  • Draw a circle: In the image cache, with (X_Center Y_Center) as the center, draw a circle with a radius of Radius, you can choose the color, the width of the line, whether to fill the inside of the circle
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
parameter:
          X_Center: X coordinate of the center of the circle
          Y_Center: Y coordinate of the center of the circle
          Radius: the radius of the circle
          Color: fill color
          Line_width: the width of the arc, providing 8 default widths
                       typedef enum {
                                      DOT_PIXEL_1X1 = 1, // 1 x 1
                                      DOT_PIXEL_2X2 , // 2 X 2
                                      DOT_PIXEL_3X3 , // 3 X 3
                                      DOT_PIXEL_4X4 , // 4 X 4
                                      DOT_PIXEL_5X5 , // 5 X 5
                                      DOT_PIXEL_6X6 , // 6 X 6
                                      DOT_PIXEL_7X7 , // 7 X 7
                                      DOT_PIXEL_8X8 , // 8 X 8
 } DOT_PIXEL;
 Draw_Fill: Fill, whether to fill the inside of the circle
            typedef enum {
                          DRAW_FILL_EMPTY = 0,
                          DRAW_FILL_FULL,
 } DRAW_FILL; 
Draw character (ASCII)

Set(Xstart Ystart) as letf-top point, draw a ASCII character.

void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Ascii_Char, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)

Parameter:

  • Xstart: X coordinate of the left-top pixel of character;
  • Ystart: Y coordinate of the left-top pixel of character;
  • Ascii_Char:Ascii character;
  • Font: 5 fonts are available;
    font12:7*12
    font16:11*16
    font20:14*20
    font24:17*24
  • Color_Foreground: color of character;
  • Color_Background: color of background;
Draw String

Set point (Xstart Ystart) as the left-top pixel, draw a string.

void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)

Parameters:

  • Xstart: X coordinate of left-top pixel of characters;
  • Ystart: Y coordinate of left-top pixel of characters;
  • pString:Pointer of string
  • Font: 5 fonts are available:
    font8:5*8
    font12:7*12
    font16:11*16
    font20:14*20
    font24:17*24
  • Color_Foreground: color of string
  • Color_Background: color of the background
Draw Chinese characters

this function is used to draw Chinese fonts based ON GB2312 fonts.

void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Foreground, UWORD Color_Background)

Parameters:

  • Xstart: Coordinate of left-top pixel of characters;
  • Ystart: Coordinate of left-top pixel of characters;
  • pString:Pointer of string;
  • Font: GB2312 fonts:
    font12CN:11*21(ascii),16*21 (Chinese)
    font24CN:24*41(ascii),32*41 (Chinese)
  • Color_Foreground: color of string
  • Color_Background: color of the background
Draw number

Draw a string of numbers, (Xstart, Ystart) is the left-top pixel.

void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Nummber, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)

Parameter:

  • Xstart: X coordinate of left-top pixel;
  • Ystart: Y coordicate of left-to pixel;
  • Nummber: the numbers displayed. the numbers are saved in int format, the maximum is 2147483647;
  • Font: 5 fonts are available:
    font8:5*8
    font12:7*12
    font16:11*16
    font20:14*20
    font24:17*24
  • Color_Foreground: color of font;
  • Color_Background: color of background;
Draw image

Send image data of BMP file to buffer

void Paint_DrawBitMap(const unsigned char* image_buffer)

Parameters:

  • image_buffer: adrress of image data in buffer
Read local bmp picture and write it to buffer

Linux platform like Jetson Nano and Raspberry Pi support to directly operate bmp pictures Raspberry Pi & Jetson Nano:RaspberryPi&JetsonNano\c\lib\GUI\GUI_BMPfile.c(.h)

UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)

Parameters:

  • path:The path of BMP pictures
  • Xstart: X coordination of left-top of picture, default 0;
  • Ystart: Y coordination of left-top of picture, default 0;

Testing Code

Test code.png

The first three chapters introduce the classic linux three-layer code structure, here is a little explanation of the user test code
For Raspberry Pi and Jetson Nano, in the directory: RaspberryPi_JetsonNano\c\examples, for all test codes, multiple shields can be made in main.c in this directory;
If you need to run the 7.5inch e-paper test program, you need to remove the 42 line shield

// EPD_7in5_test();

change to

EPD_7in5_test();

Re-execute in linux command mode as follows:

make clean
make
sudo ./epd

Python

For Jetson Nano\Raspberry Pi, based on python2.7 and python3
python is easy to use than c codes
Raspberry Pi and Jetson Nano:RaspberryPi&JetsonNano\python\lib\
Epd.png

Bottom Interface

The epdconfig.py file in the underlying interface

  • Initialize module and exit handle:
def module_init()
def module_exit()

Note:
1. The functions are used to set GPIP before and after driving e-Paper
2. If the board you have is printed with Rev2.1, the module enter low-ultra mode after Module_Exit(). (as we test, the current is about 0 in this mode);

  • GPIO Read/Write:
def  digital_write(pin, value)
def  digital_read(pin)
  • SPI Write data:
def spi_writebyte(data)

Driver Interface

epdxxx.py (xxx means size, if it is 2.13inch e-paper, it is epd2in13.py, and so on)

  • Initialize e-paper: this function should be used at the beginning. It can also be used to wake up e-Paper from Sleep mode.
#For 2.13inch e-Paper、2.9inch e-Paper
def init(self, update) #  Choose lut_full_update or lut_partial_update
#Other type
def init(self)
  • Clear e-paper: This function is used to clear e-Paper to white;
def Clear(self)
def Clear(self, color) # Some types of e-Paper should use this function to clear screen
  • Convert image to arrays
def getbuffer(self, image)
  • Transmit one frame of image data and display
#For two-color e-paper
def display(self, image)

#Because that controllers of 2.13inch e-paper are updated, when partial refresh, they should first use displayPartBaseImage() to display static background, then use displayPart() to dynamaticlly display.
def displayPartBaseImage(self, image)
def displayPart(self, image)
  • Enter sleep mode
def sleep(self)

Testing Function

epd_xxx_test.py (xxx means size, if it is 2.13inch e-paper, it is epd_2in13_test.py, and so on)
python is in the following directory:
Raspberry Pi and Jetson Nano: RaspberryPi_JetsonNano\python\examples\
Epd-test-function.png
If your python version is python2, and you need to run the 7.5inch e-paper test program, re-execute it in the linux command mode as follows:

sudo python epd_7in5_test.py

If your python version is python3, and you need to run the 7.5inch e-paper test program, re-execute it in the linux command mode as follows:

sudo python3 epd_7in5_test.py

Orientation

To rotate the display, you can use transpose function like blackimage = blackimage.transpose(Image.ROTATE_270):

blackimage = blackimage.transpose(Image.ROTATE_270) 
redimage = redimage.transpose(Image.ROTATE_270)
#Support ROTATE_90, ROTATE_180, ROTATE_270

Orientation.png

GUI

Python has a powerful PIL library, which can be used directly to draw figures. Here we use it for drawing.

  • Install the library firstly
sudo apt-get install python3-pil 

Import the library

from PIL import Image,ImageDraw,ImageFont

Image: library; ImageDraw: drawing function; ImageFont: fonts

  • Set image buffer for drawing.
image = Image.new('1', (epd.width, epd.height), 255)  # 255: clear the frame

The first parameter is the depth of color, 1 means 2 grayscale. The second parameter is a tuple of image size. The third parameter is the color of the image, 0 is black and 255 is white.

  • Create an image object.
draw = ImageDraw.Draw(image)
  • Draw rectangle
draw.rectangle((0, 10, 200, 34), fill = 0)

The first parameter is a tuple of coordination. 0, 10 is the top-left point of the rectangle, 200, 34) is the right-bottom point. fille = 0 set the fill color to black.

  • Draw line
draw.line((16, 60, 56, 60), fill = 0)

The first parameter is a type of coordination, 16, 60 is the beginning point, and 200, 34 is the endpoint. fill=0 set the line to black

  • Draw circle
draw.arc((90, 60, 150, 120), 0, 360, fill = 0)

This function is used to draw a encircle of a square. The first parameter is a tuple of coordination of the square. the degree of the circle is 0 to 360 °, fille=0 set the circle to black.
If the figure is not square according to the coordination, you will get an ellipse.

Besides the arc function, you can also use the chord function for drawing a solid circle.

draw.chord((90, 130, 150, 190), 0, 360, fill = 0)

The first parameter is the coordination of the enclosing rectangle. The second and third parameters are the beginning and end degrees of the circle. The fourth parameter is the fill color of the circle.

  • Character

You can directly import ImageFont model for drawing characters:

font = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24)

You can use the fonts of Windows or other fonts which is in ttc format.

To draw English characters, you can directly use the fonts; for Chinese characters, you need to add a symbol u:

draw.text((8, 12), 'hello world', font = font, fill = 255)
draw.text((8, 36), u'微雪电子', font = font, fill = 0)

The first parameter is a tuple of 2 elements, with (8, 12) as the left vertex, fill is the font color, and the first sentence fill=255, so it seems that it will not be displayed. The second sentence shows 微雪电子.

  • Read local picture
image = Image.open(os.path.join(picdir, 'lin54.bmp'))

The parameter is the path of picture.

  • Other functions.

For more information about the PIL library, you can search online.