One Wire Digital Temperature Sensor

3 years ago 2188
  • Description
  • Documents
  • BOM
  • Attachments
  • Members
  • Comments

Description

Arduino drives A single wire digital temperature sensor

DS18B20 fromMaxim (formerly Dallas) is a great chip to measure temperature in your project. Fortunately, the Dallas emperature library which makes use of the sensor is easy to Arduino.

In the latest version of the library can be found here http://www.milesburton.com/?title=Dallas_Temperature_Control_Library

We used version 3.6.0 for this tutorial which can also be downloaded in last

Drag and drop the DallasTemperture folder into my arduino/libraries folder

The DS18B20 can be powered by 5.5V to 3.0V, so you can simply connect the GND pin to the 0V and VDD pins for the +5V from the Arduino. However, DS18B20 can also be extracted from the data line, which means that we only need two wires to connect their power. Which makes it very suitable for use as an external sensor.

Arduino is received from the DQ pin to pin 2 on the board (which can be any Arduino digital pin) Pull it up to 5V a 10k ohm on pull resistor, which is required in the DQ pin Here is our sensor installed on the bread board One Wire Digital Temperature Sensor

Next, add the following sketch and upload it to your Arduino mega 2560. The use of the Dallas temperature library makes it easy to get the temperature.


#include 
#include 

// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

void setup(void)
{
  // start serial port
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");

  // Start up the library
  sensors.begin();
}

void loop(void)
{

  Serial.print(" Requesting temperatures...");
  sensors.requestTemperatures(); 
  Serial.println("DONE");

  Serial.print("Temperature for Device 1 is: ");
  Serial.print(sensors.getTempCByIndex(0)); 

When you have uploaded the sketch, click on the Serial Monitor and you should see output like the following. The temperature is in degrees C

One Wire Digital Temperature Sensor - DS18B20

Documents

One Wire Digital Temperature Sensor

BOM

ID Name Designator Footprint Quantity
1 Arduino MEGA 2560 U1 DIP 1
2 DS18B20 U2 DS18B20_SOIC 1
3 10k R1 R3 1

Attachments

Filename Download
DallasTemperature_easyeda.zip

Members

Success
The owner does not allow comments in this project now

Comments (0)

goToTop
你现在访问的是EasyEDA海外版,使用建立访问速度更快的国内版 https://lceda.cn(需要重新注册)
如果需要转移工程请在个人中心 - 工程 - 工程高级设置 - 下载工程,下载后在https://lceda.cn/editor 打开保存即可。
有问题联系QQ 3001956291 不再提醒
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow
We use cookies to offer you a better experience. Detailed information on the use of cookies on this website is provided in our Privacy Policy. By using this site, you consent to the use of our cookies.