Temperature Monitoring with DS18B20 Waterproof Sensor Module
This project demonstrates how to measure temperature using a DS18B20 waterproof temperature sensor module with an Arduino Uno.
The DS18B20 sensor provides accurate temperature readings in various environments, and the Arduino is used to display the temperature readings on the serial monitor.
Components Needed
- Arduino Uno
- DS18B20 Waterproof Temperature Sensor Module
- Jumper Wires
Block Diagram
Hardware Wiring Explanation:
Connect the data pin of the DS18B20 sensor module to Arduino digital pin 2.
Connect the VCC pin of the sensor module to Arduino 5V.
Connect the GND pin of the sensor module to Arduino GND.
Software (Arduino IDE):
Open the Arduino IDE on your computer.
Write or paste the provided program into the IDE.
Select the correct board and port in the Arduino IDE under the Tools menu.
Upload the program to the Arduino.
Initialize the System:
Begin serial communication at a baud rate of 9600 in the setup function.
Initialize the DS18B20 sensor using the OneWire and DallasTemperature libraries.
Read Sensor Values:
Send the command to the sensor to request temperature measurements using
Read the temperature in Celsius from the sensor using
Display Readings:
Check if the temperature reading is valid (-127.00 indicates a failed reading).
Print the temperature to the serial monitor with the appropriate unit (°C).
Repeat Measurement:
Add a delay of 1 second between measurements to avoid rapid readings.
Applications
Notes
Ensure proper waterproofing of the sensor module if used in wet environments
Calibrate the sensor if necessary for accurate temperature measurements.