galoebn
Published © GPL3+

e-Paper display using fonts

In this project I will show you how to work with different fonts using the GxEPD2 library.

IntermediateFull instructions provided1,130
e-Paper display using fonts

Things used in this project

Hardware components

ESP32
Espressif ESP32
You can use any ESP32 board
×1
2.9inch E-Ink display module
×1

Story

Read more

Schematics

Schematics

Connect as shown in the picture only if you have a NodeMCU ESP32

Code

e_ink_fonts

Arduino
#define ENABLE_GxEPD2_GFX 0

#include <GxEPD2_BW.h> // including both doesn't use more code or ram
#include <GxEPD2_3C.h> // including both doesn't use more code or ram
#include <U8g2_for_Adafruit_GFX.h>

//if you have another microcontroller or another e-ink display module you have to change the following line
GxEPD2_BW<GxEPD2_290_T94_V2, GxEPD2_290_T94_V2::HEIGHT> display(GxEPD2_290_T94_V2(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEM029T94, Waveshare 2.9" V2 variant

U8G2_FOR_ADAFRUIT_GFX u8g2Fonts;

void setup()
{
  display.init();
  // comment out next line to have no or minimal Adafruit_GFX code
  display.setTextColor(GxEPD_BLACK);
  display.firstPage();
  display.setRotation(1);

  u8g2Fonts.begin(display); // connect u8g2 procedures to Adafruit GFX
  delay(1000);

  uint16_t bg = GxEPD_WHITE;
  uint16_t fg = GxEPD_BLACK;
  u8g2Fonts.setForegroundColor(fg);         // apply Adafruit GFX color
  u8g2Fonts.setBackgroundColor(bg); 
  
  do
  {
    display.fillScreen(GxEPD_WHITE);

    u8g2Fonts.setFont(u8g2_font_6x12_tr);   //font is set
    u8g2Fonts.setCursor(0, 10);             //cursor(x,y)
    u8g2Fonts.print("Hello World! 1234");   //print the text
    
    u8g2Fonts.setFont(u8g2_font_7x13B_tr);
    u8g2Fonts.setCursor(0, 25); 
    u8g2Fonts.print("Hello World! 1234");
    
    u8g2Fonts.setFont(u8g2_font_9x15_tr);
    u8g2Fonts.setCursor(0, 40); 
    u8g2Fonts.print("Hello World! 1234");
    
    u8g2Fonts.setFont(u8g2_font_fur17_tr);
    u8g2Fonts.setCursor(0, 60); 
    u8g2Fonts.print("Hello World! 1234");
    
    u8g2Fonts.setFont(u8g2_font_helvB18_tr);
    u8g2Fonts.setCursor(0, 85); 
    u8g2Fonts.print("Hello World! 1234");
    
    u8g2Fonts.setFont(u8g2_font_fur30_tr);
    u8g2Fonts.setCursor(0, 123); 
    u8g2Fonts.print("Hello World! 1234");
  }
  while (display.nextPage());
}

void loop() {};

Credits

galoebn
9 projects • 4 followers
Contact

Comments

Please log in or sign up to comment.