Adafruit Feather and SPI LCD Display

This article will cover connecting a 1.3″ LCD SPI display to the Adafruit Feather nRF52840 Sense. The instructions should be OK for any Adafruit Feather and, perhaps to a lesser extent, to other SPI displays.

I’m a big fan of the Adafruit Feather series, and of the Circuit Python language I use to program them. I’ve had the SPI display for a while but there seem to be many more instructions for connecting it to a Raspberry Pi than to anything else. Having said that, it only took a small amount of reading to discover that the existing Circuit Python st7789 library was ideal for controlling this display. It was then only a matter of hooking up the display to the appropriate pins on the feather and making a small change to any of the existing example programs to reflect the choice of pins. Some of the pins on the display had no directly corresponding feather pin, so I chose to use A0, A1, and A2 for convenient placing.

SPI Display Adafruit Feather
3v3v
CSA0
SCKSCK
MOSIMO
DCA1
BL (optional)A2
GNDGND

Backlight
The BL/A2 connection is optional. When connected the A2 pin can be used to turn the backlight of the display on and off. If the backlight is off the display is not visible, but this can be used to hide display refreshes and to conserve power

The code given below is taken directly from the Circuit Python examples for ST7789. The only changes as I have are to the pin selection, to make the code precisely match the connections given above, and to outline in comments how the backlight can be used.

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

# Minor modifications for pins and optional backlight. PHW 3/4/21

"""
This test will initialize the display using displayio and draw a solid green
background, a smaller purple rectangle, and some yellow text.
Pinouts are for the 1.3" PiTFT and should be run in CPython.
"""
import time
import board
import terminalio
import digitalio
import displayio
from adafruit_display_text import label
from adafruit_st7789 import ST7789

# Release any resources currently in use for the displays
displayio.release_displays()

spi = board.SPI()
tft_cs = board.A0
tft_dc = board.A1

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)

display = ST7789(display_bus, width=240, height=240, rowstart=80, rotation=180)

# Make the display context
splash = displayio.Group(max_size=10)
display.show(splash)

color_bitmap = displayio.Bitmap(240, 240, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0x00FF00  # Bright Green

bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)

# Draw a smaller inner rectangle
inner_bitmap = displayio.Bitmap(200, 200, 1)
inner_palette = displayio.Palette(1)
inner_palette[0] = 0xAA0088  # Purple
inner_sprite = displayio.TileGrid(inner_bitmap, pixel_shader=inner_palette, x=20, y=20)
splash.append(inner_sprite)

# Draw a label
text_group = displayio.Group(max_size=10, scale=2, x=50, y=120)
text = "Hello World!"
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFFFF)
text_group.append(text_area)  # Subgroup for text scaling
splash.append(text_group)

# Setup the backlight - Optional extra
# backlight = digitalio.DigitalInOut(board.A2)
# backlight.switch_to_output()
# backlight.value = True

while True:
    pass
Working display showing connections

Additional Resources
Circuit Python library bundle
Full documentation for the Circuit Python ST7789 library

Comments are closed.