ESP32 boards with a TFT display
8th March 2023
There are two ESP32-based boards that include an integral 240x135 colour TFT display, and these make an excellent platform for running uLisp. The ESP Release 4.3b of uLisp includes graphics extensions that support these boards, based on Adafruit's GFX library, making it easy to write programs that plot points, lines, shapes, and text on these displays.
Boards
LILYGO also make a T-Display-S3 based on the ESP32-S3 [1], but I can't currently recommend this for use with uLisp because of a problem with the built-in USB interface that causes it to hang up if you upload a long Lisp program. The developers of the Arduino core are aware of the problem and hope to fix it on a future release.
Adafruit ESP32-S2 TFT Feather
The Adafruit ESP32-S2 TFT Feather [2] adopts the same format as Adafruit's other Feather boards, and incorporates a 240x135 colour TFT display:
It has a USB-C connector, and uses the ESP32-S2's native USB, avoiding the need for a UART chip.
It has the same specification as their ESP32-S2 Feather: it provides 4 MB flash and 2 MB PSRAM, and includes a JST connector for a Lipo battery, a Lipo charger to allow the battery to be charged from the USB port, and an I2C LC709203 battery monitor chip. The board also has a QWIIC/STEMMA QT connector for connecting I2C modules.
For information about the I/O pins and interfaces see: Adafruit ESP32-S2 TFT Feather Pinouts.
Installing uLisp from the Arduino IDE
- Install the ESP32 Arduino core version 2.0.5 or later.
- Select ESP32 Arduino from the Board menu.
- Select the Adafruit Feather ESP32-S2 TFT board option.
- Set Partition Scheme to Default 4MB with spiffs, to allow you to save the workspace with save-image.
You can leave the other options at their defaults.
- If not already installed, install the Adafruit ST7735 and ST7789 and Adafruit GFX libraries.
- Download the latest ESP version of uLisp from the Download uLisp page.
- Enable the uLisp graphics support by uncommenting the line:
#define gfxsupport
- Upload uLisp to the board.
You should then be able to select the USB port from the Port menu, select Serial Monitor from the Tools menu, and enter Lisp commands.
Note that the first time you call save-image LittleFS allocates the file system, and an error may be displayed. It should work without error the second and subsequent times.
LED
As with other Feather boards the Adafruit ESP32-S2 TFT Feather has a red LED connected to the digital pin 13 which you can flash with the following program:
(defun blink (&optional x) (pinmode :led-builtin t) (digitalwrite :led-builtin x)
(delay 1000) (blink (not x)))
Run it by typing:
(blink)
Exit by entering ~.
TFT display
The display is a 240x135 1.14" colour TFT display based on a ST7789 controller. It is supported by the uLisp graphics extensions; see Graphics extensions.
Here is the board running the program described in Ray tracing with uLisp:
Analogue inputs
The Adafruit ESP32-S2 TFT Feather has six analogue inputs on pins 8 and 14 to 18.
Analogue outputs
The Adafruit ESP32-S2 TFT Feather has two DAC analogue outputs on pins 17 and 18.
Serial
The Adafruit ESP32-S2 TFT Feather has one serial port on pin numbers 2 (RX) and 1 (TX). By default the baud rate is 9600.
SPI
The Adafruit ESP32-S2 TFT Feather has one SPI port on pin numbers 37 (MISO), 35 (MOSI), and 36 (SCK).
I2C
The Adafruit ESP32-S2 TFT Feather has one I2C port on pin numbers 42 (SDA) and 41 (SCL).
TTGO T-Display
The TTGO T-Display from Chinese company LILYGO [3] is based on an ESP32, and incorporates the same 240x135 1.14" colour TFT display:
It has a USB-C connector, and uses a CH9102 USB to serial chip. It provides 4 MB flash but no PSRAM, and includes a JST connector for a Lipo battery. It provides a reset button on the side of the board, and two user buttons each side of the USB connector.
For information about the I/O pins and interfaces see: TTGO ESP32 TFT Pinouts.
Installing uLisp from the Arduino IDE
- Install the ESP32 Arduino core version 2.0.5 or later.
- Select ESP32 Arduino from the Board menu.
- Select the ESP32 Dev Module board option.
- Check that Partition Scheme is set to Default 4MB with spiffs, to allow you to save the workspace with save-image.
You can leave the other options at their defaults.
- If not already installed, install the Adafruit ST7735 and ST7789 and Adafruit GFX libraries.
- Download the latest ESP version of uLisp from the Download uLisp page.
- Enable the uLisp graphics support by uncommenting the line:
#define gfxsupport
- Upload uLisp to the board.
You should then be able to select the USB port from the Port menu, select Serial Monitor from the Tools menu, and enter Lisp commands.
Note that the first time you call save-image LittleFS allocates the file system, and an error may be diplayed. It should work without error the second and subsequent times.
LED
As with other Feather boards the ESP32-S2 Feather has a red LED connected to the digital pin 13 which you can flash with the following program:
(defun blink (&optional x) (pinmode :led-builtin t) (digitalwrite :led-builtin x)
(delay 1000) (blink (not x)))
Run it by typing:
(blink)
Exit by entering ~.
Buttons
The buttons are on Pin 0 and Pin 35.
TFT display
The display is a 240x135 1.14" colour TFT display based on a ST7789 controller. It is supported by the uLisp graphics extensions; see Graphics extensions.
Here is the board running the program described in Ray tracing with uLisp:
Analogue inputs
The TTGO T-Display has 11 analogue inputs on pins 12 to 15, 25 to 27, 32 to 33, 36, and 39.
Analogue outputs
The TTGO T-Display has two DAC analogue outputs on pins 25 and 26.
Serial
The TTGO T-Display doesn't have a serial port.
SPI
The TTGO T-Display doesn't have an external SPI port.
I2C
The TTGO T-Display has one I2C port on pin numbers 21 (SDA) and 22 (SCL).
- ^ T-Display-S3 on LILYGO.
- ^ Adafruit ESP32-S2 TFT Feather on Adafruit.
- ^ T-Display on LILYGO.