DS18B20 Temperature Sensor
Digital temperature sensing device using 1-Wire communication.
What is the DS18B20 Temperature Sensor and what is it used for?
Digital temperature sensing device using 1-Wire communication. Makers use it to read temperature with suitable pull-up.
Temperature monitoring
Sensors convert a physical quantity into an electrical signal. Calibrate, verify module supply, interfaces and environmental limits.
Key specifications
| Sensor spec | Value |
|---|---|
| Measures | Temperature |
| Range | −55 to 125 °C |
| Accuracy | ±0.5 °C from −10 to 85 °C |
| Interface | 1-Wire (many sensors on one pin; each has a 64-bit ID) |
| Supply voltage | 3.0 to 5.5 V |
| Operating temperature | −55 to 125 °C |
Pinout
How to use it
Needs a 4.7 kΩ pull-up on the data line. The waterproof probe version is ideal for liquids and soil. Use the OneWire and DallasTemperature libraries.
#include <OneWire.h>
#include <DallasTemperature.h>
OneWire bus(4);
DallasTemperature t(&bus);
void setup() { Serial.begin(115200); t.begin(); }
void loop() { t.requestTemperatures(); Serial.println(t.getTempCByIndex(0)); delay(1000); }Applications
Builds that use it
Temperature threshold alarm
Sensor fault detector
1-Wire sensor bus
Temperature graph on a graphic LCD
Two-point sensor calibration
Battery safety checker for toys
ESP32 mesh network
Li-po safe charging box
Alternatives
- DHT22 SensorAdds humidity, not waterproof
Common questions
What is the DS18B20 Temperature Sensor used for?
In products: temperature monitoring. In maker projects: read temperature with suitable pull-up.
How does the DS18B20 Temperature Sensor work?
Sensors convert a physical quantity into an electrical signal. Calibrate, verify module supply, interfaces and environmental limits.
What voltage does the DS18B20 Temperature Sensor need?
3.0 to 5.5 V.
How do I connect the DS18B20 Temperature Sensor to an Arduino or ESP32?
1-Wire (many sensors on one pin; each has a 64-bit ID). Pins: GND (Ground (black)), DQ (Data (yellow), 4.7 kΩ pull-up to VCC), VDD (3.0 to 5.5 V (red)).
What can I use instead of the DS18B20 Temperature Sensor?
DHT22 Sensor.
