Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino-Based Temperature Monitoring System with DS18B20 Sensor

View and Edit Project In Cirkit DesignerImage of Arduino-Based Temperature Monitoring System with DS18B20 Sensor

Circuit Documentation

Summary

This circuit is designed to read temperature data from a DS18B20 temperature sensor using an Arduino UNO microcontroller. The DS18B20 sensor communicates with the Arduino via a digital pin, and a resistor is used as a pull-up for the data line. The temperature readings are printed to the serial console.


Component List

Arduino UNO

DS18B20

Resistor


Wiring Details

Arduino UNO


DS18B20


Resistor


Documented Code

/*
 * This Arduino sketch reads temperature data from a DS18B20 sensor
 * connected to pin D2 and prints the temperature to the serial console.
 * Pin D3 is set to HIGH to act as a pull-up resistor for the DS18B20 data line.
 */

#include "OneWire.h"
#include "DallasTemperature.h"

#define ONE_WIRE_BUS 2
#define PULLUP_PIN 3

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void setup() {
  // Set D3 as output and set it HIGH for pull-up
  pinMode(3, OUTPUT);
  digitalWrite(3, HIGH);

  // Start serial communication
  Serial.begin(9600);
  // Start up the library
  sensors.begin();
  
}

void loop() {
  // Request temperature readings
  sensors.requestTemperatures();
  // Fetch and print the temperature in Celsius
  Serial.println("here getting tempC by index");
  float temperatureC = sensors.getTempCByIndex(0);
  Serial.print("Temperature: ");
  Serial.print(temperatureC);
  Serial.println(" °C");
  // Wait 1 second before repeating
  delay(1000);
}

This documentation provides a comprehensive overview of the circuit, detailing the components used, their connections, and the code that drives the functionality of the system.