Arduino UNO Based DS18B20 Temperature Sensor Monitoring System
View and Edit Project In Cirkit Designer
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
- Description: A microcontroller board based on the ATmega328P.
- Pins Used: IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13.
- Purpose: Acts as the central processing unit for the circuit, reading temperature data from the DS18B20 sensor and sending it to the serial console.
DS18B20 Temperature Sensor
- Description: A digital temperature sensor that provides 9-bit to 12-bit Celsius temperature measurements.
- Pins Used: VDD, DQ, GND.
- Purpose: Measures the temperature and sends the data to the Arduino UNO.
Resistor (200 Ohms)
- Description: A passive two-terminal electrical component that implements electrical resistance as a circuit element.
- Pins Used: pin1, pin2.
- Purpose: Acts as a pull-up resistor for the DS18B20 data line.
Wiring Details
Arduino UNO
- 5V connected to DS18B20 VDD.
- GND connected to DS18B20 GND.
- D3 connected to one end of the Resistor (acts as a pull-up).
- D2 connected to the other end of the Resistor and DS18B20 DQ.
DS18B20 Temperature Sensor
- VDD connected to Arduino UNO 5V.
- DQ connected to Arduino UNO D2 through a Resistor.
- GND connected to Arduino UNO GND.
Resistor (200 Ohms)
- pin1 connected to Arduino UNO D3.
- pin2 connected to DS18B20 DQ and Arduino UNO D2.
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.