Read temperature and relative humidity while separating resolution from accuracy.
Physics Phoebe Predict the reading, then compare it with the measurement.
Wokwi ESP32
Third party Tool
Tier 2 · Web · paste-in setup · Account needed to save a project
Version tested: Compiled with arduino-cli 1.5.2-rc.1 for esp32 core 3.3.11; booted headlessly with wokwi-cli 0.26.1 on 2026-09-07; serial line 'T=24.0 C, RH=40.0 %' seen at 5.361 s (wall time from CLI start; scenario timeout 20 s simulated time); captured in the Wokwi web editor on 2026-09-09. Date: 2026-09-05.
Open the ESP32 editor, paste diagram.json, then paste 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
Screens captured against Wokwi ESP32 Compiled with arduino-cli 1.5.2-rc.1 for esp32 core 3.3.11; booted headlessly with wokwi-cli 0.26.1 on 2026-09-07; serial line 'T=24.0 C, RH=40.0 %' seen at 5.361 s (wall time from CLI start; scenario timeout 20 s simulated time); captured in the Wokwi web editor on 2026-09-09 on 2026-09-05; the tool may have moved on — the text steps are the contract.
1 Step 1
Do
In the Simulation panel, inspect the DHT22 wiring after pasting both supplied files.
You will see
Input: inspect the running Wokwi circuit and diagram.json tab.
The DHT22 has red power and black ground leads.
Its green data lead reaches ESP32 GPIO 15.
The same tool window reports T=24.0 C, RH=40.0 %.
Why it matters
The capture ties the serial reading to this wired DHT22.
Power, ground, and data paths are all visible.
The GPIO 15 route identifies the signal used by the sketch.
This is a simulator configuration, not installed sensor accuracy.
In the sketch.ino editor tab, find delay(2000) and the temperature and humidity calculations.
You will see
Input: inspect sketch.ino beside the running Wokwi circuit.
The loop begins with delay(2000).
The sketch converts five DHT bytes to temperature and humidity.
Serial Monitor prints T=24.0 C, RH=40.0 % in this run.
Why it matters
The 2000 ms delay sets the sketch's sampling interval.
The one-decimal serial line shows its output format.
The code checks reception and checksum before printing values.
The programmed interval does not measure physical response time.
In the Simulation toolbar, click the play button and wait for compilation.
You will see
Input: click Start the simulation in Wokwi.
The toolbar changes to a visible Stop control.
The simulator clock reaches 00:07.166 in the capture.
Serial Monitor below the circuit prints T=24.0 C, RH=40.0 %.
Why it matters
The running timer and Stop control confirm execution.
The Serial Monitor supplies the first measured simulator values.
The DHT22 and ESP32 remain visible beside that readout.
A reference instrument would still be needed for installed accuracy.
In the Serial Monitor panel, read the first temperature and humidity result after at least two seconds.
You will see
Input: leave the DHT22 at 24 C and 40% in Wokwi.
Observed: "T=24.0 C, RH=40.0 %".
Expected: 24.0 C and 40.0% RH.
The measured line matches the real screenshot.
Why it matters
This establishes both channels before either control changes.
The firmware reports each value to one decimal place.
The simulator settings reach the serial readout.
One simulated reading does not establish physical accuracy.
In the Simulation panel, select the DHT22 and set its temperature control to 30 °C.
You will see
Input: set the DHT22 temperature control to 30 C in Wokwi.
Observed: "T=30.0 C, RH=40.0 %".
Expected: temperature changes while humidity stays at 40.0%.
The control displayed 30 C in this run.
Why it matters
Only one simulated sensor channel changed.
The Serial Monitor value matches the real screenshot.
The 6 C difference from baseline is visible.
This does not establish physical sensor accuracy.
In the DHT22 control panel, set relative humidity to 70%.
You will see
Input: keep temperature at 30 C and set humidity to 70%.
Observed: "T=30.0 C, RH=70.0 %".
Expected: humidity changes by 30 percentage points.
Temperature remained at the prior 30 C setting.
Why it matters
The two controls can be varied independently.
The run printed both updated values together.
The screenshot marks the same 70.0% response.
The result is a controlled simulator reading.
In the DHT22 control panel, restore temperature to 24 °C and relative humidity to 40%.
You will see
Input: restore DHT22 controls to 24 C and 40%.
Observed: "T=24.0 C, RH=40.0 %".
Expected: the starting serial line returns.
Both Wokwi controls displayed their original settings.
Why it matters
The final reading repeats the baseline values.
This closes the change-and-restore sequence.
The screenshot marks the same restored line.
No physical drift is measured in this simulation.
A team chooses a sensor because it is inexpensive, but the field environment causes frequent drift and replacement visits. Which specification review was incomplete?