Digital Temperature Probe (DS18B20) – How to Use it?
The DS18B20 Digital temperature sensor provides 9 to 12-bit (configurable) temperature readings which indicate the temperature of the device. The DS18B20 communicates over a 1-Wire bus that by definition requires only one data line (and ground) for communication with a central microprocessor.In addition, the DS18B20 can derive power directly from the data line, eliminating the need for an external power supply.
- Usable temperature range: -55 to 125°C.
- 9 to 12 bit selectable resolution.
- Uses 1-Wire interface- requires only one digital pin for communication.
- Unique 64 bit ID burned into chip.
- Multiple sensors can share one pin.
- ±0.5°C Accuracy from -10°C to +85°C.
- Temperature-limit alarm system.
- Query time is less than 750ms.
- Usable with 3.0V to 5.5V power/data.
This sensor is being widely used in various fields. This sensor has been included in many applications such as Thermostatic Controls,Industrial Systems, Consumer Products,Thermometers,Thermally Sensitive Systems.
Project For Reference:
The Temperature sensor has 3 pins and it should be connected as follows:
- Vcc – 5V.
- Gnd – Gnd.
- Data – D2.
- Pull up resistor of value 4.7kohm between data and supply voltage.
Before going deep into the coding parts, let us download few libraries:
Download Dallas Temperature library- https://github.com/milesburton/Arduino-Temperature-Control-Library
Download One wire library- https://github.com/PaulStoffregen/OneWire
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
Serial.println("Arduino Digital Temperature");
Serial.print("Temperature is: ");