Difference between revisions of "DS18B20 Temperature Sensor Module"
From Geeetech Wiki
(→Example code) |
(→how to buy) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 18: | Line 18: | ||
[[File:DS18b20b.jpg]] | [[File:DS18b20b.jpg]] | ||
− | [[File:DS18B20 wiring.jpg| | + | [[File:DS18B20 wiring.jpg|400px]] |
==Document== | ==Document== | ||
Line 36: | Line 36: | ||
case 1: | case 1: | ||
Serial.println("Invalid CRC"); | Serial.println("Invalid CRC"); | ||
− | + | tempSensor.reset(); // Attempts to redetect IC | |
return; | return; | ||
case 2: | case 2: | ||
Line 49: | Line 49: | ||
Serial.print("F"); | Serial.print("F"); | ||
Serial.println(); | Serial.println(); | ||
− | } | + | } |
− | == | + | ==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] |
Latest revision as of 10:55, 16 May 2014
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