Greetings to all, we welcome you back to Techatronic. During today’s meeting, we will discuss the development of a smart water heater project that involves Arduino and DS1820B temperature sensors. If you’re interested in creating a mobile smart water heater for the winter, then this project is perfect for you. This new technology can be used for many different reasons when a small, smart, and safe water heater is needed.
Introduction
This project is simple yet adaptable, offering usefulness in many different environments. It is easy to transport due to its portability, which is advantageous for different scenarios. Although there are comparable smart water heaters on the market, this specific project differentiates itself with distinct added features. To easily make it, just follow the given directions.
Having some background in Arduino or basic electronics will greatly ease the construction process. Moreover, we have a detailed article on our website for individuals interested in learning about basic electronics and Arduino programming.
We have put together a comprehensive guide that includes code, circuit diagrams, and thorough step-by-step instructions. By adhering to these instructions, you can create your personal intelligent water heater plan.
Components Required.
By using the Arduino Nano, 16×2 display, DS1820B temperature sensor, buzzer, push button, single-channel relay, potentiometer, and mini water heater, you can create an impressive smart water heater setup.
The central control role in this project is taken on by the Arduino Nano. Famous for being a microcontroller, the Arduino excels at handling sensor information and controlling output devices. In this arrangement, the Arduino Nano gathers data from sensors like ultrasonic and temperature sensors. Using this information, the relay is activated to control the water heater’s operation.
The purpose of the 16×2 display is to communicate system information. This intelligent water heater shows the current temperature, desired temperature, container water level, and operational guidance.
The DS1820B operates as a moisture-resistant temperature sensor, also known as a probe temperature sensor, perfect for sensing liquid temperatures.
Three push buttons are used for adjusting the temperature on this intelligent water heater. The initial button raises the value, the subsequent button lowers it, and the last button adjusts 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
By combining an Arduino Nano, a 16×2 display, a DS1820B temperature sensor, a buzzer, a push button, a single-channel relay, a potentiometer, and a mini water heater, you can create an impressive intelligent water heating system.
Source: Arduino-Powered Smart Water Heater: A DIY Project