Download as pdf or txt
Download as pdf or txt
You are on page 1of 80

SOLAR WATER HEATER CONTROL USING IoT

A PROJECT REPORT

Submitted by

ARUNVIJAY S - 921320105007

BALAJI R - 921320105011

JANANI D - 921320105022

BRIGHT GILBERT RAY J - 921320105302

in partial fulfillment for the award of the degree

of

BACHELOR OF ENGINEERING
IN
ELECTRICAL AND ELECTRONICS ENGINEERING

PSNA COLLEGE OF ENGINEERING AND TECHNOLOGY,


(An Autonomous Institution Affiliated to Anna University, Chennai)
DINDIGUL - 624622
MAY 2024
PSNA COLLEGE OF ENGINEERING AND TECHNOLOGY
(An Autonomous Institution Affiliated to Anna University, Chennai)

DINDIGUL - 624622

BONAFIDE CERTIFICATE

Certified that this Project report “SOLAR WATER HEATER CONTROL

USING IoT” is the bonafide work of “ARUNVIJAY S (921320105007),

BALAJI R (921320105011), JANANI D (921320105022) and BRIGHT

GILBERT RAY J (921320105302)” who carried out the project work under

my supervision.

SIGNATURE SIGNATURE
Dr.N.Chandrasekaran,ME.,Ph.D. Dr.I.Gerald Christopher Raj, M.E., Ph.D.
HEAD OF THE DEPARTMENT SUPERVISOR
PROFESSOR
Electrical and Electronics Engineering Electrical and Electronics Engineering
PSNA College of Engineering & PSNA College of Engineering &
Technology, Dindigul – 624622. Technology, Dindigul – 624622.

Submitted for Project viva-voce examination held on……………….

INTERNAL EXAMINER EXTERNAL EXAMINER

ii
ABSTRACT

This outlines a holistic solution to common challenges in solar water

heaters, emphasizing innovation and efficiency. Integrating cloud control allows

for remote management, ensuring optimal performance. To address inadequate

heating capacity, user-settable temperatures enhance customization. The

solution prioritizes reduced maintenance by implementing advanced materials

and self-cleaning mechanisms.

Furthermore, it tackles freezing and overheating risks through intelligent

thermal management systems. Cost concerns are mitigated by emphasizing

long-term savings and environmental benefits, fostering affordability. The

solution recognizes the importance of system integration, proposing seamless

incorporation with existing plumbing and heating setups.

To combat the lack of awareness, educational campaigns are advocated

for widespread adoption. In essence, this solution amalgamates technological

advancements, user empowerment, and awareness initiatives to propel solar

water heaters towards enhanced efficiency, reduced costs, and increased public

acceptance.

