Skip to content

Verify a DS18B20 conversion

Discover one addressed DS18B20, wait for its 12-bit conversion, and verify positive and negative readings without accepting protocol error values.

How to complete this Wokwi lab

Your task: Verify a DS18B20 conversion

Goal: Discover one addressed DS18B20, wait for its 12-bit conversion, and verify positive and negative readings without accepting protocol error values.

Open the simulator · Read the full text instructions

Use this checklist as you work. Checks last only on this page and do not submit or record completion.

  1. Details for step 1
  2. Details for step 2
  3. Details for step 3
  4. Details for step 4
  5. Details for step 5
  6. Details for step 6
  7. Details for step 7
Simulator unavailable? Use the text fallback

Follow the checklist using the recorded results below. Predict each change, compare it with the recorded result, and explain why it matters. These are the lab's recorded results, not measurements you have made. Run the simulator later to test your predictions.

  1. Recorded result for step 1

    Input: inspect diagram.json beside the running Wokwi circuit. The DS18B20 data lead reaches ESP32 GPIO4. A 4.7 kOhm resistor pulls the shared line to 3.3 V. Serial Monitor reports TEMP value=24.00C status=VALID.

    Why it matters: The resistor is part of this 1-Wire bus path. The running circuit ties a valid reading to that wiring. Power and ground are visible beside the data connection. Bus discovery would be unreliable without the pull-up.

  2. Recorded result for step 2

    Input: inspect sketch.ino while its Wokwi run is active. The source sets ONE_WIRE_PIN=4 and CONVERSION_MS_12_BIT=750. It requests a 12-bit conversion without blocking inside the library. Serial Monitor alternates CONVERT requested and TEMP value=24.00C status=VALID.

    Why it matters: The 750 ms wait belongs to the 12-bit conversion. The repeated valid result follows each request in this run. The source also checks the sensor address and disconnected sentinel. Discovery, completion, and validity are separate claims.

  3. Recorded result for step 3

    Input: start the supplied ESP32 and 1-Wire diagram. Observed: "ONEWIRE FOUND count=1 pin=4 pullup=4.7k". Expected: one sensor on GPIO4 with a 4.7k pull-up. An address line followed in the same run.

    Why it matters: The bus search found one simulated device. The reported pin matches the diagram. Discovery precedes temperature conversion. This is a simulator bus, not a measured resistor.

  4. Recorded result for step 4

    Input: read Serial Monitor after bus discovery. Observed: "ONEWIRE ADDRESS 280102030405069E". Expected: a ROM identifier for the one discovered sensor. It matches the real screenshot.

    Why it matters: The ROM line identifies the simulated device. It follows the count=1 discovery result. The address is a teaching fixture. Keep it with the reading to avoid device confusion.

  5. Recorded result for step 5

    Input: leave the DS18B20 at 24 C. Observed: "CONVERT requested resolution=12bit wait=750ms". Observed: "TEMP value=24.00C status=VALID conversion=750ms". Expected: a valid result after the named wait.

    Why it matters: The request and result appeared together in this run. The VALID result is for the baseline temperature. The 750 ms label explains the conversion interval. This is protocol simulation, not physical calibration.

  6. Recorded result for step 6

    Input: set the DS18B20 temperature control to 30 C in Wokwi. Observed settled line: "TEMP value=30.00C status=VALID conversion=750ms". Expected: a valid 30 C result after conversion. The control displayed 30 C; an intermediate 29.19 C line appeared during slider movement.

    Why it matters: The settled value matches the real screenshot. The 750 ms conversion interval remains in force. The transient line shows why to wait for the slider to settle. The exercise does not calibrate a physical probe.

  7. Recorded result for step 7

    Input: set the DS18B20 temperature control to -7 C in Wokwi. Observed settled line: "TEMP value=-7.00C status=VALID conversion=750ms". Expected: a valid signed negative temperature. The control displayed -7 C; an intermediate 2.81 C line appeared during slider movement.

    Why it matters: The signed reading matches the real screenshot. The VALID status remained set for this in-range fixture. The transient line is distinct from the settled -7 C result. This verifies simulator conversion, not field accuracy.

Review the detailed text steps and cautions below.

Physics Phoebe: I want you to prove identity and conversion completion before trusting the temperature., your practice guide

Physics Phoebe: I want you to prove identity and conversion completion before trusting the temperature.
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

774 bytes · Circuit connections

Download

sketch.ino

