What it is: The DS18B20 is a precise digital temperature sensor (-55 to +125 °C, ±0.5 °C) that talks over Maxim's 1-Wire bus. It comes as a small TO-92 chip or a waterproof stainless probe.
How it works: Each sensor has a unique 64-bit address, so many can share one data wire. The ESP32 sends a "convert" command, waits, then reads back the temperature over the same wire.
Wiring:
DS18B20 DATA (middle) -> GPIO10
DS18B20 VDD -> 3V3
DS18B20 GND -> GND
IMPORTANT: add a 4.7k pull-up resistor between DATA and 3V3 — the bus does not work reliably without it.
OLED VCC=3V3, GND=GND, SDA=GPIO4, SCL=GPIO5
Libraries: "OneWire" by Paul Stoffregen, "DallasTemperature" by Miles Burton, plus "Adafruit SSD1306" and "Adafruit GFX Library".
On screen / Serial: temperature in °C with one decimal, updated about twice a second. A reading of -127 °C means the sensor wasn't found — check the pull-up and the DATA wire.
Gotchas: The waterproof probe's wire colors vary; commonly red=VDD, black=GND, yellow=DATA, but verify with a multimeter. Don't skip the 4.7k pull-up.