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

Project report 2020-21 Smart Wireless Water Meter with Web Database

SMART WIRELESS WATER METER WITH WEB DATABASE

A PROJECT REPORT
Submitted by
AKSHAY J (SNG17CS004)
ANJANA P A (SNG17CS011)
ASWATHY LAL (SNG17CS020)
BASIL BABY(SNG17CS022)
to
The APJ Abdul Kalam Technological University
in partial fulfillment of the requirements for the award of the Degree of
Bachelor of Technology
In

Computer Science and Engineering

Department of Computer Science and Engineering


Sree Narayana Gurukulam College of Engineering,
Kadayiruppu, 682311

JUNE 2021

i
Project report 2020-21 Smart Wireless Water Meter with Web Database

DECLARATION

We undersigned hereby declare that the project report “Smart Wireless Water Meter with Web
Database”, submitted for partial fulfilment of the requirements for the award of degree of Bachelor of
Technology of the APJ Abdul Kalam Technological University, Kerala is a bonafide work done by me
under supervision of Asst. Prof. Anil C.B. This submission represents our ideas in our own words and
where ideas or words of others have been included, we have adequately and accurately cited and
referenced the original sources. We also declare that we have adhered to ethics of academic honesty and
integrity and have not misrepresented or fabricated any data or idea or fact or source in my submission.
We understand that any violation of the above will be a cause for disciplinary action by the institute
and/or the University and can also evoke penal action from the sources which have thus not been properly
cited or from whom proper permission has not been obtained. This report has not been previously formed
the basis for the award of any degree, diploma or similar title of any other University.

Place: Kadayiruppu Akshay J


Date: 14/06/2021 Anjana P A
Aswathy Lal
Basil Baby

ii
Project report 2020-21 Smart Wireless Water Meter with Web Database

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING,


SREE NARAYANA GURUKULAM COLLEGE OF ENGINEERING,
KADAYIRUPPU, 682311
(Affiliated to APJ Abdul Kalam Technological University & Approved by A.I.C.T.E)

CERTIFICATE

This is to certified that the project report, “SMART WIRELESS WATER METER WITH WEB
DATABASE” submitted by AKSHAY J, ANJANA P A, ASWATHY LAL, BASIL BABY to the APJ
Abdul Kalam Technological University in partial fulfillment of the requirements for the award of the
Degree of Bachelor of Technology in Computer Science and Engineering is a bona fide record of the
project work carried out by them under our guidance and supervision .This report in any form has not been
submitted to any other University or Institute for any purpose.

Prof. (Dr.) Smitha Suresh Asst. Prof. Lisha Kurian Asst. Prof. Anil C.B

HEAD OF THE DEPARTMENT PROJECT GUIDE PROJECT COORDINATOR

Submitted for the University Evaluation on ……………………………………….


University Register No…………………………………………………………….

Internal Examiner External Examiner

iii
Project report 2020-21 Smart Wireless Water Meter with Web Database

CONTENTS

ACKNOWLEDGEMENT………………………………………………………………………………7
ABSTRACT……………………………………………………………………………………………...8
LIST OF TABLES……………………………………………………………………………………....9
LIST OF FIGURES…………………………………………………………………………………….10
ABBREVIATIONS……………………………………………………………………………………..11
CHAPTER 1. INTRODUCTION……………………………………………………………………...12
1.1 GENERAL BACKGROUND……………………………………………………………...12
1.2 OBJECTIVE……………………………………………………………………………….13
1.3 SCOPE……………………………………………………………………………………...13
1.4 INTRODUCTION TO TOPIC……………………………………………………………14

CHAPTER 2. LITERATURE SURVEY……………………………………………………………...16


2.1 AUTOMATED WATER USAGE MONITORING SYSTEM………………………..…17
2.2 WATER LEVEL MONITORING SYSTEM USING IOT…………………………...….17
2.3 WATER LEVEL MONITORING ULTRASONIC SENSOR………………………..….18
2.4 CONVENTIONAL WATER METER SYSTEM……………………………………..….18
2.5 COMPARISON TABLE……………………………………………………………..…….19
CHAPTER 3. SYSTEM REQUIREMENTS…………………………………………………….…...20
3.1 ESP8266……………………………………………………………………………………..20
3.1.1 PIN CONFIGURATIONS……………………………………………………….21
3.2 FLOW SENSOR……………………………………………………………………………23
3.3 OLED DISPLAY…………………………………………………………………………...23
CHAPTER 4. SYSTEM ANALYSIS………………………………………………………………….25
4.1 SOFTWARE SPECIFICATIONS………………………………………………………...25
4.2 HARDWARE SPECIFICATIONS………………………………………………………..25
4.3 FUNCTIONAL REQUIREMENTS….…………………………………………………...26
4.4 NON-FUNCTIONAL REQUIREMENTS………………………………………………..26
CHAPTER 5. DESIGN………………………………………………………………………………...27
5.1 ARCHITECURE DIAGRAM………………………………………………………….….27

iv
Project report 2020-21 Smart Wireless Water Meter with Web Database

5.2 HARDWARE DESIGN……………………………………………………………………28

5.3 DATAFLOW DIAGRAM………………………………………………………………....29


5.4 CLASS DIAGRAM………………………………………………………………………...31
5.5 SEQUENCE DIAGRAM…………………………………………………………………..33
5.5.1 WEBSITE………………………………………………………………………...33
5.5.2 MOBILE APP…………………………………………………………………....34
5.6 USECASE DIAGRAM…………………………………………………………………….35
5.6.1 USECASE 1………………………………………………………………………35
5.6.2 USECASE 2………………………………………………………………………35
5.6.3 EMBEDDED USECASE………………………………………………………...36
5.7 STATE DIAGRAM………………………………………………………………………..37
5.7.1 MOBILE APP……………………………………………………………………37
5.7.2 WEBSITE………………………………………………………………………..38
CHAPTER 6. IMPLEMENTATION………………………………………………………………...39
6.1 HARDWARE CODE……………………………………………………………………...39
6.2 WEBSITE CODE………………………………………………………………………….47
6.2.1 STYLE……………………………………………………………………………47
6.2.2 SEARCH…………………………………………………………………………51
6.2.3 CONNECTION………………………………………………………………….54
6.2.4 DB-READ………………………………………………………………………..54
6.2.5 DB-WRITE……………………………………………………………………....56
6.2.6 INDEX…………………………………………………………………………....57
6.2.7 AUTHENTICATION…………………………………………………………....60
6.3 APPLICATION CODE……………………………………………………………………62
6.3.1 MAIN ACTIVITY……………………………………………………………….62
6.3.2 HOME…………………………………………………………………………….65
6.3.3 USER……………………………………………………………………………...68
6.3.4 REGISTRATION………………………………………………………………..69
6.3.5 LEVEL……………………………………………………………………………74

v
Project report 2020-21 Smart Wireless Water Meter with Web Database

6.3.6 LOGIN UI……………………………………………………………………….79


6.3.7 REGISTRATION UI…………………………………………………………...83
6.3.8 HOME UI………………………………………………………………………..87
6.3.9 LEVEL UI……………………………………………………………………….89
6.3.10 USAGE UI……………………………………………………………………...93

CHAPTER 7. TESTING …………………………………………………………………………….95


7.1 OUTPUT SCREEN……………………………………………………………………….95
7.1.1 APPLICATION…………………………………………………………………95
7.1.2 WEBSITE……………………………………………………………………….98
7.2 HARDWARE CONNECTIVITY……………………………………………………….101
CHAPTER 8. CONCLUSION………………………………………………………………………102
REFERENCES……………………………………………………………………………………….103

vi
Project report 2020-21 Smart Wireless Water Meter with Web Database

ACKNOWLEDGEMENT

Dedicating this project to the Almighty God whose abundant grace and mercy enabled its successful
completion, we would like to express our profound gratitude to all the people who had inspired and
motivated us to undertake this project.

We wish to express our sincere thanks to our Head of the Department, Prof. (Dr.) Smitha Suresh, for
providing us the opportunity to undertake this project. We are deeply indebted to our project coordinator
Asst. Prof. Anil C.B and project guide Asst. Prof. Lisha Kurian in the Department of Computer
Science and Engineering for providing us with valuable advice and guidance during the course of the
project.

Finally, we would like to express my gratitude to Sree Narayana Gurukulam College of Engineering for
providing me with all the required facilities without which the successful completion of the project work
would not have been possible.

7
Project report 2020-21 Smart Wireless Water Meter with Web Database

ABSTRACT

As water consumption and wastage increases day by day, water scarcity has become a growing concern
around the globe. While some irresponsible people are overusing water and wasting it daily, a large
population remain deprived of safe drinking water. This problem is caused by the irregular distribution of
water. To deal with this, we need a solution that gives data about daily and monthly consumption of water
in every home to the owner and to the respective authority. This is done to alert the house owner about the
water usage, in order to enable proper water distribution. In this project, we are going to make a smart
water meter that measures our daily water usage and provides live data on our phone that is connected to
a database, which can also be accessed by the authority. The smart metering approach proposed differs
from existing commercial methodologies by making use of low cost IoT hardware and smartphone app.
This scheme permits both Meter Reader as well as individual domestic / industrial consumers to use regular
smartphones to perform meter reading and update to utility’s portal / database for billing and payment. The
proposed scheme reduces overheads on Utilities in handling meter reading and billing for water distribution
in metropolitan and large urban conglomerates.

