Skip to content

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., your practice guide

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 Tool

Tier 1 · Web · No account

Version tested: Compiled and booted by the Wokwi gate (ESP32 Arduino core 3.3.11); captured in the Wokwi web editor on 2026-09-09. Date: 2026-09-09.

Open 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.

diagram.json

558 bytes · Circuit connections

Download

sketch.ino

1,009 bytes · ESP32 program

Download

  1. Use the launch button above to open the ESP32 editor in Wokwi.
  2. Select the editor’s diagram.json tab and replace all its text with the supplied diagram.json.
  3. Select the sketch.ino tab, replace all its text with the supplied sketch.ino, then click Start Simulation.

Steps

Screens captured against Wokwi ESP32 Compiled and booted by the Wokwi gate (ESP32 Arduino core 3.3.11); captured in the Wokwi web editor on 2026-09-09 on 2026-09-09; the tool may have moved on — the text steps are the contract.

  1. 1 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: The LDR module analog output connects to ESP32 GPIO34. The ring marks the sensor and signal path.
    Step 1 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  2. 2 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: The code records sample number, sensor identity, setup state, counts, voltage, and validity. The ring marks the evidence fields.
    Step 2 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  3. 3 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: LDR LAB scope=direction-only reference=none QUESTION does-light-change-move-the-recorded-signal The ring marks the bounded claim.
    Step 3 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  4. 4 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: EVIDENCE n=2 id=ldr state=BASE raw=1001count V=0.807 valid=Y. The ring marks the baseline record.
    Step 4 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  5. 5 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: EVIDENCE n=5 id=ldr state=SHADE raw=2532count V=2.040 valid=Y. The ring marks the changed record.
    Step 5 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  6. 6 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: EVIDENCE n=8 id=ldr state=BRIGHT raw=157count V=0.127 valid=Y. The ring marks the bright-state record.
    Step 6 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  7. 7 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: EVIDENCE n=11 id=ldr state=RETEST raw=1001count V=0.807 valid=Y. The ring marks the repeatability check.
    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.

  1. 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 check
  2. A 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 check
  3. What should the team do about the installed sensor measuring board heat?

    Return to the chapter’s knowledge check

Caution

The Wokwi control is a model input and the ADC result is not calibrated lux. On hardware, record placement, orientation, spectral response, optical cover, reference instrument, ADC supply, and uncertainty. Never infer energy efficiency, occupancy, safety, or whole-room illumination from this short direction-only exercise.

Return to Sensor Hardware Selection · Browse Labs