Build an LDR change-evidence record
Collect a bounded before-change-after-retest LDR record that preserves sensor identity, sample order, units, validity, setup changes, and claim limits.

Physics Phoebe: I want you to preserve the question, state change, units, validity, and retest trigger—not just the number.
Predict the reading, then compare it with the measurement.
Wokwi ESP32
Third party ToolOpen the ESP32 editor, paste diagram.json, then paste sketch.ino.
Open Wokwi to paste in the files (new tab)Get the files
Use both prepared files. This is a paste-in setup; saving a project requires a Wokwi account.
sketch.ino
- Use the launch button above to open the ESP32 editor in Wokwi.
- Select the editor’s diagram.json tab and replace all its text with the supplied diagram.json.
- Select the sketch.ino tab, replace all its text with the supplied sketch.ino, then click Start Simulation.
Steps
Step 1
- Do
- In the Wokwi simulation panel, paste diagram.json and sketch.ino into a new Wokwi ESP32 project, then trace the LDR module's analog path.
- You will see
- Input: inspect diagram.json beside the running Wokwi LDR module. The LDR supply uses 3.3 V and common ground. Its analog output A0 reaches ESP32 GPIO34. Serial Monitor records STARTUP raw=1001count V=0.807 valid=Y.
- Why it matters
- The sensor id and analog path are visible in one tool window. The baseline count belongs to this wired model. The supply and ground complete the setup context. That context is needed before interpreting later changes.

Step 1 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 2
- Do
- In the Wokwi simulation panel, inspect the serial change-note handler and evidence-record output.
- You will see
- Input: inspect the serial handler and EVIDENCE printf in sketch.ino. The handler stores named changes such as BASE and RETEST. The record includes n, id=ldr, state, raw counts, V, and valid. Serial Monitor prints STARTUP raw=1001count V=0.807 valid=Y.
- Why it matters
- The sequence number retains sample order. The state label ties a value to its test condition. Units and validity make the ADC output interpretable. The real baseline line demonstrates all those fields together.

Step 2 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 3
- Do
- Start Wokwi and read the declared scope and measurement question in Serial Monitor.
- You will see
- Input: start the supplied Wokwi ESP32 sketch and open Serial Monitor. Observed: "LDR LAB scope=direction-only reference=none". Observed: "QUESTION does-light-change-move-the-recorded-signal". Observed first sample: "EVIDENCE n=1 id=ldr state=STARTUP raw=1001count V=0.807 valid=Y".
- Why it matters
- The run declares a direction-only measurement question. The first 500-lux fixture reading is 1001 raw counts. No reference calibration is present in this teaching setup. The startup record cannot establish the later SHADE or BRIGHT response.

Step 3 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 4
- Do
- Send BASE in Serial Monitor while the supplied LDR control remains at 500 lux.
- You will see
- Input: leave the Wokwi LDR at 500 lux and send BASE. Serial Monitor: CHANGE note=BASE retest-required=yes. The next row is EVIDENCE n=2 id=ldr state=BASE. That row reports raw=1001count V=0.807 valid=Y.
- Why it matters
- The BASE label records the starting condition. The count and voltage are observed simulator outputs. The valid flag is Y in this run. Later SHADE and BRIGHT rows can be compared with this baseline.

Step 4 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 5
- Do
- In the Wokwi simulation panel, set the LDR control to 50 lux, send SHADE, and preserve the next reading.
- You will see
- Input: set the Wokwi LDR to 50 lux and send SHADE. Serial Monitor: CHANGE note=SHADE retest-required=yes. The marked EVIDENCE n=5 row has state=SHADE and valid=Y. It reports raw=2532count V=2.040, above BASE's 1001count.
- Why it matters
- The simulated shade input raises the ADC count in this circuit. The SHADE record preserves the same sensor id and units. The paired BASE and SHADE rows establish a direction of change. They do not calibrate the ADC voltage as physical lux.

Step 5 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 6
- Do
- In the Wokwi simulation panel, set the LDR control near 10,000 lux (the slider shows 9976 lux), send BRIGHT, and preserve the next reading.
- You will see
- Input: move the real Wokwi LDR slider to 9976 lux and send BRIGHT. Serial Monitor: CHANGE note=BRIGHT retest-required=yes. The marked EVIDENCE n=8 row has state=BRIGHT and valid=Y. It reports raw=157count V=0.127, below BASE's 1001count.
- Why it matters
- The bright input moves the ADC count below baseline. The 157 count result is inside the 12-bit ADC range. The same id and validity fields remain visible. This second direction check strengthens the limited simulator claim.

Step 6 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 7
- Do
- In the Wokwi simulation panel, restore the LDR control to 500 lux, send RETEST, and compare with the baseline.
- You will see
- Input: return the Wokwi LDR slider to 500 lux and send RETEST. Serial Monitor: CHANGE note=RETEST retest-required=yes. The marked EVIDENCE n=11 row has state=RETEST and valid=Y. It reports raw=1001count V=0.807, matching the BASE row.
- Why it matters
- The simulated return reproduces the baseline count. The voltage also returns to 0.807 V. This supports repeatability for this Wokwi configuration. Changing placement or hardware would require a new measurement record.

Step 7 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
Chapter checks
These questions refer to the chapter’s examples. Use the return links to review their answers.
A team chooses a sensor module because it is easy to wire, but the review does not state placement, calibration, environment, or the decision it supports. What is the strongest finding?
Return to the chapter’s knowledge checkA soil-moisture sensor works during a classroom demo but degrades after outdoor installation. What should the practitioner add to the hardware decision record?
Return to the chapter’s knowledge checkWhat should the team do about the installed sensor measuring board heat?
Return to the chapter’s knowledge check