Raspberry Pi practice problem · Sensors
Wait for it to settle
HardBudget $7Python · gpiozero
A DS18B20 on GPIO4 (4.7 kΩ pull-up, or the probe module) and a green LED on GPIO17. The probe has just been dropped into hot water and is still climbing.
Read it continuously (each read takes 0.75 s). The reading has settled when the last three readings are all within 0.5 °C of each other (highest − lowest ≤ 0.5). When that first happens, print the newest reading with one decimal and light the LED:
Settled at 59.5 C
Print it once. The test climbs 30 → 40 → 48 → 54 → 57 → 58.5 → 59.25 → 59.5 °C, one step per second from 0.5 s, then holds at 59.5 °C.