8
Project report 2020-21 Smart Wireless Water Meter with Web Database

LIST OF TABLES

No. Title Page Number


1 Comparison between Existing Systems and 19
Proposed System.

9
Project report 2020-21 Smart Wireless Water Meter with Web Database

LIST OF FIGURES

No. Title Page Number


1 ESP8266 20

2 ESP8266 Pin Configuration 21

3 Flow Sensor 23

4 OLED Display 24

5 Architecture Diagram 27

6 Hardware Design 28

7 Data Flow Diagram 29

8 Class Diagram 31

9 Sequence Diagram 1 33

10 Sequence Diagram 2 34

11 Use case Diagram 1 35

12 Use case Diagram 2 35

13 Use case Diagram 3 36

14 State Diagram 1 37

15 State Diagram 2 38

16 User Registration 95

17 Login Screen 95

18 Level & Usage Screen 96

19 Level Tracking 96

20 Data Tracking 97
21 Login Screen 98
22 Search Bar 99

23 User Details Screen 100


24 Hardware Setup 101

10
Project report 2020-21 Smart Wireless Water Meter with Web Database

ABBREVIATIONS

No Title Expansion
1 OLED Organic Light Emitting Diode

2 EN Enable

3 RST
Reset

4 GPIO General Purpose Input/Output

5 SPI Serial Peripheral Interface

6 UART Universal Asynchronous


Receiver/Transmitter
7 AO Analog Read

8 SVM Smart Water Meter

9 HTML Hyper Text Markup Language

10 PHP Hypertext Preprocessor

11 CSS Cascading Style Sheets


12 UI User Interface
13 XML Extensible Markup Language
14 GUI Graphical User Interface

11
Project report 2020-2021 Smart Wireless Water Meter with Web Database

CHAPTER 1

INTRODUCTION

1.1 GENERAL BACKGROUND

The world is increasingly looking forward to adaptation and use of new technologies to improve quality
of life as well as reduce impact of human activities and consumption patterns on environment. Availability
of clean water, its increasing demand from urbanization and growing population in cities, cost for
management of water transmission, storage, treatment, distribution and billing for consumption are serious
issues in underdeveloped and developing countries. Rapid changes in lifestyle and increased paying
capacity have impacted use of water and related overheads on sewerage requirements. Water Utilities have
traditionally looked at managing water distribution as a sensitive task with humanitarian approach which
sometimes result in uneconomically high cost of water management and skewed cost-sharing
arrangements among different categories of consumers. The main revenue for water utilities have been
through Billing for consumption. Utilities try to meet most of their expenditure on Capital for new
installations, operations, maintenance, etc. from consumption metering and billing.
The IoT based Smart Water Metering System provides real time visibility over water consumption to
consumers and utilities. The solution comprises of a multi-tenant web portal for Utilities and mobile apps
for customers to view the captured data. The system also generates analytics for the users to get real- time
insights on water consumption. It is designed to generate alerts such as over consumption of water
resource, billing, leakage detection etc…

Smart meters have already become an essential component of the modern-day electrical grids and are now
finding their way in the water utilities. Currently, in a world where people are perishing due to lack of
water, these meters are the breakthrough innovation that water utilities can use to provide everyone with
potable water. Unlike traditional water gauges, smart water meters are a part of a wide area network that
allow utilities and consumers to engage in two-way communication. These meters help water suppliers to
enhance their water distribution network and incorporate robust water conservation & management
practices.

12
Project report 2020-2021 Smart Wireless Water Meter with Web Database

1.2 OBJECTIVE

Among the existing physical infrastructure, water supply networks are of the utmost importance because
water is the city’s most valuable resource. Efficient management of water supply networks is a key
challenge faced by smart cities. According to European Environment Agency, water leakage accounts for
more than 20% of the water supply in urban water networks in most countries.
With the proposed concept, centralized management is expected to be enabled with real-time information
collected from sensors deployed in strategic locations along the water supply networks. In case there is
any water leakage, we shall get an immediate alert from the monitoring platform. In addition, real-time
information from automatic meter reading helps us to improve water conservation. This project aims to
focus on these features as well as to avoid the major disadvantages of analogue water meters.

1.3 SCOPE

A smart water meter favors dynamic water billing, which eliminates the need for manual supervision
every month in each household. It supports real-time web-based metering that helps provide live alerts
about the leaks, water getting wasted, etc. A smart water meter also facilitates a two-way interaction
among the water distributors and the consumers where the suppliers can track each house’s water
consumption that come under the real-time networking range. It helps the authorities to automatically
generate the bill and send them to all the consumers within the specified time.

Adding a smart water meter solution helps identify consumption inefficiencies and patterns. These
smart meters comprise an IoT platform suite, which tracks the amount of water consumed by each
consumer regularly. This results in harnessing the over-consumption or water wastage by incorporating
necessary steps.

Establishing a base to improve anything requires the knowledge of what is causing the challenges in
abundance. Similarly, to bring down the excess water loss requires frequent evaluation of the
consumption habits and knowing the places where over-consumption or spilling is taking place.
Previously, the level of water loss was evaluated annually, and that too, when the customers used to send
their readings. The development of a smart meter is constantly eradicating the traditional methods of
evaluating water levels and is proving to be among the best innovations to save and conserve our water.

13
Project report 2020-2021 Smart Wireless Water Meter with Web Database

1.4 INTRODUCTION TO TOPIC

Water is our most precious natural resource, which is used for various purposes. Hence, it becomes our
duty to take care of it. Thinking about the future generation, they would definitely require water to sustain.
Therefore, there is a need to put a full stop towards the reckless usage of water. This project aims at
overcoming the disadvantages of the existing analogue water meter. The major disadvantages are:

• Creepy water meter Reading: This is by far the most popular meter problem. Whether it is you or
your local water company that is reading the meter, not all persons are aware of the correct way of
reading a water meter. Knowing the right way to read the water meter can tell you how to locate
leaks, conserve your water and monitor your water usage.
• Air Accumulation Problem: Air pressure in the piping system can lead to major water meter issues
such as erroneous water metering and damage to the internal components of the water meter. An
air valve prevents air from travelling through the piping system and passing through the water
meter. When public or private water supply is irregular or inconsistent, water channels through
from upper levels of the distribution system and gathers in the lower levels. Air replaces the water
drained from the upper levels. As soon as the water supply is restored, water refills the pipeline,
moves the air, forcing air through the water meter, rotating the impeller and gears very quickly.
Air flowing through the meter causes damage to its internal components and escalates its readings.
• Uneven distribution of water: The analog meters which cannot keep the track of the amount of
water supplied results in uneven distribution of water.

The proposed system will overcome these major issues. A smart water meter is nothing fancy; it is a
normal device that wirelessly communicates with a local or wide area network, enabling remote location
monitoring and leak detection, which results in minimal water wastage. Here are some of the main
features of a smart water meter.

• Real-time web-based monitoring


• Flexible billing cycle
• Data alerts
• Lots of savings
• Advanced data analytics

14
Project report 2020-2021 Smart Wireless Water Meter with Web Database

Smart meters are changing the way utilities operate—let it be the energy or water segment. The use of
these meters along with a well-crafted IoT solution allow water utilities to manage their water distribution
practices and provide their customers with clean potable water. These meters are also empowering the
consumers to see the value of water meter in reducing cost linked with their consumption of water.

15
Project report 2020-2021 Smart Wireless Water Meter with Web Database

CHAPTER 2

LITERATURE SURVEY

The purpose of a literature review is to, as the name suggests, “review” the literature surrounding a certain
topic area. The word “literature “means “sources of information” or “research”. The literature will inform
us about the research that has already been conducted on our chosen subject.

Imagine the usefulness of being able to switch on the air conditioner system ten minutes before you get
home on a hot afternoon. How about security system to detect smoke, burglary attempts alerted to you.
These imaginations build the idea of Water Level Monitoring that has no end. The sophisticated Water
Level Monitoring systems of course record the usage of water.

Technology nowadays has become an integrated part of people's lives. It has, and continues to influence
many aspects of daily life and has allowed better social interaction, ease of transportation, the ability to
indulge in entertainment and media and has helped in the development in medicine. The creation of many
devices such as mobile phones and computers have caused many people to rely on technology to
communicate with their friends, store information such as pictures, movies, documents, and music.

