ESP32墨水屏

概 述

这是一款集成了ESP32开发板的2.13寸墨水屏,内置WiFi与蓝牙功能可实现与阿里云连接远程控制显示,支持IO端口控制其他设备,节省开发成本。这款墨水屏可以黑白形式显示图片(图案和中文)与英文字符,显示清晰,断电后可保持显示最后一屏内容,具有功耗低,视角宽等特点。

墨水屏的分辨率为250*122很适合静态图形文字显示,可用于超市价格标签、胸牌、留言板等,连接WiFi后可做成从网络获取时间的日历台、电子时钟、天气预报显示等。

产品参数

引脚/接口说明

引脚介绍 接口介绍

使用教程

准备

安装开发板的板卡驱动包

1、打开Arduino IDE,首先需要添加开发板驱动的下载地址。菜单栏中选择File->Preferences(或使用快捷键“ctrl+ ,”)。

板卡下载1

2、点击Additional Boards Manager URLs右边的小图标。

板卡下载2

3、如图将开发板驱动的URL地址复制到弹出窗口的最后一行:https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

板卡下载3

4、分别在Additional Boards Manager URLsPreferences窗口点击OK确认。

5、菜单栏中选择Tools->Board->Boards Manager...

板卡下载4

6、弹出Boards Manager开发板管理器,管理器会自动更新板卡信息。

板卡下载5

7、等待更新完成后,搜索栏输入ESP32,选择esp32,选择最新版本的开发板驱动,单击Install安装驱动。如果搜索不到或者下载失败请打开网络加速器再次尝试下载。

板卡下载6

8、成功安装完成后会显示INSTALLED已安装,关闭该窗口即可。

板卡下载7

9、菜单栏中选择Tools->Board->ESP32 Dev Module,此时可向开发板烧录程序或查看串口打印的数据。

板卡下载8

例程1:显示图片与字符

// include library, include base class, make path known
#include <GxEPD.h>
#include "SD.h"
#include "SPI.h"

//  由于屏幕有多个版本,如下载程序后出现花屏请将下面4个头文件都测试一遍!
#include <GxDEPG0213BN/GxDEPG0213BN.h>
//#include <GxGDE0213B1/GxGDE0213B1.h>      // 2.13" b/w
//#include <GxGDEH0213B72/GxGDEH0213B72.h>  // 2.13" b/w new panel
//#include <GxGDEH0213B73/GxGDEH0213B73.h>  // 2.13" b/w newer panel

int bmpWidth = 232, bmpHeight = 52;
//width:150,height:39
const unsigned char DFRobot[] = {0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xE0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x3F,0xFF,0xF8,0x00,0x3C,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xFC,0x00,0x7F,0xFF,0xFE,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFE,0x01,0xFF,0xFF,0xFF,0x00,0x7F,0x00,0x00,0x7F,0xFE,0x00,0x1F,0xFF,0xFE,0x7F,
0xFF,0x80,0x3F,0xFF,0x03,0xFF,0x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E,0x00,0x07,0x80,0x3C,0x00,
0x00,0x6C,0x00,0x00,0x00,0x6E,0x00,0x00,0x00,0x7F,0xFF,0xFE,0x1F,0xC0,0x00,0x78,
0x03,0xE3,0xFF,0xFF,0xF3,0xFF,0xFF,0x9F,0xFF,0xFF,0x00,0x3C,0x00,0x00,0x6C,0x00,
0x00,0x00,0x6E,0x00,0x00,0x00,0x7F,0xFF,0xFC,0x1F,0xC0,0x00,0x78,0x01,0xF9,0xFF,
0xFF,0xF3,0xFF,0xFF,0x9F,0xFF,0xFF,0x00,0x3C,0x00,0x00,0x6C,0x00,0x00,0x00,0x6E,
0x00,0x00,0x00,0x7F,0xFF,0xF0,0x1F,0xC0,0x00,0x78,0x00,0xFD,0xFF,0xFF,0xE3,0xFF,
0xFF,0x0F,0xFF,0xFF,0x00,0x3C,0x00,0x00,0x6E,0x00,0x00,0x00,0xEE,0x00,0x00,0x00,
0x7F,0xFE,0x00,0x1F,0xC0,0x00,0x78,0x00,0x7C,0x3F,0xFF,0x03,0xFF,0xF8,0x03,0xFF,
0xF8,0x00,0x38,0x00,0x00,0x67,0xC0,0x00,0x07,0xCE,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x70,0xF8,0x00,0x3E,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,
0x1F,0x01,0xF0,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC3,0xFF,0x87,
0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xF8,0x3C,0x3F,0xFE,0x00,0x00,
0x00,0x7E,0x7E,0xD0,0xBF,0x0F,0xD8,0x9F,0x83,0xEC,0x5F,0xB1,0x7F,0x7E,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0x81,0xFF,0xFC,0x00,0x00,0x00,0x7F,0x7E,
0xD9,0xBF,0x0F,0xD8,0x9F,0x83,0xEC,0x5F,0xB1,0x7F,0x7E,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x63,0x62,0xD9,0xA0,0x03,
0x1F,0x90,0x02,0x0C,0x46,0x31,0x63,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x1F,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x63,0x7E,0xCF,0x3E,0x03,0x1F,0x9F,0x03,
0xCC,0x46,0x31,0x7F,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,
0xFF,0xC0,0x00,0x00,0x00,0x63,0x6C,0xCF,0x30,0x03,0x18,0x98,0x03,0xCC,0x46,0x21,
0x6E,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0xFF,0x80,0x00,
0x00,0x00,0x7F,0x66,0xC6,0x3F,0x03,0x18,0x9F,0x83,0x0F,0xC6,0x3F,0x63,0x7E,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x7C,
0x62,0xC6,0x3F,0x03,0x18,0x9F,0x82,0x07,0xC6,0x1F,0x61,0x7E,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x0F,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00};
// FreeFonts from Adafruit_GFX
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h>
#include <Fonts/FreeMonoBold24pt7b.h>


