The u2if project is an experimental firmware originally by execuc. It allows you to run "regular" Python code on your main computer and have it communicate with external devices connected through an RP2040 board. We have a guide on how to setup this firmware on your board, which you should follow before proceeding with this example. On this page, you'll run an example for an eInk display with the Feather RP2040 ThinkInk board with a 2.13" Tri-Color eInk display.
Open the 24-pin connector on the Feather. Slot the display ribbon connector into the connector on the Feather with its pins facing up.
Similar to how you would load CircuitPython firmware, you'll reset the Feather by holding down the boot button, pressing the reset button and then releasing the boot button to get the board into bootloader mode. Then, you can drag and drop the UF2 file below onto the board.
Blinka and Python Installation
You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. These steps are detailed in the u2if guide.
Once that's done, from your command line run the following command to install the Adafruit_CircuitPython_EPD library:
sudo pip3 install adafruit-circuitpython-epd
Example Code
Once you have the library pip3
installed on your computer, copy or download the following example to your computer, and run the following from your command line, replacing feather_epd_blinka.py with whatever you named the file:
python3 feather_epd_blinka.py
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT import time import digitalio import busio import board from adafruit_epd.epd import Adafruit_EPD from adafruit_epd.ssd1680 import Adafruit_SSD1680 # create the spi device and pins we will need spi = busio.SPI(board.EPD_SCK, MOSI=board.EPD_MOSI, MISO=None) epd_cs = digitalio.DigitalInOut(board.EPD_CS) epd_dc = digitalio.DigitalInOut(board.EPD_DC) epd_reset = digitalio.DigitalInOut(board.EPD_RESET) epd_busy = digitalio.DigitalInOut(board.EPD_BUSY) srcs = None display = Adafruit_SSD1680( 122, 250, spi, cs_pin=epd_cs, dc_pin=epd_dc, sramcs_pin=srcs, rst_pin=epd_reset, busy_pin=epd_busy, ) display.rotation = 3 display.fill(Adafruit_EPD.WHITE) display.fill_rect(20, 20, 50, 60, Adafruit_EPD.BLACK) display.hline(80, 30, 60, Adafruit_EPD.BLACK) display.vline(80, 30, 60, Adafruit_EPD.BLACK) # draw repeatedly with pauses while True: display.display() time.sleep(15)
After the code runs, you'll see the display refresh and show a rectangle and two lines.
u2if support makes it possible to use desktop Python libraries on hardware that would traditionally only run embedded libraries, such as CircuitPython, MicroPython or Arduino. This opens up the possibilities for large scale projects.
Page last edited January 21, 2025
Text editor powered by tinymce.