Built-in project · Arduino Uno R3

E-paper name badge on an Arduino Uno

A 2.13 inch SSD1680 e-paper badge driven with GxEPD2: the name drawn once, a button that swaps the bottom line with a partial refresh, and a picture that stays with the power off. The whole build, an Arduino Uno and 2 more parts, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.

IntermediateRuns in your browser. Free, and no account needed.

E-paper name badge · Arduino Uno R3live0.000 s 0.00x
Hold the button
The circuit itself, running here on the simulator. Press what can be pressed; click anything else to open it in the editor.

The code

The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.

sketch.ino · Arduino Uno R3
// E-paper name badge: a 2.13 inch black and white e-paper panel on an
// SSD1680, driven with GxEPD2, as a conference or club badge.
//
//   e-paper   SCL -> 13   SDA -> 11   CS -> 10   DC -> 9   RES -> 8   BUSY -> 7
//             VCC -> 3.3 V   GND -> GND
//   button    pin 2 to GND (the pin's pull-up holds it high)
//
// The badge draws its name once with a full refresh, which takes the panel
// about two seconds while BUSY is high. The button swaps the bottom line
// between the role and a contact line with a partial refresh, a fraction of
// a second, and then the controller goes back to deep sleep. E-paper keeps
// its picture with no power at all, so a real badge draws and then sleeps
// until the button is pressed again.
//
// The panel is 250 x 122 pixels, bigger than this board's 2 KB of RAM, so
// GxEPD2 draws it in pages of 50 rows: the do { } while (nextPage()) loop
// runs once for each page.

#include <GxEPD2_BW.h>

#define MAX_DISPLAY_BUFFER_SIZE 800
#define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? \
                         EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))

GxEPD2_BW<GxEPD2_213_BN, MAX_HEIGHT(GxEPD2_213_BN)>
    display(GxEPD2_213_BN(10, 9, 8, 7));  // CS, DC, RES, BUSY

const int BUTTON = 2;
bool contact = false;

void bottomLine() {
  display.fillRect(0, 96, 250, 26, GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
  display.setTextSize(2);
  display.setCursor(12, 102);
  display.print(contact ? "ADA@CLUB.ORG" : "ELECTRONICS CLUB");
}

void drawBadge() {
  display.setFullWindow();
  display.firstPage();
  do {
    display.fillScreen(GxEPD_WHITE);
    // The band across the top, white letters on black.
    display.fillRect(0, 0, 250, 24, GxEPD_BLACK);
    display.setTextColor(GxEPD_WHITE);
    display.setTextSize(2);
    display.setCursor(18, 5);
    display.print("HELLO, MY NAME IS");
    // The name, as big as it fits.
    display.setTextColor(GxEPD_BLACK);
    display.setTextSize(4);
    display.setCursor(30, 44);
    display.print("ADA");
    display.drawFastHLine(10, 88, 230, GxEPD_BLACK);
    bottomLine();
  } while (display.nextPage());
}

void drawBottom() {
  display.setPartialWindow(0, 96, 250, 26);
  display.firstPage();
  do {
    bottomLine();
  } while (display.nextPage());
}

void setup() {
  pinMode(BUTTON, INPUT_PULLUP);
  display.init(115200);
  display.setRotation(1);
  drawBadge();
  display.hibernate();
}

void loop() {
  if (digitalRead(BUTTON) == LOW) {
    contact = !contact;
    drawBottom();
    display.hibernate();
    while (digitalRead(BUTTON) == LOW) delay(10);
  }
  delay(20);
}

Parts list

4 parts, plus the jumper wires. Every one is in the editor's parts bin.

How it is wired

10 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.

  • Ground: Arduino Uno R3 pin GND; E-paper display, SSD1680 2.13 inch pin GND
  • Arduino Uno R3 pin 13; E-paper display, SSD1680 2.13 inch pin SCL
  • Arduino Uno R3 pin 11; E-paper display, SSD1680 2.13 inch pin SDA
  • Arduino Uno R3 pin 10; E-paper display, SSD1680 2.13 inch pin CS
  • Arduino Uno R3 pin 9; E-paper display, SSD1680 2.13 inch pin DC
  • Arduino Uno R3 pin 8; E-paper display, SSD1680 2.13 inch pin RES
  • Arduino Uno R3 pin 7; E-paper display, SSD1680 2.13 inch pin BUSY
  • Arduino Uno R3 pin 2; Pushbutton pin 1a
  • Arduino Uno R3 pin 3V3; E-paper display, SSD1680 2.13 inch pin VCC
  • Ground: Arduino Uno R3 pin GND; Pushbutton pin 2a

Change it and keep it

Open it in the editor, change the circuit or the code, and keep your version in a free account.