The internet has become a common interface that many devices use in order to simplify the daily life of
many people giving the ability to search for information, store their own information in the cloud while
also giving them better ways of managing information. From the time of its introduction, the number of
people that use mobile phones and the internet to communicate with other people has increased
dramatically to become one of the major means of communication. People with the help of smartphones
can now connect to the internet without the need for a computer, while still offering the same functionality
but through different means. With the introduction of advanced software and hardware devices,
smartphones are now powerful devices and have become an important part of people’s daily lives. A major
aspect is how the Smartphone is able to connect and communicate with other devices. A field that is
gaining popularity is Water Level Monitoring which can also use smartphones as information or
functionality hubs.

16
Project report 2020-2021 Smart Wireless Water Meter with Web Database

2.1 AUTOMATED WATER USAGE MONITORING SYSTEM

Automated water usage monitoring system proposes an effective way of controlling the wastage of water
at home/Industries by means of Wireless sensor nodes and LabVIEW software. At many places water is
luxuriously wasted while many areas don't have enough. Sensor nodes are placed at every water outlet
point sensing the flow of water. The concept of internet of things (IOT) is used to continuously monitor
and track water usage via the wireless sensor nodes. Server collects the data through Wi-Fi/LAN to process
and track usage and wastage of water at every outlet. When water is used at excess it is indicated and an
alert is sent to the user. The user can continuously keep a track of the water usage or wastage through a
mobile or laptop with an internet connection. This proposed water monitoring system helps the individuals
to keep a track on their water bills and helps the government to manage the water supply and modify
billing scheme based on the water usage. Using this system it is very easy to generate bills and no need of
a third party to notify the users about the water consumption and all.

2.2 WATER LEVEL MONITORING SYSTEM USING IOT

IOT based Water Level Monitoring system is an innovative system which will inform the users about the
level of liquid and will prevent it from overflowing. To demonstrate this the system makes use of
containers, where the ultrasonic sensors placed over the containers to detect the liquid level and compare
it with the container’s depth. The system makes use of AVR family microcontroller, Raspberry Pi, LCD
screen, Wi-Fi modem for sending data and a buzzer. A 12 V transformer is used for power supply in this
system. The LCD screen is used to display the status of the level of liquid in the containers. The liquid
level is highlighted as colored to show the level of liquid present in the container with the help of a web
page to the user. The buzzer starts ringing when the set limit of the liquid is crossed. Thus this system
helps to prevent the wastage of water by informing about the liquid levels of the containers. Some of the
major advantages of this system are reliability, portability and efficient working.

17
Project report 2020-2021 Smart Wireless Water Meter with Web Database

2.3 WATER LEVEL MONITORING ULTRASONIC SENSOR

An Ultrasonic sensor is used in the transmitter circuit, which measures the distance of water level from
the upper point of the bottle or Tank. The distance is measured in centimeters and sent to receiver circuit
using RF communication. Receiver circuit receives the data from transmitter circuit and converts it in
terms of the percentage and shows on LCD. Ultrasonic sensor has two openings-one is Trigger and the
other is Echo. Trigger makes high frequency sound waves. These sound waves are passed through the
tank from top to bottom. The sound waves hit the water and are reflected back in the form of Echo waves.
The Echo opening receives the Echo waves. The water level sensor Arduino measures the time between
Echo and Trigger. This traveled distance is directly proportional to the time. This system has simplified
interface and it can interface with any data logger or control system

2.4 CONVENTIONAL WATER METER SYSTEM

Conventional water meter system works on the principle of flow rate measurement. A device is placed in
between the main supply and the household inlet and the flow rate of water is measured by the mechanical
device. Sophisticated technologies are not used in this system. Flow rate measurement is performed
through turbine rotation with a shunt, propeller, or paddle wheel design. The mechanical types of water
flow meters work by measuring the speed of water flowing through the pipe that causes a piston or turbine
to rotate. The volumetric flow rate of the water is proportional to the rotational speed of the blades.
Readings generated by the system is then calculated by an employee of the water authority and then the
bill amount is calculated

18
Project report 2020-2021 Smart Wireless Water Meter with Web Database

2.5 COMPARISON TABLE

CHARACTERIS- CONVENTIONAL AUTOMATED WATER ULTRA- SMART


TICS SYSTEM SYSTEM LEVEL SONIC WIRELS-
MONITORING SENSOR S
SYSTEM WATER
METER

cost High Moderate Moderate Moderate Less

Water Wastage More More More More Less

User Less Less Less Less More


Friendliness

Smart Alerts No Yes No No Yes

Table 1. Comparison Between Existing and Proposed System

19
Project report 2020-2021 Smart Wireless Water Meter with Web Database

CHAPTER 3
SYSTEM REQUIREMENTS

3.1 ESP8266

Fig 1. ESP8266

The ESP8266 Wi-Fi Module is a self-contained SOC with integrated TCP/IP protocol stack that can give
any microcontroller access to your Wi-Fi network. The ESP8266 is capable of either hosting an application
or offloading all Wi-Fi networking functions from another application processor. Each ESP8266 module
comes pre-programmed with an AT command set firmware, meaning, you can simply hook this up to your
Arduino device and get about as much Wi-Fi-ability as a Wi-Fi Shield offers (and that's just out of the
box). The ESP8266 module is an extremely cost-effective board with a huge, and ever growing,
community.

This module has a powerful enough on-board processing and storage capability that allows it to be
integrated with the sensors and other application specific devices through its GPIOs with minimal
development up-front and minimal loading during runtime. Its high degree of on-chip integration allows

20
Project report 2020-2021 Smart Wireless Water Meter with Web Database

for minimal external circuitry, including the front-end module, is designed to occupy minimal PCB area.
The ESP8266 supports APSD for VoIP applications and Bluetooth co-existence interfaces, it contains a
self-calibrated RF allowing it to work under all operating conditions, and requires no external RF parts.

3.1.1 Pin Configurations

Fig 2. ESP8266 Pin Configuration

❖ Control Pins – EN, RST


✓ The pin and the button reset the microcontroller

❖ Analog Pin – AO

21
Project report 2020-2021 Smart Wireless Water Meter with Web Database

✓ Used to measure analog voltage in the range of 0-3.3 V


❖ GPIO Pins – GPIO1 – GPIO16
✓ NodeMCU has 16 general purpose input-output pins on its board

❖ SPI Pins – SD1, CMD, SD0, CLK


✓ NodeMCU has 4 pins available for SPI communication

❖ UART Pins – TXD0, RXD0, TXD2, RXD2


✓ NodeMCU has two UART interfaces, UART0(RXD0 & TXD0) and UART1(RXD1
& TXD1). UART1 is used to upload the firmware/ program

❖ I2C Pins
✓ NodeMCU has I2C functionality support but due to the internal functionality of
these pins, you have to find which pin is I2C

❖ Analog Input Pins: 1


❖ UARTs: 1
❖ SPIs: 1
❖ I2Cs: 1

22
Project report 2020-2021 Smart Wireless Water Meter with Web Database

3.2 FLOW SENSOR

Fig 3. Flow Sensor

Water flow sensors are installed at the water source or pipes to measure the rate of flow of water and
calculate the amount of water flowed through the pipe. Rate of flow of water is measured as liters per hour
or cubic meters. Water flow sensor consists of a plastic valve from which water can pass. A
water rotor along with a hall effect sensor is present the sense and measure the water flow.
When water flows through the valve it rotates the rotor. By this, the change can be observed in the speed
of the motor. This change is calculated as output as a pulse signal by the hall effect sensor. Thus, the rate
of flow of water can be measured.
The main working principle behind the working of this sensor is the Hall effect. According to this
principle, in this sensor, a voltage difference is induced in the conductor due to the rotation of the rotor.
This induced voltage difference is transverse to the electric current. When the moving fan is rotated due
to the flow of water, it rotates the rotor which induces the voltage.

23
Project report 2020-2021 Smart Wireless Water Meter with Web Database

3.3 OLED DISPLAY

Fig 4. OLED Display

An organic light-emitting diode (OLED or organic LED), also known as organic


electroluminescent (organic EL) diode, is a light-emitting diode (LED) in which
the emissive electroluminescent layer is a film of organic compound that emits light in response to an
electric current. This organic layer is situated between two electrodes; typically, at least one of these
electrodes is transparent. OLEDs are used to create digital displays in devices such
as television screens, computer monitors, portable systems such as smartphones, handheld game
consoles and PDAs. A major area of research is the development of white OLED devices for use in solid-
state lighting applications.

There are two main families of OLED: those based on small molecules and those employing polymers.
Adding mobile ions to an OLED creates a light-emitting electrochemical cell (LEC) which has a slightly
different mode of operation. An OLED display can be driven with a passive-matrix (PMOLED) or active-
matrix (AMOLED) control scheme. In the PMOLED scheme, each row (and line) in the display is
controlled sequentially, one by one,[6] whereas AMOLED control uses a thin-film transistor backplane to
directly access and switch each individual pixel on or off, allowing for higher resolution and larger display
sizes.

24
Project report 2020-2021 Smart Wireless Water Meter with Web Database

CHAPTER 4

SYSTEM ANALYSIS

4.1 SOFTWARE SPECIFICATIONS

WEBSITE
• Coding Language: HTML, PHP, CSS
• Platform: 000webhost
• Server: Apache
• Database: MariaDB