#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>

#define SPI_MOSI 23
#define SPI_MISO -1
#define SPI_CLK 18

#define ELINK_SS 5
#define ELINK_BUSY 4
#define ELINK_RESET 16
#define ELINK_DC 17

#define SDCARD_SS 13
#define SDCARD_CLK 14
#define SDCARD_MOSI 15
#define SDCARD_MISO 2

#define BUTTON_PIN 39


GxIO_Class io(SPI, /*CS=5*/ ELINK_SS, /*DC=*/ ELINK_DC, /*RST=*/ ELINK_RESET);
GxEPD_Class display(io, /*RST=*/ ELINK_RESET, /*BUSY=*/ ELINK_BUSY);

SPIClass sdSPI(VSPI);


const char *Website = "www.dfrobot.com";
bool sdOK = false;
int startX = 9, startY = 20;

void setup()
{
  Serial.begin(115200);
  Serial.println();
  Serial.println("setup");
  SPI.begin(SPI_CLK, SPI_MISO, SPI_MOSI, ELINK_SS);
  display.init(); // enable diagnostic output on Serial

  display.setRotation(1);
  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
  display.setFont(&FreeMonoBold12pt7b);
  display.setCursor(0, 0);

  sdSPI.begin(SDCARD_CLK, SDCARD_MISO, SDCARD_MOSI, SDCARD_SS);

  if (!SD.begin(SDCARD_SS, sdSPI)){
  sdOK = false;
  } else {
  sdOK = true;
  }

  display.fillScreen(GxEPD_WHITE);

  display.drawBitmap(DFRobot, startX, startY,  bmpWidth, bmpHeight, GxEPD_BLACK);

  display.setCursor(20,95);

  display.println(Website);

  display.setTextColor(GxEPD_BLACK);

  display.update();

  // goto sleep
  esp_sleep_enable_ext0_wakeup((gpio_num_t)BUTTON_PIN, LOW);

  esp_deep_sleep_start();
}

void loop()
{
}

结果

例程1结果

例程2:获取NTP时间并显示在墨水屏上

本样例是从NTP服务器上获取当前时间然后显示在屏幕上

注意:在上传代码之前请修改ssid与password

#include <GxEPD.h>
#include "SD.h"
#include "SPI.h"


#include <WiFi.h>
#include "time.h"

const char* ssid       = "*****";//wlan information
const char* password   = "*****";

const char* ntpServer = "ntp.ntsc.ac.cn";//local ntp server
const uint32_t  gmtOffset_sec = 8*3600;  //GMT+08:00
const uint16_t   daylightOffset_sec = 0;


//  由于屏幕有多个版本,如下载程序后出现花屏请将下面4个头文件都测试一遍!
#include <GxDEPG0213BN/GxDEPG0213BN.h>
//#include <GxGDE0213B1/GxGDE0213B1.h>      // 2.13" b/w
//#include <GxGDEH0213B72/GxGDEH0213B72.h>  // 2.13" b/w new panel
//#include <GxGDEH0213B73/GxGDEH0213B73.h>  // 2.13" b/w newer panel

#include <Fonts/FreeMonoBold18pt7b.h>


#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>

#define SPI_MOSI 23
#define SPI_MISO -1
#define SPI_CLK 18

#define ELINK_SS 5
#define ELINK_BUSY 4
#define ELINK_RESET 16
#define ELINK_DC 17

#define SDCARD_SS 13
#define SDCARD_CLK 14
#define SDCARD_MOSI 15
#define SDCARD_MISO 2

