Categories
TUTORIALS

Water Temperature Sensor with Arduino

Introduction

In this tutorial, I will introduce and explain how to use a water temperature sensor to sense the water temperature inside a river or other water features. There are lots of water temperature sensors you could use with Arduino, but I am using Gikfun DS18B20 Waterproof Temperature Sensor for this tutorial, you can find and buy it at this link or other websites:https://www.amazon.com/Gikfun-DS18B20-Temperature-Waterproof-EK1083x3/dp/B012C597T0

Parts List

Arudino IDE
DS18B20 Waterproof Temperature Sensor
Jumper Wires
Breadboard

DS18B20 Waterproof Temperature Sensor

Our key element for this tutorial is our temperature sensor. The DS18B20 temperature sensor is a one-wire digital temperature sensor. This means that it just requires one data line and GND to communicate with the Arduino. And you should not use a non-waterproof temperature sensor for sensing the water temperature. Notice, DS18B20 also has a non-waterproof version of it!

DS18B20 can be powered by an external power supply or it can derive power from the data line, which eliminates the need for an external power supply. DS18B20 can measure temperatures from -55°C to +125°C, it has a ±0.5°C accuracy from -10°C to +85°C. This is totally enough for sensing water temperature inside rivers or water bodies in normal geographic locations.

For more information, you can check the DS18B20 datasheet at this link:https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf

Circuit

First, we need to look at the pinout of DS18B20.

As you can there are three pins: Black, Red, and Yellow.

Three pins

Black Pin needs to be connected to GND

Red Pin needs to be connected to VCC (5V or 3.3V)

Yellow Pin needs to be connected to a digital pin on Arduino.

Circuit

Code

The next step is to run the code. Before having the code, make sure to install two libraries in your Arduino.

Open your Arduino IDE and go to 

Sketch Include Library > Manage Libraries.

Search OneWire by Paul Stoffregen and Dallas Temperature by Miles Burton. There are many similar libraries, make sure the authors are right.

Output

Finally, after running the code, we can open up our serial monitor in Arduino IDE, and you should see similar output as below.

Serial Monitor Output

Since it is a waterproof temperature sensor, you can just test it in your own bowl!

Test inside water

Reference

https://arduinogetstarted.com/tutorials/arduino-temperature-sensor

https://www.youtube.com/watch?v=qxEclOy6jpI

https://create.arduino.cc/projecthub/iotboys/how-to-use-ds18b20-water-proof-temperature-sensor-2adecc

Leave a Reply

Your email address will not be published. Required fields are marked *