CircuitPython eInk displayio Library Installation
To use displayio, you will need to install the appropriate library for your display.
First make sure you are running the latest version of Adafruit CircuitPython for your board. You will need the latest version of CircuitPython.
Next you'll need to install the necessary libraries to use the hardware--carefully follow the steps to find and install these libraries from Adafruit's CircuitPython library bundle. Our introduction guide has a great page on how to install the library bundle for both express and non-express boards.
You will need to copy the appropriate displayio driver from the bundle lib folder to a lib folder on your CIRCUITPY drive. The displayio driver contains the initialization codes specific to your display that are needed to for it to work. Since there is more than one driver, you will need to copy the correct file over. Here is a list of each of the displays and the correct driver for that display.
Adafruit_CircuitPython_SSD1608
The 200x200 monochrome display with SSD1608 driver uses the Adafruit_CircuitPython_SSD1608 library. Copy the adafruit_ssd1608.mpy
file from the bundle to the lib folder on your CIRCUITPY drive.
Adafruit_CircuitPython_IL0373
The 152x152 Tri-Color display with IL0373 uses the Adafruit_CircuitPython_ILI0373 library. Copy the adafruit_il0373.mpy
file from the bundle to the lib folder on your CIRCUITPY drive.
Adafruit_CircuitPython_SSD1681
The 200x200 Tri-Color display with SSD1681 driver uses the Adafruit_CircuitPython_SSD1681 library. Copy the adafruit_ssd1681.mpy
file from the bundle to the lib folder on your CIRCUITPY drive.
Image File
To show you how to use the eInk with displayio, we'll show you how to draw a bitmap onto it. First start by downloading display-ruler.bmp
Copy display-ruler.bmp into the root directory of your CIRCUITPY drive.
Monochrome Display Usage
In the examples folder for your SSD1608 displayio driver, there should be a test for your display which we have listed here:
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT """Simple test script for 1.54" 200x200 monochrome display. Supported products: * Adafruit 1.54" Monochrome ePaper Display Breakout * https://www.adafruit.com/product/4196 """ import time import board import displayio import fourwire import adafruit_ssd1608 displayio.release_displays() # This pinout works on a Feather M4 and may need to be altered for other boards. spi = board.SPI() # Uses SCK and MOSI epd_cs = board.D9 epd_dc = board.D10 epd_reset = board.D5 epd_busy = board.D6 display_bus = fourwire.FourWire( spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000 ) time.sleep(1) display = adafruit_ssd1608.SSD1608( display_bus, width=200, height=200, busy_pin=epd_busy, rotation=180 ) g = displayio.Group() with open("/display-ruler.bmp", "rb") as f: pic = displayio.OnDiskBitmap(f) # CircuitPython 6 & 7 compatible t = displayio.TileGrid( pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter()) ) # CircuitPython 7 compatible only # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader) g.append(t) display.root_group = g display.refresh() print("refreshed") time.sleep(120)
Configure and Upload
You will want to change the epd_reset
and epd_busy
to the correct values. If you wired it up as shown on the Wiring page, you will want to change it to these values:
epd_reset = board.D8 epd_busy = board.D7
Save it to your CIRCUITPY drive as code.py and it should automatically run. Your display will look something like this:
Tri-Color Display Usage
HD Tri-Color Display
In the examples folder for your SSD1681 displayio driver, there should be a test for your display which we have listed here:
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries # SPDX-FileCopyrightText: Copyright (c) 2021 Melissa LeBlanc-Williams for Adafruit Industries # # SPDX-License-Identifier: Unlicense """Simple test script for 1.54" 200x200 tri-color display. Supported products: * Adafruit 1.54" Tri-Color Display Breakout * https://www.adafruit.com/product/4868 """ import time import board import displayio import adafruit_ssd1681 # Compatibility with both CircuitPython 8.x.x and 9.x.x. # Remove after 8.x.x is no longer a supported release. try: from fourwire import FourWire except ImportError: from displayio import FourWire displayio.release_displays() # This pinout works on a Feather M4 and may need to be altered for other boards. spi = board.SPI() # Uses SCK and MOSI epd_cs = board.D9 epd_dc = board.D10 epd_reset = board.D5 epd_busy = board.D6 display_bus = FourWire( spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000 ) time.sleep(1) display = adafruit_ssd1681.SSD1681( display_bus, width=200, height=200, busy_pin=epd_busy, highlight_color=0xFF0000, rotation=180, ) g = displayio.Group() with open("/display-ruler.bmp", "rb") as f: pic = displayio.OnDiskBitmap(f) # CircuitPython 6 & 7 compatible t = displayio.TileGrid( pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter()) ) # CircuitPython 7 compatible only # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader) g.append(t) display.root_group = g display.refresh() print("refreshed") time.sleep(120)
Standard Tri-Color Display
In the examples folder for your ILI0373 displayio driver, there should be a test for your display which we have listed here:
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT """Simple test script for 1.54" 152x152 tri-color display. Supported products: * Adafruit 1.54" Tri-Color Display Breakout * https://www.adafruit.com/product/3625 """ import time import board import displayio import fourwire import adafruit_il0373 displayio.release_displays() # This pinout works on a Feather M4 and may need to be altered for other boards. spi = board.SPI() # Uses SCK and MOSI epd_cs = board.D9 epd_dc = board.D10 epd_reset = board.D5 epd_busy = board.D6 display_bus = fourwire.FourWire( spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000 ) time.sleep(1) display = adafruit_il0373.IL0373( display_bus, width=152, height=152, busy_pin=epd_busy, highlight_color=0xFF0000, rotation=180, ) g = displayio.Group() with open("/display-ruler.bmp", "rb") as f: pic = displayio.OnDiskBitmap(f) # CircuitPython 6 & 7 compatible t = displayio.TileGrid( pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter()) ) # CircuitPython 7 compatible only # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader) g.append(t) display.root_group = g display.refresh() print("refreshed") time.sleep(120)
Configure and Upload
For either display, you will want to change the epd_reset
and epd_busy
to the correct values. If you wired it up as shown on the Wiring page, you will want to change it to these values:
epd_reset = board.D8 epd_busy = board.D7
Save it to your CIRCUITPY drive as code.py and it should automatically run. Your display will look something like this:
Text editor powered by tinymce.