MOBILE APP

• Platform: Android Studio


• Coding Language: Java
• UI: XML
• Database: Firebase

4.2 HARDWARE SPECIFICATIONS

ESP8266
• Type: 32-bit microcontroller
• CPU: Ten silica Diamond Standard 106Micro@80 MHz or 160 MHz
• Memory: 32 KiB (Instruction), 80 KiB (User data)
• Operating Voltage: 3.3 V
• Input Voltage: 7-12 V
• Flash Memory: 4 MB
• SRAM: 64 KB

25
Project report 2020-2021 Smart Wireless Water Meter with Web Database

FLOW SENSOR

• Working Voltage: DC 5V~15V


• Flow Rate: 1~25L
• Frequency: (11*Q) Q
• Operating Temperature: 0~80 C
• Water Pressure: <=1.75 MPa

OLED DISPLAY

• Resolution: 128*64 pixels


• Working Temperature: -30 C - 70 C
• Dimensions: L27.8 * W27.3 * H4.3 mm
• Driver: IC SSD1306

4.3 FUNCTIONAL REQUIREMENTS

The functional requirements will describe the features and functionality of the system.
Functional requirements record the operation that must be done. Following are the functional
requirements of the system.

➢ Register
➢ Login
➢ Usage Tracking
➢ Notifications
➢ Bill generation

4.4 NON-FUNCTIONAL REQUIREMENTS

➢ Security: It is the feature of the system which ensures that system is protected from
the unauthorized access.
➢ User-friendly: The graphical user interface (GUI) of all platforms is user-friendly
➢ Usability: It defines the ease of use of the system

26
Project report 2020-2021 Smart Wireless Water Meter with Web Database

CHAPTER 5

DESIGN

5.1 ARCHITECTURE DIAGRAM

Fig.5 Architecture diagram

The Architectural diagram is the graphical representation of a set of concepts that are part of an
architecture, including their principles, elements and components. It is a diagram of a system that is used
to abstract the overall outline of the software system and the relationships, constraints, and boundaries
between components. It is an important tool as it provides an overall view of the physical deployment of
the software system and its evolution roadmap.

The major components of the system are displayed in the diagram. The input from the flow sensor will
monitor and it will be stored in the database and displayed on the OLED display. The data transmission is
done through the Wi-Fi module. The data stored in the database is accessed by the mobile application as
well. The OLED display will display the flow rate and the mobile application gives information regarding
the usage and also display the bill amount. The application will also notify the user when an overflow and
underflow occur.

27
Project report 2020-2021 Smart Wireless Water Meter with Web Database

5.2 HARDWARE DESIGN

Fig 6. Hardware Design

Hardware Design means all design that describes electronic circuits or modules and including CAD
databases, schematics, mechanical layouts and drawings, bills-of-materials, manufacturing and assembly
information, and associated documentation.

28
Project report 2020-2021 Smart Wireless Water Meter with Web Database

5.3 DATAFLOW DIAGRAM

Fig 7. Data Flow Diagram

29
Project report 2020-2021 Smart Wireless Water Meter with Web Database

A data-flow diagram (DFD) is a way of representing a flow of a data of a process or a system (usually an
information system). The DFD also provides information about the outputs and inputs of each entity and
the process itself.

The diagram identifies data flow and integration points for typical water metering solution. The data flow
starts from the water flow sensor and move towards database, mobile app as well as the website through
the ESP8266.The data flow is controlled by the Wi-Fi module and the data will be accessed by the
user/customer via mobile application.

30
Project report 2020-2021 Smart Wireless Water Meter with Web Database

5.4 CLASS DIAGRAM

Fig.8 class diagram

31
Project report 2020-2021 Smart Wireless Water Meter with Web Database

In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static
structure diagram that describes the structure of a system by showing the system's classes, their
attributes, operations (or methods), and the relationships among objects. Class diagram represents
relationship between different classes.

For smart water meter, we have four classes. Database, Application, Website and Water_ meter_ reading.
Each of these classes have attributes as well as functions. Database class is linked to all other classes so
that they can retrieve data from the database. Database class contains the information regarding the users
and their water usage details. Each time the volume table gets updated when the user consumes water
from the tank. Website class contain information of each user’s water usage level as well as the monthly
charge. Application class have usage details and bill amount. Water_ meter_ reading is a major class that
contains the volume of water which is given to the database so that all other classes can collect data from
database.

32
Project report 2020-2021 Smart Wireless Water Meter with Web Database

5.5 SEQUENCE DIAGRAM

5.5.1. Website

Fig 9. sequence diagram1

A sequence diagram simply depicts interaction between objects in a sequential order. i.e., the order in
which these interactions take place and also describe how and in what order the objects in a system
function. This diagram shows the sequence of activities done by the authorities to access user details,
usage tracking and bill generation.

33
Project report 2020-2021 Smart Wireless Water Meter with Web Database

5.5.2 Mobile App

Fig 10. sequence diagram2

This diagram shows sequence of activities performed by the user during the tracking of water usage and
to monitor the bill amount from the mobile application.

34
Project report 2020-2021 Smart Wireless Water Meter with Web Database

5.6 USECASE DIAGRAM

5.6.1 USECASE 1: Mobile App

Fig 11. Use-case 1


5.6.2 USECASE 2: Website

Fig12.Use-case 2

35
Project report 2020-2021 Smart Wireless Water Meter with Web Database

5.6.3 USECASE 3: EMBEDDED USECASE

Fig 13. Use-case 3

36
Project report 2020-2021 Smart Wireless Water Meter with Web Database

5.7 STATE DIAGRAM

5.7.1 Mobile App

Fig 14. state diagram1

37
Project report 2020-2021 Smart Wireless Water Meter with Web Database

5.7.2 Website

Fig 15. State diagram2

A state diagram is used to represent the condition of the system or part of the system at finite instances
of time. It’s a behavioral diagram and it represents the behavior using finite state transitions. State
diagrams are also referred to as State machines and State-chart Diagrams. These terms are often used
interchangeably. So simply, a state diagram is used to model the dynamic behavior of a class in response
to time and changing external stimuli.

38
Project report 2020-2021 Smart Wireless Water Meter with Web Database

CHAPTER 6

IMPLEMENTATION

6.1 HARDWARE CODING

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <FlowMeter.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <FirebaseArduino.h>
#include <ArduinoJson.h>

#define FIREBASE_HOST "final-project-5f795-default-rtdb.firebaseio.com" //--> URL address of your


Firebase Realtime Database.
#define FIREBASE_AUTH "p2QJcydi7Fip7XlEOjRXziGtiRrzjTiW85kdOl5p" //--> Your firebase
database secret code.

#define SCREEN_WIDTH 128 // OLED display width, in pixels


#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

#define LED_BUILTIN 16

39
Project report 2020-2021 Smart Wireless Water Meter with Web Database

#define SENSOR 2

long currentMillis = 0;
long previousMillis = 0;
int interval = 1000;
boolean ledState = LOW;
float calibrationFactor = 4.5;
volatile byte pulseCount;
byte pulse1Sec = 0;
float flowRate;
unsigned long flowMilliLitres;
unsigned int totalMilliLitres;
float flowLitres;
float totalLitres;
String sendval,sendval2, postData;
// Update HOST URL here

#define HOST "r8aproj.000webhostapp.com" // Enter HOST URL without "http:// " and "/" at the
end of URL

#define WIFI_SSID "Tenda_" // WIFI SSID here


#define WIFI_PASSWORD "12345678" // WIFI password here

// Declare global variables which will be uploaded to server

void IRAM_ATTR pulseCounter()


{
pulseCount++;
}

40
Project report 2020-2021 Smart Wireless Water Meter with Web Database

WiFiClient client;

void setup()
{
Serial.begin(115200);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //initialize with the I2C addr 0x3C (128x64)
display.clearDisplay();
delay(10);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(SENSOR, INPUT_PULLUP);
pulseCount = 0;
flowRate = 0.0;
flowMilliLitres = 0;
totalMilliLitres = 0;
previousMillis = 0;

attachInterrupt(digitalPinToInterrupt(SENSOR), pulseCounter, FALLING);


Serial.begin(115200);
Serial.println("Communication Started \n\n");
delay(500);

pinMode(LED_BUILTIN, OUTPUT); // initialize built in led on the board

WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD); //try to connect with wifi
Serial.print("Connecting to ");
Serial.print(WIFI_SSID);
while (WiFi.status() != WL_CONNECTED)

41
Project report 2020-2021 Smart Wireless Water Meter with Web Database

{ Serial.print(".");
delay(500); }

Serial.println();
Serial.print("Connected to ");
Serial.println(WIFI_SSID);
Serial.print("IP Address is : ");
Serial.println(WiFi.localIP()); //print local IP address
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
}