#define BUTTON_PIN 39

typedef enum
{
    RIGHT_ALIGNMENT = 0,
    LEFT_ALIGNMENT,
    CENTER_ALIGNMENT,
} Text_alignment;



GxIO_Class io(SPI, /*CS=5*/ ELINK_SS, /*DC=*/ ELINK_DC, /*RST=*/ ELINK_RESET);
GxEPD_Class display(io, /*RST=*/ ELINK_RESET, /*BUSY=*/ ELINK_BUSY);

SPIClass sdSPI(VSPI);

const uint8_t Whiteboard[1700] = {0x00};

uint16_t Year = 0 , Month = 0 , Day = 0 , Hour = 0 , Minute = 0 , Second = 0;
char Date[]={"2000/01/01"};
char Time[]={"00:00:00"};
bool sdOK = false;

void displayText(const String &str, uint16_t y, uint8_t alignment)
{
  int16_t x = 0;
  int16_t x1, y1;
  uint16_t w, h;
  display.setCursor(x, y);
  display.getTextBounds(str, x, y, &x1, &y1, &w, &h);

  switch (alignment)
  {
  case RIGHT_ALIGNMENT:
    display.setCursor(display.width() - w - x1, y);
    break;
  case LEFT_ALIGNMENT:
    display.setCursor(0, y);
    break;
  case CENTER_ALIGNMENT:
    display.setCursor(display.width() / 2 - ((w + x1) / 2), y);
    break;
  default:
    break;
  }
  display.println(str);
}

void getTimeFromNTP()
{
  configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
  struct tm timeinfo;
  if(!getLocalTime(&timeinfo)){
    Serial.println("Failed to obtain time");
    return;
  }

  Date[2] = (timeinfo.tm_year - 100) / 10 % 10 + '0';
  Date[3] = (timeinfo.tm_year - 100) % 10 + '0';
  Date[5] = (timeinfo.tm_mon + 1) / 10 % 10 + '0';
  Date[6] = (timeinfo.tm_mon + 1) % 10 + '0';
  Date[8] = timeinfo.tm_mday / 10 % 10 + '0';
  Date[9] = timeinfo.tm_mday % 10 + '0';

  Time[0] = timeinfo.tm_hour / 10 % 10 + '0';
  Time[1] = timeinfo.tm_hour % 10 + '0';
  Time[3] = timeinfo.tm_min / 10 % 10 + '0';
  Time[4] = timeinfo.tm_min % 10 + '0';
  Time[6] = timeinfo.tm_sec / 10 % 10 + '0';
  Time[7] = timeinfo.tm_sec % 10 + '0';

  Serial.println(Date);
  Serial.println(Time);
  Serial.println(" ");
}

void setup()
{
  Serial.begin(115200);
  Serial.println();
  Serial.println("setup");

  Serial.printf("Connecting to %s ", ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println(" CONNECTED");

  SPI.begin(SPI_CLK, SPI_MISO, SPI_MOSI, ELINK_SS);
  display.init(); // enable diagnostic output on Serial

  display.setRotation(1);
  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
  display.setFont(&FreeMonoBold18pt7b);
  display.setCursor(0, 0);

  sdSPI.begin(SDCARD_CLK, SDCARD_MISO, SDCARD_MOSI, SDCARD_SS);

  if (!SD.begin(SDCARD_SS, sdSPI)) {
    sdOK = false;
  } else {
    sdOK = true;
  }

  display.fillScreen(GxEPD_WHITE);
  display.update();
}

void loop()
{
  getTimeFromNTP();
  displayText(String(Date), 60, CENTER_ALIGNMENT);
  displayText(String(Time), 90, CENTER_ALIGNMENT);
  display.updateWindow(22, 30,  222,  90, true);
  display.drawBitmap(Whiteboard, 22, 31,  208, 60, GxEPD_BLACK);
}

结果

例程2结果

图片取模教程

图片制作 在制作图片的时候,需要做成纯黑白图片,保存为.bmp或者jpg 文件。

取模方法 取模可以采用 lcd-image-converter.exe 软件

Fig3:FireBeetle Covers-ePaper Black\&White Display Module(SPI)

Fig3:FireBeetle Covers-ePaper Black\&White Display Module(SPI)

Fig3:FireBeetle Covers-ePaper Black\&White Display Module(SPI)

Fig3:FireBeetle Covers-ePaper Black\&White Display Module(SPI)

Fig3:FireBeetle Covers-ePaper Black\&White Display Module(SPI)

相关资料

常见问题

还没有客户对此产品有任何问题,欢迎通过 qq 或者论坛联系我们! 更多问题及有趣的应用,可以访问论坛进行查阅或发帖

更多

DFRobot 商城购买链接