Waveshare 2.13inch e-paper + ESP32

提供: robot-jp wiki
ナビゲーションに移動検索に移動

注:以下の構成で全く動作していません。チャレンジ中です。

Link

TopPage

https://www.waveshare.com/wiki/2.13inch_e-Paper_HAT

Overview

https://www.waveshare.com/wiki/2.13inch_e-Paper_HAT_Manual#Overview

for ESP32

https://forum.arduino.cc/t/waveshare-2-13-inch-e-paper-display-hat-b-v3-and-esp-wroom-32d/1156021

Pin Function

MODULEのコネクタから出ているケーブル

e-Paper SPEC ESP32 Arduino UNO Mega2560
VCC SPI通信電圧 3.7~6V 3.3V pin1 5V 5V
GND GND GND pin14 GND GND
DIN EPD_MOSI_PIN MOSI SPI MOSI/D23 pin37 D11 D51
CLK EPD_SCK_PIN SCK SPI SCK/D18 pin30 D13 D52
/CS EPD_CS_PIN DOUT SPI CS (Low Active)/D14 pin12 D10 D10
DC EPD_DC_PIN DOUT H:Data,L:command/D27 pin11 D9 D9
/RST EPD_RST_PIN DOUT External Reset(Low Active)/D33 pin8 D8 D8
BUSY EPD_BUSY_PIN DIN Status H:Busy/D32 pin7 D7 D7


ESP32-DEV BOARD

e-paper Func pin ESP32-DevKitC-32D.jpg pin Func SPI e-paper
3V3 1 38 GND GND
EN 2 37 D23 MOSI DIN
D36 3 36 D22
D39 4 35 D01
D34 5 34 D03
D35 6 33 D21
BUSY D32 7 32 GND
RST D33 8 31 D19 MISO
D25 9 30 D18 SCK CLK
D26 10 29 D05
DC D27 11 28 D17
CS D14 12 27 D16
D12 13 26 D04
GND 14 25 D0
D13 15 24 D2
D9 16 23 D15
D10 17 22 D8
D11 18 21 D7
VCC 5V0 19 20 D6

ソースコードの変更箇所

 1//install lib:GxEPD by Jean-Marc Zingg
 2
 3#include <SPI.h>
 4#include "GxEPD2_BW.h"
 5#include "GxEPD2_3C.h"
 6#include "Fonts/FreeMonoBold9pt7b.h"
 7
 8// ピン設定
 9#define EPD_CS  14
10#define EPD_DC  27
11#define EPD_RST  33
12#define EPD_BUSY 32
13#define SPI_SCK 18
14#define SPI_MOSI 23
15
16// ディスプレイオブジェクトを作成
17GxEPD2_BW<GxEPD2_213_B72, GxEPD2_213_B72::HEIGHT> display(GxEPD2_213_B72(/*CS=D8*/ EPD_CS, /*DC=D3*/ EPD_DC, /*RST=D4*/ EPD_RST, /*BUSY=D2*/ EPD_BUSY));
18
19void helloWorld() {
20  display.setRotation(1);
21  display.setFont(&FreeMonoBold9pt7b);
22  display.setTextSize(1);
23  display.setFullWindow();
24  display.firstPage();
25  do
26  {
27    display.fillScreen(GxEPD_WHITE);
28    display.setCursor(10, 40);
29    display.print("Hello World!");
30  }
31  while (display.nextPage());
32}
33
34void setup() {
35  Serial.begin(115200);
36  Serial.println();
37  Serial.println("setup");
38
39  SPI.begin(SPI_SCK, -1, SPI_MOSI, EPD_CS);
40  display.init(115200); // 115200bpsで初期化
41
42  // 最初の表示
43  helloWorld();
44}
45
46void loop() {
47  // 必要に応じてここで画面更新処理を追加
48  delay(5000); 
49}