Breadboard
docs
Example project · Displays & sensors

E-ink badge (persistent display)

A 1.54″ e-paper panel driven by a real SSD1681 SPI sequence: the script writes the controller RAM, fires Master Activation, and polls BUSY through the ~1 s refresh flash, and then the image stays put even if you cut the power. That’s e-paper.

The E-ink badge (persistent display) circuit as rendered by the simulator

What's on the bench

  • Battery
  • E-Ink 1.54″ 200×200
  • ESP32-C3

The code

This MicroPython script runs on the emulated board every boot; edit it in the Code tab.

from machine import Pin, SoftSPI
import framebuf, time
spi = SoftSPI(baudrate=2000000, sck=Pin(4), mosi=Pin(5), miso=Pin(0))
cs, dc, rst = Pin(6, Pin.OUT, value=1), Pin(7, Pin.OUT), Pin(3, Pin.OUT, value=1)
busy = Pin(10, Pin.IN)
def cmd(c, data=b""):
    cs(0); dc(0); spi.write(bytes([c]))
    if data:
        dc(1); spi.write(data)
    cs(1)
def wait():
    while busy.value():
        time.sleep_ms(20)
rst(0); time.sleep_ms(10); rst(1); time.sleep_ms(10)
cmd(0x12); wait()  # SW reset
W = H = 200
buf = bytearray(W * H // 8)
fb = framebuf.FrameBuffer(buf, W, H, framebuf.MONO_HLSB)
fb.fill(1)  # 1 = white paper
fb.fill_rect(4, 4, 192, 36, 0)
fb.text('E - I N K', 64, 18, 1)
fb.rect(4, 4, 192, 192, 0)
fb.text('real SSD1681 driver', 24, 70, 0)
fb.text('RAM -> refresh', 44, 95, 0)
fb.text('~1s flash, then', 40, 120, 0)
fb.text('the image stays', 40, 135, 0)
fb.text('even unpowered', 44, 150, 0)
cmd(0x11, b'\x03')  # entry mode: x+, y+
cmd(0x44, bytes([0, W // 8 - 1]))
cmd(0x45, b'\x00\x00' + bytes([(H - 1) & 0xFF, (H - 1) >> 8]))
cmd(0x4E, b'\x00'); cmd(0x4F, b'\x00\x00')
cmd(0x24, buf)  # write RAM: nothing visible yet
cmd(0x22, b'\xF7'); cmd(0x20)  # master activation
wait()
print('badge refreshed (busy =', busy.value(), ') - cut the power: the image stays')