・2017/11/20
Raspberry Pi 3で SPI接続の 2.7インチ 3色 電子ペーパー液晶を使用する方法 Waveshare製
(ラズパイ3に 264x176 2.7inch E-Ink display HAT three colorを SPI接続して制御する方法。)
Tags: [Raspberry Pi], [電子工作]
● Raspberry Pi 3 Model Bを遂に購入
Raspberry Pi3 Model B RPI2 RPI3
大人気の CPUボードの Raspberry Piに WiFiと Bluetoothが搭載されたモデルが新発売となりました。
以前から Raspberry Pi 2を買おうかどうか迷っていましたが、Raspberry Pi 3 Model Bの発売を機に購入を決意してラズベリアンになる事にしました。
※ ラズパイの OS Raspbianはバージョンが上がる毎に過去の版と OSの内部の作りが変わり、過去に書かれた製作記事(例えば Raspbian Wheezyの時代の記事)がそのままではエラーが出たりして動かない事が有ります。
※ 当方のホームページのラズパイ記事は全て Raspberry Pi 3 Model Bと Raspbian Jessieの組み合わせで動作確認をしております。
(ただし、将来的に新しい Raspbian OSが出た場合に、当方の Raspbian Jessieを基にした内容がそのままでは動かない可能性が有ります。)
※ 2017/08/16から Raspbian OSは Raspbian Jessieから Raspbian Stretchに変わりました。
※ 2019/06/20から Raspbian OSは Raspbian Stretchから Raspbian Busterに変わりました。
Download Raspbian for Raspberry Pi
ちなみに、歴代のバージョンと名称は
Debian | コードネーム | 年月 | 備考 | (参考)Ubuntuでの該当名称 |
Debian 11 | Bullseye | 2021/08/14~ | 2021/11からラズパイにリリース | Focal Fossa 20.04 LTS ? |
Debian 10 | Buster | 2019/06/20~ | 2019/06からラズパイ4対応 | Bionic 18.04 LTS |
Debian 9 | Stretch | 2017/08/16~ | 2018/03からラズパイ3B+対応 | Xenial 16.04 LTS |
Debian 8 | Jessie | 2015~ | 2016/02からラズパイ3対応 | Trusty 14.04 LTS |
Debian 7 | Wheezy | 2013~2016 | | |
Debian 6.0 | Squeeze | 2011~2014 | | |
Debian GNU/Linux 5.0 | Lenny | 2009~2012 | | |
● Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)
2.7inch e-Paper HAT (B)
264x176, 2.7inch E-Ink display HAT for Raspberry Pi, three-color

Waveshare 1.54インチ電子ペーパーRaw表示パネル200 x 200解像度3.3 V電子インク電子ペーパー画面with埋め込みコントローラSpiインタフェースサポート部分的なリフレッシュ 2.7inch e-Paper HAT (B)
ASIN: B074P32F9B
※ eBay.comでは US$ 25程度で買えます。
● Interfaces
VCC | 3.3V |
GND | GND |
DIN | SPI MOSI |
CLK | SPI SCK |
CS | SPI chip select (Low active) |
DC | Data/Command control pin (High for data / Low for command) |
RST | External reset pin (Low for reset) |
BUSY | Busy state output pin (Low for busy) |
● Hardware connection
Here is the connection between Raspberry Pi 3B and E-paper.
e-Paper, Raspberry Pi 3B
3.3V | 17 | 3.3V |
GND | 20 | GND |
DIN | 19 | MOSI GPIO 10 |
CLK | 23 | SCLK GPIO 11 |
CS | 24 | CE0 GPIO 8 |
DC | 22 | GPIO 25 (BCM) |
RST | 11 | GPIO 17 (BCM) |
BUSY | 18 | GPIO 24 (BCM) |
Expected result
1) After the corresponding libraries installed, you can copy the relative programs into your Raspberry Pi, and then enter the corresponding file.
BCM2835: Execute the command: make, to compile the code and generate a file epd. Execute the command: sudo ./epd, the program will run.
WringPi: Execute the command: make, to compile the code and generate a file epd. Execute the command: sudo ./epd, the program will run.
Python: Execute the command: sudo python main.py
2) Image will be displayed on the screen.
Note:The refresh rate of this module is slow, and it will flicker for several times during refreshing (about 15s). Please be patient.
● 7z形式のアーカイブの解凍方法
sudo apt-get -y install p7zip
7zr x {7zのファイル名.7z}
●サンプルアプリ Waveshare 2.7inch e-Paper HAT (B)
File:2.7inch e-paper hat b code.7z
sudo apt-get -y install p7zip
cd
wget https://www.waveshare.com/w/upload/b/b7/2.7inch_e-paper_hat_b_code.7z
7zr x 2.7inch_e-paper_hat_b_code.7z
● BCM2835版
BCM2835ライブラリをビルドしてインストールする。
C library for Broadcom BCM 2835 as used in Raspberry Pi
cd
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.52.tar.gz
tar -zxf bcm2835-1.52.tar.gz
cd bcm2835-1.52
./configure
sudo make install
cd
cd ./raspberrypi/bcm2835
make
ls -l epd
# -rwxr-xr-x 1 pi pi 99348 Nov 22 13:13 epd
sudo ./epd
BCM2835ライブラリが無いと下記のリンカーエラーが出てビルドに失敗する。
cd
cd ./raspberrypi/bcm2835
make
g++ -Wall -c main.cpp -lbcm2835
g++ -Wall -c epd2in7b.cpp -lbcm2835
g++ -Wall -c epdpaint.cpp -lbcm2835
g++ -Wall -o epd main.o epd2in7b.o imagedata.o epdif.o font8.o font12.o font16.o font20.o font24.o epdpaint.o -lbcm2835
/usr/bin/ld: cannot find -lbcm2835
collect2: error: ld returned 1 exit status
Makefile:4: recipe for target 'epd' failed
make: *** [epd] Error 1
● WringPi版
sudo raspi-configで SPI I/Fを有効にしておく
ls -l /dev/spi*
# ls: cannot access '/dev/spi*': No such file or directory
sudo raspi-config
# 1) 5 Interfacing Options Configure connections to peripher
# 2) P4 SPI Enable/Disable automatic loading
# 3) Would you like the SPI interface to be enabled? <Yes>
# 4) The SPI interface is enabled <Ok>
ls -l /dev/spi*
# crw-rw---- 1 root spi 153, 0 Nov 22 13:18 /dev/spidev0.0
# crw-rw---- 1 root spi 153, 1 Nov 22 13:18 /dev/spidev0.1
cd
cd ./raspberrypi/wiringpi
make
ls -l epd
# -rwxr-xr-x 1 pi pi 48532 Nov 22 13:17 epd
sudo ./epd
SPI I/Fが有効になっていないと下記のエラーが出ます。
pi@raspberrypi:~/raspberrypi/wiringpi $ ./epd
Unable to open SPI device: No such file or directory
pi@raspberrypi:~/raspberrypi/wiringpi $ sudo ./epd
Unable to open SPI device: No such file or directory
● Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)
・Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)

・Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)

・Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)

・Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)

・Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)

・Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)

・Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)

・Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)

・Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)

・Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)

・Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)

・Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)

・Raspberry Pi 3で Waveshare 2.7inch e-Paper HAT (B)

Tags: [Raspberry Pi], [電子工作]
●関連するコンテンツ(この記事を読んだ人は、次の記事も読んでいます)
FWinSdCardImager SDカード イメージ書き込みアプリ、ラズパイの Raspbian OS、Jetson Nanoの Ubuntuの書き込みに便利
ラズパイや Jetson Nano等のワンボードマイコン等への OSイメージの書き込みが簡単にできる
FWinPiFinder ラズベリーパイ IPアドレス発見アプリ。ARPコマンドでラズパイの IPアドレスを探索発見する
Raspberry Piや NVIDIA Jetson Nano等の IPアドレスを MACアドレスの OUI部分を使用して発見する
Raspberry Pi 3系のトラブルであるある第一位の電源トラブル、低電圧警報に関する情報のまとめ
ラズパイ3B系での低電圧警報に関する情報まとめ、コマンドラインやログファイルから低電圧を検知する方法
Raspberry Piで CPUの脆弱性 Spectreと Meltdownの脆弱性をチェックする方法
ラズパイで 2018年初頭に大騒ぎになったスペクターとメルトダウンの CPUの脆弱性をチェックする方法
Raspberry Pi Zero Wを海外通販の Pimoroni等での購入方法、購入できる通販ショップ一覧まとめ
ラズパイゼロW ワイヤレスモデルを海外通販でサクッと簡単に個人輸入で入手。技適通過でも国内販売は常に品切れ
Raspberry Pi 3で安定して使える相性の無い最適な microSDカードの種類のまとめ
ラズパイ3で安定して使える microSDカードを購入する Teamと SanDiskは絶対に買わない
Raspberry Pi 3 Model Bに専用カメラモジュール RaspiCamを接続する方法
ラズパイに専用カメラモジュールを接続して Raspbianで写真の静止画撮影や動画を録画する方法
Raspberry Pi 3の Linuxコンソール上で使用する各種コマンドまとめ
ラズパイの Raspbian OSのコマンドラインで使用する便利コマンド、負荷試験や CPUシリアル番号の確認方法等も
Raspberry Pi 3公式フォーラムの FAQの内容の日本語訳
ラズパイ公式フォーラムの「The Raspberry Pi 3 Model B Q&A thread」の日本語訳
Raspberry Pi 3で GPIO端子の I2C機能を有効化する方法
ラズパイ3の GPIO端子の I2C機能を有効にして各種センサーを繋げる方法まとめ
大人気の CPUボード、Raspberry Pi 3 Model Bで作ってみよう
Raspberry Piの開発環境の構築やタッチパネル付き液晶ディスプレイや各種センサーの使い方まとめ
Raspberry Pi関連はこちらへまとめました
下記以外にも多数のラズパイ関係の記事が有ります。
(I2C制御、GPIO制御、1-Wire制御、シリアル通信、日本語音声合成、日本語音声認識、中国語音声合成、MeCab 形態素解析エンジン、赤外線リモコン制御、秋月 I2C液晶モジュール、KeDei 3.5インチ液晶、HDMI 5インチ液晶、NFCカードリーダ、コマンドライン操作方法等)
Espressif ESP8266 Arduino互換でスケッチが使える ESP-12Eモジュール基板
Espressif ESP8266 ESP-12-E NodeMCU V1 ESP12 CP2102
BangGood通販はドローン以外にも面白い商品がまだまだ有った(電子工作編)
レーザー彫刻機、カラー液晶の DIYオシロ、Arduinoや Raspberry Pi用の小型カラー液晶
[HOME]
|
[BACK]
リンクフリー(連絡不要、ただしトップページ以外は Web構成の変更で移動する場合があります)
Copyright (c)
2017 FREE WING,Y.Sakamoto
Powered by 猫屋敷工房 & HTML Generator
http://www.neko.ne.jp/~freewing/raspberry_pi/raspberry_pi_3_e_paper_lcd_2_7inch_spi_hat_with_button/