Lesson plan

Light, color, UV and gesture sensors lesson plan

The digital light sensors read close to their datasheets on the Uno: lux with the BH1750 and VEML7700, the LTR390’s UV index, color with the TCS34725 and by frequency with the TCS3200, APDS-9960 gestures and AMG8833 heat pixels, then a candy color sorter.

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

  • Light in lux and ultraviolet in UV index, and the gain that sets the range.
  • Two color sensors, one with counts on I2C and one with a frequency on a pin.
  • A sensor that sees which way a hand swipes, and one that sees in heat.
  • A color sensor, a servo and a tally: a candy-sorting machine.

Materials for the whole unit

  • Ambient light, VEML7700
  • APDS-9960 gesture sensor
  • Arduino Uno R3
  • Buzzer
  • Character LCD with I2C backpack
  • Color sensor, TCS3200 / TCS230 (GY-31)
  • Color sensor, TCS34725
  • Hobby servo
  • LED
  • Light sensor, BH1750
  • Resistor
  • Thermal camera, AMG8833
  • UV and light, LTR-390

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 2 h 10 min

How bright

Light in lux and ultraviolet in UV index, and the gain that sets the range.

LessonTimeWhat students do
Lux with BH1750 and VEML7700Two digital light meters that answer in lux: the BH1750 read with three Wire calls, the VEML7700 with automatic gain, a streetlight with hysteresis, and what saturates in full sun and how a longer or shorter measurement fixes it.65 min
  1. Run it: two light meters
  2. How bright is bright
  3. Dusk
  4. The streetlight
  5. Two thresholds
  6. Full sun
  7. A shorter measurement
UV index with an LTR390An LTR390 measures visible light and ultraviolet with two photodiodes, one at a time: mode switching, raw counts into a UV index with the datasheet’s sensitivity, the WHO’s exposure bands, and gain against range.65 min
  1. Run it: invisible light
  2. One photodiode at a time
  3. Counts into an index
  4. The beach at noon
  5. Extreme
  6. Too much gain
  7. Less gain, more range

Materials

  • Ambient light, VEML7700
  • Arduino Uno R3
  • LED
  • Light sensor, BH1750
  • Resistor
  • UV and light, LTR-390

Check for understanding

Each student finishes "UV index with an LTR390" 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: "Less gain, more range".

Chapter 2. About 1 h 50 min

What color

Two color sensors, one with counts on I2C and one with a frequency on a pin.

LessonTimeWhat students do
Color with a TCS34725Red, green, blue and clear counts under the sensor’s own white LED: why a color is in the shares and not the counts, naming a color by its hue, what the LED is for, and what too much gain does to a white card.55 min
  1. Run it: four numbers
  2. A green card
  3. Naming a color
  4. White, gray and black
  5. Switch the LED off
  6. Too much gain
TCS3200: color by frequencyA color sensor with no bus at all: four filter groups chosen with two pins, light turned into a square wave, edges counted on an interrupt for a fixed gate time, calibration against white and black cards, and frequency scaling.55 min
  1. Run it: light as a frequency
  2. Choosing a filter
  3. Counting edges
  4. White and black cards
  5. Frequency scaling
  6. Which color sensor

Materials

  • Arduino Uno R3
  • Color sensor, TCS3200 / TCS230 (GY-31)
  • Color sensor, TCS34725

Check for understanding

Each student finishes "TCS3200: color by frequency" 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: "Which color sensor".

Chapter 3. About 1 h 50 min

Hands and heat

A sensor that sees which way a hand swipes, and one that sees in heat.

LessonTimeWhat students do
Gestures with an APDS-9960One chip that sees light, color, a hand coming close and which way it swipes: proximity from reflected infrared, the gesture engine and its FIFO, the interrupt pin, and a lamp you switch and dim with a wave.55 min
  1. Run it: a sensor that watches
  2. A hand comes close
  3. Swipe right
  4. The interrupt pin
  5. Dim it
  6. Finer steps
Heat pixels with an AMG8833An 8x8 thermal camera on I2C: 64 thermopiles that read temperature from a distance, the raw quarter-degree words, a heat map in text, the hottest pixel’s row and column, and a presence lamp that works in the dark.55 min
  1. Run it: a picture in heat
  2. Quarter degrees
  3. Someone there
  4. Move across the room
  5. An empty room
  6. Farther away

Materials

  • APDS-9960 gesture sensor
  • Arduino Uno R3
  • LED
  • Resistor
  • Thermal camera, AMG8833

Check for understanding

Each student finishes "Heat pixels with an AMG8833" 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: "Farther away".

Chapter 4. About 1 h 5 min

Boss: the sorter

A color sensor, a servo and a tally: a candy-sorting machine.

LessonTimeWhat students do
Boss: a candy color sorterBuild a candy-sorting machine: a TCS34725 looks at each candy, a nearest-neighbor match against six taught colors picks a bin, a servo swings the chute, an LCD keeps the tally, and anything unknown goes to the reject bin with a beep.65 min
  1. Run it: the first candy
  2. The chute
  3. Nearest neighbor
  4. The tally
  5. Something it does not know
  6. The beep
  7. Teach it pink

Materials

  • Arduino Uno R3
  • Buzzer
  • Character LCD with I2C backpack
  • Color sensor, TCS34725
  • Hobby servo

Check for understanding

Each student finishes "Boss: a candy color sorter" 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: "Teach it pink".

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.