void loop()
{
currentMillis = millis();
if (currentMillis - previousMillis > interval)
{

pulse1Sec = pulseCount;
pulseCount = 0;

// Because this loop may not complete in exactly 1 second intervals we calculate
// the number of milliseconds that have passed since the last execution and use
// that to scale the output. We also apply the calibrationFactor to scale the output
// based on the number of pulses per second per units of measure (litres/minute in
// this case) coming from the sensor.
flowRate = ((1000.0 / (millis() - previousMillis)) * pulse1Sec) / calibrationFactor;
previousMillis = millis();

42
Project report 2020-2021 Smart Wireless Water Meter with Web Database

// Divide the flow rate in litres/minute by 60 to determine how many litres have
// passed through the sensor in this 1 second interval, then multiply by 1000 to
// convert to millilitres.
flowMilliLitres = (flowRate / 60) * 1000;
flowLitres = (flowRate / 60);

// Add the millilitres passed in this second to the cumulative total


totalMilliLitres += flowMilliLitres;
totalLitres += flowLitres;

// Print the flow rate for this second in litres / minute


Serial.print("Flow rate: ");
Serial.print(float(flowRate)); // Print the integer part of the variable
Serial.print("L/min");
Serial.print("\t"); // Print tab space

display.clearDisplay();

display.setCursor(10,0); //oled display


display.setTextSize(1);
display.setTextColor(WHITE);
display.print("Water Flow Meter");

display.setCursor(0,20); //oled display


display.setTextSize(2);
display.setTextColor(WHITE);
display.print("R:");
display.print(float(flowRate));

43
Project report 2020-2021 Smart Wireless Water Meter with Web Database

display.setCursor(100,28); //oled display


display.setTextSize(1);
display.print("L/M");

// Print the cumulative total of litres flowed since starting


Serial.print("Output Liquid Quantity: ");
Serial.print(totalMilliLitres);
Serial.print("mL / ");
Serial.print(totalLitres);
Serial.println("L");

display.setCursor(0,45); //oled display


display.setTextSize(2);
display.setTextColor(WHITE);
display.print("V:");
display.print(totalLitres);
display.setCursor(100,53); //oled display
display.setTextSize(1);
display.print("L");
display.display();
HTTPClient http; // http object of clas HTTPClient

// Convert integer variables to string


sendval = String(totalLitres);
sendval2 = String(flowRate);

Firebase.setString("User/M6hVVHd0mKQ0VnemeMhlOxBEmBv2/Volume IN/Values",sendval); //--


> Command or code to send data or update data (String data type) to the Firebase Realtime Database.

44
Project report 2020-2021 Smart Wireless Water Meter with Web Database

Firebase.setString("User/M6hVVHd0mKQ0VnemeMhlOxBEmBv2/Flow Rate IN/Values",sendval2);


//--> Command or code to send data or update data (String data type) to the Firebase Realtime Database.

Firebase.setString("User/M6hVVHd0mKQ0VnemeMhlOxBEmBv2/Volume OUT/Values",sendval);
//--> Command or code to send data or update data (String data type) to the Firebase Realtime Database.
Firebase.setString("User/M6hVVHd0mKQ0VnemeMhlOxBEmBv2/Flow Rate
OUT/Values",sendval2); //--> Command or code to send data or update data (String data type) to the
Firebase Realtime Database.
// Conditions for handling errors.
if (Firebase.failed()) {
Serial.print("Setting /Value failed :");
Serial.println(Firebase.error());
delay(5);

}
else{
Serial.println("Firebase Updated....");
Serial.println("");
}
postData = "sendval=" + sendval ;

// We can post values to PHP files as


example.com/dbwrite.php?name1=val1&name2=val2&name3=val3

// Hence created variable postDAta and stored our variables in it in desired format

// Update Host URL here:-

45
Project report 2020-2021 Smart Wireless Water Meter with Web Database

http.begin("http://r8aproj.000webhostapp.com/dbwrite.php"); // Connect to host where MySQL


databse is hosted
http.addHeader("Content-Type", "application/x-www-form-urlencoded"); //Specify content-type
header
int httpCode = http.POST(postData); // Send POST request to php file and store server response code
in variable named httpCode
Serial.println("Volume: " + sendval );
// if connection eatablished then do this
if (httpCode == 200) {
Serial.println("Values uploaded successfully.");
Serial.println( httpCode);
String webpage = http.getString(); // Get html webpage output and store it in a string
Serial.println(webpage + "\n");
}
// if failed to connect then return and restart
else {
Serial.println( httpCode);
Serial.println("Failed to upload values. \n");
String webpage = http.getString(); // Get html webpage output and store it in a string
Serial.println(webpage + "\n");
http.end();
return;
}
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
digitalWrite(LED_BUILTIN, HIGH);
}
}

46
Project report 2020-2021 Smart Wireless Water Meter with Web Database

6.2 WEBSITE CODE

6.2.1 STYLING

body{
margin: 0;
padding: 0;

font-family: sans-serif;

background: #34495e;

.box{

width: 300px;

padding: 40px;

position: absolute;

top: 50%;

left: 50%;

transform: translate(-50%,-50%);

background: #191919;

47
Project report 2020-2021 Smart Wireless Water Meter with Web Database

text-align: center;

.box h1{

color: white;

text-transform: uppercase;

font-weight: 500;

.box input[type = "text"],.box input[type = "password"]{

border:0;

background: none;

display: block;

margin: 20px auto;

text-align: center;

border: 2px solid #3498db;

padding: 14px 10px;

48
Project report 2020-2021 Smart Wireless Water Meter with Web Database

width: 200px;

outline: none;

color: white;

border-radius: 24px;

transition: 0.25s;

.box input[type = "text"]:focus,.box input[type = "password"]:focus{

width: 280px;

border-color: #2ecc71;

.box input[type = "submit"]{

border:0;

background: none;

display: block;

margin: 20px auto;

49
Project report 2020-2021 Smart Wireless Water Meter with Web Database

text-align: center;

border: 2px solid #2ecc71;

padding: 14px 40px;

outline: none;

color: white;

border-radius: 24px;

transition: 0.25s;

cursor: pointer;

.box input[type = "submit"]:hover{

background: #2ecc71;

50
Project report 2020-2021 Smart Wireless Water Meter with Web Database

6.2.2 SEARCH

<html>
<head>
<title> BILL GENERATION </title>
<style>
body{
background-color: whitesmoke;

}
input{
width: 40%;
height: 5%;
border:1px;
border-radius: 05px;
padding: 9px 15px 8px 15px;
margin: 10px 0px 10px 0px;
box-shadow: 1px 1px 2px;

}label{
width: 40%;
height: 5%;
border:1px;
border-radius: 05px;
padding: 9px 15px 8px 15px;
}
</style>

51
Project report 2020-2021 Smart Wireless Water Meter with Web Database

</head>
<body>
<center>
<br><h1> User Bill Generation </h1>
<form action="" method="POST">
<input type="text" name="id" placeholder="Enter Customer ID"/><br/>
<input type="submit" name="search" value="Search Data">
</form>
<?php
$host = "localhost";
$user = "id16795764_r8aproject";
$password = "?Km#W2{%g^gyp8ag";
$db_name = "id16795764_r8a";

$con = mysqli_connect($host, $user, $password, $db_name);


if(mysqli_connect_errno())
{
die("Failed to connect with MySQL: ". mysqli_connect_error());
}

if(isset($_POST['search']))
{
$id = $_POST['id'];

$query= "SELECT * FROM abc WHERE id='$id'";


$query_run = mysqli_query($con,$query);
while ($row = mysqli_fetch_array($query_run))

52
Project report 2020-2021 Smart Wireless Water Meter with Web Database

{ ?>
<form action="" method="POST">
<br><label for="id"> Customer ID </label>
<br> <input type="text" name="id" value= "<?php echo $row['id'] ?>"/ >
<br> <label for="id"> Customer Name </label>
<br><input type="text" name="name" value= "<?php echo $row['name'] ?>" / >
<br><label for="id"> Usage </label>
<br> <input type="text" name="volume" value= "<?php echo $row['volume'] ?>"/ >
<br><label for="id"> Bill Amount </label>
<br><input type="text" name="amount" value= "<?php echo $row['amount'] ?>"/ >

</form>
<?php
}

?>
</center>
</body>
</html>

53
Project report 2020-2021 Smart Wireless Water Meter with Web Database

6.2.3 CONNECTION

<?php $host = "localhost";$user = "id16795764_r8aproject";$password =


"?Km#W2{%g^gyp8ag";$db_name = "id16795764_r8a";$con = mysqli_connect($host, $user,
$password, $db_name);if(mysqli_connect_errno()){die("Failed to connect with MySQL: ".
mysqli_connect_error());}?>

6.2.4 DB-READ

<?php

$host = "localhost"; // host = localhost because database hosted on the same server where PHP files
are hosted
$dbname = "id16795764_r8a"; // Database name
$username = "id16795764_r8aproject"; // Database username
$password = "?Km#W2{%g^gyp8ag"; // Database password

// Establish connection to MySQL database


$conn = new mysqli($host, $username, $password, $dbname);

// Check if connection established successfully


if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

else { echo "Connected to mysql database. <br>"; }

54
Project report 2020-2021 Smart Wireless Water Meter with Web Database

// Select values from MySQL database table

$sql = "SELECT volume FROM abc"; // Update your tablename here

$result = $conn->query($sql);

echo "<center>";

if ($result->num_rows > 0) {

// output data of each row


while($row = $result->fetch_assoc()) {
echo " <strong> val: </strong> " . $row["volume"];

}
} else {
echo "0 results";
}
echo "</center>";
$conn->close();
?>

55
Project report 2020-2021 Smart Wireless Water Meter with Web Database

6.2.5 DB-WRITE

<?php

$host = "localhost"; // host = localhost because database hosted on the same server where PHP
files are hosted
$dbname = "id16795764_r8a"; // Database name
$username = "id16795764_r8aproject"; // Database username
$password = "?Km#W2{%g^gyp8ag"; // Database password

// Establish connection to MySQL database


$conn = new mysqli($host, $username, $password, $dbname);

// Check if connection established successfully


if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
else { echo "Connected to mysql database. "; }

// If values send by NodeMCU are not empty then insert into MySQL database table

if(!empty($_POST['sendval']) )
{
$volume = $_POST['sendval'];

// Update your tablename here


$sql = "UPDATE abc SET volume= '".$volume."',amount= '".$volume."'*10 WHERE id=123";

56
Project report 2020-2021 Smart Wireless Water Meter with Web Database

if ($conn->query($sql) === TRUE) {


echo "Values inserted in MySQL database table.";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
// Close MySQL connection
$conn->close();
?>

6.2.6 INDEX

<!DOCTYPE html>

<html lang="en" dir="ltr">

<head>

<meta charset="utf-8">

<title>Billing Login </title>

<link rel="stylesheet" href="style.css">

</head>

<body>

<form action = "authentication.php" onsubmit = "return validation()" method = "POST" >

57
Project report 2020-2021 Smart Wireless Water Meter with Web Database

<fieldset class="box" action="index.html" method="post" >

<h1>Login</h1>

<input type="text" name="user" placeholder="Username">

<input type="password" name="pass" placeholder="Password">

<input type="submit" name="" value="Login">

</fieldset>

</form>

<script>

function validation()

var id=document.f1.user.value;

var ps=document.f1.pass.value;

if(id.length=="" && ps.length=="") {

alert("User Name and Password fields are empty");

return false;

58
Project report 2020-2021 Smart Wireless Water Meter with Web Database

else

if(id.length=="") {

alert("User Name is empty");

return false;

if (ps.length=="") {

alert("Password field is empty");

return false;

}
</script>
</body>
</html>

59
Project report 2020-2021 Smart Wireless Water Meter with Web Database

6.2.7 AUTHENTICATION

<?php

include('connection.php');

$redirect_to_url="../search.php";

$username = $_POST['user'];

$password = $_POST['pass'];

//to prevent from mysqli injection

$username = stripcslashes($username);

$password = stripcslashes($password);

$username = mysqli_real_escape_string($con, $username);

$password = mysqli_real_escape_string($con, $password);

$sql = "select *from login where username = '$username' and password = '$password'";

$result = mysqli_query($con, $sql);

$row = mysqli_fetch_array($result, MYSQLI_ASSOC);

$count = mysqli_num_rows($result);
if($count == 1){

60
Project report 2020-2021 Smart Wireless Water Meter with Web Database

//echo "<h1><center> Login successful </center></h1>";

header("Location: ".$redirect_to_url);

echo "You are being redirected. Click <a href=\"".$redirect_to_url."\">here</a> if it doesn\'t


happen automatically.";

die();

else{

echo "<h1> Login failed. Invalid username or password.</h1>";

?>

61
Project report 2020-2021 Smart Wireless Water Meter with Web Database

6.3 APPLICATION CODE

6.3.1 MAIN ACTIVITY

package com.example.finalproject;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.util.Patterns;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {


private TextView register;
private EditText editTextTextPersonName,editTextTextPassword2;

62
Project report 2020-2021 Smart Wireless Water Meter with Web Database

private Button button3;


private FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

register = (TextView) findViewById(R.id.tv_register);


register.setOnClickListener(this);

editTextTextPersonName = (EditText) findViewById(R.id.editTextTextPersonName);


editTextTextPassword2 = (EditText) findViewById(R.id.editTextTextPassword2);
button3 = (Button) findViewById(R.id.button3);
button3.setOnClickListener(this);

mAuth = FirebaseAuth.getInstance();
}
@Override
public void onClick(View v) {
switch(v.getId()){
case R.id.tv_register:
startActivity(new Intent(MainActivity.this,Registration.class));
break;
case R.id.button3:
home();
break;

63
Project report 2020-2021 Smart Wireless Water Meter with Web Database

}
private void home(){
String email = editTextTextPersonName.getText().toString().trim();
String password = editTextTextPassword2.getText().toString().trim();

if (email.isEmpty()){
editTextTextPersonName.setError("Email is Required");
editTextTextPersonName.requestFocus();
return;
}
if (!Patterns.EMAIL_ADDRESS.matcher(email).matches()){
editTextTextPersonName.setError("enter valid e-mail");
editTextTextPersonName.requestFocus();
return;
}
if (password.isEmpty()){
editTextTextPassword2.setError("Password is required");
editTextTextPassword2.requestFocus();
}

mAuth.signInWithEmailAndPassword(email,password).addOnCompleteListener(new
OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){

64
Project report 2020-2021 Smart Wireless Water Meter with Web Database

//redirect to home
startActivity(new Intent(MainActivity.this,Home.class));
}
else {
Toast.makeText(MainActivity.this,"Incorrect mail Id or
Password",Toast.LENGTH_LONG).show();
}
}
});

6.3.2 HOME

package com.example.finalproject;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;

65
Project report 2020-2021 Smart Wireless Water Meter with Web Database

import android.widget.TextView;

import com.google.firebase.auth.FirebaseAuth;

public class Home extends AppCompatActivity {


Button level,usage;
Animation scaleup,scaledown;
Button logout;

@SuppressLint("ClickableViewAccessibility")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);

level = (Button) findViewById(R.id.level);


usage = (Button) findViewById(R.id.usage);

logout = findViewById(R.id.logout);

scaleup = AnimationUtils.loadAnimation(this,R.anim.scale_up);
scaledown = AnimationUtils.loadAnimation(this,R.anim.scale_down);

logout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FirebaseAuth.getInstance().signOut();

66
Project report 2020-2021 Smart Wireless Water Meter with Web Database

startActivity(new Intent(Home.this,MainActivity.class));
}
});

level.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction()==MotionEvent.ACTION_DOWN ){
level.startAnimation(scaleup);

}
else if (event.getAction()==MotionEvent.ACTION_UP ){
level.startAnimation(scaledown);
startActivity(new Intent(Home.this,Level.class));

return false;
}
});

usage.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction()==MotionEvent.ACTION_DOWN ){
usage.startAnimation(scaleup);
}

67
Project report 2020-2021 Smart Wireless Water Meter with Web Database

else if (event.getAction()==MotionEvent.ACTION_UP ){
usage.startAnimation(scaledown);
startActivity(new Intent(Home.this,Usage.class));

}
return false;
}
});
}
}

6.3.3 USER

package com.example.finalproject;

public class User {


public String fname, email, number, c_id;

public User() {

}
public User(String fname, String email, String number, String c_id) {
this.fname = fname;
this.email = email;
this.number = number;
this.c_id = c_id;
}
}

68
Project report 2020-2021 Smart Wireless Water Meter with Web Database

6.3.4 REGISTRATION

package com.example.finalproject;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.renderscript.Sampler;
import android.util.Patterns;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.FirebaseDatabase;

import java.util.regex.Pattern;

public class Registration extends AppCompatActivity implements View.OnClickListener {


private FirebaseAuth mAuth;
private TextView textView;

69
Project report 2020-2021 Smart Wireless Water Meter with Web Database

private EditText
editTextTextPersonName2,editTextTextPersonName3,editTextNumber,editTextTextEmailAddress,edit
TextTextPassword,editTextTextPassword1;
private Button button2;
private ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration);

mAuth = FirebaseAuth.getInstance();
textView = (TextView) findViewById(R.id.textView);
textView.setOnClickListener(this);

button2 = (Button) findViewById(R.id.button2);


button2.setOnClickListener(this);

editTextTextPersonName2 =(EditText) findViewById(R.id.editTextTextPersonName2);


editTextTextPersonName3 =(EditText) findViewById(R.id.editTextTextPersonName3);
editTextNumber = (EditText) findViewById(R.id.editTextNumber);
editTextTextEmailAddress = (EditText) findViewById(R.id.editTextTextEmailAddress);
editTextTextPassword = (EditText) findViewById(R.id.editTextTextPassword);
editTextTextPassword1 = (EditText) findViewById(R.id.editTextTextPassword1);

progressBar = (ProgressBar) findViewById(R.id.progressBar);


progressBar.setVisibility(View.GONE);

70
Project report 2020-2021 Smart Wireless Water Meter with Web Database

@SuppressLint("NonConstantResourceId")
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.textView:
startActivity(new Intent(this,MainActivity.class));
break;
case R.id.button2:
registeruser();
}

private void registeruser()


{
String email = editTextTextEmailAddress.getText().toString().trim();
String password = editTextTextPassword.getText().toString().trim();
String recheck = editTextTextPassword1.getText().toString().trim();
String name = editTextTextPersonName2.getText().toString().trim();
String number = editTextNumber.getText().toString().trim();
String c_id = editTextTextPersonName3.getText().toString().trim();

if (name.isEmpty()){
editTextTextPersonName2.setError("Name is required");
editTextTextPersonName2.requestFocus();
return;
}
if (c_id.isEmpty()){
editTextTextPersonName3.setError("Custommer ID is required");

71
Project report 2020-2021 Smart Wireless Water Meter with Web Database

editTextTextPersonName3.requestFocus();
return;
}
if (number.isEmpty()){
editTextNumber.setError("Number is required");
editTextNumber.requestFocus();
return;
}
if (email.isEmpty()){
editTextTextEmailAddress.setError("Email is required");
editTextTextEmailAddress.requestFocus();
return;
}
if(!Patterns.EMAIL_ADDRESS.matcher(email).matches()){
editTextTextEmailAddress.setError("pease provide valid e-mail id");
editTextTextEmailAddress.requestFocus();
}

if (password.isEmpty()) {
editTextTextPassword.setError("Password is required");
editTextTextPassword.requestFocus();
return;
}
if (password.length()<6) {
editTextTextPassword.setError("Minimum 6 character required");
editTextTextPassword.requestFocus();
return;
}
if (!recheck.equals(password)){
editTextTextPassword1.setError("Password does not match");

72
Project report 2020-2021 Smart Wireless Water Meter with Web Database

editTextTextPassword1.requestFocus();
}
progressBar.setVisibility(View.GONE);
mAuth.createUserWithEmailAndPassword(email,password)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
User user = new User(name,email,number,c_id);

FirebaseDatabase.getInstance().getReference("User")
.child(FirebaseAuth.getInstance().getCurrentUser().getUid())
.setValue(user).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
Toast.makeText(Registration.this,"User has registered
succesfully",Toast.LENGTH_LONG).show();
progressBar.setVisibility(View.VISIBLE);
startActivity(new Intent(Registration.this,MainActivity.class));
//redirect to login layout
progressBar.setVisibility(View.GONE);
}
else {
Toast.makeText(Registration.this,"Failed to Register, Try
again",Toast.LENGTH_LONG).show();
progressBar.setVisibility(View.GONE);
}
}
});

73
Project report 2020-2021 Smart Wireless Water Meter with Web Database

}else {
Toast.makeText(Registration.this,"Failed to Register, Try
again",Toast.LENGTH_LONG).show();
progressBar.setVisibility(View.GONE);
}
}
});

