Project tutorial

Temperature Sensor [DS18B20] © GPL3+

Temperature sensor using the sensor temperature DS18B20 and read by the Serial Monitor.

  • 25,895 views
  • 0 comments
  • 7 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
Adafruit DS18B20
(this product include the Sensor and the Resistor 4.7Kohm
×1
11026 02
Jumper wires (generic)
×1
12002 04
Breadboard (generic)
×1
Mfr 25fbf52 4k75 sml
Resistor 4.75k ohm
conect this resistor between the Data Pin and the VCC Pin of the Sensor
×1

Apps and online services

About this project

Hello dear friends greetings from Honduras!

In this tutorial you will learn how to use DS18B20 temp sensor with Arduino.

The temperature will be printed on the serial monitor of Arduino IDE.

I decided to do this project because it is quite easy to do and most are accustomed to using the sensor LM35.


The DS18B20 communicates over a 1-Wire bus by definition requires That only one data line (and ground) for communication with Arduino. It has an operating temperature range of -55 ° C to + 125 ° C and is accurate to ± 0.5 ° C over the range of -10 ° C to + 85 ° C. In Addition, the DS18B20 can derive power Directly from the data line ( "parasite power"), Eliminating the need for an external power supply.


Each DS18B20 has a unique 64-bit serial code, Which Allows multiple DS18B20s to function on the same 1-Wire bus. THUS, it is simple to use one microprocessor to check many DS18B20s distributed over a large area. Applications That Can Benefit From this feature include HVAC environmental controls, temperature monitoring systems inside buildings, equipment, or machinery, and process monitoring and systems control.


Basic Features:


Unique 1-Wire Interface Requires Only One Port Pin for Communication

Each Device has a Unique 64-Bit Serial Code Stored in an On-Board ROM

Requires No External Components

Can Be Powered from Data Line; Power Supply 3.0V to 5.5V Range is

Measures Temperatures from -55 ° C to + 125 ° C (-67 ° F to + 257 ° F)

Accuracy ± 0.5 ° C from -10 ° C to + 85 ° C

Schematics

circuit diagrams
*Arduino UNO
*Sensor DS18B20
*Resistor 4.7Kohm
*Jumper Wires
*Breadboard
Ds18s20 hookup

Code

DS18B20 CODEArduino
//Include libraries
#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);

void setup(void)
{
  Serial.begin(9600); //Begin serial communication
  Serial.println("Arduino Digital Temperature // Serial Monitor Version"); //Print a message
  sensors.begin();
}

void loop(void)
{ 
  // Send the command to get temperatures
  sensors.requestTemperatures();  
  Serial.print("Temperature is: ");
  Serial.println(sensors.getTempCByIndex(0)); // Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire
  //Update value every 1 sec.
  delay(1000);
}

Comments

Created by

Everth Villamil Ruiz

Are you Everth Villamil Ruiz? Claim this project and add it to your profile.

This is mine

Posted by

Villaruizhn
VillaRuizHN
  • 0 projects
  • 3 followers

Members who respect this project

Raddm

and 6 others

Project replicated by

Raddm
Add projectSign up / Login