Difference between revisions of "Template:Hardware/Software setting for SPI e-paper"

From Waveshare Wiki
Jump to: navigation, search
(Created page with "We provide examples for four popular platforms: Arduino UNO, Jetson Nano, Raspberry Pi, and STM32. You can refer to the corresponding part according to the platform you use(...")
 
 
Line 3: Line 3:
  
 
The example we provide for Arduino platform is based on Waveshare UNO PLUS (it is compatible with official Arduino UNO R3). If you use other Arduino board which is not compatible with UNO, you may need to change the wring.
 
The example we provide for Arduino platform is based on Waveshare UNO PLUS (it is compatible with official Arduino UNO R3). If you use other Arduino board which is not compatible with UNO, you may need to change the wring.
==Hardware connection==
+
;Hardware connection
 +
----
 
{|border=1; style="width:700px;" align="center"
 
{|border=1; style="width:700px;" align="center"
 
|+Connect to Arduino UNO
 
|+Connect to Arduino UNO
Line 26: Line 27:
 
|}
 
|}
  
==Running examples==
+
;Running examples
 +
----
 
Download demo codes from Resources, unzip it to get projects. Arduino example is located in the directory ~/Arduino UNO/… <br />
 
Download demo codes from Resources, unzip it to get projects. Arduino example is located in the directory ~/Arduino UNO/… <br />
 
Open project according to the type. For example, if the e-Paper you have is 1.54inch e-Paper Module, please open the epd1in54 folder and run project epd1in54.ino.<br />
 
Open project according to the type. For example, if the e-Paper you have is 1.54inch e-Paper Module, please open the epd1in54 folder and run project epd1in54.ino.<br />
Line 33: Line 35:
  
 
='''Raspberry Pi'''=
 
='''Raspberry Pi'''=
==Hardware connection==
+
;Hardware connection
 +
----
 
If the board you get is the HAT version like 2.13inch e-Paper HAT, you can directly attach it on the 40PIN GPIO of Raspberry Pi. Or you can wire ti to Raspberry Pi with 8PIN cable.
 
If the board you get is the HAT version like 2.13inch e-Paper HAT, you can directly attach it on the 40PIN GPIO of Raspberry Pi. Or you can wire ti to Raspberry Pi with 8PIN cable.
 
