Maker Pro
ESP8266

Simple e-ink display for your projects (MH-ET LIVE 1.54) setup and demo

May 12, 2019 by Petr Lukáš
Share
banner

MH-ET LIVE 1.54 E-Paper - cheap e-ink display for your Arduino or ESP (setup and demo)

In this video I'd like to setup and test new MH-ET LIVE 1.54-inches E-Paper display. This display has 200 x 200 pixels resolution and it is available in 3 different color combinations: black-white, black-yellow-white, black-red-white. It works with 3.3 V or 5 V and uses SPI for communication with microcontroller (in my case ESP8266). Advantage of this display is zero power consumption after refresh but you have to consider long refresh time. This display is perfect for battery-powered/solar-powered applications or other low-power projects. Source is minified for ESP8266, check the library for Arduino/ESP32 versions.

Content:

  • Package and display introduction
  • Basic setup/assembling of cover
  • Basic demo (weather dashboard screen example)
  • Display partial refresh (QR code example)
  • Power consumption (Deep-sleep mode)

Library:

E-ink display *

*(check the version of your display in examples, e.g. for 1.54 b/w you'll need GxGDEP015OC1/GxGDEP015OC1.cpp)

QR code library by Richard Moore (or Arduino Library Manager - QRCode)

#include <GxEPD.h>
#include <GxGDEP015OC1/GxGDEP015OC1.cpp>
#include <Fonts/OpenSansBold12pt7b.h>
#include <Fonts/OpenSansBold14pt7b.h>
#include <Fonts/OpenSansBold30pt7b.h>
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>
#include GxEPD_BitmapExamples
#include "qrcode.h"
GxIO_Class io(SPI, /*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
GxEPD_Class display(io /*RST=D4*/ /*BUSY=D2*/); // default selection of D4(=2), D2(=4)
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println("Display setup...");
display.init(115200); // enable diagnostic output on Serial
display.setRotation(0);
display.update();
Serial.println("Done");
pinMode(D0, WAKEUP_PULLUP);
}
void loop() {
weatherDemo();
drawPicture();
qrCard();
// Use this line if you need to save energy (e.g. battery application)
int seconds = 10;
ESP.deepSleep(seconds * 1000000);
}
void weatherDemo(){
float temp = 16.4;
int hum = 54;
float pres = 1010.5;
uint16_t line_y = 0;
uint16_t line_x = 0;
display.setTextColor(GxEPD_BLACK);
line_y = 50;
display.drawLine(0, line_y, 200, line_y, GxEPD_BLACK);
line_y = 135;
display.drawLine(0, line_y, 200, line_y, GxEPD_BLACK);
line_x = 100;
display.drawLine(line_x, 135, line_x, 200, GxEPD_BLACK);
display.setFont(&OpenSansBold12pt7b);
display.setCursor(10, 35);
display.print("clear sky");
display.setFont(&OpenSansBold14pt7b);
display.setCursor(155, 90);
display.print("C");
display.setCursor(173, 83);
display.print("o");
display.setFont(&OpenSansBold30pt7b);
display.setCursor(15, 115);
display.print(temp,1);
display.setFont(&OpenSansBold12pt7b);
display.setCursor(10, 160);
display.print("%");
display.setFont(&OpenSansBold14pt7b);
display.setCursor(10, 190);
display.print(hum);
display.setFont(&OpenSansBold12pt7b);
display.setCursor(110, 160);
display.print("hPa");
display.setFont(&OpenSansBold14pt7b);
display.setCursor(110, 190);
display.print(pres,1);
display.update();
delay(2000);
}
void drawPicture(){
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_WHITE);
display.update();
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
display.update();
delay(2000);
}
void qrCard(){
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_WHITE);
display.update();
// Start time
uint32_t dt = millis();
byte box_x = 1;
byte box_y = 1;
byte box_s = 6;
byte init_x = box_x;
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false);
// Create the QR code
QRCode qrcode;
uint8_t qrcodeData[qrcode_getBufferSize(4)];
qrcode_initText(&qrcode, qrcodeData, 4, 0, "https://www.youtube.com/channel/UCrynPq5AwTTXQr-Hv9_fzMA?sub_confirmation=1");
// Delta time
dt = millis() - dt;
Serial.print("QR Code Generation Time: ");
Serial.print(dt);
Serial.print("\n");
// Top quiet zone
Serial.print("\n\n\n\n");
for (uint8_t y = 0; y < qrcode.size; y++) {
// Left quiet zone
Serial.print(" ");
// Each horizontal module
for (uint8_t x = 0; x < qrcode.size; x++) {
// Print each module (UTF-8 \u2588 is a solid block)
//Serial.print(qrcode_getModule(&qrcode, x, y) ? "\u2588\u2588": " ");
if(qrcode_getModule(&qrcode, x, y)){
Serial.print("\u2588\u2588");
//Serial.println(py+ps);
display.fillRect(box_x, box_y, box_s, box_s, GxEPD_BLACK);
} else {
Serial.print(" ");
//Serial.println(py+ps);
display.fillRect(box_x, box_y, box_s, box_s, GxEPD_WHITE);
}
box_x = box_x + box_s;
}
Serial.print("\n");
display.updateWindow(0, box_y, 200, box_s, true);
box_y = box_y + box_s;
box_x = init_x;
}
//display.update();
// Bottom quiet zone
Serial.print("\n\n\n\n");
}
view raw eink_demo.ino hosted with ❤ by GitHub

Author

Avatar
Petr Lukáš

Application Software Developer, Performance and capacity reporting for IBM zSeries team, experimenting with home automation, sensors, Arduino and ESP

Related Content

Categories

Comments


You May Also Like