While there are many types of temperature sensors available in the market, the DS18B20 Temperature Sensor form DALLAS is the best choice in applications which require high accuracy and high reliability. Its ultra-small size, low hardware overhead, strong anti-interference capability and high accuracy, together with other additional features makes DS18B20 even more popular among users. For electronic enthusiasts and hobbyists, the DS18B20 is a good start for learning and developing temperature-dependent prototypes.
Technical Specification:
Sensor Type: Digital
Sensing Temperature: -55°C ~ 125°C
Output Type: 1-Wire®
Voltage: 3V ~ 5.5V
Resolution: 12 bit
Accuracy - Highest (Lowest): ±0.5°C (±2°C)
Test Condition: -10°C ~ 85°C (-55°C ~ 125°C)
Operating Temperature: -55°C ~ 125°C
Mounting Type: Through Hole
Package: TO-92-3
Example Sketch & Diagram
Code
#include <OneWire.h> #include <DallasTemperature.h> #define ONE_WIRE_BUS 2 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); void setup(void){ Serial.begin(9600); Serial.println("Dallas Temperature IC Control Library Demo"); sensors.begin(); } void loop(void){ Serial.print("Requesting temperatures..."); sensors.requestTemperatures(); Serial.println("DONE"); Serial.print("Temperature for the device 1 (index 0) is: "); Serial.println(sensors.getTempCByIndex(0)); }
Pinouts: