Arduino-Powered Smart Water Heater: A DIY Project

Hello everyone, welcome back to Techatronic. In today’s session, we’re diving into the creation of a smart water heater project utilizing Arduino and DS1820B temperature sensors. If you’re inclined towards building a portable smart water heater for the winter season, this project is just for you. This innovation can serve a variety of purposes where a compact, intelligent, and secure water heater is required.

Introduction

This project is both straightforward and versatile, finding utility in numerous settings. Its portability allows for easy transportation, making it convenient for various situations. While similar smart water heaters are available in the market, this particular project stands out with unique additional features. To create it effortlessly, simply adhere to the provided instructions.

Having prior experience with Arduino or basic electronics will significantly simplify the assembly process. Additionally, for those seeking to familiarize themselves with basic electronics and Arduino programming, we have a comprehensive article available on our website.

We’ve compiled a complete tutorial inclusive of code, circuit diagrams, and detailed step-by-step instructions. By following these guidelines, you can craft your own smart water heater project.

Components Required.

Utilizing the following components: Arduino Nano, 16×2 display, DS1820B temperature sensor, buzzer, push button, single-channel relay, potentiometer, and a mini water heater, you can assemble a remarkable smart water heater system.

The Arduino Nano assumes the central control role in this project. Renowned as a microcontroller, the Arduino is proficient in processing sensor data and operating output devices. In this setup, the Arduino Nano collects information from sensors such as the ultrasonic and temperature sensors. Based on this data, it triggers the relay, thereby controlling the operation of the water heater.

The 16×2 display serves the purpose of conveying system information. Within this smart water heater, it displays current temperature, desired temperature, water level in the container, and operational instructions.

The DS1820B functions as a waterproof temperature sensor, also referred to as a probe temperature sensor, ideal for detecting liquid temperatures.

For temperature setting in this smart water heater, we utilize three push buttons. The first button increases the value, the second button decreases it, and the third button sets the values accordingly.

Circuit Diagram

Code

const int buttonPin1 = 2, buttonPin2 = 3;
int button1_State = 0, button2_State = 0;
int count_value =0;
int prestate =0;
#include

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 10, d5 = 9, d6 = 8, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

#include
#include

// Data wire is conntec to the Arduino digital pin 4
#define ONE_WIRE_BUS 5

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature sensor
DallasTemperature sensors(&oneWire);

int duration=0;
long distance=0;
int firstduration=0;
long firstdistance=0;
int secondduration=0;
long seconddistance=0;

void setup() {
// initialize the pushbutton pin as an input:
sensors.begin();
pinMode(buttonPin1, INPUT_PULLUP);
pinMode(buttonPin2, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
lcd.begin(16, 2);
Serial.begin(9600);
lcd.clear();
lcd.setCursor(2, 0);
lcd.print(“SMART WATER”);
lcd.setCursor(5, 1);
lcd.print(“HEATER”);
digitalWrite(A0, LOW);
digitalWrite(A1, HIGH);
pinMode(A4,OUTPUT);
pinMode(A5,INPUT);
}

void loop() {

// read the state of the pushbutton value:
button1_State = digitalRead(buttonPin1);
button2_State = digitalRead(buttonPin2);
int m = digitalRead(4);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (button1_State == LOW && prestate == 0) {
count_value++;

Serial.println(count_value);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“SET TEMPERATURE”);
lcd.setCursor(7, 1);
lcd.print(count_value);
prestate = 1;
delay(100);
}
//decrement
else if (button2_State == LOW && prestate == 0) {
count_value–;

Serial.println(count_value);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“SET TEMPERATURE”);
lcd.setCursor(7, 1);
lcd.print(count_value);
prestate = 1;
delay(100);
}

else if(m==0)

{
digitalWrite(A4, HIGH);
delayMicroseconds(10);
digitalWrite(A4, LOW);
delayMicroseconds(2);
duration= pulseIn(A5,HIGH);
delay(100);
distance=duration*0.034/2;
Serial.println(distance);
if(distance==3 || distance==4)
{

digitalWrite(A1, LOW);
digitalWrite(A0, LOW);

while(1)
{

lcd.clear();

lcd.setCursor(11, 1);
lcd.print(count_value);
sensors.requestTemperatures();

lcd.setCursor(2, 0);
lcd.print(“HEATER START”);
lcd.setCursor(2, 1);
lcd.print(sensors.getTempCByIndex(0));
delay(500);

if(sensors.getTempCByIndex(0)>=count_value)

{

digitalWrite(A0, HIGH);
digitalWrite(A1, HIGH);
//delay(200);
}
else
{
digitalWrite(A0, LOW);
digitalWrite(A1, LOW);

}

}
}

else

{

lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“FILL MORE WATER”);
lcd.setCursor(0, 1);
lcd.print(distance);
digitalWrite(A1, HIGH);
//digitalWrite(A0, LOW);

}

}

else if(button1_State == HIGH && button2_State == HIGH) {
prestate = 0;
}

}

Smart Water heater Working

The display provides comprehensive instructions on the system’s operation. To begin, ensure the container is adequately filled, maintaining a suitable water level for the water heater’s operation. Next, utilize the first push button to increase the temperature to your desired setting. Conversely, the temperature can be decreased using another button. Finally, press the third button to set the temperature. The system will initiate the water heater’s function until the desired temperature is reached.

Source: Arduino-Powered Smart Water Heater: A DIY Project


About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation, and engineering. I have a clear and simple writing style and am skilled in using infographics and diagrams. I am a great researcher and is able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter
Scroll to Top