DS18B20 Temperature Sensor Module
From Geeetech Wiki
introduction
This breakout uses the DS18B20 1-Wire digital temperature sensor from Maxim IC. It can Reports degrees C with 9 to 12-bit precision, -55C to 125C (+/-0.5C). Each
sensor has a unique 64-Bit Serial number etched into it - allows for a huge number of sensors to be used on one data bus. This is a wonderful part that is the corner
stone of many data-logging and temperature control projects.
Features
- 3.0-5.5V input voltage
- Waterproof
- -55°C to+125°C temperature range
- ±0.5°C accuracy from -10°C to +85°C
- 1 Wire interface
Usage
Document
Example code
#include <DallasTemperature.h> DallasTemperature tempSensor; // You may instantiate as many copies as you require. void setup(void) { Serial.begin(9600); tempSensor.begin(12); // Data wire is plugged into port 12 on the Arduino Serial.println("Dallas Temperature IC Control Library 1.0. Miles Burton"); } void loop(void) { // Ask the library whether the device is valid switch(tempSensor.isValid()) { case 1: Serial.println("Invalid CRC");
tempSensor.reset(); // Attempts to redetect IC return;
case 2: Serial.println("Not a valid device");
tempSensor.reset(); // Attempts to redetect IC
return; } Serial.print(tempSensor.getTemperature()); Serial.print("C"); Serial.println(); Serial.print(DallasTemperature::toFahrenheit(tempSensor.getTemperature())); Serial.print("F"); Serial.println();
}
how to buy
Click here to buy DS18B20 Temperature Sensor Module