raspberry pi pico

overview

raspberry pi pico is a microcontroller board based on the rp2040 chip. dual-core arm cortex-m0+ processor, 264kb sram, flexible gpio.

good for projects needing more processing power than arduino but simpler than full raspberry pi.

key features

programming

st7789 display demo

demonstration of connecting st7789 tft display to raspberry pi pico.

schematic

connect st7789 display to pico via spi:

source code

import board
import displayio
import busio
import time
import terminalio
try:
    from fourwire import FourWire
except ImportError:
    from displayio import FourWire

from adafruit_st7789 import ST7789
from adafruit_display_text import label
displayio.release_displays()

spi = busio.SPI(clock=board.GP18, MOSI=board.GP19)
while not spi.try_lock():
    pass
# spi.configure(baudrate=24000000)
spi.unlock()
tft_cs = board.GP17
tft_dc = board.GP16
tft_reset = board.GP20
backlight = board.GP12

display_bus = FourWire(spi,
                       command=tft_dc,
                       chip_select=tft_cs,
                       reset=tft_reset)

# Try different offset combinations
display = ST7789(
    display_bus,
    width=240,
    height=280,
    rowstart=20,
    rotation=180,
)

# Make the display context
splash = displayio.Group()
display.root_group = splash

text = """In circuits bright and pixels clear,
A microcontroller's heart beats here.
Through SPI and GPIO pins,
A digital dance now begins.
On ST7789's glowing face,
Code and art share this space.
Where bits and bytes flow like streams,
Building electronic dreams.
With Python code we light the way,
Creating magic day by day.
In this small screen's gentle glow,
Technology's beauty we can show.
---

Mayphus Tang"""
text_area = label.Label(terminalio.FONT, text=text, color=0x0000FF, x=10, y=30)
splash.append(text_area)

while True:
    time.sleep(1)