Lesson plan

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.

4 chapters, 7 lessons, about 5 hours, on the ESP32-C3-DevKitM-1. Every lesson runs in the browser, with nothing to install.

The unit

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.

Chapter 1. About 1 h 30 min

Scales and lines

The function from data to pixels, and a line chart that hides nothing.

LessonTimeWhat 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
  1. Data in, pixels out
  2. A linear scale
  3. Nice ticks
  4. Fewer, rounder ticks
  5. Start at zero?
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
  1. More data than pixels
  2. Join the dots
  3. The vanishing spike
  4. Keep the extremes
  5. An alarm line

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".

Chapter 2. About 1 h 55 min

Bars, sparks and dials

Three more ways to show a number, and when each one is honest.

LessonTimeWhat 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
  1. Share out the pixels
  2. From zero, always
  3. Sort to answer the question
  4. Color means something
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
  1. Charts the size of a word
  2. Its own scale
  3. The normal band
  4. A minimum span
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
  1. The live sensor
  2. Value to angle
  3. Angle to pixels
  4. A storm front
  5. Widen the sweep

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".

Chapter 3. About 45 min

Live data

A ring buffer and a chart that keeps up ten times a second.

LessonTimeWhat 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
  1. A ring buffer
  2. Heat the cabin
  3. The window forgets
  4. Scroll or sweep
  5. Faster samples

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".

Chapter 4. About 55 min

Boss

The whole life-support dashboard from one sensor.

LessonTimeWhat 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
  1. Life support
  2. The frame budget
  3. Cabin hot
  4. Tune a limit
  5. Damp air
  6. Make it yours

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".

Your class

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.