
Mechatronics Lab Professor — SJSU
Photoresistor
Analog sensing lab using photoresistors (LDRs) to teach voltage dividers, ADC resolution, and light-based threshold detection with Arduino.
Lab 5: Photoresistor introduced students to analog sensing and the analog-to-digital conversion pipeline on the Arduino. Using a light-dependent resistor (LDR) in a voltage divider circuit, students explored how physical phenomena (ambient light intensity) translate into measurable electrical signals and, ultimately, digital values in software.
The lab walked through the theory of photoresistive materials, the relationship between illuminance (lux) and resistance, and how the voltage divider equation maps that resistance change to a 0–5 V signal readable by the ATmega328P's 10-bit ADC. Students observed the non-linear characteristic curve of the LDR and discussed linearization techniques, including lookup tables and logarithmic fitting.
Practical exercises included building a light-level meter with serial output, implementing threshold-based control (e.g., turning on an LED when ambient light drops below a set point), and exploring hysteresis to prevent oscillation near the switching threshold. The lab reinforced the broader course theme of integrating software codes into hardware systems, ensuring students grasped real-time sensor-to-actuator workflows.