Smart Night-Light Activity and Data Analysis

Professor Laura Cruz Castro and Maryam Khalid Multani developed this activity.

The activity introduces a smart night‑light system that bridges basic microelectronics with quantitative data analysis. By situating a photoresistor‑based illumination sensor within an Arduino‑controlled circuit, students explore how physical measurements can be transformed into actionable control logic. The exercise highlights the relevance of sensor‑driven design for embedded‑system engineering and computational modeling.

In the Tinkercad environment, learners construct a voltage‑divider circuit using a photoresistor, a 10 kΩ resistor, an LED, and a 220 Ω current‑limiting resistor connected to an Arduino Uno. The Arduino program continuously reads the analog voltage on pin A0, compares each reading to a scalar threshold, and drives the LED high when the reading falls below that threshold. Recorded sensor values are exported as a MATLAB vector `lightReadings`, and a MATLAB function `analyzeNightLight` computes the number of dark readings, the average, minimum, and maximum light levels, and a logical vector `ledOn` that flags the LED‑on condition. The function employs built‑in MATLAB operations such as `mean`, `min`, `max`, and element‑wise logical comparisons, and it is required to handle both row and column vectors without producing console output.

With this knowledge, learners are able to build and test the smart night‑light circuit in Tinkercad, program the Arduino to interpret photoresistor data, and analyze the resulting measurements in MATLAB to determine illumination‑dependent LED control. By writing the multi‑output MATLAB function, they gain experience in extracting summary statistics and generating logical control signals, skills that translate directly to real‑world applications such as automated lighting, energy‑saving systems, and data‑driven embedded device design.

Previous
Previous

Fragment Frenzy

Next
Next

Signals Through Headphones and Noise Cancellation