{|border=1; style="width:700px;" align="center"
 
{|border=1; style="width:700px;" align="center"
Line 63: Line 66:
 
{{RPI_open_spi}}
 
{{RPI_open_spi}}
  
==Libraries Installation==
+
;Libraries Installation
 +
----
 
*Install BCM2835 libraries
 
*Install BCM2835 libraries
 
<pre>
 
<pre>
Line 106: Line 110:
 
</pre>
 
</pre>
  
==Download examples==
+
;Download examples
 +
----
 
Open terminal and execute command to download demo codes<br />
 
Open terminal and execute command to download demo codes<br />
 
<pre>
 
<pre>
Line 113: Line 118:
 
</pre>
 
</pre>
  
==Running examples==
+
;Running examples
 +
----
 
*C codes
 
*C codes
 
Find the main.c file, uncomment the definition of e-Paper types, then compile and run the codes.
 
Find the main.c file, uncomment the definition of e-Paper types, then compile and run the codes.
Line 135: Line 141:
 
='''Jetson nano Developer Kit'''=
 
='''Jetson nano Developer Kit'''=
 
The example for Jetson Nano use software SPI, speed of sfotware SPI is a little slow<br />
 
The example for Jetson Nano use software SPI, speed of sfotware SPI is a little slow<br />
==Hardware connection==
+
;Hardware connection
 +
----
 
Jetson Nano's 40PIN GPIO is compatible with Raspberry PI, and API of Jetson.GPIo is same as RPi.GPIO, therefore, the pin numbers of Jetson nano are same as Raspberry Pi's
 
Jetson Nano's 40PIN GPIO is compatible with Raspberry PI, and API of Jetson.GPIo is same as RPi.GPIO, therefore, the pin numbers of Jetson nano are same as Raspberry Pi's
 
{|border=1; style="width:700px;" align="center"
 
{|border=1; style="width:700px;" align="center"
Line 163: Line 170:
 
|}
 
|}
  
==Software setting==
+
;Software setting
 +
----
 
*Open terminal, and install GPIO libraries :
 
*Open terminal, and install GPIO libraries :
 
<pre>
 
<pre>
Line 182: Line 190:
 
sudo apt-get install python3-numpy
 
sudo apt-get install python3-numpy
 
</pre>
 
</pre>
===Download examples===
+
;Download examples
 +
----
 
Open terminal and execute commands:<br />
 
Open terminal and execute commands:<br />
 
<pre>
 
<pre>
Line 189: Line 198:
 
</pre>
 
</pre>
  
===Running examples===
+
;Running examples
 +
----
 
*C codes
 
*C codes
 
Find main.c file, Open it and uncommend the e-Paper which you use, compile and run it<br />
 
Find main.c file, Open it and uncommend the e-Paper which you use, compile and run it<br />
Line 210: Line 220:
  
 
='''STM32'''=
 
='''STM32'''=
==Hardware connection==
+
;Hardware connection
 +
----
 
The examples we provide are based on Wavshare [https://www.waveshare.com/open103z-standard.htm Open103Z], the connecting method provide is based on STM32F13ZET6 as well. For other board, please port it by yourself.
 
The examples we provide are based on Wavshare [https://www.waveshare.com/open103z-standard.htm Open103Z], the connecting method provide is based on STM32F13ZET6 as well. For other board, please port it by yourself.
 
{|border=1; style="width:700px;" align="center"
 
{|border=1; style="width:700px;" align="center"
Line 233: Line 244:
 
|BUSY||PA3
 
|BUSY||PA3
 
|}
 
|}
==Running examples==
+
;Running examples
 +
----
 
Enter the directly of STM32 examples, open project by Keil5 software. Set Board and programmer, then compile and download it to board
 
Enter the directly of STM32 examples, open project by Keil5 software. Set Board and programmer, then compile and download it to board

Latest revision as of 07:16, 6 September 2019

We provide examples for four popular platforms: Arduino UNO, Jetson Nano, Raspberry Pi, and STM32. You can refer to the corresponding part according to the platform you use(This is a common template will be used by all types of the e-Paper, please refer to the corresponding type you have)

Arduino UNO

The example we provide for Arduino platform is based on Waveshare UNO PLUS (it is compatible with official Arduino UNO R3). If you use other Arduino board which is not compatible with UNO, you may need to change the wring.

Hardware connection

Connect to Arduino UNO
e-Paper Arduino
Vcc 5V
GND GND
DIN D11
CLK D13
CS D10
DC D9
RST D8
BUSY D7
Running examples

Download demo codes from Resources, unzip it to get projects. Arduino example is located in the directory ~/Arduino UNO/…
Open project according to the type. For example, if the e-Paper you have is 1.54inch e-Paper Module, please open the epd1in54 folder and run project epd1in54.ino.
Open project, choose the correct Board and Port, then compile and upload it to board.
Note: Because of the small RAM of Arduino, it cannot support drawing function, therefore, we only provide image display function. The image data are stored in flash. Or you can think about using Waveshare e-Paper Shield for Arduino board

Raspberry Pi

Hardware connection

If the board you get is the HAT version like 2.13inch e-Paper HAT, you can directly attach it on the 40PIN GPIO of Raspberry Pi. Or you can wire ti to Raspberry Pi with 8PIN cable.

Connect to Raspberry Pi
e-Paper Raspberry Pi
BCM2835 Board
VCC 3.3V 3.3V
GND GND GND
DIN MOSI 19
CLK SCLK 23
CS CE0 24
DC 25 22
RST 17 11
BUSY 24 18

Enable SPI interface

  • Open terminal, use command to enter the configuration page
sudo raspi-config
Choose Interfacing Options -> SPI -> Yes  to enable SPI interface

RPI open spi.png
Reboot Raspberry Pi:

sudo reboot

Please makre sure that SPI interface was not used by other device

Libraries Installation

  • Install BCM2835 libraries
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
#For more details, please refer to http://www.airspayce.com/mikem/bcm2835/
  • Install wiringPi libraries
sudo apt-get install wiringpi

#For Pi 4, you need to update it:
cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v
#You will get 2.52 information if you install it correctly
  • Install Python libraries
#python2
sudo apt-get update
sudo apt-get install python-pip
sudo apt-get install python-pil
sudo apt-get install python-numpy
sudo pip install RPi.GPIO
sudo pip install spidev
#python3
sudo apt-get update
sudo apt-get install python3-pip
sudo apt-get install python3-pil
sudo apt-get install python3-numpy
sudo pip3 install RPi.GPIO
sudo pip3 install spidev
Download examples

Open terminal and execute command to download demo codes

sudo git clone https://github.com/waveshare/e-Paper
cd e-Paper/RaspberryPi\&JetsonNano/
Running examples

  • C codes

Find the main.c file, uncomment the definition of e-Paper types, then compile and run the codes.

cd c
make clean
make
sudo ./epd
  • python

Run examples, xxx is the name of the e-Paper. For example, if you want to run codes of 1.54inch e-Paper Module, you xxx should be epd_1in54

cd python/examples
# python2
sudo python xxx.py
# python3
sudo python3 xxx.py

Jetson nano Developer Kit

The example for Jetson Nano use software SPI, speed of sfotware SPI is a little slow

Hardware connection

Jetson Nano's 40PIN GPIO is compatible with Raspberry PI, and API of Jetson.GPIo is same as RPi.GPIO, therefore, the pin numbers of Jetson nano are same as Raspberry Pi's

Connect to Jetson Nano
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

  • Open terminal, and install GPIO 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

Note: your_user_name is the user name of your Jetson, for example:waveshare

  • Install I2C libraries
sudo apt-get install python-smbus
  • Install PIL libraries
sudo apt-get install python3-pil
sudo apt-get install python3-numpy
Download examples

Open terminal and execute commands:

sudo git clone https://github.com/waveshare/e-Paper
cd e-Paper/RaspberryPi\&JetsonNano/
Running examples

  • C codes

Find main.c file, Open it and uncommend the e-Paper which you use, compile and run it

cd c
make clear
make
sudo ./epd
  • python

Run examples, xxx is the name of e-Paper. For example, if you want to run examples of 1.54inch e-Paper Module, xxx should be epd_1in54

cd python/examples
# python2
sudo python xxx.py
# python3
sudo python3 xxx.py

STM32

Hardware connection

The examples we provide are based on Wavshare Open103Z, the connecting method provide is based on STM32F13ZET6 as well. For other board, please port it by yourself.

Connect to STM32F103ZET6
e-Paper STM32F103ZET6
Vcc 3.3V
GND GND
DIN PA7
CLK PA5
CS PA3
DC PA2
RST PA1
BUSY PA3
Running examples

Enter the directly of STM32 examples, open project by Keil5 software. Set Board and programmer, then compile and download it to board