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

Arduino UNO Temperature Monitoring System with DS18B20 Sensor and Pull-Up Resistor

View and Edit Project In Cirkit DesignerImage of Arduino UNO Temperature Monitoring System with DS18B20 Sensor and Pull-Up Resistor

Circuit Documentation

Summary

This circuit is designed to read temperature data from a DS18B20 sensor using an Arduino UNO. The temperature data is then printed to the serial console. A pull-up resistor is used on the data line of the DS18B20 sensor.

Component List

  1. Arduino UNO

    • Description: A microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. DS18B20

    • Description: A digital temperature sensor.
    • Pins: VDD, DQ, GND
  3. Resistor

    • Description: A resistor with a resistance of 200 Ohms.
    • Pins: pin1, pin2
    • Properties:
      • Resistance: 200 Ohms

Wiring Details

Arduino UNO

DS18B20

Resistor

Code Documentation

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

This code initializes the DS18B20 sensor and sets up a pull-up resistor on pin D3. It then continuously reads the temperature from the sensor and prints it to the serial console every second.