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

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

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
    Paste diagram.json and sketch.ino into a new Wokwi ESP32 project, then trace the LDR module's analog path.
    You will see
    The module uses 3.3 V and common ground, with analog output connected to GPIO34.
    Why it matters
    The controller, sensor identity, supply, and signal path are setup evidence for every later reading.
    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
    Inspect the serial change-note handler and evidence-record output.
    You will see
    Each record preserves sample order, LDR identity, named setup state, ADC counts, voltage, and validity.
    Why it matters
    A value without identity, units, context, and validity cannot support a reviewable interpretation.
    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 the simulation and read the declared scope and measurement question.
    You will see
    The lab declares direction-only scope, no reference, and asks whether a light change moves the recorded signal.
    Why it matters
    The declaration prevents simulated ADC values from being mistaken for calibrated lux or building-performance evidence.
    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
    The next valid record pairs a BASE state with an ADC count and derived voltage.
    Why it matters
    A named starting condition gives the later direction-of-change result a comparison point.
    Step 4: EVIDENCE n=4 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
    Set the LDR control to 50 lux, send SHADE, and preserve the next reading.
    You will see
    The SHADE evidence record changes from the baseline while retaining identity, count units, voltage, and valid state.
    Why it matters
    The before-and-after pair supports only the direction-of-change claim in this simulated setup.
    Step 5: EVIDENCE n=7 id=ldr state=SHADE raw=2531count 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
    Set the LDR control to 10,000 lux, send BRIGHT, and preserve the next reading.
    You will see
    The BRIGHT record moves in the opposite direction from SHADE and remains within the 12-bit ADC range.
    Why it matters
    Exercising both sides of the baseline is stronger evidence than one attractive reading.
    Step 6: EVIDENCE n=10 id=ldr state=BRIGHT raw=156count V=0.126 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
    Restore the LDR control to 500 lux, send RETEST, and compare with the baseline.
    You will see
    The RETEST record returns near the original simulated baseline value.
    Why it matters
    A return test checks repeatability and states the trigger: any placement, optical cover, wiring, sampling, or reference change requires a new record.
    Step 7: EVIDENCE n=12 id=ldr state=RETEST raw=999count V=0.805 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. A room comfort sensor is mounted inside a sealed electronics box, and its readings track board heat more than room air. What is the best under-the-hood response?

    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