Charts on small screens lesson plan
Build a space capsule's life-support screen in C++ on an ESP32-C3: scales and axes, line charts, bars, sparklines, gauges and a live dashboard on a 320 x 240 TFT.
Objectives and materials
By the end, students can
- The function from data to pixels, and a line chart that hides nothing.
- Three more ways to show a number, and when each one is honest.
- A ring buffer and a chart that keeps up ten times a second.
- The whole life-support dashboard from one sensor.
Materials for the whole unit
- ESP32-C3-DevKitM-1
- Full-size breadboard
- Pressure, humidity and temperature, BME280
- TFT display, 240x320
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.
Scales and lines
The function from data to pixels, and a line chart that hides nothing.
| Lesson | Time | What students do |
|---|---|---|
| Scales and axesMap a day of cabin temperatures onto 320 x 240 pixels: a linear scale, a y axis that has to flip, and tick marks on nice 1, 2, 5 steps. | 45 min |
|
| Line chartsSixteen hours of cabin CO2, 960 samples in 240 columns: joining points into lines, decimation that hides a spike, min and max columns that keep it, and an alarm line. | 45 min |
|
Materials
- ESP32-C3-DevKitM-1
- Full-size breadboard
- Pressure, humidity and temperature, BME280
- TFT display, 240x320
Check for understanding
Each student finishes "Line charts" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "An alarm line".
Bars, sparks and dials
Three more ways to show a number, and when each one is honest.
| Lesson | Time | What students do |
|---|---|---|
| Bar chartsSix oxygen tanks as a bar chart: bars that start at zero, widths and gaps shared out in whole pixels, sorting so the eye finds the emptiest tank, and color for the ones running low. | 35 min |
|
| SparklinesFour charts the size of a word for oxygen, CO2, temperature and humidity: a scale each, the latest value in big digits, a shaded normal band, and a minimum span so noise stays flat. | 35 min |
|
| GaugesThe BME280's cabin pressure on a round dial: a value mapped onto an angle, sine and cosine for the needle's tip, ticks around the rim, a red zone, and redrawing only the needle. | 45 min |
|
Materials
- ESP32-C3-DevKitM-1
- Full-size breadboard
- Pressure, humidity and temperature, BME280
- TFT display, 240x320
Check for understanding
Each student finishes "Gauges" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Widen the sweep".
Live data
A ring buffer and a chart that keeps up ten times a second.
| Lesson | Time | What students do |
|---|---|---|
| Scrolling real timeThe cabin temperature ten times a second into a ring buffer, an auto scale that forgets, and two ways to draw it: a scrolling chart that redraws everything and a scope sweep that redraws one column. | 45 min |
|
Materials
- ESP32-C3-DevKitM-1
- Full-size breadboard
- Pressure, humidity and temperature, BME280
- TFT display, 240x320
Check for understanding
Each student finishes "Scrolling real time" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Faster samples".
Boss
The whole life-support dashboard from one sensor.
| Lesson | Time | What students do |
|---|---|---|
| Boss: a sensor dashboardThe capsule's life-support screen from one BME280: a sweeping temperature trace, a pressure dial, a humidity bar and an alarm banner, all drawn inside a 250 ms frame budget. | 55 min |
|
Materials
- ESP32-C3-DevKitM-1
- Full-size breadboard
- Pressure, humidity and temperature, BME280
- TFT display, 240x320
Check for understanding
Each student finishes "Boss: a sensor dashboard" 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: "Make it yours".
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.