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

Arduino UNO Based DS18B20 Temperature Sensor Monitoring System

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

Circuit Documentation

Summary of the Circuit

This circuit consists of an Arduino UNO microcontroller, a DS18B20 temperature sensor, and a resistor. The purpose of the circuit is to read temperature data from the DS18B20 sensor and output the temperature readings to the serial console. The Arduino UNO is used to interface with the sensor and process the data. A pull-up resistor is connected to the data line of the DS18B20 to ensure reliable communication.

Component List

Arduino UNO

DS18B20 Temperature Sensor

Resistor (200 Ohms)

Wiring Details

Arduino UNO

DS18B20 Temperature Sensor

Resistor (200 Ohms)

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(PULLUP_PIN, OUTPUT);
  digitalWrite(PULLUP_PIN, 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
  float temperatureC = sensors.getTempCByIndex(0);
  Serial.print("Temperature: ");
  Serial.print(temperatureC);
  Serial.println(" °C");
  // Wait 1 second before repeating
  delay(1000);
}

Filename: sketch.ino

Description: The code initializes the OneWire and DallasTemperature libraries to communicate with the DS18B20 sensor. It sets pin D3 as a pull-up for the data line and reads the temperature every second, printing the result to the serial console.