iii
ACKNOWLEDGEMENT`

Many people have contributed to this project, and it is our pleasure to

express our gratitude to our management who has been inspiring us for all our

activities.

We express our sincere thanks to our principal Dr. D. VASUDEVAN

ME., Ph.D., who had heartily permitted us to do this project work.

We are greatly indebted to Dr. N. CHANDRASEKARAN ME.,

Ph.D., Head of the Department, Department of Electrical and Electronics

Engineering, forhis motivation and tireless encouragement.

We extend our wholehearted sincere thanks to our esteemed project

coordinator Dr. R. KARTHIGAIVEL M.TECH., Ph.D., Professor/EEE, for

his constant encouragement and support.

We express our sincere appreciation to our guide Dr. I. GERALD

CHRISTOPHER RAJ ME., Ph.D., Professor/EEE, for his valuable guidance,

sustained inspiration and timely encouragement throughout the tenure of this

project work.

We also thank the faculty members, supporting staff members, our

family members, and our friends of PSNACET for their moral and technical

support which has led to the successful completion of our project work.

iv
TABLE OF CONTENTS

CHAPTER NO. TITLE PAGE NO.

ABSTRACT iii

ACKNOWLEDGEMENT iv

LIST OF TABLES ix

LIST OF FIGURES x

LIST OF ABBREVIATION xii

1 INTRODUCTION 1

1.1 PROJECT INTRODUCTION 1

1.2 OBJECTIVE OF THE PROJECT 1

1.3 IMPORTANT OF THE PROJECT 1

1.4 SUMMARY 2

2 LITERATURE REVIEW 3

2.1 ANALYSIS OF ENERGY AUDIT 6

2.2 THERMAL SYSTEM - ANALYSIS OF


7
EFFICIENCY

2.3 HARDWARE DESCRIPTION 7

2.3.1 ESP8266 7

2.3.1.1 Introduction 7

2.3.1.2 Features 8

v
2.3.2 Temperature sensor – DS18B20 9

2.3.2.1 Introduction 9

2.3.2.2 Application 10

2.3.2.3 Description 10

2.3.3 REES52 NODEMCU LUA ESP8266

ESP 12E 11

2.3.3.1 Introduction 11

2.3.4 Relay 12

2.3.4.1 Description 12

2.3.4.2 Specification 13

2.3.5 Servomotor 14

2.3.5.1 Introduction 14

2.3.5.2 Servomotor working 15

Mechanism

2.3.5.3 Servomotor working 16

Principles

2.3.5.4 Controlling Servomotor 16

2.3.6 Liquid Crystal Display 18

2.4 SOFTWARE DESCRIPTION 19

2.4.1 Arduino IDE 19

2.4.2 Firebase 23

2.4.2.1 Introduction 23

2.4.2.2 Methodology 23

2.4.3 React 32

vi
3 METHODOLOGY 36

3.1 INTRODUCTION 36

3.2 BLOCK DIAGRAM FOR PROPOSED

WORK 37

3.3 WORKING PRINCIPLE OF PROPOSED

BLOCK DIAGRAM 38

3.4 CIRCUIT DIAGRAM OF HARDWARE

SETUP 40

3.5 COST ESTIMATION OF HARWARE

SETUP 41

3.6 SUMMARY 42
4 RESULT AND DISCUSSION 44
5 CONCLUSION 53

REFERENCES 55

APPENDIX 57

vii
LIST OF TABLES

TABLE NO. TITLE PAGE NO.

2.1 Comparison of Designs and Major Findings 5

3.5 Cost Estimation of Hardware Setup 41

viii
LIST OF FIGURES

FIGURE NO. TITLE PAGE NO.

2.1 8
ESP 8266 Pin Diagram

2.2 DS18B20 Terminal Diagram 10

2.3 REES52 NODEMCU LUA ESP8266 ESP 12E 12

2.4 2 Channel 5V Relay Module with Optocoupler 13

2.5 Servo Motor 15

2.6 Servo Motor Rotation Angle 17

2.7 16*2 Liquid Crystal Display 19

2.8 Arduino IDE 21

2.9 Analytics 24

2.10 Cloud Messaging 26

2.11 Real-time Database 28

2.12 Crashlytics 29

2.13 Test Lab 32

2.14 React Key Features 35

3.1 Block Diagram for Proposed Work 37

3.2 Circuit Diagram of Hardware Setup 40

4.1 Layout of Hardware Setup 44

ix
4.2 Web Dashboard 45

4.3 Mobile Dashboard 46

4.4 Working of Valve control by Bulb ON in App 47

4.5 Working of Valve control by Bulb OFF in App 48

4.6 Firebase Real-time Database 49

4.7 Working of the Heater when it exceeds the set 50


value

x
LIST OF ABBREVIATIONS

ABBREVIATION FULL FORM

SWH Solar Water Heating

STC State trading corporation of India

TCP Transmission control protocol

IP Internet protocol

LNA Low -noise amplifier

DMA Direct memory access

MCU Micro controller unit

IOS IPhone operating system

DOM Document object model

RISC Reduced instruction set computer

TR Table row

WEP Wired Equivalent privacy

WPA Wi-Fi Protected access

xi
CHAPTER 1
INTRODUCTION

1.1 PROJECT INTRODUCTION

Solar water heating systems harness the power of sunlight to provide an


eco-friendly and cost-effective solution for heating water. However, despite
their numerous advantages, traditional solar water heaters often encounter
challenges such as inadequate heating capacity, performance limitations in
adverse weather conditions, and maintenance requirements. To address these
issues and maximize the potential of solar water heating technology, we
propose the development of an innovative IoT-based solar water heater system.

1.2 OBJECTIVE OF PROJECT

The primary objective of this project is to design and implement an IoT-


based solar water heater system that integrates cloud control technology to
enhance performance, reduce maintenance requirements, and improve user
experience. By leveraging Internet of Things (IoT) capabilities, the system will
enable remote monitoring and control, allowing users to set the desired water
temperature, receive real-time updates on system status, and optimize energy
consumption.

1.3 IMPORTANCE OF PROJECT

This project holds significant importance for both individuals and the
environment. Firstly, it addresses common challenges associated with
traditional solar water heaters, such as inadequate heating capacity and
performance limitations in adverse weather conditions, by implementing
advanced IoT and cloud control technologies. By doing so, it ensures a reliable
and efficient supply of hot water regardless of external factors like weather
fluctuations.

1
Secondly, the integration of cloud control technology enhances
convenience and usability for users. With remote monitoring and control
capabilities, users can adjust settings, receive alerts for maintenance needs, and
track energy usage from anywhere, providing greater flexibility and peace of
mind. This not only improves the user experience but also promotes the
adoption of sustainable technologies by making them more accessible and user-
friendly.
Furthermore, the project contributes to broader sustainability efforts by
promoting the use of renewable energy sources. By harnessing solar energy to
heat water, the system reduces reliance on fossil fuels and decreases carbon
emissions, making a positive impact on the environment and mitigating the
effects of climate change. Additionally, by reducing energy consumption and
lowering utility bills, the system offers financial benefits to users, further
incentivizing its adoption.

1.4 SUMMARY
In summary, this project aims to revolutionize solar water heating
technology by developing an IoT-based system that offers superior performance,
increased efficiency, and enhanced user control. Through the integration of
cloud control technology, users can remotely monitor and adjust the system, set
desired water temperatures, and receive real-time updates on system status. This
innovative approach not only addresses common challenges associated with
traditional solar water heaters but also promotes renewable energy adoption and
contributes to a more sustainable future.

2
CHAPTER 2
LITERATURE REVIEW

A variety of protective techniques have been used to address the problem


of continuous overheating. For example, the dump system includes a
discrimination regulator with an upper limit function that is activated. The
circular pump of the solar pump stops at this point, causing the water to drain.
The two main drawbacks of this method: it requires a variety of active
solar heating devices and wastes water when superheated water is drained from
the system. Mist-reverse is another system that turns off the pump when the
temperature of the water tank reaches its maximum [7, 8].
When the temperature of the water tank reaches its maximum, the heat
dump system is activated automatically. An indirect pump in the heat dump
uses a bobby coil to discharge excess heat into the atmosphere via a heat
exchanger, allowing cooler water to flow through.
Nonetheless, there are numerous connections to the storage tank because
this fitted device is a secondary collection circle facing the primary collector
circle. As a result, the solar heater must be modified to achieve this result. This
safeguard only applies to flat solar panels, not to empty pipes with irreversible
heating cycles [3, 9-10].
As a result, not all solar water heater models and types are compatible
with this security system. Pump cycling is yet another device that raises the
temperature of the water to a predetermined set point after the pump has been
turned off due to temperature which improves convective heat loss. The
reservoir’s capacity has been reached. Once the predetermined point is
reached, the pump will beginsupplying heat to the tank [11–14].

3
This strategy also considers design variations. The heat resistant solar
collector prevents overheating by allowing excess hot air to flow in while
preventing overheating.
As a result, a large amount of water is wasted. The automated result is a
system in which hot water passes through a finned tube radiator, dispersing
heat to the outside air [15, 16].
This is analogous to a machine’s cooling capacity. Installing a solar
water heater, on the other hand, is less feasible due to the cooling system’s
reliance on electricity.
Covering the solar panel with a grounded system is a low cost way to
protect the device from overheating. This security system is also not automatic
because the solar water heater is manually covered. Tilt is a creature system
created with a manifold at latitude +15 degree.
The heating product grows in direct proportion to the inclination angle.
Thepoint, however, differs between active (pipes) and non-resistant (pipes and
tank) solar water heaters.
When the system overheats, a bypass tube with a handmade valve is
introduced to prevent the water in the solar panels from rotating. However, the
temperature control mechanism is not automated because the overheating
protection system’s shut-off valve is homemade [17, 18].
Furthermore, this strategy only shields the tank from warming water, not
the solar panels. Stopping the pump at a predetermined temperature is another
system in which the pump is turned off and no water is forced through the solar
panels when the temperature reaches a certain threshold.

4
Table 2.1 Comparison of Designs and Major Findings

Reference Designs Country Major findings

[23] Pyramidal Oman Solar performance can be boosted


type further by adding more basins and
energy storage options

[24] Elliptical Libya A solar still was developed and


type tested in the center of an
experimentally made point-focus
elliptical solar still with concave
reflectors.

[25] Still Iran By attaching an evacuated tube


coupled collector to a small solar still capable
with ETC of producing drinking water, the rate
of water evaporation onto a glass
condensation surface is enhanced.

[26] Triangular Malaysia The heat exchange technique and


type mechanisms for storing heat energy
were investigated in order to develop
strategies for producing more fresh
water.

[27] Solar still of Egypt In various regions, solar still designs


stepped type have been created to produce more
water each day.

5
When the collection temperature reaches a certain level, the volatile
reflectors open, allowing ambient air into the collector housing and limiting the
amount of water heated and cooled by convection.
Collectors can no longer access this find. In a vacuum system, the glycol
collecting circle is under high pressure, allowing the temperature of the water
to rise while also boiling. This strategy, on the other hand, does not work in
countries where the sun is strong and the day is long.
None of the creature styles perform all of the collector’s recommended
access protection duties; work for top models with no solar system revision; do
notwaste water; and are beneficial to rainfall and home demand [19, 20].
In [21, 22], the cost analysis contrasts the efficiency of the proposed
distributed communication platform and the centralized management of micro
grid communications. Table 2.1 presented the comparison of designs and major
findings of different types of solar water heater systems used in various
countries.

2.1 ANALYSIS OF ENERGY AUDIT


To conduct the first ever SWH energy audit, the sensor data are used.
Solar subsystems pump subsystems, supplementary subsystems, hot water
subsystems, and circulation subsystems are all evaluated separately in the
SWH.
Each subsystem's heat energy is estimated using the transfer equation of
heat: where Qp/c is the heat consumption/production (kWh), C and m are the
heat density and capacity of the fluid, and T denotes the difference in the
temperature between the measured sub-input system and outflow.

6
2.2 THERMAL SYSTEM - ANALYSIS OF EFFICIENCY
There are two types of STCs for the selected SWH: flat plate and
vacuum tube. Introduce efficiency indicators as key performance indicators to
measure the execution of solar thermal systems. This is expressed as ηs(%) =
Qˆs Qs × 100%. 1), Qs is an estimate of the solar energy intent by the STC.
The contribution of the paper is to develop a novel design based on IoT
intelligent monitoring of a solar water heater. The paper focuses primarily on
the monitoring system for controlling its performance and data collection using
IoT technology via a user-facing website.

2.3 HARDWARE DESCRIPTION


2.3.1 ESP8266
2.3.1.1 Introduction
The Fig 2.1 ESP 8266 Pin Diagram is a low-cost Wi-Fi microchip, with
built-in TCP/IP networking software, and microcontroller capability, produced
by Espressif Systems[1] in Shanghai, China.
The chip was popularized in the English-speaking maker community in
August 2014 via the ESP-01 module, made by a third-party manufacturer Ai-
Thinker. This small module allows microcontrollers to connect to a Wi-Fi
network and make simple TCP/IP connections using Hayes-style commands.
However, at first, there was almost no English-language documentation
on the chip and the commands it accepted.[2]
The very low price and the fact that there were very few external
components on the module, which suggested that it could eventually be very
inexpensive in volume, attracted many hackers to explore the module, the chip,
andthe software on it, as well as to translate the Chinese documentation.[3]

7
The ESP8285 is a similar chip with a built-in 1 MiB flash memory,
allowingthe design of single-chip devices capable of connecting via Wi-Fi.[4]

These microcontroller chips have been succeeded by the ESP32 family


ofdevices.

Fig 2.1 ESP 8266 Pin Diagram

2.3.1.2 Features
Processor: L106 32-bit RISC microprocessor core based on the
Tensilica Diamond Standard 106Micro running at 80 or 160 MHz [5]

 Memory:

 32 KiB instruction RAM


 32 KiB instruction cache RAM
 80 KiB user-data RAM
 16 KiB ETS system-data RAM

8
 External QSPI flash: up to 16 MiB is supported (512 KiB to 4 MiB
typically included)
 IEEE 802.11 b/g/n Wi-Fi
 Integrated TR switch, balun, LNA, power amplifier and
matching network
 WEP or WPA/WPA2 authentication, or open networks

 17 GPIO pins[7]
 Serial Peripheral Interface Bus (SPI)
 I²C (software implementation)[8]
 I²S interfaces with DMA (sharing pins with GPIO)
 UART on dedicated pins, plus a transmit-only UART can be enabled on
GPIO2
 10-bit ADC (successive approximation ADC)

In 2020, Espressif announced a new chip, ESP32-C3, which is pin-


compatible with ESP8266. It is based on a single core RISC-V 32-bit CPU
with a clock speed of up to 160 MHz

2.3.2 Temperature Sensor - DS18B20


2.3.2.1 Introduction
The Fig 2.2 DS18B20 Pin Diagram digital thermometer provides 9-bit to
12-bit Celsius temperature measurements and has an alarm function with
nonvolatile user-programmable upper and lower trigger points. The DS18B20
communicates over a 1-Wire bus that by definition requires only one data line
(andground) for communication with a central microprocessor.

9
In addition, the DS18B20 can derive power directly from the data line
(“parasite power”), eliminating the need for an external power supply. Each
DS18B20 has a unique 64-bit serial code, which allows multiple DS18B20s to
function on the same 1-Wire bus.
Thus, it is simple to use one microprocessor to control many DS18B20s
distributed over a large area. Applications that can benefit from this feature
include HVAC environmental controls, temperature monitoring systems inside
buildings, equipment, or machinery, and process monitoring and control
systems.

2.3.2.2 Applications

 Thermostatic Controls
 Consumer Products
 Industrial Systems
 Thermally Sensitive System

2.3.2.3 Description

Fig 2.2 DS18B20 Terminal Diagram

10
 Programmable Digital Temperature Sensor
 Communicates using 1-Wire method
 Operating voltage: 3v to 5v
 Temperature Range: -55°C to +125°C
 Accuracy: ±0.5°C
 Output Resolution: 9-bit to 12-bit (programmable)
 Conversion time: 750ms at 12-bit
 Programmable alarm options
 Available as To-92, SOP and even as a waterproof sensor

2.3.3 REES52 NODEMCU LUA ESP8266 ESP 12E


2.3.3.1 Introduction

The Fig 2.3 REES52 baseboard is the Breakout Board for our NodeMcu
ESP8266 V3 Lua CH340 Wi-Fi Dev. Board. NodeMcu Baseboard NodeMcu
Lua WIFI DevelopmentBoard ESP8266 Serial Port Baseboard is an open-source
networking platform. It uses Lua scripting language programming. Allows
developers to deal with the underlying hardware in a manner similar to for
Arduino. So that software developers can easily operate hardware devices.

11
Fig 2.3 REES52 NODEMCU LUA ESP8266 ESP 12E

2.3.4 Relay
2.3.4.1 Description
The Fig 2.4 is a 5v, 10A 2-Channel Relay interface board. It can be used
to control various appliances, and other equipment with large current. It can be
controlled directly with 3.3v or 5v logic signals from a microcontroller
(Arduino, 8051, AVR, PIC, DSP, ARM, ARM, MSP430, TTL logic).
It has a 1x4 (2.54mm pitch) pin header for connecting power (5v and 0v),
and for controlling the 2 relays.

12
Fig 2.4 2 Channel 5v Relay Module with Optocoupler

The pins are marked on the PCB:-

 GND - Connect 0v to this pin.


 IN2 - Controls relay 2, active Low Relay will turn on when
this input goesbelow about 2.0v.
 VCC - Connect 5v to this pin. Is used to power the optocouplers.

2.3.4.2 Specification

 High current relay, AC250v 10A, DC5v 10A.


 LEDs to indicate when relays are on.
 Works with logic level signals from 3.3v or 5v devices.
 Opto isolation circuitry.

13
2.3.5 Servomotor
2.3.5.1 Introduction

The Fig: 2.5 Servomotor is a type of motor that can rotate with great
precision. Normally this type of motor consists of a control circuit that
provides feedback on the current position of the motor shaft; this feedback
allows the servo motors to rotate with great precision. If you want to rotate an
object at some specific angles or distance, then you use a servomotor. It is just
made up of a simple motor which runs through a servo mechanism. If a motor
is powered by a DC power supply then it is called DC servomotor, and if it is
AC-powered motor then it is called AC servo motor.
For this tutorial, we will be discussing only the DC servomotor working.
Apart from these major classifications, there are many other types of
servomotors based on the type of gear arrangement and operating
characteristics. A servo motor usually comes with a gear arrangement that
allows us to get a very high torque servomotor in small and lightweight
packages.
Servomotors are rated in kg/cm (kilogram per centimeter) most hobby
servo motors are rated at 3 kg/cm or 6 kg/cm or 12 kg/cm. This kg/cm tells you
how much weight your servo motor can lift at a particular distance. For
example: A 6 kg/cm Servomotor should be able to lift 6kg if the load is
suspended 1 cm away from the motors shaft, the greater the distance the lesser
the weight carrying capacity. The position of a servomotor is decided by
electrical pulse and its circuitry is placed beside the motor.

14
Fig: 2.5 Servomotor
2.3.5.2 Servom otor Working Mechanism
It consists of three parts:
 Controlled device
 Output sensor
 Feedback system

It is a closed-loop system where it uses a positive feedback system to


control motion and the final position of the shaft. Here the device is controlled
by a feedback signal generated by comparing output signal and reference
input signal.
Here the reference input signal is compared to the reference output
signal and the third signal is produced by the feedback system. And this third
signal acts as an input signal to control the device.
This signal is present as long as the feedback signal is generated or there
is a difference between the reference input signal and reference output signal.
So the main task of servomechanism is to maintain the output of a system at the
desired value in the presence of noises.

15
2.3.5.3 Servomotor Working Principles
A servo consists of a Motor (DC or AC), a potentiometer, gear
assembly, and a controlling circuit. First of all, we use gear assembly to
reduce RPM and to increase torque of the motor. Now an electrical signal is
given to another input terminal of the error detector amplifier.
Now the difference between these two signals, one comes from the
potentiometer and another comes from other sources, will be processed in a
feedback mechanism and output will be provided in terms of error signal.
This error signal acts as the input for the motor and motor starts rotating. Now
the motorshaft is connected with the potentiometer and as the motor rotates so
does the potentiometer and it will generate a signal.
After sometime the position of potentiometer reaches a position that the
output of potentiometer is the same as the external signal provided. At this
condition, there will be no output signal from the amplifier to the motor input
as there is no difference between external applied signal and the signal
generated at potentiometer, and in this situation the motor stops rotating.

2.3.5.4 Controlling Servomotor


All motors have three wires coming out of them. Out of which two will
be used for Supply (positive and negative) and one will be used for the signal
that is tobe sent from the MCU.
Servomotor is controlled by PWM (Pulse width Modulation) which is
provided by the control wires. There is a minimum pulse, a maximum pulse
and a repetition rate. Servomotor can turn 90 degrees from either direction
from its neutral position.

16
The servomotor expects to see a pulse every 20 milliseconds (ms) and
the length of the pulse will determine how far the motor turns. For example, a
1.5ms pulse will make the motor turn to the 90° position, such as if the pulse is
shorter than 1.5ms the shaft moves to 0° and if it is longer than 1.5ms then it
will turn the servo to 180°.
Servomotor works on PWM (Pulse width modulation) principle,
meaning its angle of rotation is controlled by the duration of applied pulse to
its Control PIN. Basically a servo motor is made up of a DC motor which is
controlled by a variable resistor (potentiometer) and some gears. High speed
force of the DC motor is converted into torque by Gears.
We know that WORK= FORCE X DISTANCE, in DC motor Force is
less and distance (speed) is high and in Servo, force is High and distance is
less. The potentiometer is connected to the output shaft of the Servo, to
calculate the angle and stop the DC motor on the required angle.

Fig: 2.6 Servomotor Rotation Angle

17
The Fig: 2.6 Servomotor Rotation Angle can be rotated from 0 to 180
degrees, but it can go up to 210 degrees, depending on the manufacturing. This
degree of rotation can be controlled by applying the Electrical Pulse of proper
width to its Control pin. Servo checks the pulse every 20 milliseconds.
The pulse of 1 ms (1 millisecond) width can rotate the servo to 0
degrees, 1.5ms can rotate to 90 degrees (neutral position) and 2 ms pulse can
rotate it to 180 degree.
All servomotors work directly with your +5V supply rails but we have to
be careful about the amount of current the motor would consume if you are
planning to use more than two servo motors a proper servo shield should be
designed.

2.3.6 Liquid Crystal Display

LCD is a flat display technology, which stands for "Liquid Crystal


Display," which is generally used in computer monitors, instrument panels, cell
phones, digital cameras, TVs, laptops, tablets, and calculators. It is a thin
display device that offers support for large resolutions and better picture
quality.
The older CRT display technology has been replaced by LCDs, and new
display technologies like OLEDs have started to replace LCDs. An LCD
display is most commonly found with Dell laptop computers and is available as
an active-matrix, passive-matrix, or dual-scan display.
The Fig 2.7 16*2 Liquid Crystal Displays are not only different in terms
of weight than CRT monitors; even the process of working them is also
different. An LCD contains a backlight rather than the firing electrons at a
glass screen, which offers light to individual pixels arranged in a rectangular
grid. All pixels have a sub-pixel, red, green, and blue, which can be turned on
or off.

18
The display appears black if all of a pixel's sub-pixels are turned off and
appears white if all the sub-pixels are turned on 100%. The millions of color
combinations can be possible with the help of adjusting the individual levels of
red,green, and blue light.

Fig 2.7 16*2 Liquid Crystal Display

2.4 SOFTWARE DESCRIPTION


2.4.1 Arduino IDE
It is official software introduced by Arduino.cc that is mainly used for
editing, compiling and uploading the code in the Arduino Device. Almost all
Arduino modules are compatible with this software that is open source and is
readily available to install and start compiling the code on the go.

19
In this article, we will introduce the Software, how we can install it, and
make it ready for developing applications using Arduino modules.
 Fig: 2.8 Arduino IDE is open source software that is mainly used for
writing and compiling the code into the Arduino Module.
 It is official Arduino software, making code compilation so easy that
even a common person with no prior technical knowledge can get their
feet wet with the learning process.
 It is easily available for operating systems like MAC, Windows, Linux
and runs on the Java Platform that comes with inbuilt functions and
commands that play a vital role for debugging, editing and compiling
the code in the environment.
 A range of Arduino modules available including Arduino Uno,
Arduino Mega, Arduino Leonardo, Arduino Micro and many more.
 Each of them contains a microcontroller on the board that is actually
programmed and accepts the information in the form of code.
 The main code, also known as a sketch, created on the IDE platform will
ultimately generate a Hex File which is then transferred and uploaded in
the controller on the board.
 The IDE environment mainly contains two basic parts: Editor and
Compiler where former is used for writing the required code and later
is used for compiling and uploading the code into the given Arduino
Module.
 This environment supports both C and C++ languages.

The software is available for common operating systems like Linux,


Windows, and MACos; we select to download the correct software version that
is easily compatible with our operating system.

20
The IDE environment is mainly distributed into three sections
 Menu Bar
 Text Editor
 Output Panel

As we download and open the IDE software, it will appear like an image below.

Fig: 2.8 Arduino IDE

21
 The bar appearing on the top is called Menu Bar that comes with
fivedifferent options as follows:
 File – You can open a new window for writing the code or open an
existingone.
 Following table shows the number of further subdivisions the file option
iscategorized into.
 Edit – Used for copying and pasting the code with further modification
for font.
 Sketch – For compiling and programming.
 Tools – Mainly used for testing projects. The Programmer section in this
panel isused for burning a boot loader to the new microcontroller.
 Help – In case you are feeling skeptical about software, complete help is
availablefrom getting started to troubleshooting.
 The check mark appearing in the circular button is used to verify the
code.Click this once you have written your code.
 The arrow key will upload and transfer the required code to the
Arduinoboard.
 The dotted paper is used for creating a new file.
 The upward arrow is reserved for opening an existing Arduino project.
 The downward arrow is used to save the current running code.
 The button appearing on the top right corner is a Serial Monitor – A
separate pop-up window that acts as an independent terminal and plays a
vital role forsending and receiving the Serial Data.
 You need to select the baud rate of the Arduino Board you are using
right now. For my Arduino Uno Baud Rate is 9600, as you write the
following code and click the Serial Monitor, the output will show.

22
2.4.2 Firebase

2.4.2.1 Introduction
Google Firebase may be Google-backed application development
software that allows developers to develop IOS, Android and Web apps.
Firebase provides tools for tracking analytics, reporting and fixing app
crashes, creating marketing and product experiments.

2.4.2.2 Methodology
Firebase offers variety of services, including:
 Analytics
Google Analytics helps you understand how people use your web,
Apple, or Android app. The SDK automatically captures a number of events
and user properties and also allows you to define your own custom events to
measure the things that uniquely matter to your business.
Once the data is captured, it's available in a dashboard through the
Firebase console. This dashboard provides detailed insights about your data
from summary data such as active users and demographics, to more detailed
data such as identifying your most purchased items.
Fig: 2.9 Analytics also integrates with a number of other Firebase
features. For example, it automatically logs events that correspond to
notification messages sent via the Notifications composer and provides
reporting on the impact of each campaign.
Analytics helps you understand how your users behave, so you can make
informed decisions about how to market your app. See the performance of your
campaigns across organic and paid channels to understand which methods are
mosteffective at driving high-value users.

23
If you need to perform custom analysis or join your data with other
sources you can link your Analytics data to Big Query, which allows for more
complex analysis like querying large data sets and joining multiple data sources.

Fig: 2.9 Analytics

 Authentication
Most apps need to know the identity of a user. Knowing a user's identity
allows an app to securely save user data in the cloud and provide the same
personalized experience across all of the user's devices.
Firebase Authentication provides backend services, easy-to-use SDKs,
and ready-made UI libraries to authenticate users to your app. It supports
authentication using passwords, phone numbers, popular federated identity
providers like Google,Facebook and Twitter, and more.
Firebase Authentication integrates tightly with other Firebase services,
and it leverages industry standards like OAuth 2.0 and Open ID Connect, so it
can be easily integrated with your custom backend.

24
When you upgrade to Firebase Authentication with Identity Platform,
you unlock additional features, such as multi-factor authentication, blocking
functions, user activity and audit logging, SAML and generic Open ID Connect
support, multi-tenancy, and enterprise-level support.

 Cloud Messaging
Firebase Cloud Messaging (FCM) may be various messaging tools
allowing companies to trust and receive messages on IOS, Android and
therefore the web at no cost.
Using FCM, you can notify a client app that new email or other data is
available to sync. You can send notification messages to drive user re-
engagement and retention. For use cases such as instant messaging, a message
can transfer a payload of up to 4096 bytes to a client app.

A Fig: 2.10 Firebase Cloud Messaging implementation includes two


main components for sending and receiving:

 A trusted environment such as Cloud Functions for Firebase or


an app serveron which to build, target, and send messages.

 An Apple, Android, or web (JavaScript) client app that


receives messages via the corresponding platform-specific
transport service.

You can send messages via the Firebase Admin SDK or the FCM server
protocol. You can use the Notifications composer for testing and to send
marketing or engagement messages using powerful built-in targeting and
analytics or custom imported segments.

25
See the architectural overview for more detail and important information
about the components of FCM.

Fig: 2.10 Cloud Messaging

 Real-time Database
The Firebase Real-time Database is a cloud-hosted database. Data is
stored as JSON and synchronized in real-time to every connected client. When
you build cross-platform apps with our Apple platforms, Android, and
JavaScript SDKs, all of your clients share one Real-time Database instance and
automatically receive updates with the newest data.
Alternatively, consider trying Cloud Fire store for modern applications
requiring richer data models, query ability, scalability and higher availability.

26
The Firebase Real-time Database lets you build rich, collaborative
applications by allowing secure access to the database directly from client-side
code. Data is persisted locally, and even while offline, real-time events
continue to fire, giving the end user a responsive experience.
When the device regains connection, the Real-time Database
synchronizes the local data changes with the remote updates that occurred
while the client was offline, merging any conflicts automatically.
The Fig: 2.11 Real-time Database provides a flexible, expression-based
rules language, called Firebase Real-time Database Security Rules, to define
how your data should be structured and when data can be read from or written
to.
When integrated with Firebase Authentication, developers can define
who has access to what data, and how they can access it.
The Real-time Database is a NoSQL database and as such has different
optimizations and capabilities compared to a relational database. The Real-time
Database API is designed to only allow operations that can be executed
quickly.
This lets you build a great real time experience that can serve millions of
users without compromising on responsiveness. Because of this, it is important
to think about how users need to access your data and then structure it
accordingly.
Store and sync data with our NoSQL cloud database. Data is synced
across all clients in real time, and remains available when your app goes
offline.

27
Fig: 2.11 Real-time Databases

 Crashlytics
Firebase Crashlytics may be a real-time crash journalist assisting
engineer’s track, prioritize and fix problems that diminish the quality of their
applications.
The Fig: 2.12 Crashlytics is a lightweight, real-time crash reporter that
helps you track, prioritize, and fix stability issues that erode your app quality.
Crashlytics saves you troubleshooting time by intelligently grouping crashes
and highlighting the circumstances that lead up to them.
Find out if a particular crash is impacting a lot of users. Get alerts when
an issue suddenly increases in severity. Figure out which lines of code are
causing crashes.

28
Fig: 2.12 Crashlytics
To provide metrics and reports about your app, Crashlytics collects and
analyzes crashes, non-fatal exceptions, and other event types from your app.
We use the mapping information for your app's build to create human-readable
crash reports to help you understand the events (for example, we use the debug
symbol (dSYM) files for Apple platform apps).
When Crashlytics receives events, it uses an analysis engine to group
related events into issues. The analysis engine looks at the frames in the stack
trace, exception message, error code, and other platform or error type
characteristics to group events into issues. In an issue, all events have a
common point of failure. As more incoming events match to an issue, the issue
rises towards the top of your app's Issues table in the Crashlytics dashboard.
This grouping and ranking helps you identify and fix the most impactful
problems faster.

29
Yet even within this group of events, the stack traces leading to the
point-of-failure might be different. And a different stack trace could mean a
different root cause.

To represent this possible difference within an issue, Crashlytics creates


variants within issues; each variant is a sub-group of events in an issue that
have the same failure point and a similar stack trace. With variants, you can
debug the most common stack traces within an issue and determine if different
root causes are leading to the failure.

 Performance
The Cloud-Firebase Performance Monitoring feature provides
developers with an understanding of application features of their IOS and
Android apps to help them decide where to reach and when the performance of
their applications is improved.
Firebase Performance Monitoring is a service that helps you to gain
insight into the performance characteristics of your Apple, Android, and web
apps.
You use the Performance Monitoring SDK to collect performance data
from your app, then review and analyze that data in the Firebase console.
Performance Monitoring helps you to understand in real time where the
performance of your app can be improved so that you can use that information
to fix performance issues.
The collected performance data for each trace are called metrics and vary
depending on the type of trace. For example, when an instance of your app
issues a network request, the trace collects metrics that are important for
network request monitoring, like response time and payload size.

30
Performance Monitoring uses traces to collect data about these processes.
A trace is a report that contains data captured between two points in time in
your app.
Each time an instance of your app runs a monitored process, the
associated trace also automatically collects attributes data for that app instance.
For example, if an Android app issues a network request, the trace collects the
device, app version, and other attributes for that specific app instance. You can
use these attributes to filter your performance data and learn if specific user
segments are experiencing issues.
The out-of-the-box traces from Performance Monitoring get you started
with monitoring your app, but to learn about the performance of specific tasks
or flows, try out instrumenting your own custom traces of code in your app.

 Test Lab

Firebase Test Lab may be a cloud-based application testing


infrastructure. By one performance, developers can test their IOS or Android
apps across all device devices as well device configuration. They will see
results, including videos, screenshots and logs, inside the Firebase console.
Firebase Test Lab may be a cloud-based application testing
infrastructure. By one performance, developers can test their IOS or Android
apps across all device devices as well device configuration.
Fig: 2.13 Test Lab uses real, production devices running in a Google
data center to test your app. The devices are flashed with updated APIs and
have customizable locale settings, allowing you to road-test your app on the
hardware and configurations it'll encounter in real-world use.

31
Fig: 2.13 Test Lab

2.4.3 React

React is a JavaScript library for building user interfaces, primarily for


creating single-page applications where user interactions are dynamic and
frequent. Developed and maintained by Facebook, react allows developers to
build reusable UI components that efficiently update and render in response to
data changes.

32
Here is a brief description of Fig: 2.14 React Key Features:

 Declarative

React follows a declarative paradigm, allowing developers to describe


the desired outcome rather than focusing on the step-by-step process of
achieving it. This simplifies the code and makes it more predictable.

 Component-Based

React encourages a modular approach to building user interfaces through


the use of components. Each component represents a reusable, self-contained
piece of the UI that can be composed to create complex applications.

 Virtual DOM

React uses a virtual DOM to optimize the rendering process. Instead of


updating the entire DOM whenever there is a change, react updates a virtual
representation of the DOM and then calculates the most efficient way to update
theactual DOM.

 JSX (JavaScript XML)

JSX is a syntax extension for JavaScript that looks similar to XML or


HTML. It allows developers to write UI components in a syntax that resembles
the final output, making the code more readable and expressive.

 Unidirectional Data Flow

React enforces a unidirectional data flow, meaning that data flows in one
direction through the application. This helps maintain a clear and predictable
state, making it easier to understand and debug code.

33
 React Hooks

Introduced in React 16.8, hooks are functions that allow developers to


use state and lifecycle features in functional components. This makes it easier
to manage state and side effects in functional components, promoting a more
modularand concise code structure.

 Community and Ecosystem

React has a large and active community, resulting in a rich ecosystem of


libraries, tools, and resources. This community support contributes to the
growth and evolution of React, ensuring that it stays relevant and up-to-date.

 React Native

While React is primarily used for web development, React Native


extends its capabilities to mobile app development. React Native enables
developers to build cross-platform mobile applications using the same React
principles.
In summary, react is a powerful tool for building user interfaces. It is a
library that can be used with other libraries to render to certain environments.
Reacts primary goal is to minimize the bugs that occur when developers are
building UIs.
It does this through the use of components self-contained, logical pieces
of code that describe a portion of the user interface. These components can be
composed together to create a full UI, and React abstracts away much of the
rendering work, leaving you to concentrate on the UI design.

React is a component-based front-end library responsible only for the


view layer of a Model View Controller (MVC) architecture.

34
It is an open-source JavaScript library used to create user interfaces in a
declarative and efficient way. React is not a complete framework and requires
the use of additional libraries for routing, state management, and other features.

React is a popular choice for building web applications because it allows


developers to build reusable UI components and provides a fast and efficient
way to update the user interface when data changes.

Fig: 2.14 React Key Features

35
CHAPTER 3

METHODOLOGY

3.1 INTRODUCTION

Introducing an innovative solution to common challenges faced by solar


water heaters, our project leverages cutting-edge technology to enhance
performance and user convenience. By integrating components like the ESP8266
microcontroller, DS18B20 temperature sensor, LCD display, and cloud-based
control system, devised a robust system that ensures optimal heating efficiency
andminimal maintenance requirements.

The solution prioritizes user comfort and control, allowing individuals to


set their desired water temperature remotely via a mobile application powered by
Firebase and React software. This intuitive interface empowers users to customize
their hot water experience while optimizing energy consumption.

Moreover, the system incorporates advanced monitoring capabilities


facilitated by cloud connectivity, enabling real-time tracking of temperature
levels and system status. By utilizing stepper motor technology, the solar panel
orientation can be adjusted automatically to maximize solar exposure, further
enhancing heating performance.

With a focus on reducing maintenance demands, the solution streamlines


system management processes and minimizes the risk of scale buildup or
component deterioration. By addressing key challenges such as limited heating
capacity, weather-dependent performance, and integration complexities, our
projectaims to promote widespread adoption of solar water heating technology.

36
Through this project, aim to revolutionize the way solar water heaters
operate, offering a seamless, efficient, and user-centric solution that harnesses the
power of IoT and cloud technology to deliver superior performance and user
satisfaction.

3.2 BLOCK DIAGRAM FOR PROPOSED WORK

Fig. 3.1 Block Diagram for Proposed Work

37
3.3 WORKING PRINCIPLE OF PROPOSED BLOCK DIAGRAM

Here's a working principle for the setup you described:


 Hardware Setup:
ESP8266: This serves as the main controller and connects to your local
Wi-Fi network, enabling communication with your mobile phone.
Temperature Sensor DS18B20: This sensor measures the temperature of
the water in your solar water heater.
Relay: The relay is used to control the power supply to your water heater. It
can turn the heater on or off based on commands from the ESP8266.
LCD Display: The LCD display provides real-time temperature readings
and other status information for easy monitoring.
Servo Motor: This motor controls the opening and closing of a valve in
your solar water heater system to regulate the flow of water.
Mobile Phone: You'll develop a mobile application that communicates
with the ESP8266 over Wi-Fi to send commands and receive data.

 Software Implementation:
ESP8266 Firmware: Write firmware for the ESP8266 using Arduino IDE
or similar development environment.

The firmware should include code to:


 Connect to your Wi-Fi network.
 Initialize communication with the temperature sensor (DS18B20) to
read temperature data.
 Implement logic to receive commands from the mobile app, such as
turning the relay on/off and setting temperature values.
 Control the servo motor based on the temperature set values.

38
 Send real-time temperature data to the mobile app for display.
 Update the LCD display with temperature readings and system status.
Web Application: Developed a Web application for Android or iOS
that allows users to:
 Connect to the ESP8266 over Wi-Fi.
 Send commands to turn the water heater on/off.
 Set temperature values for the water heater.
 Receive real-time temperature readings from the ESP8266.
 Display system status and feedback from the ESP8266.

 Working Principle:
 The ESP8266 continuously reads temperature data from the DS18B20
sensor.
 It compares the current temperature with the temperature set values
receivedfrom the mobile app.
 If the current temperature is lower than the set value, the ESP8266
activatesthe relay to turn on the water heater.
 Once the temperature reaches the desired set value, the ESP8266
deactivatesthe relay to turn off the water heater.
 The ESP8266 also adjusts the servo motor to regulate the flow of
waterbased on the temperature set values.
 Meanwhile, it sends real-time temperature data to the mobile app for
displayon the user's device.
 The mobile app allows users to remotely control the water heater, set
desiredtemperatures, and monitor the system's status.

39
 Operation:
 Users launch the mobile app and connect it to the ESP8266.
 They set their desired temperature using the mobile app.
 The ESP8266 continuously monitors the temperature and adjusts the
water heater and servo motor accordingly.
 Users can monitor the current temperature and system status on their
mobile devices in real-time.
 They can also manually control the water heater by turning it on/off via
the app.

3.4 CIRCUIT DIAGRAM OF HARDWARE SETUP

Fig 3.2 Circuit Diagram of Hardware Setup

40
3.5 COST ESTIMATION OF HARDWARE SETUP

Table 3.5 Cost Estimation of Hardware Setup

S.NO COMPONENTS QUANTITY COST (Rs.)

1. ESP8266 2 800.00

2. Temperature Sensor DS18B20 1 300.00

3. Relay 2 150.00

4. Servo Motor 1 180.00

5. LCD Display 1 450.00

6. PCB Board 1 120.00

7. USB Wire 2 300.00

8. Bulb wooden stand 1 200.00

9. Bulb and Holder 2 600.00

10. Connecting Wires AS REQUIRED 100.00

TOTAL 3,200.00

41
3.6 SUMMARY

The proposed solution aims to address common challenges associated with


solar water heaters by leveraging IoT technology and cloud-based control
systems. By incorporating features such as remote monitoring, user-defined
temperature settings, and efficient maintenance procedures, the system offers a
comprehensive solution for optimizing solar water heating performance.

Firstly, the integration of IoT devices such as the ESP8266 and DS18B20
sensor enables real-time monitoring of key parameters such as water temperature
and system status. This data is then transmitted to the cloud, providing users with
remote access to system information via a mobile application or web interface.

The user-friendly interface allows homeowners to set the desired water


temperature according to their preferences, ensuring comfort and convenience.
Additionally, the system incorporates a servo motor-controlled solar panel screen,
which adjusts the panel angle based on the user-defined temperature setting,
maximizing solar energy absorption and optimizing heating efficiency.

Maintenance requirements are minimized through intelligent design and


automation. The system includes self-diagnostic capabilities to detect potential
issues before they escalate, reducing the need for manual intervention.
Furthermore, regular maintenance reminders are sent to users via the mobile
application, ensuring that the system operates at peak efficiency over time.
Cloud-based control not only enables remote monitoring and management
but also facilitates data analytics and predictive maintenance. By analyzing
historical performance data, the system can identify trends and patterns, allowing
for proactive maintenance interventions and troubleshooting.

42
Overall, this IoT-based solar water heater solution offers numerous
benefits, including improved heating performance, reduced maintenance
requirements, and enhanced user control and convenience. By harnessing the
power of IoT and cloud technologies, homeowners can enjoy reliable hot water
supply while minimizing energy consumption and environmental impact.

In summary, the project combines innovative hardware components, such


as the ESP8266, DS18B20 sensor, and servo motor, with cloud-based control and
monitoring capabilities to create an intelligent and efficient solar water heating
system. With its user-friendly interface and advanced features, the system
addresses common challenges associated with solar water heaters and provides
homeowners with a reliable and sustainable hot water solution for their
households.

43
CHAPTER 4
RESULT AND DISCUSSION

4.1 Layout of Hardware Setup

Fig 4.1 Layout of Hardware Setup

44
4.2 Web Dashboard

Fig 4.2 Web Dashboard

45
4.3 Mobile Dashboard

Fig 4.3 Mobile Dashboard

46
4.4 Working of Valve control by Bulb ON in App

Fig 4.4 Working of Valve control by Bulb ON in App

47
4.5 Working of Valve control by Bulb OFF in App

Fig 4.5 Working of Valve control by Bulb OFF in App

48
4.6 Firebase Real-time Database

Fig 4.6 Firebase Real-time Database

49
4.7 Working of the Heater when it exceeds the set value

Fig 4.7 Working of the Heater when it exceeds the set value

50
Procedure:
 Initial Set up process:
 Connect the esp8266 to the configured Wi-Fi network.
 Check for the connection status as shown in fig 4.1.
 Navigate to the website: https://65e9b4eea246ac02fb4a00c2--steady-
salamander-fd34a3.netlify.app/

 Heater turn on and off process:


 To Turn on the heater Press the Turn on button the heater (servo
motor) turnson.
 You can also set the required Servo Motor angle (Screen opening
Percentage). By using the select tag you set various percentages like
25%,50%,75%,100% based on the water temperature requirements.
 The default percentage is 100%.
 To turn off the heater you can simply press the turn off button in the
webdashboard in fig 4.2 and also for mobile control fig 4.3 shown.

 Automatic turn off feature:


 The heater operates till 75 C° (our requirement).
 The web application is designed such that whenever the water
temperature Rises above 75 C° the servo motor angle sets to 0° angle
(Heater turns off byfull closing of the Screen) for this we can refer fig
4.7.
 Another feature of the web dashboard is that you cannot turn on the
heaterwhen the temperature is above 75 C°, it will show an alert such
as “wait forthe water temperature to reduce, to turn on the heater”.

51
 Inlet and outlet valve control feature:
 As per our requirement we can control both the inlet and outlet water
valve of our heater.
 To Turn on the Inlet water valve fig 4.4 press the Turn on button on
the
 Inlet valve section, Perform the same action to turn off the valve.
 To turn on the outlet water valve fig 4.5 press the Turn on button on
the outlet valve section, perform the same action to turn off the valve.

52
CHAPTER 5
CONCLUSION

The IoT-based solar water heater system addresses several common


challenges associated with traditional solar water heaters while providing
innovative solutions to enhance performance, convenience, and efficiency. By
integrating cutting-edge technology such as cloud control, remote monitoring,
and smart temperature settings, we have created a system that not only overcomes
existing limitations but also sets a new standard for solar water heating solutions.

Cloud Control for Enhanced Accessibility:


By utilizing cloud-based services, the system allows users to remotely
monitor and control their solar water heater from anywhere with internet access.
This feature enhances convenience and accessibility, empowering users to adjust
settings, monitor performance, and receive alerts or notifications in real-time.

Reduced Maintenance Requirements:


One of the key objectives of the project was to minimize maintenance
requirements associated with solar water heaters. By leveraging IoT technology
and smart sensors, the system enables proactive maintenance and reduces the
likelihood of issues such as scale buildup or component malfunctions. This not
only improves the longevity of the system but also reduces the need for frequent
maintenance interventions.

User-Defined Temperature Settings:


Another significant feature of the system is the ability for users to set their
desired water temperature through the mobile application.
This customization empowers users to tailor the system to their
preferences, ensuring optimal comfort and efficiency while conserving energy.

53
Integration of ESP8266, DS18B20 Sensor, LCD, and Servo Motor:
The integration of ESP8266 for Wi-Fi connectivity, DS18B20 sensor for
temperature sensing, LCD for local display, and servo motor for solar panel angle
adjustment demonstrates the versatility and scalability of our system. These
components work seamlessly together to enable efficient operation, accurate
temperature control, and intuitive user interface.

Future Directions and Recommendations:


To conclude this project, it's important to consider potential future
directions and recommendations for further improvement. This may include
exploring advanced predictive maintenance algorithms, enhancing energy
optimization strategies, integrating additional renewable energy sources such as
wind or geothermal, and expanding the scope of user interaction through voice
commands or machine learning algorithms.

In summary, the IoT-based solar water heater system represents a


significant advancement in the field of renewable energy technology. By
addressing common challenges, implementing innovative solutions, and
prioritizing user convenience and efficiency, we have created a system that not
only meets the needs of today but also paves the way for a sustainable and eco-
friendly future.

54
REFERENCES

1. Alhasnawi, B.N., Jasim, B.H., Mansoor, R., Alhasnawi, A.N., Rahman,


Z.-A.S.A., Haes Alhelou, H., Guerrero, J.M., Dakhil, A.M., Siano, P.
(2022) 'A new Internet of Things based optimization scheme of residential
demand side management system.' IET Renew. Power Gener., 9, 3792–
3800.

2. Alhasnawi, B.N., Jasim, B.H., Siano, P., Alhelou, H.H., Al-Hinai, A. (2022)
'A novel solution for day-ahead scheduling problems using the IoT-based
bald eagle search optimization algorithm.' Inventions, 16(3), 1992.

3. Benghanem, M., Mellit, A., Emad, M. (2022) 'IoT-based performance


analysis of hybrid solar heater-double slope solar still.' Water Supply, 91(3),
90–108.

4. Ge, T.S., Wang, R.Z., Xu, Z.Y., Pan, Q.W., Du, S., Chen, X.M., Chen, J.F.
(2018) 'Solar heating and cooling: Present and future development.' Renew.
Energy, 126, 1126–1140.

5. Hossein Motlagh, N., Mohammadrezaei, M., Hunt, J., Zakeri, B. (2020)


'Internet of Things (IoT) and the energy sector.' Energies, 13(2), 494.

6. Jabbar, W.A., Kian, T.K., Ramli, R.M., Zubir, S.N., Balfaqih, M., Alharbi,
S.(2019) 'Design and fabrication of smart homes with Internet of Things
enabled automation systems.' IEEE Access, 7, 144059–144074.

7. Liu, Z., Li, H., Liu, K., Yu, H., Cheng, K. (2017) 'Design of High -
performance water - in - glass evacuated tube solar water heaters by a High
-throughput screening based on machine learning: A combined modeling
andexperimental study.' Sol. Energy, 142, 61–67.

8. Mamouri, S.J., Derami, H.G., Ghiasi, M., Shafii, M.B., Shiee, Z. (2014)
'Experimental investigation of the effect of using thermosyphon heat pipes
and vacuum glass on the performance of solar still.' Energy, 75, 501–507.

55
9. Nassar, Y.F., Yousif, S.A., Salem, A.A. (2007) 'The second generation of the
solar desalination systems.' Desalination, 209(1-3), 177–181.

10. Ntsaluba, S., Zhu, B., Xia, X. (2016) 'Optimal flow control of a forced
circulation solar water heating system with energy storage units and
connecting pipes.' Renew. Energy, 126, 1126–1140.

11. Sehrawat, D., Gill, N.S. (2019) 'Smart sensors: Analysis of different types of
IoT sensors.' In: 2019 3rd IEEE International Conference on Trends in
Electronics and Informatics (ICOEI), pp. 523–528. IEEE, Piscataway.

12. Shrivastava, R.L., Kumar, V., Untawale, S.P. (2017) 'Modeling and
simulation of solar water heater: A TRNSYS perspective.' Renewable
Sustainable Energy Rev., 67, 126–143.

13. Sadeeq, M.A., Zeebaree, S. (2021) 'Energy management for internet of


things via distributed systems.' J. Appl. Sci. Technol. Trends, 2(02), 59–71.

56
APPENDIX:

Code ESP1:
#include <Arduino.h>#include <OneWire.h>
#include <DallasTemperature.h>
#if defined(ESP32)
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>#endif
#include <Firebase_ESP_Client.h>
//Provide the token generation process info.#include "addons/TokenHelper.h"
//Provide the RTDB payload printing info and other helper functions.#include
"addons/RTDBHelper.h"
#include <Wire.h>
#include <LiquidCrystal_I2C.h>#include <Servo.h>
Servo myservo;int intial=0;
int final=0;
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Insert your network credentials
//#define API_KEY "pBd3bAeqQKZbeuwSFZfw8l2DwG5zopQGkpFVgbsy"

#define WIFI_SSID "ARUNVIJAY"


#define WIFI_PASSWORD "12345678"

// Insert Firebase project API Key


#define API_KEY "AIzaSyCNhg-XqcHTvjoJHCrhEMW5YacQtS1SFrQ"

// Insert RTDB URL define the RTDB URL */


//#define DATABASE_URL
"https://temp-32fa0-default-rtdb.asia-southeast1.firebasedatabase.app"

#define DATABASE_URL "https://solar-35e5b-default-rtdb.firebaseio.com/"


//Define Firebase Data objectFirebaseData fbdo; FirebaseAuth auth;
FirebaseConfig config;
57
unsigned long sendDataPrevMillis = 0;
int count = 0;
bool signupOK = false;
// Data wire is connected to GPIO 0 on ESP8266#define ONE_WIRE_BUS D8
// Setup a oneWire instance to communicate with any OneWire devicesOneWire
oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature sensorDallasTemperature
sensors(&oneWire);
void setup(){ Serial.begin(115200);Wire.begin(D2,D1);
lcd.init(); // initializing the LCD
lcd.backlight(); // Enable or Turn On the backlight
// Start Printing pinMode(D3, OUTPUT);
pinMode(D4, OUTPUT);

//servo myservo.attach(D5);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED){Serial.print(".");
delay(300);}
Serial.println(); Serial.print("Connected with IP: ");Serial.println(WiFi.localIP());
Serial.println();
/* Assign the api key (required) */config.api_key = API_KEY;
/* Assign the RTDB URL (required) */ config.database_url = DATABASE_URL;
/* Sign up */
if (Firebase.signUp(&config, &auth, "", "")){Serial.println("ok");
signupOK = true;}
else{
Serial.printf("%s\n", config.signer.signupError.message.c_str());}
/* Assign the callback function for the long running token generation task */
config.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h
Firebase.begin(&config, &auth);
Firebase.reconnectWiFi(true);
58
// Start up the DS18B20 sensor librarysensors.begin();
}
void enableInletValve1(int x)
{
if(x==1)
{
digitalWrite(D3,LOW);
}
else
{
digitalWrite(D3,HIGH);
}
}
void enableInletValve2(int x)
{
if(x==1)
{
digitalWrite(D4 ,LOW);
}
else
{
digitalWrite(D4,HIGH);
}
}
void enableMotor(int x,int screenPercentage)
{
int angle=0; switch(screenPercentage)
{
case 100:
{
angle=180;break;

59
}
case 75:
{
angle=135;break;
}
case 50:
{
angle=90;break;
}
case 25:{angle=45; break;}
default:
{
angle=100;break;
}
}
Serial.println(angle); if(x==1 && intial==0)
{
intial=0;final=0;
myservo.write(angle);
//for (int i = 0; i <= angle; i++) {
//myservo.write(i);
//delay(0); }
}
if(x==0)
{
myservo.write(0);intial=0;
}
}
void loop(){ int valve1=0;
//valve operations
if (Firebase.RTDB.getInt(&fbdo, "valve")) {
60
if (fbdo.dataType() == "int") {
valve1 = fbdo.intData();
}
}
int valve2=0;
if (Firebase.RTDB.getInt(&fbdo, "inletValve")) {

if (fbdo.dataType() == "int") {
valve2 = fbdo.intData();
}
}
//servomotor
int heaterStatus=0;
if (Firebase.RTDB.getInt(&fbdo, "ONOFFStatus")) {

if (fbdo.dataType() == "int") {
heaterStatus = fbdo.intData();
}
}
int screenPercentage=0;
if (Firebase.RTDB.getInt(&fbdo, "percentage_opening")) {

if (fbdo.dataType() == "int") {
screenPercentage = fbdo.intData();
}
}
//valve operations enableInletValve1(valve1); enableInletValve2(valve2);
enableMotor(heaterStatus,screenPercentage);
//Temperature sensing
if (Firebase.ready() && signupOK && (millis() - sendDataPrevMillis > 1000 ||
sendDataPrevMillis == 0)){
sendDataPrevMillis = millis();
// Request temperature data from DS18B20 sensorsensors.requestTemperatures();
61
float temperatureC = sensors.getTempCByIndex(0); // Get temperature in Celsius
lcd.print(String(temperatureC)+" C");
// Write temperature data to Firebase
if (Firebase.RTDB.setFloat(&fbdo, "temperature", temperatureC)){
Serial.println("Temperature sent to Firebase: " + String(temperatureC) + "°C");
}
else {
("Failed to send temperature data to Firebase"); Serial.println("REASON: " +
fbdo.errorReason());
}
delay(1000); // Delay before next data sendlcd.clear();
}
}

Code ESP2:
#include <Arduino.h>#include <OneWire.h>
#include <DallasTemperature.h>
#if defined(ESP32)
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>#endif
#include <Firebase_ESP_Client.h>
//Provide the token generation process info.#include "addons/TokenHelper.h"
//Provide the RTDB payload printing info and other helper functions.
#include "addons/RTDBHelper.h"
#include <Wire.h>
#include <LiquidCrystal_I2C.h>#include <Servo.h>
Servo myservo;int intial=0;
int final=0;
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Insert your network credentials
62
//#define API_KEY "pBd3bAeqQKZbeuwSFZfw8l2DwG5zopQGkpFVgbsy"

#define WIFI_SSID "ARUNVIJAY"


#define WIFI_PASSWORD "12345678"
// Insert Firebase project API Key
#define API_KEY "AIzaSyCNhg-XqcHTvjoJHCrhEMW5YacQtS1SFrQ"
// Insert RTDB URLefine the RTDB URL */
//#define DATABASE_URL
"https://temp-32fa0-default-rtdb.asia-southeast1.firebasedatabase.app"

#define DATABASE_URL "https://solar-35e5b-default-rtdb.firebaseio.com/"


//Define Firebase Data objectFirebaseData fbdo; FirebaseAuth auth;
FirebaseConfig config;
unsigned long sendDataPrevMillis = 0;

int count = 0;
bool signupOK = false;
// Data wire is connected to GPIO 0 on ESP8266#define ONE_WIRE_BUS D8
// Setup a oneWire instance to communicate with any OneWire devicesOneWire
oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature sensorDallasTemperature
sensors(&oneWire);
void setup(){ Serial.begin(115200);Wire.begin(D2,D1);
lcd.init(); // initializing the LCD
lcd.backlight(); // Enable or Turn On the backlightWiFi.begin(WIFI_SSID,
WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED){Serial.print(".");
delay(300);
}
Serial.println(); Serial.print("Connected with IP: ");Serial.println(WiFi.localIP());
Serial.println();
/* Assign the api key (required) */config.api_key = API_KEY;
63
/* Assign the RTDB URL (required) */ config.database_url = DATABASE_URL;
/* Sign up */
if (Firebase.signUp(&config, &auth, "", "")){Serial.println("ok");
signupOK = true;
}
else{
Serial.printf("%s\n", config.signer.signupError.message.c_str());
}
/* Assign the callback function for the long running token generation task */
config.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h
Firebase.begin(&config, &auth);
Firebase.reconnectWiFi(true);
// Start up the DS18B20 sensor librarysensors.begin();
}
void loop(){
float temperatureC=0;
if (Firebase.RTDB.getInt(&fbdo, "temperature")) {
if (fbdo.dataType() == "float" || fbdo.dataType() == "int" ) {temperatureC =
fbdo.floatData();
}
}
lcd.print(String(temperatureC)+" C"); delay(1000); // Delay before next data send
lcd.clear();
}

React JS Code:
import { FaTemperatureHalf,FaTemperatureArrowUp } from "react-icons/fa6";

import { FaWater } from "react-icons/fa";


import { IoMenuSharp } from "react-icons/io5";import { FaPowerOff } from
"react-icons/fa"; import './App.css';
import React, {useEffect, useState } from "react";
64
import { onValue, ref,set,update} from "firebase/database";import Db from "./Db"
function App() {
const [temperature, setTemperature] = useState("20");

const [ONOFF, setONFF] = useState(0);


const [SolarRunningStatus, SolarRunningStatusChange] = useState(false);
const [valvestatus,valvestatusChange] = useState(false);
const [valveOnOFF,valveOnOFChange] = useState(0);
const [valvestatus2,valvestatusChange2] = useState(false);const
[valveOnOFF2,valveOnOFChange2] = useState(0);
//peak temperatur above 75 on off if(temperature>75 && ONOFF===1){
const updates={}setONFF(0)
SolarRunningStatusChange(false) updates["ONOFFStatus"]=0
update(ref(Db),updates)}
// get temperatureuseEffect(() => {
const query = ref(Db, "temperature");
return onValue(query, (snapshot) => {
const data = snapshot.val(); setTemperature(data)
});
}, []);
useEffect(() => {
const query = ref(Db, "ONOFFStatus");return onValue(query, (snapshot) => {
const data = snapshot.val(); setONFF(data)
});
}, []);
//for valves statususeEffect(() => {
const query = ref(Db, "valve");
return onValue(query, (snapshot) => {

const data = snapshot.val(); valveOnOFChange(data)


});
}, []);

65
useEffect(() => {
const query = ref(Db, "inletValve");

return onValue(query, (snapshot) => {


const data = snapshot.val();valveOnOFChange2(data)
});
}, []);
const changeStatus=()=>{
if(temperature>75){
alert("PLEASE WAIT FOR THE WATER TEMPERATURE TO REDUCE TO
TURN ON THE HEATER")}
else{ SolarRunningStatusChange(!SolarRunningStatus)

const status=SolarRunningStatus===true?0:1; const updates={}


updates["ONOFFStatus"]=status

update(ref(Db),updates)

}}
const changeStatusValve=()=>{
valvestatusChange(!valvestatus)
const status=valvestatus===false?1:0;

const updates={} updates["valve"]=status update(ref(Db),updates)}


const changeStatusValve2=()=>{
valvestatusChange2(!valvestatus2) const status=valvestatus2===false?1:0;const
updates={} updates["inletValve"]=status update(ref(Db),updates)}
const getPercentage=(e)=>{
const status=e.target.valueconsole.log(typeof status)const updates={}
updates["percentage_opening"]=parseInt(status) update(ref(Db),updates)}
const onButtonTxt=ONOFF===0?"TURN ON":"TURN OFF"
const onButtonTxtStyle=ONOFF===0?"TURN-ON-BTN":"TURN-OFF-BTN" const
onButtonTxtValve=valveOnOFF===0?"TURN ON":"TURN OFF"
const

66
onButtonTxtStyleValve=valveOnOFF===0?"TURN-ON-BTN":"TURN-OFF-BTN
"
const onButtonTxtValve2=valveOnOFF2===0?"TURN ON":"TURN OFF"const
onButtonTxtStyleValve2=valveOnOFF2===0?"TURN-ON-BTN":"TURN-OFF-B
TN"
return (
<div className="App-container">
<ul className="temperature-container">
<li>
<div className="container-temp-icon">{
temperature>75?(<FaTemperatureArrowUp color="red" className="icon-temp"
size={32}/>):( <FaTemperatureHalf className="icon-temp" color="green"
size={32}/>)}
</div>
</li>
<li><h1 className="real-temperature">Real Time Temperature : {temperature}C°
</h1></li>
</ul>
<div className="card-1">
<div className="flow-container">{
ONOFF===1?(<FaPowerOff color="red" className="icon-temp"
size={35}/>):(<FaPowerOff color="green" className="icon-temp" size={35}/>)}{
ONOFF===1?<h1 className="heater-head">Heater Running</h1>:<h1
className="heater-head">Heater Not Running</h1>}
<select className="select-style" onChange={getPercentage}>
<option>25</option>
<option>50</option>
<option>75</option>
<option selected>100</option>
</select>
<button onClick={changeStatus}
67
className={onButtonTxtStyle}>{onButtonTxt}</button>
</div>
<div className="flow-container">
{valveOnOFF===0?(<IoMenuSharp color="#0E87CC" className="icon-temp"
size={35}/>):(<FaWater color="#0E87CC" className="icon-temp"
size={30}/>)}{
valveOnOFF===1?<h1 className="heater-head">Inlet Water Flowing</h1>:<h1
className="heater-head">Inlet Water Stoped</h1>}
<button onClick={changeStatusValve}
className={onButtonTxtStyleValve}>{onButtonTxtValve}</button>
</div>
<div className="flow-container">{
valveOnOFF2===0?(<IoMenuSharp color="#0E87CC" className="icon-temp"
size={35}/>):(<FaWater color="#0E87CC" className="icon-temp" size={30}/>)}{
valveOnOFF2===1?<h1 className="heater-head">Outlet Water
Flowing</h1>:<h1 className="heater-head">Outlet Water Stoped</h1>}
<button onClick={changeStatusValve2}
className={onButtonTxtStyleValve2}>{onButtonTxtValve2}</button>
</div>
</div>
</div>
);}
export default App;}}

68
69

You might also like