What is DS18B20 Temperature Sensor with Arduino 1

Digital temperature sensors like the DS18B20 are widely use in a wide range of electronic projects and applications. It is manufacture by Maxim Integrate and is part of the 1-Wire family of sensors.The DS18B20 is widely use in applications like weather stations, temperature monitoring systems, home automation, and many other projects that require accurate temperature measurements. It’s a versatile and cost-effective sensor for such applications. Here are some key features and information about the DS18B20 sensor:

Key features and information

  1. Temperature Measurement: The DS18B20 sensor is design to measure temperature. It provides 9 to 12-bit Celsius temperature readings, with an accuracy of ±0.5°C (±0.9°F) in the range of -10°C to +85°C.
  2. Digital Interface: The sensor communicates using a digital protocol called 1-Wire. This means it can connected to a microcontroller or other digital devices with just one data wire, along with a power supply and ground connection. This makes it easy to integrate into various electronic projects.
  3. Unique 64-Bit Serial Number: Each DS18B20 sensor has a unique 64-bit serial number, which allows multiple sensors to connected to the same data line without conflicts. This feature is useful in applications where you need to measure temperature at multiple locations.
  4. Wide Operating Voltage Range: The DS18B20 can operate over a wide voltage range, typically from 3.0V to 5.5V, which makes it compatible with a variety of microcontrollers and systems.
  5. High Resolution: The DS18B20 allows you to select different resolution settings for temperature measurements, ranging from 9 to 12 bits. Higher resolution settings provide more accurate measurements
  6. Waterproof Versions: Some DS18B20 sensors are available in waterproof casings, which make them suitable for outdoor or wet environments. These are often refer to as “DS18B20 waterproof” or “DS18B20 waterproof temperature sensors.”
  7. Library Support: Various libraries are available for popular microcontroller platforms like Arduino, Raspberry Pi, and others, which simplify the process of interfacing with DS18B20 sensors. These libraries often include functions for reading temperature values and managing multiple sensors on the same data line.


Arduino Code

DS18B20 Temperature Sensor


* Company Name:LK Tronics
* Author: Research & Development Department
* Date: 2020/ 03/ 12
* https://lk-tronics.com/
* All rights reserved. No part of this code may be reproduced, distributed,
* or transmitted in any form or by any means, including photocopying, recording,
* or other electronic or mechanical methods, without the prior written permission
* of LK Tronics, except in the case of brief quotations embodied in
* critical reviews and certain other noncommercial uses permitted by copyright law.

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

// Data wire is connected to pin 2 on the Arduino
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void setup() {
  // Initialize the sensor

void loop() {
  // Call sensors.requestTemperatures() to issue a global temperature request

  // Read temperature in Celsius
  float temperatureC = sensors.getTempCByIndex(0);

  // Check if the temperature is valid (it may return -127.00 if the sensor is not ready)
  if (temperatureC != -127.00) {
    // Print the temperature to the serial monitor
    Serial.print("Temperature: ");
    Serial.println(" °C");
  } else {
    Serial.println("Error: Unable to read temperature");

  // Wait a moment before taking another reading


One Comment

  1. Ηelⅼo mates, its fantastic articlе on the topic of cᥙltureand entirelʏ defined, keep it up all the time.

Leave a Reply