Professional Documents
Culture Documents
Solar Water Heater Control Using Iot_finaldraft
Solar Water Heater Control Using Iot_finaldraft
A PROJECT REPORT
Submitted by
ARUNVIJAY S - 921320105007
BALAJI R - 921320105011
JANANI D - 921320105022
of
BACHELOR OF ENGINEERING
IN
ELECTRICAL AND ELECTRONICS ENGINEERING
DINDIGUL - 624622
BONAFIDE CERTIFICATE
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.
ii
ABSTRACT
water heaters towards enhanced efficiency, reduced costs, and increased public
acceptance.
iii
ACKNOWLEDGEMENT`
express our gratitude to our management who has been inspiring us for all our
activities.
project work.
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
ABSTRACT iii
ACKNOWLEDGEMENT iv
LIST OF TABLES ix
LIST OF FIGURES x
1 INTRODUCTION 1
1.4 SUMMARY 2
2 LITERATURE REVIEW 3
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
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
Mechanism
Principles
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
WORK 37
BLOCK DIAGRAM 38
SETUP 40
SETUP 41
3.6 SUMMARY 42
4 RESULT AND DISCUSSION 44
5 CONCLUSION 53
REFERENCES 55
APPENDIX 57
vii
LIST OF TABLES
viii
LIST OF FIGURES
2.1 8
ESP 8266 Pin Diagram
2.9 Analytics 24
2.12 Crashlytics 29
ix
4.2 Web Dashboard 45
x
LIST OF ABBREVIATIONS
IP Internet protocol
TR Table row
xi
CHAPTER 1
INTRODUCTION
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
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
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.
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.
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]
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:
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)
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
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
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
2.3.4.2 Specification
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
31
Fig: 2.13 Test Lab
2.4.3 React
32
Here is a brief description of Fig: 2.14 React Key Features:
Declarative
Component-Based
Virtual DOM
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
React Native
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.
35
CHAPTER 3
METHODOLOGY
3.1 INTRODUCTION
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.
37
3.3 WORKING PRINCIPLE OF PROPOSED BLOCK DIAGRAM
Software Implementation:
ESP8266 Firmware: Write firmware for the ESP8266 using Arduino IDE
or similar development environment.
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.
40
3.5 COST ESTIMATION OF HARDWARE SETUP
1. ESP8266 2 800.00
3. Relay 2 150.00
TOTAL 3,200.00
41
3.6 SUMMARY
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.
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.
43
CHAPTER 4
RESULT AND DISCUSSION
44
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 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/
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
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.
54
REFERENCES
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.
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.
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.
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"
//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"
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";
65
useEffect(() => {
const query = ref(Db, "inletValve");
update(ref(Db),updates)
}}
const changeStatusValve=()=>{
valvestatusChange(!valvestatus)
const status=valvestatus===false?1:0;
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