Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Hackster is hosting Impact Spotlights: Smart Home. Watch the stream live on Thursday!Hackster is hosting Impact Spotlights: Smart Home. Stream on Thursday!
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,444
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
9 projects • 115 followers
Watch, Learn and Built IoT projects | DIY IoT Projects | IoT Projects for College Student.
Contact
Rajiv Sharma
18 projects • 71 followers
Having more than 10 years of experience in IoT and software technology. Founded IoTBoys to share knowledge with IoT enthusiasts.
Contact
Shambhoo kumar
4 projects • 43 followers
Contact

Comments

Please log in or sign up to comment.