Arduino Internet of Things IoT IoT Projects Sensors Videos

How To Use DS18B20 Water Proof Temperature Sensor

In this article we are showing how to use DS18B20 one wire water proof temperature sensor.
With the help of DS18B20 one wire temperature sensor we can measure the temperature from -55℃ To 125℃ with accuracy of ±5 .

Components Required :-

  1. 1 x Arduino uno board
  2. 1 x USB cable
  3. 1 x DS18B20 Temperature Sensor
  4. 3 x Jumper wire (Male to Male)

Additional Library :-

  1. One Wire Library
  2. Dallas Temperature Sensor library

Installation Instruction is available here

Connection :-

 

Sketch/Source Code :-

#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 5

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

 float Celcius=0;
 float Fahrenheit=0;
void setup(void)
{
  
  Serial.begin(9600);
  sensors.begin();
}

void loop(void)
{ 
  sensors.requestTemperatures(); 
  Celcius=sensors.getTempCByIndex(0);
  Fahrenheit=sensors.toFahrenheit(Celcius);
  Serial.print(" C  ");
  Serial.print(Celcius);
  Serial.print(" F  ");
  Serial.println(Fahrenheit);
  delay(1000);
}

About the author

IoT Boys

IoT Boys

10 Comments

Click here to post a comment

Meet Our Team

Rajeev Ranjan Founder IoTBoys
Founder IoTBoys
Shambhoo kumar
Founder IoTBoys

Subscribe Us