6.3.5 LEVEL

package com.example.finalproject;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.Adapter;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.google.firebase.auth.FirebaseAuth;

74
Project report 2020-2021 Smart Wireless Water Meter with Web Database

import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

import java.util.ArrayList;
import java.util.Objects;

public class Level extends AppCompatActivity {

private ListView listview,listview1,listview2,listview3;


private FirebaseUser user;
private String userID;
private DatabaseReference reference,reference1,reference2,reference3;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_level);

user = FirebaseAuth.getInstance().getCurrentUser();
assert user != null;
userID = user.getUid();

listview = findViewById(R.id.listview);

75
Project report 2020-2021 Smart Wireless Water Meter with Web Database

listview1 = findViewById(R.id.listview1);
listview2 = findViewById(R.id.listview2);
listview3 = findViewById(R.id.listview3);

final ArrayList<String> list = new ArrayList<>();


final ArrayList<String> list1 = new ArrayList<>();
final ArrayList<String> list2 = new ArrayList<>();
final ArrayList<String> list3 = new ArrayList<>();

final ArrayAdapter adapter = new ArrayAdapter<String>(this,R.layout.list_item,list);


final ArrayAdapter adapter1 = new ArrayAdapter<String>(this,R.layout.list_item,list1);
final ArrayAdapter adapter2 = new ArrayAdapter<String>(this,R.layout.list_item,list2);
final ArrayAdapter adapter3 = new ArrayAdapter<String>(this,R.layout.list_item,list3);

