Sensors & Measurement · Study deck

Light and Proximity Labs: Calibrating Sensors

Picture a cupboard light that should turn on when a hand reaches inside.

Physics Phoebe is your guide for this deck.

sensorproximitylight
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Interface light sensors: Configure BH1750 digital lux meter and LDR analog sensors
  • Build proximity detection: Use PIR motion sensors and HC-SR04 ultrasonic distance sensors
  • Compare touch sensing technologies: Differentiate capacitive and skin-inspired tactile sensor architectures
  • Diagnose I2C communication: Scan buses, address multiple sensors, and resolve communication issues
Disassembled flush wall PIR detector showing its housing, Fresnel lens, circular circuit board, and terminals
Disassembled flush wall PIR detector showing its housing, Fresnel lens, circular circuit board, and terminals
iotclass.org

Major section

Start With the Measurement Story

General purpose input output (GPIO) pins are simple digital connections that read or set an on-or-off state.

  • Inter-integrated circuit (I2C) is a shared wired link that lets a controller talk to addressed parts.
  • One short lab cannot cover every material or room.
  • The BH1750 example uses an I2C interface and reports the light level in lux.
Compact PIR board module with a small white Fresnel dome and pin interface
Compact PIR board module with a small white Fresnel dome and pin interface
iotclass.org

Major section

Learning Points: Light Sensing

A light reading supports different actions as the available natural illumination changes during the day.

  • Street lighting can dim when natural light is sufficient, while a display adjusts backlighting for its viewing conditions.
  • Smart street lights: Dim when natural light is sufficient.
  • The light lab established how illumination becomes a stable decision.
iotclass.org

Major section

Proximity & Presence Sensors

PIR (Passive Infrared) sensors detect motion by measuring changes in infrared radiation from warm bodies (humans, animals).

  • The lens and housing determine optical zones, adjustment access, weather and tamper protection, and mounting repeatability; none of them changes the PIR evidence boundary examined next.
  • What to Observe Before Coding: PIR sensors do not identify people.
  • They detect changes in infrared energy across their detection zones.
Exposed PIR development module with Fresnel lens and adjustment controls
Exposed PIR development module with Fresnel lens and adjustment controls
iotclass.org

Major section

Learning Points: PIR Sensors

A PIR motion sensor provides a digital state for a motion-triggered light or alert.

  • The sensor needs a warm-up interval after power-on before the test should judge its normal behavior.
  • Sensitivity and hold-time controls change detection and output persistence rather than converting the output into an illuminance reading.
  • A useful test connects motion in the detection area to the expected light or security response.
Enclosed wall-mounted security PIR detector with a broad lens window and indicator
Enclosed wall-mounted security PIR detector with a broad lens window and indicator
iotclass.org

Major section

Checkpoint: Presence Evidence

Ultrasonic ranging answers a different question: how far away the reflecting surface is, and whether the timing math still holds under the current air temperature.

  • The HC-SR04 operates at 5V logic, but the ESP32 GPIO pins are 3.3V.
  • The ECHO pin outputs a 5V HIGH signal that can damage the ESP32.
  • What to Observe Before Coding: The HC-SR04 measures time, not distance directly.
Rear of a blue HC-SR04 ultrasonic sensor circuit board, showing several integrated circuits, small surface-mount components and a row of four metal header pins. The two round transmit and receive transducers are not visible from this side.
Rear of a blue HC-SR04 ultrasonic sensor circuit board, showing several integrated circuits, small surface-mount components and a row of four metal header pins. The two round transmit and receive transducers are not visible from this side.
iotclass.org

Major section

Ultrasonic Measurement Flow

An ultrasonic distance measurement starts with a trigger and uses the returning echo pulse as timing evidence.

  • The measured echo interval includes the outward and return travel of the sound.
  • Temperature affects the speed of sound, so compensation changes the conversion from elapsed time to the reported distance.
  • where ddd is distance, ttt is echo pulse duration in microseconds, and vsoundv_{\text{sound}}vsound​ is 343 m/s (0.0343 cm/µs) at 20°C.
iotclass.org

Deck summary

Key takeaways

General purpose input output (GPIO) pins are simple digital connections that read or set an on-or-off state.

  • A light reading supports different actions as the available natural illumination changes during the day.
  • PIR (Passive Infrared) sensors detect motion by measuring changes in infrared radiation from warm bodies (humans, animals).
  • A PIR motion sensor provides a digital state for a motion-triggered light or alert.
  • Ultrasonic ranging answers a different question: how far away the reflecting surface is, and whether the timing math still holds under the current air temperature.
iotclass.org

Retrieval practice

Recall check 1 of 2

Physics Phoebe says: answer from memory, then check your reasoning.

Q1An automatic display needs brighter backlighting in bright daylight. Which measurement fits the chapter’s example?

AA PIR motion output as a daylight measurement
BA sensor’s I2C address as the brightness level
CThe power-down current as a proxy for daylight
DAmbient illuminance from the digital light sensor
Show answer

Answer: D The light-sensing example connects lux measurements to display brightness.

iotclass.org

Retrieval practice

Recall check 2 of 2

Physics Phoebe says: answer from memory, then check your reasoning.

Q2A motion-light prototype is evaluated immediately after power-on. What condition should the tester account for?

ATreating a HIGH output as a measured illumination level.
BUsing the light sensor address as proof that PIR is ready.
CAllowing the PIR sensor's start-up warm-up interval.
DTreating hold time as a substitute for initial PIR warm-up.
Show answer

Answer: C The section states that the sensor needs a warm-up period after power-on.

iotclass.org

Print reference

Answers

Answer key.

  1. D · The light-sensing example connects lux measurements to display brightness.
  2. C · The section states that the sensor needs a warm-up period after power-on.
iotclass.org