Color TFT screens and touch UI lesson plan
Color screens on the ESP32: SPI panels and RGB565, TFT_eSPI with fonts and smooth gauges, resistive and capacitive touch, screens and a tab bar, and a spaceship life support thermostat for the boss.
Objectives and materials
By the end, students can
- Panels on one bus, 16-bit color, and TFT_eSPI.
- Gauges and buttons, then a resistive panel to press them.
- Touch in pixels, and an app with more than one screen.
- A life support thermostat for a spaceship cabin.
Materials for the whole unit
- ESP32 DevKit V1
- IPS display, ST7789
- Round display, GC9A01
- Temperature sensor, TMP36
- Touch TFT, 2.8 inch ILI9341 with FT6206
- Touch TFT, 2.8 inch ILI9341 with XPT2046
Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.
Pixels over SPI
Panels on one bus, 16-bit color, and TFT_eSPI.
| Lesson | Time | What students do |
|---|---|---|
| SPI panels: two screens, one busAn ST7789 and a round GC9A01 on one SPI bus: clock, data, chip select and DC, RGB565 color in 16 bits, and what a full-screen fill costs. | 50 min |
|
| TFT_eSPI setup, colors and fontsTFT_eSPI on a 2.8 inch ILI9341: the setup defines, rotation, color565(), the numbered fonts, centered text with a datum, and a mission clock that redraws without flicker. | 50 min |
|
Materials
- ESP32 DevKit V1
- IPS display, ST7789
- Round display, GC9A01
- Touch TFT, 2.8 inch ILI9341 with XPT2046
Check for understanding
Each student finishes "TFT_eSPI setup, colors and fonts" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Colors by name and by number".
Widgets and touch
Gauges and buttons, then a resistive panel to press them.
| Lesson | Time | What students do |
|---|---|---|
| Buttons and gaugesA rover fuel gauge: a smooth arc and a bar from one number, a color that warns below a limit, a drawn button, and the rule of redrawing only what changed. | 50 min |
|
| Resistive touchThe XPT2046 on the same SPI bus: raw 12-bit readings and pressure, a calibration that turns them into pixels, a mirrored axis to fix, and three buttons for the cabin lights. | 50 min |
|
Materials
- ESP32 DevKit V1
- Touch TFT, 2.8 inch ILI9341 with XPT2046
Check for understanding
Each student finishes "Resistive touch" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Calibrating a real panel".
Capacitive touch and screens
Touch in pixels, and an app with more than one screen.
| Lesson | Time | What students do |
|---|---|---|
| Capacitive touchAn FT6206 on I2C: no pressure and no calibration, touch points already in pixels in the panel's own portrait frame, turned around for landscape, and a landing pad to hit. | 50 min |
|
| Screen navigationA spaceship console with three screens and a tab bar: one state variable, screens drawn only when they change, and touches that mean something only on their own screen. | 50 min |
|
Materials
- ESP32 DevKit V1
- Touch TFT, 2.8 inch ILI9341 with FT6206
Check for understanding
Each student finishes "Screen navigation" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Patterns that scale".
Boss project
A life support thermostat for a spaceship cabin.
| Lesson | Time | What students do |
|---|---|---|
| Boss: a life support thermostatA spaceship cabin thermostat: a TMP36 in big digits, a set point on touch buttons, heating and cooling with hysteresis so it never chatters, and an alarm outside the safe range. | 65 min |
|
Materials
- ESP32 DevKit V1
- Temperature sensor, TMP36
- Touch TFT, 2.8 inch ILI9341 with FT6206
Check for understanding
Each student finishes "Boss: a life support thermostat" on their own, without opening the hints. The simulator checks 8 of its 8 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Make it your ship".
Teach this unit as a class
Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.
The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.