IoTBoysRajiv SharmaShambhoo kumar
Published

How To Use DS18B20 Water Proof Temperature Sensor

We are showing how to use DS18B20 one wire water proof temperature sensor using Arduino.

BeginnerShowcase (no instructions)2 hours206,420
How To Use DS18B20 Water Proof Temperature Sensor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
DS18B20 Water Proof Temperature Sensor
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit Design

Follow the design for connection.

Code

Source Code

C/C++
Source code to use water proof temperature sensor.
#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);
}

Credits

IoTBoys

IoTBoys

9 projects • 115 followers
Watch, Learn and Built IoT projects | DIY IoT Projects | IoT Projects for College Student.
Rajiv Sharma

Rajiv Sharma

17 projects • 71 followers
Having more than 10 years of experience in IoT and software technology. Founded IoTBoys to share knowledge with IoT enthusiasts.
Shambhoo kumar

Shambhoo kumar

4 projects • 43 followers

Comments