Project Report 1
Project Report 1
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
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.
ii
Project report 2020-21 Smart Wireless Water Meter with Web Database
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
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
iv
Project report 2020-21 Smart Wireless Water Meter with Web Database
v
Project report 2020-21 Smart Wireless Water Meter with Web Database
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
9
Project report 2020-21 Smart Wireless Water Meter with Web Database
LIST OF FIGURES
3 Flow Sensor 23
4 OLED Display 24
5 Architecture Diagram 27
6 Hardware Design 28
8 Class Diagram 31
9 Sequence Diagram 1 33
10 Sequence Diagram 2 34
14 State Diagram 1 37
15 State Diagram 2 38
16 User Registration 95
17 Login Screen 95
19 Level Tracking 96
20 Data Tracking 97
21 Login Screen 98
22 Search Bar 99
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
11
Project report 2020-2021 Smart Wireless Water Meter with Web Database
CHAPTER 1
INTRODUCTION
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
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.
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
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.
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
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
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
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.
❖ Analog Pin – AO
21
Project report 2020-2021 Smart Wireless Water Meter with Web Database
❖ I2C Pins
✓ NodeMCU has I2C functionality support but due to the internal functionality of
these pins, you have to find which pin is I2C
22
Project report 2020-2021 Smart Wireless Water Meter with Web Database
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
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
WEBSITE
• Coding Language: HTML, PHP, CSS
• Platform: 000webhost
• Server: Apache
• Database: MariaDB
MOBILE APP
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
OLED DISPLAY
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
➢ 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
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
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
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
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.1. Website
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
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
Fig12.Use-case 2
35
Project report 2020-2021 Smart Wireless Water Meter with Web Database
36
Project report 2020-2021 Smart Wireless Water Meter with Web Database
37
Project report 2020-2021 Smart Wireless Water Meter with Web Database
5.7.2 Website
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
#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 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
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;
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);
display.clearDisplay();
43
Project report 2020-2021 Smart Wireless Water Meter with Web Database
44
Project report 2020-2021 Smart Wireless Water Meter with Web 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 ;
// Hence created variable postDAta and stored our variables in it in desired format
45
Project report 2020-2021 Smart Wireless Water Meter with Web Database
46
Project report 2020-2021 Smart Wireless Water Meter with Web Database
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;
border:0;
background: none;
display: block;
text-align: center;
48
Project report 2020-2021 Smart Wireless Water Meter with Web Database
width: 200px;
outline: none;
color: white;
border-radius: 24px;
transition: 0.25s;
width: 280px;
border-color: #2ecc71;
border:0;
background: none;
display: block;
49
Project report 2020-2021 Smart Wireless Water Meter with Web Database
text-align: center;
outline: none;
color: white;
border-radius: 24px;
transition: 0.25s;
cursor: pointer;
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";
if(isset($_POST['search']))
{
$id = $_POST['id'];
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
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
54
Project report 2020-2021 Smart Wireless Water Meter with Web Database
$result = $conn->query($sql);
echo "<center>";
if ($result->num_rows > 0) {
}
} 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
// If values send by NodeMCU are not empty then insert into MySQL database table
if(!empty($_POST['sendval']) )
{
$volume = $_POST['sendval'];
56
Project report 2020-2021 Smart Wireless Water Meter with Web Database
6.2.6 INDEX
<!DOCTYPE html>
<head>
<meta charset="utf-8">
</head>
<body>
57
Project report 2020-2021 Smart Wireless Water Meter with Web Database
<h1>Login</h1>
</fieldset>
</form>
<script>
function validation()
var id=document.f1.user.value;
var ps=document.f1.pass.value;
return false;
58
Project report 2020-2021 Smart Wireless Water Meter with Web Database
else
if(id.length=="") {
return false;
if (ps.length=="") {
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'];
$username = stripcslashes($username);
$password = stripcslashes($password);
$sql = "select *from login where username = '$username' and password = '$password'";
$count = mysqli_num_rows($result);
if($count == 1){
60
Project report 2020-2021 Smart Wireless Water Meter with Web Database
header("Location: ".$redirect_to_url);
die();
else{
?>
61
Project report 2020-2021 Smart Wireless Water Meter with Web Database
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;
62
Project report 2020-2021 Smart Wireless Water Meter with Web Database
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
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;
@SuppressLint("ClickableViewAccessibility")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
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 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;
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);
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();
}
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;
@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);
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
<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
<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
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
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
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.1 Application
95
Project report 2020-2021 Smart Wireless Water Meter with Web Database
96
Project report 2020-2021 Smart Wireless Water Meter with Web Database
97
Project report 2020-2021 Smart Wireless Water Meter with Web Database
7.1.2 Website
98
Project report 2020-2021 Smart Wireless Water Meter with Web Database
99
Project report 2020-2021 Smart Wireless Water Meter with Web Database
100
Project report 2020-2021 Smart Wireless Water Meter with Web Database
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