listview.setAdapter(adapter);
reference = FirebaseDatabase.getInstance().getReference().child("User").child(userID).child("Flow
Rate IN");
reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
list.clear();
for (DataSnapshot snapshot1 : snapshot.getChildren()){
list.add(Objects.requireNonNull(snapshot1.getValue()).toString());
}
adapter.notifyDataSetChanged();

76
Project report 2020-2021 Smart Wireless Water Meter with Web Database

@Override
public void onCancelled(@NonNull DatabaseError error) {

}
});

listview1.setAdapter(adapter1);
reference1 =
FirebaseDatabase.getInstance().getReference().child("User").child(userID).child("Volume IN");
reference1.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
list1.clear();
for (DataSnapshot snapshot1 : snapshot.getChildren()){
list1.add(Objects.requireNonNull(snapshot1.getValue()).toString());
}
adapter1.notifyDataSetChanged();
}

@Override
public void onCancelled(@NonNull DatabaseError error) {

}
});

77
Project report 2020-2021 Smart Wireless Water Meter with Web Database

listview2.setAdapter(adapter2);
reference2 =
FirebaseDatabase.getInstance().getReference().child("User").child(userID).child("Flow Rate OUT");
reference2.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
list2.clear();
for (DataSnapshot snapshot1 : snapshot.getChildren()){
list2.add(Objects.requireNonNull(snapshot1.getValue()).toString());
}
adapter2.notifyDataSetChanged();
}

@Override
public void onCancelled(@NonNull DatabaseError error) {

}
});

listview3.setAdapter(adapter3);
reference3 =
FirebaseDatabase.getInstance().getReference().child("User").child(userID).child("Volume OUT");
reference3.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
list3.clear();
for (DataSnapshot snapshot1 : snapshot.getChildren()){
list3.add(Objects.requireNonNull(snapshot1.getValue()).toString());

78
Project report 2020-2021 Smart Wireless Water Meter with Web Database

}
adapter3.notifyDataSetChanged();
}
@Override
public void onCancelled(@NonNull DatabaseError error) {

}
});

}
}

6.3.6 LOGIN UI

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient"
tools:context=".MainActivity">

<ImageView
android:id="@+id/imageView2"
android:layout_width="97dp"
android:layout_height="120dp"

79
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:contentDescription="@string/todo"
android:translationX="150dp"
android:translationY="100dp"
app:srcCompat="@drawable/wms" />

<EditText
android:id="@+id/editTextTextPersonName"
android:layout_width="250dp"
android:layout_height="44dp"
android:autofillHints=""
android:background="#11000000"
android:drawableStart="@drawable/ic_action_name"
android:drawableLeft="@drawable/ic_action_name"
android:ems="10"
android:hint="@string/username"
android:inputType="textPersonName"
android:textColorHint="#aaaaaa"
android:textColor="#fff"
android:textSize="16sp"
android:translationX="80dp"
android:translationY="275dp" />

<EditText
android:id="@+id/editTextTextPassword2"
android:layout_width="250dp"
android:layout_height="44dp"
android:autofillHints=""
android:ems="10"

80
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:hint="@string/password"
android:textColorHint="#aaaaaa"
android:textColor="#fff"
android:background="#11000000"
android:inputType="textPassword"
android:translationX="80dp"
android:translationY="350dp"
android:drawableStart="@drawable/ic_action_pass"
android:drawableLeft="@drawable/ic_action_pass" />

<androidx.cardview.widget.CardView
android:layout_width="300dp"
android:layout_height="50dp"
android:translationX="50dp"
android:translationY="465dp"
app:cardCornerRadius="250dp"
app:cardElevation="10dp"
app:cardBackgroundColor="#D800BCD4" >

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#D800BCD4"

81
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:elevation="10dp"
android:fontFamily="monospace"
android:text="@string/login"
android:textColor="#000"
android:textSize="24sp"
android:textStyle="bold"
app:backgroundTint="#00BCD4"
tools:targetApi="lollipop" />
</RelativeLayout>
</androidx.cardview.widget.CardView>

<TextView
android:id="@+id/tv_register"
android:layout_width="115dp"
android:layout_height="34dp"
android:text="@string/register_here"
android:textColor="#fff"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:translationX="235dp"
android:translationY="550dp" />

<TextView
android:id="@+id/textView8"
android:layout_width="115dp"
android:layout_height="34dp"
android:text="@string/forgot_password"
android:textColor="@android:color/background_light"
android:translationX="75dp"

82
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:translationY="550dp" />

</RelativeLayout>

