Difference between revisions of "DS18B20 Temperature Sensor Module"
From Geeetech Wiki
(→Example code) |
(→Example code) |
||
Line 49: | Line 49: | ||
Serial.print("F"); | Serial.print("F"); | ||
Serial.println(); | Serial.println(); | ||
− | } | + | } |
==how to buy== | ==how to buy== | ||
Click here to buy [http://www.geeetech.com/arduino-digital-ds18b20-temperature-sensor-p-17.html DS18B20 Temperature Sensor Module] | Click here to buy [http://www.geeetech.com/arduino-digital-ds18b20-temperature-sensor-p-17.html DS18B20 Temperature Sensor Module] |
Revision as of 02:30, 9 May 2012
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) { 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