296x128, 2.9inch E-Ink raw display panel V2を試してみました

経緯

アリエクでe-Paperを買ったみました

背面を見てみるとRev.2.1でしたので、関連情報を見つけて、試してみました

<関連譲歩> www.waveshare.com その一部を抜粋します。

Overview

Versions

V2: V2 hardware and interfaces are compatible with V1, adoptsV2 demo. If you are the first time to purchase it and there is a V2 label behind the screen, you can directly use the V2 demo.V1: use V1 demo.

Parameters

Dimensions 2.9inch
Driver board dimensions 89.5mm × 38mm
Display dimensions 66.89mm × 29.05mm
Outline dimensions (screen only) 79.0mm × 36.7mm × 1.05mm
Operating voltage 3.3V/5V (5V is required for power supply and signal)
Communication interface SPI
Dot pitch 0.227 × 0.226
Resolution 296 × 128
Display color Black, White
Grey scale 4
Refresh time 3s
Refresh power 26.4mW(typ.)
Standby current < 0.01uA (almost 0)
Operating Temperature 0 ~ 50 ℃
Storage Temperature -25 ~ 60 ℃ESP32/8266

Resources

Documentation

Demo code

試してみました

  1. Demo (zip file)よりダウンロードし、解凍する

  2. E-Paper_code→Arduino→epd2in9_V2を開き、epd2in9_V2.inoをダブルクリック

  3. ボードとポートを選択

  4. e-PaperとRP2040を接続

    1.

    1. e-Paper 配線色 ESP32 ESP32-S3 RP-2040
      VCC 3.3V 3.3V 3.3V
      GND GND GND GND
      DIN MOSI(Master Out Slave In) IO14 IO11 10 マスターからスレーブへ
      CLK SCK(Serial Clock) IO13 IO12 8 データ転送同期用のクロック信号
      CS チップセレクト SS(Slave Select) IO15 IO10 D4 スレーブデバイスの選択
      DC data:high command:low IO27 IO13 D3
      RST IO26 IO14 D2
      BUSY IO25 IO4 D5
      PWR IO33 IO5 D6 今回のパネルでは使用しない
  5. ソースコード変更

  endif.h

/**
 *  @filename   :   epdif.h
 *  @brief      :   Header file of epdif.cpp providing EPD interface functions
 *                  Users have to implement all the functions in epdif.cpp
 *  @author     :   Yehui from Waveshare
 *
 *  Copyright (C) Waveshare     August 10 2017
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documnetation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to  whom the Software is
 * furished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#ifndef EPDIF_H
#define EPDIF_H

#include <Arduino.h>

// Pin definition
// #define RST_PIN         8
// #define DC_PIN          9
// #define CS_PIN          10
// #define BUSY_PIN        7
// #define PWR_PIN         6

//Seeed XIAO RP2040
#define RST_PIN         D2
#define DC_PIN          D3
#define CS_PIN          D4
#define BUSY_PIN        D5
#define PWR_PIN         D6

class EpdIf {
public:
    EpdIf(void);
    ~EpdIf(void);

    static int  IfInit(void);
    static void DigitalWrite(int pin, int value); 
    static int  DigitalRead(int pin);
    static void DelayMs(unsigned int delaytime);
    static void SpiTransfer(unsigned char data);
};

#endif

epd2in9_V2.ino

  /**
 *  @filename   :   epd2in9_V2-demo.ino
 *  @brief      :   2.9inch e-paper V2 display demo
 *  @author     :   Yehui from Waveshare
 *
 *  Copyright (C) Waveshare     Nov 09 2020
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documnetation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to  whom the Software is
 * furished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#include <SPI.h>
#include "epd2in9_V2.h"
#include "epdpaint.h"
#include "imagedata.h"

#define COLORED     0
#define UNCOLORED   1

/**
  * Due to RAM not enough in Arduino UNO, a frame buffer is not allowed.
  * In this case, a smaller image buffer is allocated and you have to 
  * update a partial display several times.
  * 1 byte = 8 pixels, therefore you have to set 8*N pixels at a time.
  */
unsigned char image[1024];
Paint paint(image, 0, 0);    // width should be the multiple of 8 
Epd epd;
unsigned long time_start_ms;
unsigned long time_now_s;
char time_string[] = {'0', '0', ':', '0', '0', '\0'};

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  int cnt = 8000;     // Serialが接続されるまで、最大約1秒待ちます。
  while (!Serial && cnt--) {
    delay(1);
  }
  Serial.printf("Serial cnt:%d\n\r", 8000 - cnt);

  if (epd.Init() != 0) {
      Serial.print("e-Paper init failed");
      return;
  }

  epd.ClearFrameMemory(0xFF);   // bit set = white, bit reset = black
  paint.SetRotate(ROTATE_90);
  paint.SetWidth(128);
  paint.SetHeight(296);

  /* For simplicity, the arguments are explicit numerical coordinates */
  paint.Clear(UNCOLORED);
  paint.DrawStringAt(0, 40, "YShigu`s Diary!", &Font20, COLORED);
  epd.SetFrameMemory(paint.GetImage(), 0, 10, paint.GetWidth(), paint.GetHeight());
  epd.DisplayFrame();

  delay(5000);



  /* Deep sleep */
  Serial.print("sleep...");
  epd.Sleep();
}

void loop() {

}

プライバシーポリシー |ページトップへ

`