6.3.7 REGISTRATION UI

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient"
tools:context=".Registration">

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/user_register"
android:textColor="#00BCD4"
android:textColorHint="#00BCD4"
android:textSize="36sp"
android:textStyle="bold"
android:translationX="80dp"
android:translationY="100dp" />

<EditText

83
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:id="@+id/editTextTextPersonName2"
android:layout_width="250dp"
android:layout_height="44dp"
android:autofillHints=""
android:ems="10"
android:hint="@string/name"
android:inputType="textPersonName"
android:textColorHint="#83FFFFFF"
android:textColor="#fff"
android:translationX="80dp"
android:translationY="200dp" />

<EditText
android:id="@+id/editTextTextPersonName3"
android:layout_width="250dp"
android:layout_height="44dp"
android:autofillHints=""
android:ems="10"
android:hint="@string/customer_id"
android:inputType="textPersonName"
android:textColorHint="#83FFFFFF"
android:textColor="#fff"
android:translationX="80dp"
android:translationY="250dp" />

<EditText
android:id="@+id/editTextNumber"
android:layout_width="250dp"

84
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:layout_height="44dp"
android:autofillHints=""
android:ems="10"
android:hint="@string/mobile_number"
android:inputType="number"
android:textColorHint="#83FFFFFF"
android:textColor="#fff"
android:translationX="80dp"
android:translationY="300dp" />

<EditText
android:id="@+id/editTextTextEmailAddress"
android:layout_width="250dp"
android:layout_height="44dp"
android:autofillHints=""
android:ems="10"
android:hint="@string/email_id"
android:inputType="textEmailAddress"
android:textColorHint="#83FFFFFF"
android:textColor="#fff"
android:translationX="80dp"
android:translationY="350dp" />

<EditText
android:id="@+id/editTextTextPassword"
android:layout_width="250dp"
android:layout_height="44dp"
android:autofillHints=""

85
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:ems="10"
android:hint="@string/password"
android:inputType="textPassword"
android:textColorHint="#83FFFFFF"
android:textColor="#fff"
android:translationX="80dp"
android:translationY="400dp" />

<EditText
android:id="@+id/editTextTextPassword1"
android:layout_width="250dp"
android:layout_height="44dp"
android:autofillHints=""
android:ems="10"
android:hint="@string/confirm_password"
android:inputType="textPassword"
android:textColorHint="#83FFFFFF"
android:textColor="#fff"
android:translationX="80dp"
android:translationY="450dp" />

<Button
android:id="@+id/button2"
android:layout_width="168dp"
android:layout_height="wrap_content"
android:shadowRadius="20"
android:text="@string/register_user"
android:textSize="14sp"

86
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:textStyle="bold"
android:translationX="120dp"
android:translationY="550dp"
app:backgroundTint="#DC00BCD4"
app:cornerRadius="250dp"
app:elevation="20dp" />

<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:translationX="180dp"
android:translationY="300dp"
android:visibility="visible" />

</RelativeLayout>

6.3.8 HOME UI

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient"

87
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:gravity="center"
android:orientation="vertical"

tools:context=".Home">

<Button
android:id="@+id/level"
android:layout_width="300dp"
android:layout_height="100dp"
android:background="@drawable/button_background"
android:gravity="center"
android:text="@string/level"
android:textAlignment="center"
android:textColor="#fff"
android:textSize="34sp"
android:textStyle="bold"
app:backgroundTintMode="multiply" />

<Button
android:id="@+id/usage"
android:layout_width="300dp"
android:layout_height="100dp"
android:layout_marginTop="70dp"
android:background="@drawable/button_background"
android:gravity="center"
android:text="@string/usage"

88
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:textAlignment="center"
android:textColor="#fff"
android:textSize="34sp"
android:textStyle="bold"
app:backgroundTintMode="multiply" />

<Button
android:id="@+id/logout"
android:layout_width="50dp"
android:layout_height="50dp"
android:textColor="@color/teal_700"
android:background="@color/teal_700"
android:textStyle="bold"
android:translationX="150dp"
android:translationY="-430dp"
app:drawableTopCompat="@drawable/ic_action_logout" />

</LinearLayout>

6.3.9 LEVEL UI

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/inrate"
android:layout_width="match_parent"

89
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:layout_height="match_parent"
android:background="@drawable/gradient">

<ListView
android:id="@id/listview"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_marginBottom="10dp"
android:cacheColorHint="#FFFFFF"
android:gravity="center_horizontal"
android:padding="10dp"
android:textAlignment="center"
android:translationX="250dp"
android:translationY="100dp" />

<TextView
android:id="@+id/tv_frate"
android:layout_width="200dp"
android:layout_height="50dp"
android:gravity="center"
android:text="@string/flow_rate_in"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold"
android:translationX="40dp"
android:translationY="100dp" />

<ListView

90
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:id="@+id/listview1"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_marginBottom="10dp"
android:cacheColorHint="#FFFFFF"
android:gravity="center_horizontal"
android:padding="10dp"
android:textAlignment="center"
android:translationX="250dp"
android:translationY="250dp" />

<TextView
android:id="@+id/tv_volume"
android:layout_width="200dp"
android:layout_height="50dp"
android:gravity="center"
android:text="@string/volume_in"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold"
android:translationX="40dp"
android:translationY="250dp" />

<ListView
android:id="@+id/listview2"
android:layout_width="100dp"
android:layout_height="50dp"

91
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:layout_marginBottom="10dp"
android:cacheColorHint="#FFFFFF"
android:gravity="center_horizontal"
android:padding="10dp"
android:textAlignment="center"
android:translationX="250dp"
android:translationY="400dp" />

<TextView
android:id="@+id/tv_ofrate"
android:layout_width="200dp"
android:layout_height="50dp"
android:gravity="center"
android:text="@string/flow_rate_out"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold"
android:translationX="40dp"
android:translationY="400dp" />

<ListView
android:id="@+id/listview3"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_marginBottom="10dp"
android:cacheColorHint="#FFFFFF"
android:gravity="center_horizontal"
android:padding="10dp"
android:textAlignment="center"

92
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:translationX="250dp"
android:translationY="550dp" />

<TextView
android:id="@+id/tv_outvolume"
android:layout_width="200dp"
android:layout_height="50dp"
android:gravity="center"
android:text="@string/volume_out"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold"
android:translationX="40dp"
android:translationY="550dp" />

</RelativeLayout>

6.3.10 UASAGE UI

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"

93
Project report 2020-2021 Smart Wireless Water Meter with Web Database

android:background="@drawable/gradient"
tools:context=".Usage"
android:orientation="vertical">

<com.jjoe64.graphview.GraphView
android:id="@+id/graph"
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@color/white"
android:translationY="250dp" />

<TextView
android:id="@+id/lable"
android:layout_width="300dp"
android:layout_height="60dp"
android:gravity="center_horizontal"
android:text="@string/data_tracker"
android:textAlignment="center"
android:textAllCaps="true"
android:textColor="@color/teal_200"
android:textSize="36sp"
android:textStyle="bold"
android:translationX="50dp"
android:translationY="100dp" />

</RelativeLayout>

94
Project report 2020-2021 Smart Wireless Water Meter with Web Database

CHAPTER 7
TESTING

7.1 OUTPUT SCREEN

7.1.1 Application

Fig 16. Use Registration Fig17. Login Screen

95
Project report 2020-2021 Smart Wireless Water Meter with Web Database

Fig 18. Level & Usage Fig 19. Level Tracking

96
Project report 2020-2021 Smart Wireless Water Meter with Web Database

Fig 20. Data Tracking

97
Project report 2020-2021 Smart Wireless Water Meter with Web Database

7.1.2 Website

Fig 21. Login Screen

98
Project report 2020-2021 Smart Wireless Water Meter with Web Database

Fig 22. Search Bar

99
Project report 2020-2021 Smart Wireless Water Meter with Web Database

Fig 23. User Details Page

100
Project report 2020-2021 Smart Wireless Water Meter with Web Database

7.2 HARDWARE CONNECTIVITY

Fig 24. Hardware Setup

101
Project report 2020-2021 Smart Wireless Water Meter with Web Database

CHAPTER 8

CONCLUSION

A novel system for implementing an economic and reliable smart water distribution metering using IoT
based hardware, database and a smartphone App is discussed. The novel approach overcomes
disadvantages in certain smart-meter systems such as tampering in pre-paid water-meters that often go
undetected due to standalone nature of pre-paid meters; tampering or unauthorized Top-Up updates to
pre-paid meter smartcards using hacking software, etc. The work is being extended to cover a range of
Distribution metering and Unaccounted for Water issues faced by utilities while giving direct and
intangible gains to the consumers in the changing smart infrastructure scenario in urban areas.

102
Project report 2020-2021 Smart Wireless Water Meter with Web Database

REFERENCES

1. https://www.smartdraw.com/

2. https://creately.com/

3. https://in.000webhost.com/

4.https://developer.android.android.com/studio

5.https://sasthrytech.com

6.www.stackoverflow.com

7.www.google.com

8. www.arduino.cc

9.phpmyadmin.net

103

You might also like