Lesson plan

Air, heat and humidity sensors lesson plan

The sensors that watch the air, read close to the wire on the Uno: DS18B20 and DHT22 timing, SHT31 and AHT20 by hand, BME680 pressure and gas, SGP30, real CO2 with an SCD41 and particles with a PMS5003, then a space station cabin air monitor.

4 chapters, 7 lessons, about 7 hours, on the Arduino Uno R3. Every lesson runs in the browser, with nothing to install.

The unit

Objectives and materials

By the end, students can

  • Temperature and humidity on a single data pin, with the timing done by hand.
  • Humidity, pressure and gas sensors read from their datasheets with plain Wire calls.
  • Real CO2 and fine particles, and the health numbers that grade them.
  • Every sensor on one bus, keeping a space station module breathable.

Materials for the whole unit

  • Air quality sensor, PMS5003
  • Air quality sensor, SGP30
  • Arduino Uno R3
  • Buzzer
  • Character LCD with I2C backpack
  • CO2 sensor, SCD41
  • Gas and weather, BME680
  • Humidity sensor, AHT20
  • LED
  • Resistor x 2
  • Temperature and humidity, DHT22
  • Temperature and humidity, SHT31
  • Temperature sensor, DS18B20 x 2
  • Thermistor, 10k NTC

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 50 min

One wire, one pin

Temperature and humidity on a single data pin, with the timing done by hand.

LessonTimeWhat students do
DS18B20 vs the thermistorOne room read two ways: two DS18B20 probes sharing one wire, each with its own 64-bit address, and a thermistor on an analog pin. ROM codes, CRCs, resolution against conversion time, and when each part is the right one.55 min
  1. Run it: three thermometers
  2. Sixty-four bits of name
  3. Twelve bits take time
  4. Trade steps for speed
  5. Warm the room
  6. Below freezing
DHT22 timingRead a DHT22 with no library: the start pulse, the sensor’s answer, forty bits told apart by how long they stay high, the checksum and the sign bit, with every pulse width printed.55 min
  1. Run it: a stopwatch on one pin
  2. The first second
  3. Forty pulses
  4. Five bytes and a checksum
  5. Below freezing
  6. Too short to notice

Materials

  • Arduino Uno R3
  • Resistor x 2
  • Temperature and humidity, DHT22
  • Temperature sensor, DS18B20 x 2
  • Thermistor, 10k NTC

Check for understanding

Each student finishes "DHT22 timing" 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: "Too short to notice".

Chapter 2. About 2 h

On the I2C bus

Humidity, pressure and gas sensors read from their datasheets with plain Wire calls.

LessonTimeWhat students do
SHT31 and AHT20 on one busTwo modern humidity sensors side by side, read with plain Wire calls: the bus scan, the commands, the raw words, Sensirion’s CRC-8, the AHT20’s packed 20-bit numbers, and a dew point from the Magnus formula.55 min
  1. Run it: two sensors, one bus
  2. Who is on the bus
  3. Raw words and a CRC
  4. Twenty bits in five bytes
  5. When does it fog
  6. Which one is right
BME680 and SGP30: pressure and gasAir pressure into altitude with a BME680, then the two metal-oxide gas sensors: the BME680’s hot plate against a clean-air baseline, and the SGP30’s TVOC and CO2eq, its warm-up and its humidity compensation.65 min
  1. Run it: a weather station with a nose
  2. Pressure is height
  3. Fumes on the hot plate
  4. Say something
  5. Fifteen seconds of warm-up
  6. After the warm-up
  7. CO2eq is not CO2

Materials

  • Air quality sensor, SGP30
  • Arduino Uno R3
  • Gas and weather, BME680
  • Humidity sensor, AHT20
  • Temperature and humidity, SHT31

Check for understanding

Each student finishes "BME680 and SGP30: pressure and gas" on their own, without opening the hints. The simulator checks 7 of its 7 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "CO2eq is not CO2".

Chapter 3. About 1 h 50 min

What you breathe

Real CO2 and fine particles, and the health numbers that grade them.

LessonTimeWhat students do
Real CO2 with an SCD41A photoacoustic NDIR sensor that measures CO2 itself, every five seconds: the data-ready flag, the ventilation bands from fresh air to the workplace limit, a warning lamp, and why every CO2 sensor needs calibrating.55 min
  1. Run it: CO2, measured
  2. What the numbers mean
  3. The warning lamp
  4. The workplace limit
  5. A stricter lamp
  6. Keeping it honest
Particles with a PMS5003A laser particle counter read byte by byte: the 32-byte frame and its checksum, PM1.0, PM2.5 and PM10, a running average graded on the US AQI bands and the WHO guideline, and sleep on the SET pin.55 min
  1. Run it: counting dust
  2. Thirty-two bytes
  3. Burn the toast
  4. The AQI bands
  5. The WHO line
  6. Let it sleep

Materials

  • Air quality sensor, PMS5003
  • Arduino Uno R3
  • CO2 sensor, SCD41
  • LED
  • Resistor

Check for understanding

Each student finishes "Particles with a PMS5003" 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: "Let it sleep".

Chapter 4. About 1 h 5 min

Boss: the cabin

Every sensor on one bus, keeping a space station module breathable.

LessonTimeWhat students do
Boss: a space station cabin air monitorPut it all together: CO2 from an SCD41, temperature and humidity from an SHT31 and particles from a PMS5003, each graded OK, WARN or ALARM, the worst on an LCD, a red lamp and a buzzer, for a module with no window to open.65 min
  1. Run it: the cabin
  2. The worst grade wins
  3. The lamp
  4. Sound the alarm
  5. Crumbs in the air
  6. Damp air
  7. Your own rule

Materials

  • Air quality sensor, PMS5003
  • Arduino Uno R3
  • Buzzer
  • Character LCD with I2C backpack
  • CO2 sensor, SCD41
  • LED
  • Resistor
  • Temperature and humidity, SHT31

Check for understanding

Each student finishes "Boss: a space station cabin air monitor" on their own, without opening the hints. The simulator checks 7 of its 7 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Your own rule".

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.