Introduction
In this project we are going to create a digital thermometer to monitor the temperature of the aquarium. We will use this simple circuit in future projects for controlling equipment such as chillers, heaters and fans automatically.
Parts
- Arduino Uno or compatible
- DS18B20 Temperature Sensor Probe Waterproof w/Pluggable Terminal Adapter
- 16 x 2 LCD w/ I2C
- Jumper wires
Schematics
Assemble all parts per schematic
Note: If Pluggable Terminal Adapter is not used then a 4.70K ohm resister is needed,
Code
Library’s required
- OneWire.h
- DallasTemperature.h
- LiquidCrystal.h
Notes
- Change Sensor pin number if needed
- Change LCD I2C address if needed
Sketch
/*
* Arduino Project 1a
* Complete Project details https://thediyaquarium.com/
*/
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
const int SENSOR_PIN = 7; // Arduino pin connected to DS18B20 sensor's DQ pin
OneWire oneWire(SENSOR_PIN); // setup a oneWire instance
DallasTemperature sensors(&oneWire); // pass oneWire to DallasTemperature library
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27, 16 column and 2 rows
float tempCelsius; // temperature in Celsius
float tempFahrenheit; // temperature in Fahrenheit
void setup()
{
sensors.begin(); // initialize the sensor
lcd.init(); // initialize the lcd
lcd.backlight(); // open the backlightSerial
}
void loop()
{
sensors.requestTemperatures(); // send the command to get temperatures
tempCelsius = sensors.getTempCByIndex(0); // read temperature in Celsius
tempFahrenheit = tempCelsius * 9 / 5 + 32; // convert Celsius to Fahrenheit
lcd.clear();
lcd.setCursor(0, 0); // start to print at the first row
lcd.print(" Temperature"); // print Temperature
lcd.setCursor(0, 1); // start to print at the second row
lcd.print(tempFahrenheit); // print the temperature in Fahrenheit
lcd.print((char)223); // print ° character
lcd.print("F ");
lcd.print(tempCelsius); // print the temperature in Celsius
lcd.print((char)223); // print ° character
lcd.print("C");
delay(500);
}
Or click to download sketch
After download, unzip file and place file and folder in your Arduino Sketch directory
Operation
Load code (Sketch), put end of probe in aquarium
As long as there is power to the board, Temperature will be displayed on LCD and updated every 500ms
Summary
Can be expanded to monitor temperature across multiple aquariums
Can be expanded to record data and send to computer or cell phone
Can be updated to send warning to cell phone if readings drop below or exceeds specific temperature