LILYGO T-Dongle-S3 running CircuitPython - disable the REPL on the display for your own use
Adafruit has a specific CircuitPython distribution for the T-Dongle-S3 that uses the LCD display as its default logging and REPL output. You can see this output by enabling the LCD backlight in your Python code. You can disable this behavior and use the LCD for your own purposes with just a couple of lines of additional Python code.
The LILLYGO T-Dongle S3
The LILLYGO T-Dongle S3 is a USB thumb drive-sized microcontroller with a built-in IPS LCD display, USB port, WI-FI, Bluetooth, I2C, and a MicroSD card slot. It can be programmed to act as a computer peripheral or as a standalone device powered by a USB power source. The most common use cases include pen testing devices, smart or sensor peripherals (hardwired, Bluetooth, Wi-Fi), or standalone sensor and output control devices connected to the cloud over Wi-FI.30 seconds of Video
A short demonstration of CircuitPython, the CircuitPython REPL output, and custom Python content pushed to the built-in LCD.
Turning on the backlight
import board
# board.DISPLAY is a <BusDisplay>
# Turn on the backlight so you can see the CircuitPython REPL
# 0.0 is full brightness
# REPL is always enabled on CircuitPython ports
display = board.DISPLAY
display.brightness = 0.5
Example program used in the video
# https://github.com/adafruit/circuitpython/tree/main/ports/espressif/boards/lilygo_tdongle_s3
import time
import board
import busio
import displayio
import terminalio
from adafruit_display_text import label
# board.DISPLAY is a <BusDisplay>
# help("modules")
# print(dir(board))
# DISPLAY is defined as part board specification
# of any CircuitPython port with built in display
# A lot of programs use a variable named 'display'
display = board.DISPLAY
# Disable the REPL on the display
# Can go in boot.py but also needed here for some boards.
# This is a sample without a boot.py so put it here
display.root_group = None
# Another note said this might be needed on other systems
# for item in displayio.CIRCUITPYTHON_TERMINAL:
# item.hidden = True
splash = displayio.Group()
display.root_group = splash
# The display is described as 80x160.
# It looks like CircuitPython rotated the display for output.
# Draw larger outer rectangle
color_bitmap = displayio.Bitmap(160, 80, 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(150, 70, 1)
inner_palette = displayio.Palette(1)
inner_palette[0] = 0xAA0088 # Purple
inner_sprite = displayio.TileGrid(
inner_bitmap, pixel_shader=inner_palette, x=5, y=5
)
splash.append(inner_sprite)
# Draw a label over the top
# A scale=2 means the layers pixel is 2x2 pixels in the group
# Setting scale=2 will give you maybe 10 characters
text_group = displayio.Group(scale=2, x=11, y=20)
text = "Adafruit"
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00)
text_group.append(text_area)
splash.append(text_group)
text_group2 = displayio.Group(scale=1, x=40, y=50)
text2 = "CircuitPython"
text_area2 = label.Label(terminalio.FONT, text=text2, color=0xFFFF00)
text_group2.append(text_area2)
splash.append(text_group2)
# REPL will reenable on console when this program ends
# We don't want it to appear so simulate program continuing to run by looping here forever
while True:
pass
Available CircuitPython Modules
The custom image CircuitPython (.bin) built for the LILYGO T-Dongle-S3 contains the following modules.
Returned by print(modules)
__future__ codeop mdns synthio
__main__ collections memorymap sys
_asyncio countio microcontroller terminalio
_bleio digitalio micropython tilepalettemapper
_eve displayio msgpack time
_pixelmap epaperdisplay neopixel_write touchio
adafruit_bus_device errno nvm traceback
adafruit_bus_device.i2c_device espidf onewireio ulab
adafruit_bus_device.spi_device espnow os ulab.numpy
adafruit_pixelbuf espulp paralleldisplay ulab.numpy.fft
aesio fontio paralleldisplaybus ulab.numpy.linalg
alarm fourwire ps2io ulab.scipy
analogbufio framebufferio pulseio ulab.scipy.linalg
analogio frequencyio pwmio ulab.scipy.optimize
array gc rainbowio ulab.scipy.signal
atexit getpass random ulab.scipy.special
audiobusio gifio re ulab.utils
audiocore hashlib rgbmatrix usb
audiomixer i2cdisplaybus rotaryio usb.core
audiomp3 io rtc usb.util
binascii ipaddress sdcardio usb_cdc
bitbangio jpegio sdioio usb_hid
bitmapfilter json select usb_midi
bitmaptools keypad sharpdisplay vectorio
board keypad_demux socketpool warnings
builtins locale ssl watchdog
busdisplay lvfontio storage wifi
busio math struct zlib
canio max3421e supervisorDefined Board Characteristics
The board object contains the following predefined variables suitable for use in a Python program. Note that it includes a DISPLAY object that can be used to talk to the built-in LCD display. This means you can write to the display without configuring any drivers. You just have to disable the REPL to avoid any conflicts.
Returned by print(dir(board))
['__class__', '__name__', 'APA102_CLK', 'APA102_DI', 'BUTTON0', 'DISPLAY', 'IO0', 'IO1', 'IO12', 'IO14', 'IO16', 'IO17', 'IO18', 'IO2', 'IO21', 'IO3', 'IO38', 'IO39', 'IO4', 'IO40', 'IO43', 'IO44', 'IO5', 'LCD_BCKL', 'LCD_CLK', 'LCD_CS', 'LCD_DC', 'LCD_DIN', 'LCD_RST', 'RX', 'SD_CMD', 'SD_D0', 'SD_D1', 'SD_D2', 'SD_D3', 'SD_SCK', 'STEMMA_I2C', 'STEMMA_SCL', 'STEMMA_SDA', 'TX', '__dict__', 'board_id']CircuitPython
- Download and install using the browser-based installer on the page for the dongle https://circuitpython.org/board/lilygo_tdongle_s3/
- Python programs may need additional libraries. The entire suite of Adafruit CircuitPython libraries can be downloaded as a .zip and then copied to the device individually or en masse into the /lib folder on the mounted CIRCUITPY device: https://circuitpython.org/libraries
- Some may want to look at the board-specific configuration. You can find the CircuitPython board configuration on the Adafruit CircuitPython GitHub
Connecting to the CircuitPython REPL via Serial on a Mac
The device projects a CDC serial connection on a tty device with the name
/dev/ttyusbmodem< some number>
when plugged in. You can see the output and interact with the REPL using the Mac "screen" program in a terminal.
screen /dev/tty.usbmodem<number varies>
You can exit the Mac screen program with a key combination
Ctrl-A Ctrl-\
LILLYGO T-Dongle-S3 Official GitHub
https://github.com/Xinyuan-LilyGO/T-Dongle-S3
https://github.com/Xinyuan-LilyGO/T-Dongle-S3/tree/main/examples/micropython
Revision History
Created 2026/01
Comments
Post a Comment