1,282 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 1-Wire circuit.
    You will see
    Input: inspect diagram.json beside the running Wokwi circuit. The DS18B20 data lead reaches ESP32 GPIO4. A 4.7 kOhm resistor pulls the shared line to 3.3 V. Serial Monitor reports TEMP value=24.00C status=VALID.
    Why it matters
    The resistor is part of this 1-Wire bus path. The running circuit ties a valid reading to that wiring. Power and ground are visible beside the data connection. Bus discovery would be unreliable without the pull-up.
    Step 1: The DS18B20 data line connects to GPIO4 with a 4.7 kilohm pull-up. The ring marks the sensor and resistor.
    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 device discovery, the nonblocking conversion request, and the 750 ms wait.
    You will see
    Input: inspect sketch.ino while its Wokwi run is active. The source sets ONE_WIRE_PIN=4 and CONVERSION_MS_12_BIT=750. It requests a 12-bit conversion without blocking inside the library. Serial Monitor alternates CONVERT requested and TEMP value=24.00C status=VALID.
    Why it matters
    The 750 ms wait belongs to the 12-bit conversion. The repeated valid result follows each request in this run. The source also checks the sensor address and disconnected sentinel. Discovery, completion, and validity are separate claims.
    Step 2: The code discovers one device, waits 750 ms after conversion, and rejects disconnected readings. The ring marks the protocol checks.
    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 bus discovery line in Serial Monitor.
    You will see
    Input: start the supplied ESP32 and 1-Wire diagram. Observed: "ONEWIRE FOUND count=1 pin=4 pullup=4.7k". Expected: one sensor on GPIO4 with a 4.7k pull-up. An address line followed in the same run.
    Why it matters
    The bus search found one simulated device. The reported pin matches the diagram. Discovery precedes temperature conversion. This is a simulator bus, not a measured resistor.
    Step 3: ONEWIRE FOUND count=1 pin=4 pullup=4.7k The ring marks successful bus discovery.
    Step 3 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  4. 4 Step 4

    Do
    In Serial Monitor, read the discovered sensor ROM code.
    You will see
    Input: read Serial Monitor after bus discovery. Observed: "ONEWIRE ADDRESS 280102030405069E". Expected: a ROM identifier for the one discovered sensor. It matches the real screenshot.
    Why it matters
    The ROM line identifies the simulated device. It follows the count=1 discovery result. The address is a teaching fixture. Keep it with the reading to avoid device confusion.
    Step 4: ONEWIRE ADDRESS 280102030405069E The ring marks the discovered ROM code.
    Step 4 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  5. 5 Step 5

    Do
    Leave the sensor at 24 degrees C and inspect the request and result in Serial Monitor.
    You will see
    Input: leave the DS18B20 at 24 C. Observed: "CONVERT requested resolution=12bit wait=750ms". Observed: "TEMP value=24.00C status=VALID conversion=750ms". Expected: a valid result after the named wait.
    Why it matters
    The request and result appeared together in this run. The VALID result is for the baseline temperature. The 750 ms label explains the conversion interval. This is protocol simulation, not physical calibration.
    Step 5: CONVERT requested resolution=12bit wait=750ms TEMP value=24.00C status=VALID conversion=750ms The ring marks the completed baseline conversion.
    Step 5 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  6. 6 Step 6

    Do
    In the DS18B20 control panel, set temperature to 30 C and read the result in Serial Monitor.
    You will see
    Input: set the DS18B20 temperature control to 30 C in Wokwi. Observed settled line: "TEMP value=30.00C status=VALID conversion=750ms". Expected: a valid 30 C result after conversion. The control displayed 30 C; an intermediate 29.19 C line appeared during slider movement.
    Why it matters
    The settled value matches the real screenshot. The 750 ms conversion interval remains in force. The transient line shows why to wait for the slider to settle. The exercise does not calibrate a physical probe.
    Step 6: TEMP value=30.00C status=VALID conversion=750ms The ring marks the changed positive temperature.
    Step 6 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  7. 7 Step 7

    Do
    In the DS18B20 control panel, set temperature to -7 C and read the result in Serial Monitor.
    You will see
    Input: set the DS18B20 temperature control to -7 C in Wokwi. Observed settled line: "TEMP value=-7.00C status=VALID conversion=750ms". Expected: a valid signed negative temperature. The control displayed -7 C; an intermediate 2.81 C line appeared during slider movement.
    Why it matters
    The signed reading matches the real screenshot. The VALID status remained set for this in-range fixture. The transient line is distinct from the settled -7 C result. This verifies simulator conversion, not field accuracy.
    Step 7: TEMP value=-7.00C status=VALID conversion=750ms The ring marks the valid signed temperature.
    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. Several DS18B20 sensors share one GPIO. What lets the controller distinguish their readings?

    Return to the chapter’s knowledge check
  2. The lab sensor reads 85 °C immediately after power-up. What should firmware check first?

    Return to the chapter’s knowledge check

Caution

Wokwi verifies the digital sequence, not cable integrity, absolute accuracy, self-heating, or waterproof-probe construction. On hardware, verify pin order, use the pull-up, wait for the configured resolution, check CRC and disconnection sentinels, and compare readings with a traceable reference.

Return to Temperature Sensor Labs: Comparing Sensor Types · Browse Labs