Skip to content

DS18B20 Temperature Sensor Interface (ESP32)

Overview

This circuit connects a DS18B20 1‑Wire temperature sensor to an ESP32 GPIO.\ The design includes optional noise‑hardening components intended for electrically noisy environments such as engines or alternator systems.

The interface operates in normal powered mode (not parasite mode) with a standard 1‑Wire pull‑up resistor.


Circuit Topology (design intent)

3.3 V → 4.7 kΩ pull‑up → DATA node → ESP32 GPIO\ DATA node → 100 Ω series resistor → DS18B20 DQ pin\ DATA node → 1 nF capacitor → GND

The capacitor is intended to sit on the MCU side of the series resistor — between the DATA node (GPIO pin side) and GND — so that it filters noise before it reaches the ESP32.


Designators (V9 build)

Element Designator Value Footprint
Pull-up to 3V3 R77 4.7 kΩ 2512 (oversized for hand-replaceability)
Series resistor (MCU to sensor node) R1 100 Ω 0603
Noise filter cap (MCU side, to GND) C49 1 nF 0603

Sensor connects through RJ5 cable 1 pin 3 (Orange/White wire, TEMP-DQ).

PCB Revision Notes

Rev 7 and Rev 8 — Cap Pad on Wrong Side

On Rev 7 and Rev 8 PCBs, the 1 nF capacitor footprint was accidentally placed on the sensor side of the 100 Ω resistor rather than the MCU side. The actual circuit on those boards was:

3.3 V → 4.7 kΩ pull‑up → DATA node → ESP32 GPIO\ DATA node → 100 Ω series resistor → sensor node → DS18B20 DQ pin\ sensor node → 1 nF capacitor → GND ← wrong side

Effect: The RC filter still attenuates noise arriving from the sensor wire (which is the dominant noise path in an alternator environment), so the cap provides partial benefit even in this position. However, it does not filter noise that couples onto the PCB trace between the GPIO pin and the resistor.

Field workaround on Rev 7/8: The cap can be left installed. It still helps. If communication errors increase, remove it (see Troubleshooting below) — the pad is accessible and the cap can be physically removed the same way as intended.

V9 — Fix Applied

V9 has the cap on the correct (MCU) side of the series resistor. Per netlist audit 2026-05-23: C49 (1 nF) sits between the ESP32 GPIO13 net and GND, and R1 (100 Ω) sits between that node and the off-board sensor wire. This matches the original design intent and gives full noise rejection both for radiated pickup on the sensor cable and for any RFI that couples onto the MCU-side PCB trace.


Components

Pull‑Up Resistor

Value: 4.7 kΩ\ Purpose: Required by the 1‑Wire protocol because both the ESP32 and DS18B20 use open‑drain signaling.

When neither device pulls the line low, the pull‑up resistor restores the line to 3.3 V.

Package Choice

The pull‑up resistor is intentionally implemented using a large package:

Reason: This large footprint makes hand replacement easy if the user ever needs to service the board. The resistor is large enough to be comfortably replaced using a soldering iron without specialized rework tools.

Series Resistor

Value: 100 Ω

Purpose: • Limits fault current if the MCU pin is misconfigured\ • Provides mild signal damping\ • Improves ESD robustness on the data line

The resistor is not required for normal DS18B20 operation but adds robustness.

Noise Filter Capacitor

Value: 1 nF

Purpose: • Filters high‑frequency electrical noise\ • Helps suppress spikes on long wires or in electrically noisy environments

The capacitor forms a small RC filter with the 100 Ω resistor.

RC time constant:

τ = R × C\ τ = 100 Ω × 1 nF\ τ ≈ 100 ns

This is much shorter than typical 1‑Wire timing windows and normally does not affect communication.


Troubleshooting Strategy

If communication problems occur, remove optional filtering components in this order:

  1. Remove the 1 nF capacitor
  2. Remove the 100 Ω series resistor

The minimal canonical circuit for DS18B20 operation is:

3.3 V → 4.7 kΩ → DATA → ESP32 + DS18B20

Note for Rev 7/8: On these boards the cap pad is on the sensor side of the resistor (see PCB Revision Notes above). Removing the cap is still the correct first step — the pad is accessible and the cap can be physically removed with a soldering iron.


Notes

• The capacitor is intended on the MCU side of the series resistor (between GPIO pin and GND), not the sensor side. Rev 7/8 boards have this wrong — see PCB Revision Notes.\ • The circuit assumes short PCB traces or moderate cable length. Very long cables may require pull‑up tuning.