0% found this document useful (0 votes)
115 views109 pages

Project Report - 2

Uploaded by

bngnamisp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views109 pages

Project Report - 2

Uploaded by

bngnamisp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 109

SMART METER DEVELOPMENT WITH ESP32 PROCESSOR AND ENERGY

MONITORING PERSPECTIVE _A SMART GRID COMPONENT

Page 1 of 109
INDEX

Page 2 of 109
CHAPTER 1
INTRODUCTION
PROBLEM STATEMENT
OBJECTIVE

Page 3 of 109
SMART METER DEVELOPMENT WITH ESP32 PROCESSOR
AND ENERGY MONITORING PERSPECTIVE _A SMART
GRID COMPONENT
1.1 INTRODUCTION

Electric grid is considered to be the biggest engineering achievement of the 20th century. We
built large power plants that generate electricity which is transported over high voltage
transmission networks to long distances and distribute the electricity at low voltage to millions of
customers. The power system consisting of limited number of power stations injecting electricity
in to the grid and millions of customers drawing electricity from the grid remained as the basic
model of electrification for over a century. However in the past few years we see the emergence of
a distinct trend with proliferation of distributed generation resources which has put the electric
grids on the threshold of a paradigm shift. After 100 years of focus on centralized power
generation, the shift is now towards de-centralized generation. In the recent past (from 2010), the
picture of the grid has changed dramatically in many geographies. Some of the visible
characteristics of this shift are:
• With the increasing share of generation resources being added at the distribution end,
the traditional boundaries between generation, transmission and distribution are fast
disappearing
• With consumers becoming “prosumers”, the grid that is built for one-way flow of
electricity is now experiencing bi-directional flow of electrons
• With decreasing cost of energy storage solutions, there is already a debate on whether to
invest in transmission or in storage – the choice between “Generation + Transmission +
Distribution” AND “Distributed Generation + Storage + Distribution” is becoming real.
This is even more relevant in regions where T&D losses are very high as with distributed
generation there are fewer network losses
• The nature of loads have changed – Incandescent lamps and induction motors that could
accommodate frequency and voltage excursions comprised majority of the load on the
grid in the past. The present day digital loads require quality power at constant frequency
and voltage
• Power purchase is moving from Volumetric Tariffs to Transactive Tariffs as Inflexible Demand has
become Price Responsive Demand.

Page 4 of 109
• The “Merit Order Dispatch” has graduated towards an “ Energy Efficient and Environmentally
Responsible Dispatch” regime
• Solar PV has already achieved grid parity in many parts of the globe which is about to
unleash a rooftop PV revolution and with increasing quantum of wind power being added
the power mix on the grid is changing more towards intermittent generation resources
• Large fleets of Electric Vehicles that can be aggregated as virtual power plants which could
support short term supply-demand balancing will make the grid even more dynamic and
complex
In the traditional electric grid, the ability to monitor power flows and control it in real-time is
limited to high voltage networks which are equipped with automation systems. In the low voltage
network, the power system operator has no visibility on who is consuming how much electricity
when and where. In a smart grid equipped with sensors and smart meters which are connected to
computers in the control room, it is possible to remotely monitor and control the flow of
electricity in real time to every customer or even to every smart appliance inside a customer’s
premise. So the evolving smart grid of the 21st century will be drastically different – the grid will
soon emerge as the “grid of things” like how the internet is evolving as “internet of everything”.
CHANGING PICTURE OF THE ELECTRIC GRID
Some of the disruptive changes taking place in the power systems are described in detail below:
• Integrated Grid: Traditionally the power system was vertically divided in to three
segments as Generation, Transmission and Distribution. In the recent years, increasingly
larger share of new generation resources such as rooftop PV, micro-wind turbines, energy
storage devices (batteries and electric cars etc) are being connected to the low voltage
grid. This is leading to the fast dis- appearance of the traditional boundaries between
generation, transmission and distribution. It is a very disruptive trend for electric utilities
as their organizational structures and functions are also segregated in to Generation,
Transmission and Distribution silos. Traditionally all generation from the power plants
flowed in to the transmission department which accounted for total receipts from
generation. With rooftop PVs connected at customer premises to the distribution grid on
a net-metering scheme which department of the utility will account for the total monthly
generation and energy inputs, energy balance etc? Similarly, the System Operations group
forecast the demand and generation department will schedule the available plant capacity
for next day. With distributed generation assuming larger share in the energy mix, there is
a need for forecasting potential generation from the distributed resources connected to
the grid at customer premises in order to accurately schedule and dispatch. But neither
the customers who own these resources have any capability nor the distribution
department of the utility which deal with this segment of the grid has any expertise and
lastly but not the least the generation department has no visibility of distributed
generation. In order to manage a grid with distributed generation resources connected at
all voltage levels in the grid, utilities need to invent new organizational structures, new
skills and operating rules which will require new investments. Management and
operation of the evolving integrated grids are going to be major challenge in the
transitional term.

Page 5 of 109
Figure 1: Structure of Traditional Grid

Figure 2: Picture of the emerging Integrated Grid

Page 6 of 109
• Prosumers: The existing grid is designed for one way flow of electrons from generating
stations to loads at the customer premises. And it was operated in that fashion for over
a century. All equipment, systems, processes and operating procedures are designed to
facilitate this one-way flow of electricity. However, now with rooftop PV or Micro Wind
Turbines on customer premises being connected to the grid, a customer can inject
electricity in to the grid that the utility can sell to any customer on the network. So the
traditional customer who was only a buyer of electricity has become a producer and a
consumer – “prosumer” now. This again brings out both engineering challenges as well as
business process challenges. In engineering terms it need to be assessed how much
“reverse power flow” from a customer premises can be accommodated in the low
voltage grid; and in terms of business challenges, the utility need to put in place
new/smart metering and control systems as well as policies for accounting and payment
mechanisms. Utility need to constantly evaluate the capacity of the last mile network
before approving connectivity for rooftop PV systems which require network models and
load flow studies. Yet another challenge for utilities!
• Transmission v/s Energy Storage: A host of energy storage technologies are fast
approaching commercialization and already MW-scale lithium ion and Sodium Sulphur
(NaS) batteries are commercially deployed for certain grid applications. In many
geographies, building transmission lines has been a herculean task as people dislike high
voltage transmission lines passing through their habitations. In USA and several other
countries, it takes well over a decade to establish the right of way for a high voltage
transmission line and the cost of right of way is often higher than the actual line
construction cost. In the emerging paradigm of distributed generation coupled with
energy storage, utilities could avoid bringing high voltage transmission lines to congested
urban areas or expensive neighbour hoods. In this scenario, large capacity battery storages
(other storage technologies may also be relevant according locational considerations) and
distributed generation can be designed to service the local load.
This model of “distributed generation + energy storage + distribution/consumption” is a
challenge to the traditional model of “generation + transmission + distribution”. In the
distributed generation model, network losses are also lower compared to the traditional
model. This is highly relevant in regions with high transmission and distribution losses.
So we can expect to see in the coming years, many regions and pockets opting for
distributed generation and storage instead of bringing electricity through high voltage
transmission lines and building substations and distributing it.
• Changing nature of Loads: Incandescent lamps and induction motors comprised of
majority of the loads in the traditional grid. Both of them could accommodate frequency
and voltage excursions to certain extent. If the voltage drops even by 50% still an
incandescent bulb could burn with lower luminosity. But in the present day digital word,
majority of the new loads require quality power at constant frequency and voltage. In
the traditional grid, majority of the generation resources (large hydro and thermal
stations) could accommodate load fluctuations to certain extent and could keep the
voltage and frequency constant; but in the emerging grid with larger share of renewable
generation resources which are intermittent, sudden drop in generation can take place
any time and balancing the grid is becoming a nightmare for power system operators.
When the share of renewables exceed the limit of spinning reserve maintained in a
Page 7 of 109
power system, it can cause serious fluctuations anytime. Hence we are now exploring
demand-side controls. When sudden loss of generation happens, utility should be able to
switch off certain loads (water pumping, air conditioning etc) at customer premises so
that supply-demand equilibrium is achieved to ensure grid stability. The changes in the
nature of loads have further complicated this grid balancing.

Page 8 of 109
• Electric Vehicles: Electric Vehicles (EVs) are becoming an integral part of the electric grid.
The globally accepted model for low carbon development is “electrification of all human
activities including transportation and agriculture to the extent possible”. In India,
Government has launched a National Mission on Electric Mobility in 2013 with the target
of 2 million four wheelers and 4-5 million two wheelers by 2020. Although this mission
was moving slowly owing to a variety of teething issues including availability of charging
stations, now, GoI has accorded priority for faster roll out of EVs to address the pollution
in cities reaching dangerous levels.
EVs are big loads on the grids as car batteries are 10kWh to 100kWh whereas bus batteries
can be from 100kWh to 300kWh. These will have unprecedented impacts on the distribution
grid as it is not a stationary load for which the grid up-gradation can be made at any
particular location. EVs may be charged from different locations with in a city based on
where the EV owner is driving on a particular day. Huge investments are required to setup
charging stations city wide as well as to upgrade the capacity of transformers and cables to
accommodate the new loads from EVs. Even if a separate commercial tariff is applied on
EV charging stations, cost recovery from necessary grid upgrades will not be viable. EV
batteries can act as an energy storage device which can pump electricity back to the grid.
Large fleets of EVs connected to the grid can be aggregated as virtual power plants which
could support short term supply-demand balancing. This could help the distribution grid to
tackle the intermittency of rooftop PV generation at street level.
All the above factors are going to affect the grid operations in a profound manner in the
coming days leading to a paradigm shift. So the evolving 21st Century Grids are going to
be drastically different than the one that we are used to for over a century.
• Microgrids and DC Grids: Microgrid is top on the list of smart grid technologies in the
developed countries - reason: critical infrastructure (airports, military bases, hospitals
etc) have no stand-by power supply systems. At the heart of a microgrid is an intelligent
control centre that can island the local grid (microgrid) from the utility grid and can
control and curtail (if required) the load within that microgrid to match the emergency
demand with the available generation and storage facilities. Smart microgrids that can
island from the grid is considered as a fall back safety net against cyber attacks. While it is
easy for an attacker to target the control centre of a large utility, it will be impossible to
attack thousands of microgrids with each of it having its own control centres. In case of an
attack and breakdown of the utility control centre, the microgrids can island from the
main grid and can serve critical loads till main grid is back in operation.
Today the electricity generated from solar PV is converted from DC to AC and distributed
which is again converted to DC for the digital appliances such as computers, LED lights,
LCD/LED TVs, flat screen monitors, security cameras, cell phones etc. Almost half the
energy generated is lost in these two conversions (DC to AC and again AC to DC). As the
share of DC generation and DC consumption both are increasing steadily, it makes
business sense to have DC distribution system in parallel to AC distribution in offices and
homes. Already in certain hotels and office buildings there is 5V DC distribution system
on which USB connections are provided.

Page 9 of 109
Several teams around the world are working on standards for DC Grids. In India, ISGF
facilitated the creation of a Low Voltage Direct Current (LVDC) Forum in 2013 which has
been adopted by IEEE. This LVDC Forum has selected 48V DC for indoor applications in
India and standards for the same has been issued by Bureau of Indian Standards (BIS) in
November 2017 (IS 16711:2017 - 48 V ELVDC Distribution Systems –Guidelines). DC
Grids could also facilitate reliable rural electrification with solar PV, batteries and DC
appliances – LED lights, Brushless DC (BLDC) motors, LED TVs etc.

Page 10 of 109
OVERVIEW OF SMART GRIDS
The smart grid is the evolving electric grid with advanced automation, control, IT and IOT systems
that enables real-time monitoring and control of power flows from sources of generation to
sources of consumption. A set of technologies enable these functionalities and help manage
electricity demand in a sustainable, reliable and economic manner. Smart grids can provide
consumers with real-time information on their energy use, support pricing that reflects changes in
supply and demand, and enable smart appliances and devices to help consumers exercise choices
in terms of usage of energy.
“Smart grid is an electricity grid with communication, automation and IT systems that enable real
time monitoring and control of bi-directional power flows and information flows from points of
generation to points of consumption at the appliances level.”

WHAT IS SMART GRID


As summarized in the previous pages, a shift from centralized generation to decentralize
generation is happening. The traditional boundaries between generation, transmission and
distribution are fast disappearing and the grid is evolving into an integrated smart grid, a unique
solution which integrates all type of power generation and helps the consumer becomes a
producer and consumer (prosumer). Each household will be able to generate and store electricity
for its own use or sell it to the grid. Smart grid technologies can empower customers with real time
control and the choice to generate, store and consume electricity at lowest cost available or sell it to
the grid during the surplus generation while ensuring high quality and availability of power. With
the help of programs like demand response (DR), customers can change their consumption
patterns by shifting their consumption from expensive peak hours to cheaper off peak hours
making the power flow more interactive, efficient, more environment and customer friendly.

Smart Grid - Analogy with Human Body

The picture below depicts the analogy of a smart grid with human body.

Figure 3: Analogy of a Smart Grid with Human Body

Page 11 of 109
DRIVERS FOR SMART GRID
Since the early 21st century, advancement in electronic communication technology is being used to
resolve the limitations and costs of the electrical grid. Technological limitations on metering no
longer force peak power prices to be averaged out and passed on to all consumers equally.
Key drivers for smart grids for different stakeholders in the Indian context are:

I. UTILITIES:
• Reduction in Aggregate Technical and Commercial (AT&C) losses
• Peak load management – multiple options from direct load control to price incentives to customers
• Reduction in power purchase cost
• Better asset management
• Increased grid visibility
• Self-healing grid- faster restoration of electricity after fault or disturbances
• Renewable energy integration

II. CUSTOMERS:
• 24x7 Power for All
• Improved reliability of supply to all customers – no power cuts, no more DG sets and inverters for
back up
• Improved quality of supply – no more voltage stabilizers
• User friendly and transparent interface with utilities
• Increased choice for customers – including green power
• . “Prosumer” enablement – can produce own electricity and consume or sell
• Options to save money by shifting loads from peak hours to off-peak periods

III. GOVERNMENTS AND REGULATORS:


• Satisfied customers
• Financially sound utilities
• Tariff neutral system upgrade and modernization
• Reduction in emission intensity

Page 12 of 109
FUNCTIONALITIES AND KEY COMPONENTS OF SMART GRIDS

Page 13 of 109
The energy consumption can be monitored by using an electric device called energy meter. The
cost and the regular usage of Power consumption are informed to the user to overcome high bill
usage. The Energy meter shows the amount of units consumed and transfers the data to both the
customer and to the electrical board so this helps in reducing man-power. The user can check
their Power usage from anywhere and at any time interval. The IoT is used to Turn on/off the
household appliances using relay and ESP32 interfacing. The objective of this system is to
monitor the amount of electricity consumed. The distributer and the consumer both will be
benefitted by eventually reducing the total Power consumption.

The Electrical metering instrument technology has come a long way from what it was more than
100 years ago. From the original bulky meters with heavy magnets and coils, there have been
many innovations that have resulted in size & weight reduction in addition to improvement in
features and specifications. Resolution and accuracy of the meter have seen substantial
improvements over the years. Introduction of the digital meter in the later part of last century has
completely changed the way Electrical parameters are measured. Starting with Voltmeters &
Ammeters, the digital meter has conquered the entire spectrum of measuring instruments due to
their advantages like ease of reading, better resolution and rugged construction. Of particular
significance is the introduction of the Electronic Energy Meter in the mid-eighties. Now a days,
the energy consumption and energy distribution has become a big subject for discussion because
of huge difference in energy production and consumption. In this regard, energy consumers are
facing so many problems due to the frequent power failures; another important reason for power
cuts is due to the un-limited energy consumption of rich people. In this aspect, to minimize the
power cuts and to distribute the energy equally to all areas, some restriction should have over the
power consumption of each and every energy consumer, and according to that the Government
should implement a policy, by introducing Autonomous Energy Meters everywhere in domestic
sector. Hence, the need has come to think on this line and a solution has to be emerged out.
Smart electrical energy meter technologies have been investigated and developed for
approximately 10 years. Various technologies have been developed and used to measure the
electrical consumptions. For the billing, the users will get the bill from the energy board after
they generated and provided using the several methods. At the moment they use the traditional
electro - mechanical watt meters and the readings are not automated. The users will have to wait
the bill of energy consumptions for every month to pay their energy bill. Normally, at the end of
Page 14 of 109
the month, a staff from the meter board billing will visit every house to read the meter reading
and at the same time, give the bill to the users.

An electricity meter or energy meter is a device that measures the amount of electric energy
consumed to residence or business. There are two types of Domestic Ordinary Power Consumers
meters single phase and three phases. The energy consumption is measured by all electrical
services using kilowatt- hours meter with refer to kilowatt-hours (kWh).

Demand for electricity grows with great rapidity as a nation modernizes and it’s economy
develops. The growth rate for electricity demand has outstripped that for other forms of energy.
Demand of electricity is so much throughout the world that electric power consumption rate of
world is 297watts per capital which is still increasing with the passage of time. Development of
any country can be estimated from it’s consumption of electric power. Electric power is
enhanced not only by increasing generation capacity but also by modernizing transmission and
distribution network of power which controls power losses.

The IOT technology is used so that consumer would receive data about the consumption of
power and if it reaches the minimum amount, it would automatically alert the consumer to
recharge. This technology holds good for all electricity distribution companies, private
communities, IT parks and self containing housing projects. Apart from making reading using
wireless communication, billing system is needed to be made prepaid to avoid unnecessary usage
of power. It replaces traditional meter reading methods and enables remote access of existing
energy meter provider.

INTERNET OF THINGS
Introduction

Today, we are living in the era of smart technologies which represents a "ubiquitous
computing" or “web 0.3”. Internet of Things (IoT) has emerged strongly as a more
prosperous area to express this kind of a new technology. It is not the first technology in this
field, but also the cloud computing technology has been used to represent the ubiquitous
computing world. In the seventh in the series of ITU Internet Reports originally it was
launched in 1997 under the title “Challenges to the Network” [1], and it was first coined by
Kevin Ashton in the RFID journal 1999 [2], In 2005 this name was changed to “Internet of

Page 15 of 109
things“. The vision of IoT according to Kevin’s vision was to enable networked devices to
propagate their information about physical world objects through the web. In recent years,
the most of the IoT proposed architectures are used, web semantic to publish information
through the social networks; for instance, the iPhone has innovated service is Nike + iPod to
record information and published it on the social networks and the social network friends [3].
Actually, the definition of IoT varies based on who you talk, but formally, it can be defined
as a dynamic global network infrastructure with self-configuration and interoperable
communication. Simply, IoT means the ability to make everything around us starting from
(i.e. Machine, Devices, Mobile phone and Cars) even (Cities and Roads) are expected to be
connected to the Internet with an intelligent behavior and taking into account the existence of
the kind of autonomy and privacy. Meanwhile, the IoT environment contains a huge number
of the different objects/things can be classified into two types namely; i) Things rechargeable
batteries things: the most of them are mobiles (e.g. Laptop, tablets and mobile phone), and ii)
Things are non-rechargeable things: these things are static from the mobility point of view
[4]. Generally, IoT includes three main demands are: the first, a shared understanding of the
situation of its users and their applications. Secondly, software architecture and pervasive
communication networks to cover and process contextual information, and lastly, the
analytics tools in IoT that aims for autonomous and intelligent behaviour.

Definitions and History

In 1991, Mark Weiser has described the vision of the future Internet under the name of
“Ubiquitous Computing”. Through this vision he was focused on how to turn on the smart
livable environment in the presence of mobile phone technology this provide a powerful
multimedia system [6]. Kevin Ashton is a one of the pioneers talk about IoT [2]. According
to Atzori A.lera et al [7], classified IoT to three paradigms namely, i) internet oriented
(Middleware), ii) things oriented (Sensors), and iii) semantic oriented (Knowledge). In 1999
Neil Gershenfeld was speaking about similar things from the Massachusetts Institute of
Technology, MIT Media Lab in his book “When Things Start to think”

Security and privacy

The security rule aims to protect it from threats; these threats classify into two kinds are: the
external threats such as attacks on system form attackers and the internal threats represented

Page 16 of 109
in misuse of the system or information. There are three main factors of security are: data
confidentiality, privacy and truth. Data confidentiality guarantees only the authorized users to
access and modify data, and it includes two aspects: first, access control mechanism and
second, an object authentication process [27]. Truth is guaranteed to apply security rules into
system and common example of truth is digital certificates. Privacy is defined as a control
access to personal data; and it allows keeping certain information and data confidential; the
features of privacy are secrecy, anonymity and solitude [28]. The most current researches
seek to increase and develop privacy in the applications, the Privacy Enhancing Technologies
(PET) can be oriented to the subject, the object, the transaction or the system; it is used to
protect identity over the Internet [28]. In the IoT environment the security and the privacy are
important to guarantee a reliable interaction between the physical world and the cyber world

SOFTWARE MITAPPINVERTER

To create an app using MIT App Inventor, you can follow these basic steps. MIT App Inventor is
a free, web-based application that allows you to build Android apps without any coding
experience. Here's a step-by-step guide to get you started:

1. Sign Up / Log In to MIT App Inventor

• Go to MIT App Inventor.


• Click on "Create Apps!".
• Log in using your Google account or create one if you don't have one.

2. Start a New Project

• After logging in, click on "Create New Project".


• Name your project (e.g., "MyFirstApp").
• You will be directed to the project’s interface.

3. Design the User Interface

• You will see two main panels:


Page 17 of 109
o Viewer (on the right side): This is where you can see a live preview of your app’s
UI.
o Palette (on the left side): This contains components you can drag and drop into
the Viewer.
• Start by dragging and dropping components from the Palette to the Viewer:

o Buttons (for user interaction)


o Text Boxes (for input)
o Labels (for displaying text)
o Images (to add pictures)
o Sliders, Checkboxes, etc.
• Arrange the components visually in the Viewer to design your app’s interface.

4. Set Properties of Components

• After adding components, you can set their properties.


• Select a component from the Viewer, and in the Properties panel (on the right), you can
adjust its properties such as color, text, size, and alignment.

5. Add Functionality with Blocks

• Once you’ve designed your UI, you’ll need to add functionality using the Blocks Editor.
• Click on the Blocks button in the top-right corner of the screen.
• In the Blocks Editor, you can use a visual programming language to define the behavior
of your app:

o Event Handlers (such as Button clicks, screen touches, etc.)


o Variables (to store data)
o Logic (such as conditions and loops)
o Sensors (such as accelerometer, GPS, etc.)
• Example: To make a button show a message when clicked, you’d use the Button.Click
block, and attach a Notifier.ShowMessageDialog block.

6. Connect Your Phone or Emulator


Page 18 of 109
• You can test your app in real-time by connecting your Android phone or using an
emulator.
• Option 1: Connect via USB:

o Install the MIT AI2 Companion app from the Google Play Store.
o On MIT App Inventor, click the Connect button and select AI Companion.
o Scan the QR code shown on the screen with the MIT AI2 Companion app.
• Option 2: Use the Emulator:

o Click on Connect and select Emulator.


o The emulator will open, and you can test your app in a virtual Android
environment.

7. Test and Debug Your App

• As you build your app, test it often to see if it works as expected.


• If something isn’t working, check for errors in the Blocks Editor and correct them.
• Use the Log (in the Designer mode) to see debugging information.

8. Package and Export Your App

• Once you’re satisfied with your app, you can package it as an APK file (Android app
file).
• Go to the Build menu in MIT App Inventor and select "App (provide QR code for
.apk)" or "Save .apk to my computer".
• If you choose the QR code, scan it with your phone to install the app.

9. Publish Your App (Optional)

• If you want to share your app with others, you can upload it to the Google Play Store.
• To do this, you’ll need to create a developer account on the Google Play Store, pay the
registration fee, and submit your app.

Page 19 of 109
Debugging your app in MIT App Inventor is an essential step to ensure your app works as
expected. MIT App Inventor provides several tools and techniques for identifying and fixing
errors in your app.

1. Use the Blocks Editor to Identify Logical Errors

• Check Block Connections: Ensure that all blocks are properly connected. Blocks should
be linked correctly to execute actions.
• Verify Event Handlers: If an event (like a button click) is not firing, check if the
associated blocks are correctly placed under the event handler (e.g., Button.Click).
• Confirm Block Functions: Make sure the blocks you are using do what you expect. For
example, if you're trying to change a label's text, check that the block connected to the
label is correct (set Label.Text to).

2. Use the "Do It" Feature

• Do It: The "Do It" feature allows you to test individual blocks in real-time. You can test
blocks without running the full app, which helps you quickly isolate issues.
• How to Use:

o In the Blocks Editor, right-click on a block and select "Do It".


o This executes that block and displays the result immediately in the "Viewer" or
the "Output" panel. It's especially useful for testing variables, math calculations,
or changes to components.

3. Check the "Log" for Error Messages

• The Log panel helps you see messages that can provide insight into errors or the app’s
behavior.
• How to Access:

o In the Designer view, go to the "Window" menu and select "Show Log".
o Here, you can see any runtime errors or issues that have occurred during testing,
such as "null pointer exceptions" or "component not found."
Page 20 of 109
• If an error occurs, the log will give detailed information about where the error happened
in the code or the blocks.

4. Use the "Notifier" to Display Messages

• The Notifier component allows you to display messages on the screen, which helps track
values and app behavior at runtime.
• How to Use:

o Add a Notifier component to your app from the Palette.


o Use "Notifier.ShowMessageDialog" to display values or messages during app
execution.
o For example, you can show the value of a variable after a button click to ensure
it’s being updated correctly:

▪ Block Example: After changing a variable value, add


Notifier.ShowMessageDialog to display the updated variable value.

5. Test Using the "AI2 Companion" App

• Real-Time Debugging: When you're testing on your device using the MIT AI2
Companion app, you can see how the app behaves in real-time. This can help catch
errors that only occur on the device, such as layout issues or unexpected crashes.
• Check for Visual Problems: Often, UI elements might overlap or behave differently on
various screen sizes. Testing on your device gives you a real-time preview of how it
appears.
• Logs on Device: You can also use the Log panel to view logs while testing on your
phone via the AI2 Companion app. This can help track down issues that only happen on
the actual device.

6. Use the "Web" Component and "TinyWebDB" for Networking Issues

Page 21 of 109
• If your app communicates with a web service, use the Web component and
TinyWebDB. These components have built-in methods that provide error handling and
status responses, such as Web1.ErrorOccurred or TinyWebDB.GotValue.
• If you're getting data from a server, make sure to handle cases when the request fails by
checking for errors (e.g., "RequestError" block).

7. Test with Different Data Inputs

• Boundary Testing: Enter edge cases or extreme values into your app (like very large
numbers, empty inputs, etc.). This will help you identify potential crashes or unexpected
behavior.
• Input Validation: Add blocks to check if user input is valid. If something goes wrong,
you can use a Notifier to warn the user about invalid inputs.

8. Use the "Screens" for App Flow Issues

• If your app uses multiple screens, test the app flow between different screens. If an app
crashes when navigating to a new screen, check the blocks that trigger screen transitions
(such as open another screen or close screen).
• Debug by using the "Notifer" or "Do It" blocks to check the values passed between
screens, as sometimes they might be the cause of the issue.

9. Check for Component Initialization

• Make sure that all components are properly initialized before using them. For example, if
you're using a ListView or Data component, confirm that the list or data is populated
before performing operations like selection or display.

10. Use the "Throttling" Feature for Performance Issues

• If your app performs slow or has performance issues (e.g., freezes or lags), use
Throttling. For certain components, you can add delays (via the Clock component)
between actions to avoid overwhelming the system with too many operations at once.

Page 22 of 109
11. Try the Emulator

• If you're using an emulator, occasionally test it on an actual device, as some issues might
only appear on the real device (e.g., sensors, camera, GPS, etc.).

12. Debugging Using Browser Console (Advanced)

• If you're using the browser version of MIT App Inventor, you can open the browser’s
Developer Tools (typically by pressing F12 or right-clicking and selecting "Inspect"),
and go to the Console tab.
• Any errors from the web interface or app can show up here, especially if something is
going wrong with the IDE itself.

MQTT
MQTT (Message Queuing Telemetry Transport) is a lightweight open messaging protocol that
was developed for constrained environments such as M2M (Machine to Machine) and IoT
(Internet of Things), where a small code footprint is required. MQTT is based on the Pub/Sub
messaging principle of publishing messages and subscribing to topics. The protocol efficiently
packs messages to minimize overhead. The MQTT specification recommends TLS as a transport
option to secure the protocol using port 8883 (secure-mqtt), as the MQTT protocol does not
provide security on its own. Constrained devices can benefit from using TLS session resumption
to reduce the reconnection cost.
The wolfMQTT library is a client implementation of the MQTT written in C for embedded use.
It supports SSL/TLS via the wolfSSL library. From this, it can provide the security that the
MQTT protocol lacks. wolfMQTT was built from the ground up to be multi-platform, space
conscious and extensible. It supports all Packet Types, all Quality of Service (QoS) levels 0-2
and supports SSL/TLS using the wolfSSL library. This implementation provides support for
MQTT v5.0 and MQTT v3.1.1. Additionally, there is also client support for MQTT-SN (Sensor
Network).

An MQTT broker is a central hub that enables communication between devices using the
MQTT protocol. It acts as an intermediary, receiving messages from publishers and routing them

Page 23 of 109
to subscribers based on their topic subscriptions1. This makes it a crucial component in IoT
(Internet of Things) ecosystems and other distributed applications
What Is an MQTT Broker?

MQTT is a lightweight protocol that supports the Internet of Things (IoT).

An MQTT broker is an intermediary entity that enables MQTT clients to communicate.


Functioning as a central hub, an MQTT broker efficiently handles the flow of messages between
devices and applications. Specifically, an MQTT broker receives messages published by clients,
filters the messages by topic, and distributes them to subscribers.

Using MQTT brokers to enable the publish/subscribe (pub/sub) communication model helps
make MQTT a highly efficient and scalable protocol.

This broker-mediated communication enables a lightweight, scalable, and reliable mechanism for
devices to share information in a networked environment, playing a crucial role in the
establishment of efficient and responsive IoT ecosystems and other distributed applications.

Why Are MQTT Brokers Important?

The MQTT broker plays a crucial role in the MQTT architecture, as it is responsible for
facilitating communication between MQTT clients (publishers and subscribers).

Here are some of the main reasons MQTT brokers are important:

Message routing: The MQTT broker receives messages from publishers and routes them to
the appropriate subscribers based on their topic subscriptions. This ensures that messages are
delivered efficiently and accurately, without the need for clients to establish direct
connections with each other.

Scalability: MQTT brokers can handle a large number of simultaneous connections, which
is essential for IoT and M2M communication scenarios, where there may be thousands or
even millions of connected devices. The broker's ability to manage these connections and
messages enables the MQTT protocol to scale effectively.

Page 24 of 109
Security: MQTT brokers can provide security measures like authentication and encryption
to ensure that the data transmitted between IoT devices and applications is secure. Learn
more: 7 Essential Things to Know about MQTT Security 2024.

Integration: MQTT brokers can integrate with other communication protocols and cloud
platforms to provide a complete IoT solution. For example, MQTT brokers can integrate
with AWS IoT, Google Cloud IoT, or Microsoft Azure IoT Hub to provide a seamless IoT
ecosystem.

Session management: The MQTT broker is responsible for managing client sessions,
including maintaining information about the client's subscriptions and handling messages
that are retained for delivery to clients when they come online. This session management
feature ensures that messages are not lost when clients disconnect and later reconnect to the
broker. Learn more: MQTT Persistent Session and Clean Session Explained.

MQTT Broker Architecture

The MQTT broker architecture is based on the publish-subscribe messaging pattern, which
decouples message producers (publishers) from message consumers (subscribers). This
architecture includes three primary components: clients, topics, and the broker.

MQTT Broker Server

The MQTT broker is a server that receives messages from publishers and delivers them to
subscribers based on their topic subscriptions. It manages client connections, handles
Page 25 of 109
subscriptions and unsubscriptions, and ensures message delivery according to the
specified Quality of Service (QoS) levels.

MQTT Clients

MQTT clients can be publishers, subscribers, or both. Publishers send messages to the
MQTT broker, while subscribers receive messages from the broker. Clients can be any
device or application that can establish a connection to the MQTT broker using the MQTT
protocol, such as IoT devices, mobile applications, or other servers.

Topics

Topics are hierarchical strings that define the subject or category of a message. When
publishers send messages to the broker, they associate them with a specific topic.
Subscribers express their interest in receiving messages by subscribing to one or
more MQTT topics. The broker then routes messages to the appropriate subscribers based
on their topic subscriptions.

The MQTT broker architecture can be either centralized or distributed. In a centralized


architecture, a single broker handles all communication between clients. In a distributed
architecture, multiple brokers work together to provide a scalable and fault-tolerant
messaging infrastructure. Each broker in a distributed architecture can coordinate with
other brokers to manage message routing, ensuring messages are delivered to the
intended recipients.

Overall, the MQTT broker architecture provides a flexible and efficient messaging
infrastructure that enables devices and applications to communicate securely, efficiently,
and at scale.

Page 26 of 109
1.1 PROBLEM STATEMENT

• The Energy metering instrument technology has come a long way from what it was more
than 100 years ago. From the original bulky meters with heavy magnets and coils, there
have been many innovations that have resulted in size & weight reduction in addition to
improvement in features and specifications.

• Resolution and accuracy of the meter have seen substantial improvements over the years.
Introduction of the digital meter in the later part of last century has completely changed
the way Electrical parameters are measured. Starting with Voltmeters & Ammeters, the
digital meter has conquered the entire spectrum of measuring instruments due to their
advantages like ease of reading, better resolution and rugged construction. Of particular
significance is the introduction of the Electronic Energy Meter in the mid-eighties.

• Meter reading and other related tasks like bill payment are performed by a large number
of staff i.e., large number of employees are required and an expansive number of staff is
utilized for meter reading and other related assignments like bill payment, and also
consumer carelessly use the electricity who is unaware of its costs.
To overcome all these problems we have designed this model.

➢ Existing system is unable to adopt the external conditions.


➢ Accuracy of identification is less.
➢ Complex classification techniques employed.
➢ Time consuming.
➢ Unable to detect power theft.
➢ Curtailment of load over a certain limit.
➢ Existing Smart meter have different complexity and complex protocols.

Page 27 of 109
Page 28 of 109
1.2 OBJECTIVE
• To avoid more consumption of electricity.

• Reduction of man-power.

• Increase the accuracy of the meter reading.

• This system would provide a simple way to detect an electrical power theft without any
human interface.

• It will indicate exact zone and distribution line on which unauthorized tapping is done in
real time.

• It will determine transmission line faults.

• To maximize revenue generation by the power utility companies.

• Its cost is less as compare to other present system,single module can accuire,process &
transmit Data.

Page 29 of 109
CHAPTER 2
LITRATURE SURVEY

Page 30 of 109
2.1 LITRATURE SURVEY
Anitha et al., [1] proposed “Smart energy meter surveillance using IoT” about IoT, internet of
things as an emerging field and IoT based devices have created a revolution in electronics and
IT. The foremost objective of this project is to create awareness about energy consumption and.
efficient use of home appliances for energy savings. Due to manual work, existing electricity
billing system has major drawbacks. This system will give the information on meter reading,
power cut when power consumption exceeds beyond the specified limit using IoT. The Arduino
esp8266 micro controller is programmed toper form the objectives with the help of GSM
module. It is proposed to overcome all the disadvantages in the already existing energy meter.
All the details are sent to the consumer’s mobile through the IoT and the ESP module and it is
also displayed in the LCD. It is a time savings and it helps to eliminate the human interference
using IoT. Devadhanishini et al., [2] “Smart Power Monitoring Using IoT” that energy
Consumption is the very important and challenging issue. Automatic Electrical Energy meter is
used in large electric energy distribution system. The integration of the Arduino WIFI and SMS
provides the system as Smart Power Monitoring system. Smart energy meter provides data for
optimization and lessthe power consumption. This system also includes a motion sensor such
that if there is no human in house or house it will automatically turn off the power supply.
Mohammed Hosseiu et al., [3] presented a paper titled “Design and implementation of smart
meter using IoT” describing the growth of IoT and digital technology. The future energy grid
needs to be implemented in a distributed topology that can dynamically absorb different energy
sources. IoT can be utilized for various applications of the smart grid consisting power
consumption, smart meter, electric power demand side management and various area of energy
production. In this paper, the Smart Energy Metering(SEM) is explained as the main purpose of
SEM is necessary for collecting information on energy consumption of household appliances and
monitor the environmental parameters and provide the required services to home users.
Himanshu K Patel et al., [4] demonstrated “Arduino based smart energy meter” that removes
human intervention in meter readings and bill generation thereby reducing the error that usually
causes in India. The system consists the provision of sending an SMS to user for update on
energy consumption along with final bill generation along with the freedom of reload via SMS.
The disconnection of power supply on demand or due

Page 31 of 109
Bibek Kanti Barman, et al., [5] proposed “smart meter using IoT” on efficient energy utilization
plays a very vital role for the development of smart grid in power system. Hence proper
monitoring and controlling of power consumption is a main priority of the smart grid. The
energy meter has many problems associated to it and one of the key problems is there is no full
duplex communication to solve this problem, a smart energy meter is proposed based on Internet
of Things. The smart energy meter controls and calculate the consumption of energy using ESP
8266 12E, a Wi-Fi module and send it to the cloud from where the consumer or customer can
observe the reading. Therefore, energy examine has been by the consumer becomes much easier
and controllable. This system also helps in detecting energy loss. Thus, this smart meter helps in
home automation using IoT. Garrab et al., [6] proposed AMR approach for energy saving in
Smart Grids using Smart Meter and partial Power Line Communication” on the raising demand
of energy. Smart meters are one of the proposed solutions for the Smart Grid. In this article, an
AMR solution which gives detailed end-to-end application. It is based on an energy meter with
low-power microcontrollerMSP430FE423A and the Power Line Communication standards. The
microcontroller includes an energy metering module ESP430CEl. Landi et al., [7] presented
"ARM-based Energy management system using smart meter and Web server about a low-cost
real-time ARM-based energy management system. An integrated Web Server helps to collect the
statistics of energy consumptions, power quality and is to interface devices for load
displacement. The device is used to access the information. In this way it is possible to manage
the power consumption of the power system leading to a consumption of power. Koay et al., [8]
explained "Design and implementation of Bluetooth energy meter" described around the year
2004, digital meter has started to replace the electromechanical meters in Singapore. A wireless
digital power meter would offer greater convenience to the meter reading task. Bluetooth
technology is a possible wireless solution to this issue. The power reader can collect the power
consumption reading from the energy meter wirelessly based on Bluetooth. Two methods that
can retrieve the meter reading with little human intervention, are added and implemented in the
targeted applications, they are Automatic meter reading(AMR) and the Automatic polling
mechanism(APM). Some commercial applications are applied for the Bluetooth-enabled energy
meter

Page 32 of 109
2.2 PROPOSED METHODOLOGY

The power consumption monitoring using smart meter system is shown in figure 1. The block
diagram consists of current and voltage sensor, WIFI module and IoT, Relay and transformer.
230V AC mains is the input given to the transformer and AC mains is converted to low voltage.
Energy meter measures the live current, voltage and power in terms of KW-h. ESP 32 reads
these parameters and send it to the cloud. NodeMCU is a Wi-Fi device which has a
microcontroller in it. This connects the local router through IoT. The status of these parameters
can be obtained through mobile or laptop. WIFI is used for data communication. WIFI is
configured with ESP32. The Data from the Energy meter is sent to WIFI module and it reaches
the users mobile phone. In this system the user can switch on/off the mains or home appliances
from their Android smart phone app. The WIFI module trans and receives the data from cloud
using MITappinverter and sends to ESP32 and the ESP32 controls the relay to switch on and off
the circuit .

Page 33 of 109
CHAPTER 3

SYSTEM DESIGN

Page 34 of 109
3.1 ABSTRACT

The effort of collecting electricity utility meter reading. Internet of Things (IoT) present an
efficient and coeffective to transfer the information of energy consumer wirelessly as well as it
provides to detect the usage of the electricity the main intention of this project is measure
electricity consumption in home appliances and generate it's bill automatically using IoT. The
energy grid needs to be implemented in a distributed topology that can dynamically absorb
different energy sources. IoT can be utilized for various applications of the smart grid with
distributed energy plant meter, energy generation and energy consumption meter smart meter,
energy demand side management and various area of energy production.The system is made up
of ESP32 controller, current sensors , Relay, LCD display ,energy meter and loads.We need to
select the current sensor as well as the voltage sensor so that the current & voltage can be
measured and thus we can know about the power consumption & total power consumed. Using
the SCT-013 Current Sensor & ZMPT101B Voltage Sensor, we can measure the all required
parameters needed for Electricity Energy Meter. We will interface the SCT-013 Current Sensor
& ZMPT101B Voltage Sensor with ESP32 Wifi Module & Send the data to MITappInverter
Application. This Application Dashboard will display the Voltage, Current, Power & total unit
consumed in kWh.

Page 35 of 109
3.2 BLOCK DIAGRAM

Page 36 of 109
HARDWARE REQUIREMENTS

• Transformer
• Regulator
• Rectifier
• ESP 32
• LCD Display
• Voltage sensor
• Relay
• Push button
• CURRENT sensor

SOFTWARE REOUIREMENT
• Proteus
• Eagle
• keil

Page 37 of 109
CHAPTER 4

H/W AND S/W DESCRIPTION

Page 38 of 109
4.1 HARDWARE DESCRIPTION
TRANSFORMER

Transformers convert AC electricity from one voltage to another with a little loss of power.
Step-up transformers increase voltage, step-down transformers reduce voltage. Most power
supplies use a step-down transformer to reduce the dangerously high voltage to a safer low
voltage.

FIG 4.1: A TYPICAL TRANSFORMER

The input coil is called the primary and the output coil is called the secondary. There is
no electrical connection between the two coils; instead they are linked by an alternating magnetic
field created in the soft-iron core of the transformer. The two lines in the middle of the circuit
symbol represent the core. Transformers waste very little power so the power out is (almost)
equal to the power in. Note that as voltage is stepped down and current is stepped up.
The ratio of the number of turns on each coil, called the turn’s ratio, determines the ratio
of the voltages. A step-down transformer has a large number of turns on its primary (input) coil
which is connected to the high voltage mains supply, and a small number of turns on its
secondary (output) coil to give a low output voltage.
TURNS RATIO = (Vp / Vs) = ( Np / Ns )
Where,
Vp = primary (input) voltage.
Vs = secondary (output) voltage

Page 39 of 109
Np = number of turns on primary coil
Ns = number of turns on secondary coil
Ip = primary (input) current
Is = secondary (output) current.

Ideal power equation

The ideal transformer as a circuit element

If the secondary coil is attached to a load that allows current to flow, electrical power is
transmitted from the primary circuit to the secondary circuit. Ideally, the transformer is perfectly
efficient; all the incoming energy is transformed from the primary circuit to the magnetic field
and into the secondary circuit. If this condition is met, the incoming electric power must equal
the outgoing power:

giving the ideal transformer equation

Transformers normally have high efficiency, so this formula is a reasonable


approximation.

Page 40 of 109
If the voltage is increased, then the current is decreased by the same factor. The
impedance in one circuit is transformed by the square of the turns ratio. For example, if an
impedance Zs is attached across the terminals of the secondary coil, it appears to the primary
circuit to have an impedance of (Np/Ns)2Zs. This relationship is reciprocal, so that the impedance
Zp of the primary circuit appears to the secondary to be (Ns/Np)2Zp.

Page 41 of 109
VOLTAGE REGULATOR 7805

Features
• Output Current up to 1A.
• Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V.
• Thermal Overload Protection.
• Short Circuit Protection.
• Output Transistor Safe Operating Area Protection.

Description
The LM78XX/LM78XXA series of three-terminal positive regulators are available in the
TO-220/D-PAK package and with several fixed output voltages, making them useful in a Wide
range of applications. Each type employs internal current limiting, thermal shutdown and safe
operating area protection, making it essentially indestructible. If adequate heat sinking is
provided, they can deliver over 1A output Current. Although designed primarily as fixed voltage
regulators, these devices can be used with external components to obtain adjustable voltages and
currents.

Internal Block Diagram

Page 42 of 109
BLOCK DIAGRAM OF VOLTAGE REGULATOR

Absolute Maximum Ratings

TABLE 4.2(b): RATINGS OF THE VOLTAGE REGULATOR

VOLTAGE REGULATOR IC 7812


7812 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed
linear voltage regulator ICs. The voltage source in a circuit may have fluctuations and would not
give the fixed voltage output.

Page 43 of 109
The voltage regulator IC maintains the output voltage at a constant value. The xx in 78xx
indicates the fixed output voltage it is designed to provide. 7812 provides +12V regulated power
supply. Capacitors of suitable values can be connected at input and output pins depending upon
the respective voltage levels.

RECTIFIER
A rectifier is an electrical device that converts alternating current (AC), which
periodically reverses direction, to direct current (DC), current that flows in only one direction, a
process known as rectification. Rectifiers have many uses including as components of power
supplies and as detectors of radio signals. Rectifiers may be made of solid statediodes, vacuum
tube diodes, mercury arc valves, and other components. The output from the transformer is fed to
the rectifier. It converts A.C. into pulsating D.C. The rectifier may be a half wave or a full wave
rectifier. In this project, a bridge rectifier is used because of its merits like good stability and full
wave rectification. In positive half cycle only two diodes (1 set of parallel diodes) will conduct,
in negative half cycle remaining two diodes will conduct and they will conduct only in forward
bias only.

Page 44 of 109
WI FI MODULE
ESP32 MODULE
ESP32 is a series of low-cost, low-power system on a chip microcontrollers with integrated Wi-
Fi and dual-mode Bluetooth. The ESP32 series employs either a Tensilica Xtensa LX6
microprocessor in both dual-core and single-core variations, Xtensa LX7 dual-core
microprocessor or a single-core RISC-V microprocessor and includes built-in antenna
switches, RF balun, power amplifier, low-noise receive amplifier, filters, and power-
management modules. ESP32 is created and developed by Espressif Systems, a Chinese
company based in Shanghai, and is manufactured by TSMC using their 40 nm process.[2] It is a
successor to the ESP8266 microcontroller.

Page 45 of 109
Features[edit]

ESP32 function block diagram.

ESP32 Die shot

Features of the ESP32 include the following:[3]

• Processors:
o CPU: Xtensa dual-core (or single-core) 32-bit LX6 microprocessor, operating at
160 or 240 MHz and performing at up to 600 DMIPS
o Ultra low power (ULP) co-processor
• Memory: 520 KiB RAM, 448 KiB ROM
• Wireless connectivity:
o Wi-Fi: 802.11 b/g/n
o Bluetooth: v4.2 BR/EDR and BLE (shares the radio with Wi-Fi)
• Peripheral interfaces:
o 34 × programmable GPIOs
o 12-bit SAR ADC up to 18 channels
o 2 × 8-bit DACs
o 10 × touch sensors (capacitive sensing GPIOs)
o 4 × SPI
Page 46 of 109
o 2 × I²S interfaces
o 2 × I²C interfaces
o 3 × UART
o SD/SDIO/CE-ATA/MMC/eMMC host controller
o SDIO/SPI slave controller
o Ethernet MAC interface with dedicated DMA and planned IEEE 1588 Precision
Time Protocol support[4]
o CAN bus 2.0
o Infrared remote controller (TX/RX, up to 8 channels)
o Pulse counter (capable of full quadrature decoding)
o Motor PWM
o LED PWM (up to 16 channels)
o Ultra low power analog pre-amplifier
o IEEE 802.11 standard security features all supported, including WPA, WPA2,
WPA3 (depending on version)[5] and WLAN Authentication and Privacy
Infrastructure (WAPI)
o Secure boot
o Flash encryption
o 1024-bit OTP, up to 768-bit for customers
o Cryptographic hardware acceleration: AES, SHA-2, RSA, elliptic curve
cryptography (ECC), random number generator (RNG)
• Power management:
o Internal low-dropout regulator
o Individual power domain for RTC
o 5 μA deep sleep current
o Wake up from GPIO interrupt, timer, ADC measurements, capacitive touch
sensor interrupt

Page 47 of 109
PART NUMBER AND ORDERING INFORMATION OF ESP32

The ESP32 is a popular microcontroller developed by Espressif Systems, widely used in IoT
(Internet of Things) projects due to its built-in Wi-Fi and Bluetooth capabilities. The ESP32
comes in a variety of versions and packages, which may include different features, such as more
GPIO pins, more memory, or specific low-power options. Below is the general information for
ordering ESP32 parts, including part numbers and available variations.

The term "ESP32 D0 WD Q6" seems to refer to a specific part of the ESP32 series of
microcontrollers, manufactured by Espressif Systems. Here's a breakdown of what this
designation likely means:

ESP32:

• The ESP32 is a dual-core microcontroller with integrated Wi-Fi and Bluetooth


capabilities. It is widely used in embedded systems, IoT applications, and smart devices.

Page 48 of 109
D0:

• The D0 likely refers to a specific chip variant or revision of the ESP32 microcontroller.
Different revisions or versions of the ESP32 chip may have small hardware changes or
optimizations. It could indicate a specific stepping or revision of the chip, although the
exact meaning can depend on the context and the manufacturer's naming conventions.

WD:

• WD stands for Watchdog Timer. A watchdog timer is a hardware feature used in


microcontrollers to reset the system if it becomes unresponsive or enters an infinite loop.
It’s a safety feature to ensure that the system doesn’t hang or crash without recovering.
This feature is essential in systems where continuous operation is critical (e.g., embedded
systems, IoT devices, etc.).

Q6:

• The Q6 part of the designation refers to the package type and the number of pins in the
chip. In this case, Q6 refers to the QFN (Quad Flat No-lead) package, which is a
surface-mount package with no leads extending from the sides. The Q6 variant typically
indicates a 48-pin QFN package for the ESP32, but there are other variants of the ESP32
with different pin counts and form factors.

1. Common ESP32 Part Numbers

The most commonly used part numbers for ESP32 microcontrollers include:

ESP32-WROOM-32: This is the most popular variant of the ESP32, which integrates
Wi-Fi and Bluetooth. It features:

o CPU: Dual-core (Xtensa LX6)


o Flash: Typically 4MB, but variants with other sizes are available
o Package: 38-pin QFN
Page 49 of 109
o Features: Wi-Fi, Bluetooth (classic and BLE)
o Ordering Code: ESP32-WROOM-32

ESP32-WROVER-32: A more advanced version with more RAM (typically 8MB) and
additional features like external PSRAM, useful for more memory-intensive applications.

o Flash: 4MB or 8MB


o Package: 38-pin QFN
o Ordering Code: ESP32-WROVER-32

ESP32-WROOM-32D: A version with the same specifications as the ESP32-WROOM-


32 but with a slightly different configuration, usually for specific use cases or slight
changes in performance.

o Flash: 4MB
o Package: 38-pin QFN
o Ordering Code: ESP32-WROOM-32D

ESP32-WROVER-B: Similar to ESP32-WROVER-32, but with more available flash


and memory, suitable for applications requiring larger amounts of memory.

o Flash: 4MB or 8MB


o Package: 38-pin QFN
o Ordering Code: ESP32-WROVER-B

ESP32-S2: This is a variant with a single-core processor and improved security features.
It’s commonly used in projects requiring only Wi-Fi without Bluetooth.
Page 50 of 109

o Features: 1-core CPU, USB OTG, integrated touch sensors


o Ordering Code: ESP32-S2 (available in different sub-variants)

ESP32-C3: A newer version based on RISC-V architecture, which is optimized for lower
power consumption and smaller form factor.

o Features: Single-core RISC-V, Bluetooth Low Energy (BLE 5.0)


o Ordering Code: ESP32-C3

2. ESP32 Development Boards

There are several ESP32 development boards based on the above microcontrollers. These boards
make it easier to prototype with the ESP32. Some popular development boards include:

ESP32 DevKitC: A standard development board based on the ESP32-WROOM-32. It


comes with a USB-to-Serial converter for easy programming.

o Ordering Code: ESP32-DevKitC


ESP32-WROOM-32 DevKit V1: A variation of the DevKitC, used for development and
prototyping with the ESP32-WROOM-32 module.

o Ordering Code: ESP32-WROOM-32 DevKit V1


ESP32-WROVER DevKit: This development board uses the ESP32-WROVER module,


offering more RAM and external PSRAM.
Page 51 of 109

o Ordering Code: ESP32-WROVER DevKit


ESP32-S2 Saola 1.0: A development board based on the ESP32-S2 variant, ideal for Wi-
Fi-only projects requiring better security.

o Ordering Code: ESP32-S2 Saola 1.0

3. Ordering Information

To order ESP32 chips, modules, or development boards, you can typically source them from
several well-known distributors. Some of the common distributors include:

• Espressif Official Website: For direct purchase or to find authorized resellers.


• Digi-Key Electronics: Offers a variety of ESP32 parts and development boards,
including global shipping.
• Mouser Electronics: A major distributor that carries ESP32 and ESP32-based products.
• SparkFun Electronics: Known for development boards and accessories for ESP32.
• Adafruit Industries: Offers ESP32 boards for rapid prototyping and development.
• Seeed Studio: Offers various ESP32 boards and accessories, including custom designs.

To place an order, you can search for the specific ESP32 module or development board by its
part number (e.g., ESP32-WROOM-32) or product name (e.g., ESP32 DevKitC), depending
on what you need.

4. Common Part Numbers for Ordering

Here’s a summary of commonly used part numbers for ordering:

ESP32-WROOM-32:

Page 52 of 109
o Ordering Code: ESP32-WROOM-32
o Manufacturer: Espressif Systems

ESP32-WROVER-32:

o Ordering Code: ESP32-WROVER-32


o Manufacturer: Espressif Systems

ESP32-S2:

o Ordering Code: ESP32-S2


o Manufacturer: Espressif Systems

ESP32-C3

o Ordering Code: ESP32-C3


o Manufacturer: Espressif Systems

ESP32-WROOM-32D:

o Ordering Code: ESP32-WROOM-32D


o Manufacturer: Espressif Systems

ESP32-DevKitC:

o Ordering Code: ESP32-DevKitC


o Manufacturer: Espressif Systems (or distributors like Digi-Key, Mouser, etc.)

ESP32 DEVKIT V1

Introduction

Page 53 of 109
The ESP32 DEVKIT V1 is a versatile development board that harnesses the power of the ESP32
microcontroller. This chip comes with integrated Wi-Fi and Bluetooth capabilities, making it an
ideal choice for Internet of Things (IoT) projects. The board's 30 GPIO pins offer a wide range of
functionality, from digital and analog I/O to touch sensors, SPI, I2C, and UART communication.

Common Applications and Use Cases

• Smart home devices


• Wireless sensors
• IoT networking
• Bluetooth-based applications
• Low-power device prototypes

Technical Specifications

Page 54 of 109
Key Technical Details

• Microcontroller: ESP32
• Operating Voltage: 3.3V
• Input Voltage: 7-12V
• Digital I/O Pins: 30
• Analog Input Pins: 6 (VP, VN, 32, 33, 34, 35)
• Flash Memory: 4MB
• SRAM: 520 KB
• Clock Speed: 240MHz
• Wi-Fi: 802.11 b/g/n
• Bluetooth: v4.2 BR/EDR and BLE

Pin Configuration and Descriptions

Pin Number Function Description

1-2 GND Ground

Page 55 of 109
Pin Number Function Description

3 3V3 3.3V power supply

4-5 EN Chip enable. Active high.

6-7 VP 36, SENSOR_VP, ADC_H, RTC_GPIO0

8-9 VN 39, SENSOR_VN, ADC_H, RTC_GPIO3

10-11 IO34 34, ADC1_CH6, RTC_GPIO4

12-13 IO35 35, ADC1_CH7, RTC_GPIO5

14-15 IO32 32, XTAL_32K_P (32.768 kHz crystal oscillator positive input)

16-17 IO33 33, XTAL_32K_N (32.768 kHz crystal oscillator negative input)

18-19 IO25 25, DAC_1, ADC2_CH8, RTC_GPIO6

20-21 IO26 26, DAC_2, ADC2_CH9, RTC_GPIO7

22-23 IO27 27, ADC2_CH7, TOUCH7, RTC_GPIO17

24-25 IO14 14, ADC2_CH6, TOUCH6, RTC_GPIO16

26-27 IO12 12, ADC2_CH5, TOUCH5, RTC_GPIO15

Page 56 of 109
Pin Number Function Description

28-29 IO13 13, ADC2_CH4, TOUCH4, RTC_GPIO14

30 IO9 9, SD2, SPIHD, HSPIHD

LIQUID CRYSTAL DISPLAY

This is the first interfacing example for the Parallel Port. We will start with something
simple. This example doesn't use the Bi-directional feature found on newer ports, thus it should
work with most, if not all Parallel Ports. It however doesn't show the use of the Status Port as an
input for a 16 Character x 2 Line LCD Module to the Parallel Port. These LCD Modules are very
common these days, and are quite simple to work with, as all the logic required running them is
on board.

LCD Background

Frequently, an 8051 program must interact with the outside world using input and output
devices that communicate directly with a human being. One of the most common devices
attached to an 8051 is an LCD display. Some of the most common LCDs connected to the 8051
are 16x2 and 20x2 displays. This means 16 characters per line by 2 lines and 20 characters per
line by 2 lines, respectively.

Fortunately, a very popular standard exists which allows us to communicate with the vast
majority of LCDs regardless of their manufacturer. The standard is referred to as HD44780U,
which refers to the controller chip which receives data from an external source (in this case, the
8051) and communicates directly with the LCD.

Page 57 of 109
FIG 4.8: LCD

LCD BACKGROUND

The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for the data
bus. The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus.
If a 4-bit data bus is used the LCD will require a total of 7 data lines (3 control lines plus the 4
lines for the data bus). If an 8-bit data bus is used the LCD will require a total of 11 data lines (3
control lines plus the 8 lines for the data bus

The three control lines are referred to as EN, RS, and RW.

The EN line is called "Enable." This control line is used to tell the LCD that you are sending it
data. To send data to the LCD, your program should make sure this line is low (0) and then set
the other two control lines and/or put data on the data bus. When the other lines are completely
ready, bring EN high (1) and wait for the minimum amount of time required by the LCD
datasheet (this varies from LCD to LCD), and end by bringing it low (0) again.

Page 58 of 109
The RS line is the "Register Select" line. When RS is low (0), the data is to be treated as a
command or special instruction (such as clear screen, position cursor, etc.). When RS is high (1),
the data being sent is text data which should be displayed on the screen. For example, to display
the letter "T" on the screen you would set RS high.

The RW line is the "Read/Write" control line. When RW is low (0), the information on the data
bus is being written to the LCD. When RW is high (1), the program is effectively querying (or
reading) the LCD. Only one instruction ("Get LCD status") is a read command. All others are
write commands--so RW will almost always be low .Finally, the data bus consists of 4 or 8 lines
(depending on the mode of operation selected by the user). In the case of an 8-bit data bus, the
lines are referred to as DB0, DB1, DB2, DB3, DB4, DB5, DB6, and DB7.

RTC DS3231
The DS3231 is a low-cost, highly accurate Real Time Clock which can maintain hours, minutes
and seconds, as well as, day, month and year information. Also, it has automatic compensation
for leap-years and for months with fewer than 31 days.
The module can work on either 3.3 or 5 V which makes it suitable for many development
platforms or microcontrollers. The battery input is 3V and a typical CR2032 3V battery can
power the module and maintain the information for more than a year.
SPECIFICATIONS

• Highly Accurate RTC Completely Manages All Timekeeping Functions


• Real-Time Clock Counts Seconds, Minutes, Hours, Date of the Month, Month, Day of
the Week, and Year, with Leap-Year Compensation Valid Up to 2100
• Accuracy ±2ppm from 0°C to +40°C
• Accuracy ±3.5ppm from -40°C to +85°C

Page 59 of 109
• Digital Temp Sensor Output: ±3°C Accuracy
• Two Time-of-Day Alarms
• Programmable Square-Wave Output Signal
• Simple Serial Interface Connects to Most Microcontrollers
• Fast (400kHz) I2C Interface
• Battery-Backup Input for Continuous Timekeeping
• Low Power Operation Extends Battery-Backup Run Time
• 3.3V Operation

HOW DOES IT WORK?


The DS3231 real time clock module keeps track of the time even when the module is not
powered. It has a built-in 3V battery which keeps updating the time. We will get the time and
date from the RTC module using the library functions and then we will compare this time with
the alarm time that we have set in the code.
Most RTC’s use an external 32kHz timing crystal that is used to keep time with low current
draw. And that’s all well and good, but those crystals have slight drift, particularly when the
temperature changes (the temperature changes the oscillation frequency very very very slightly
but it does add up!) This RTC is in a beefy package because the crystal is inside the chip! And
right next to the integrated crystal is a temperature sensor. That sensor compensates for the
frequency changes by adding or removing clock ticks so that the timekeeping stays on schedule.
PINOUTS

Page 60 of 109
Power Pins:

• VCC – this is the power pin. Since the RTC can be powered from 2.3V to 5.5V power,
you do not need a regulator or level shifter for 3.3V or 5V logic/power. To power the
board, give it the same power as the logic level of your microcontroller – e.g. for a 5V
micro like Arduino, use 5V
• GND – common ground for power and logic

I2C Logic pins:

• SCL – I2C clock pin, connect to your microcontrollers I2C clock line. This pin has a 10K
pullup resistor to Vin
• SDA – I2C data pin, connect to your microcontrollers I2C data line. This pin has a 10K
pullup resistor to Vin

Other Pins:

• 32K – 32KHz oscillator output. Open drain, you need to attach a pullup to read this
signal from a microcontroller pin
• SQW – optional square wave or interrupt output. Open drain, you need to attach a pullup
to read this signal from a microcontroller pin

Page 61 of 109
RELAY

A simple electromagnetic relay consists of a coil of wire wrapped around a soft iron core, an iron
yoke which provides a low reluctancepath for magnetic flux, a movable iron armature, and one
or more sets of contacts (there are two in the relay pictured). The armature is hinged to the yoke
and mechanically linked to one or more sets of moving contacts. It is held in place by a spring so
that when the relay is de-energized there is an air gap in the magnetic circuit. In this condition,
one of the two sets of contacts in the relay pictured is closed, and the other set is open. Other
relays may have more or fewer sets of contacts depending on their function. The relay in the
picture also has a wire connecting the armature to the yoke. This ensures continuity of the circuit
between the moving contacts on the armature, and the circuit track on the printed circuit
board (PCB) via the yoke, which is soldered to the PCB.

When an electric current is passed through the coil it generates a magnetic field that activates the
armature, and the consequent movement of the movable contact(s) either makes or breaks
(depending upon construction) a connection with a fixed contact. If the set of contacts was closed
when the relay was de-energized, then the movement opens the contacts and breaks the
connection, and vice versa if the contacts were open. When the current to the coil is switched off,
the armature is returned by a force, approximately half as strong as the magnetic force, to its
relaxed position. Usually this force is provided by a spring, but gravity is also used commonly in
industrial motor starters. Most relays are manufactured to operate quickly. In a low-voltage
application this reduces nois in a high voltage or current application it reduces arcing.

When the coil is energized with direct current, a diode is often placed across the coil to
dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise
generate a voltage spike dangerous to semiconductor circuit components. Such diodes were not
widely used before the application of transistors as relay drivers, but soon became ubiquitous as
early germanium transistors were easily destroyed by this surge. Some automotive relays include
a diode inside the relay case.

If the relay is driving a large, or especially a reactive load, there may be a similar
problem of surge currents around the relay output contacts. In this case a snubber circuit (a
capacitor and resistor in series) across the contacts may absorb the surge. Suitably rated
capacitors and the associated resistor are sold as a single packaged component for this
commonplace use.

Page 62 of 109
If the coil is designed to be energized with alternating current (AC), some method is used
to split the flux into two out-of-phase components which add together, increasing the minimum
pull on the armature during the

AC cycle. Typically this is done with a small copper "shading ring" crimped around a portion of
the core that creates the delayed, out-of-phase component,[9] which holds the contacts during the
zero crossings of the control voltageA relay can be compared to a vacuum tube and solid state
transistor amplifier because both can use a small voltage and current in one circuit to control a
large voltage and current in another circuit. However, unlike tubes and transistors, a relay cannot
produce a variable output; It can only switch on and off similar to a logic circuit in a computer.
But the relay has the advantage of being able to completely isolate its input circuit from its
output.
Below is a drawing of a Single Pole Double Throw (SPDT) relay. A single contact called
the Common contact switches between a Normally Closed contact and a Normally Open contact.
The Common contact is attached to an armature which is a strip of metal that is hinged at one
end and has electrical contacts, usually made of silver, at the other end. A spring pulls the
armature up so its contact connects to the Normally Closed contact. An electromagnet below the
armature attracts the armature when it is energized and pulls it down so its contact disconnects
from the Normally Closed contact and connects to the Normally Open contact instead.

Page 63 of 109
The electromagnet is made of a coil of fine enameled copper wire wound on a plastic bobbin that
has an iron core in its center. A magnetic field is created in the iron core when current flows
through the coil. The number of turns in the coil and the wire size determine the voltage that
must applied to it. Relays are available for operation at almost any voltage but the most common
are 5, 6, 9, 12, 24 and 48 volts DC. The coil current also depends on the number of turns and
wire size and usually ranges from 30 to 200 million mperes.

There is no connection between the coil and any of the contacts. The contacts are completely
electrically isolated from the circuit that powers the coil.

In a device using a relay where the relay contacts are brought out to a terminal block or other
termination, the contacts can be used to switch any type of DC or AC load that is within the
voltage and current ratings of the contacts. This is usually marked on the relay.

A relay does not provide power for a load, it just switches power from a power source, on
and off, similar to how a wall switch turns a lamp on and off but does not itself provide the
power that lights the lamp. Relays are made in many configurations, sizes and shapes, coil
voltage and current, contact voltage and current. They are available as:

Single Pole Single Throw SPST either Normally Open or Normally Closed
Single Pole Double Throw SPDT as above
Double Pole Single Throw DPST either Normally Open or Normally Closed
Double Pole Double Throw DPD

POT
Potentiometer

Page 64 of 109
Potentiometer is a small sized electronic component whose resistance can be adjusted
manually. Increasing or decreasing the value of resistance controls the amount of current flowing
in a circuit. The potentiometer is used in various electronics, for example: is used as volume
knob in music systems, as fan regulators etc. Potentiometer has two strips made on it resistive
and conductive. Resistive strip is made of carbon and is responsible for potentiometer’s
resistance variance feature. Conductive strip helps the potentiometer to carry the current into the
circuit in accordance with the resistance. To understand the theory of our humble potentiometers
(or pots), let us know the parts of the potentiometer:
· Lugs: Potentiometers by convention have three lugs

Resistive Strip: This is the heart of the potentiometer. It is a carbon strip that is printed on a
phenolic strip. There are metal contacts in the end to connect it to the lugs.
· Metal Wiper: When we rotate the shaft, it in turn rotates a metallic wiper which connects the
lug 1 and lug2.

Page 65 of 109
Working of Potentiometers

The metallic wiper acts as a conducting path between the lug 1 and lug 2. So the resistance
between the left lug and the centre lug is the resistance of the part of carbon strip over which the
metallic wiper has traversed. When we rotate the shaft of the potentiometer, we actually rotate
the metallic wiper attached to it and hence change the resistance. This way the pot acts as a
variable resistance

Taper
The relation between the position of wiper and the resistance is called the taper of the
potentiometer. In other words taper decides how the resistance will vary when we turn the pot.
Taper divides potentiometers broadly into two types:
· Linear Pots: In these pots, the resistance between lug 1 and lug 2 is directly proportional to
the distance moved by the wiper. These are the common pots found in labs and are inexpensive.
· Logarithmic Pots: In these pots, the resistance between lug1 and lug 2 is a logarithmic
function of the wiper position. Actually their taper graph looks more like a 10x graph. They are
expensive and not readily available. Also there are reverse logarithmic pots which are similar to
Page 66 of 109
logarithmic pots, which have a taper opposite to that of log pots. More about logarithmic pots in
the next section.

How to check the taper with an ohm meter? Set the pot to the centre position (50% rotation)
and measure the resistance between the centre pin and each of the outer pins. If the resistance is
equal (50% of the pots value) the pot is linear. If the values are not equal, the pot is an log taper.

Logarithmic Pots
These pots are extensively used in audio electronics and hence are also called audio pots. The
reason for their wide use in audio electronics especially in volume control owes to the perception
of loudness by human ears. If two sources produce sound, then the human ear will perceive one
source twice as loud as the other only if the intensity of sound of one source is ten times the
other. So by using audio pots we are able to achieve perceivable change in loudness by slight
turning of the pot. If a linear pot is used instead, we will notice that loudness changes only when
the pot is turned to its full extent.
Page 67 of 109
How logarithmic tapering is achieved? Well to answer this, we need to go back to the heart of
the potentiometer, the resistive strip. One way to achieve log taper is to change the width of the
cross section of the resistive strip. For cheaper log pots, the cross section width remains same
but two or three resistive materials of different resistivity are used to approximate a log taper.

How to make a linear pot behave like a logarithmic pot? Log pots are expensive and tough to
find. One idea is to make a circuit whose transfer function is not exactly but similar to
logarithmic function. One such circuit is as follows:

Let the total resistance of the pot be R, R1 be the resistance between lug 3 and lug 1 and R2 be
the resistance between lug 1 and lug 2. R3 is a resistance put in parallel to R2. We define
x=R2/R (the fraction of resitance swept by the wiper) and y=R3/R.
The relation between input voltage Vin and output voltage across R3 come out to be

Below is the graph of Vin/Vout when y=4 and x is varied between 0 to 1 which looks similar to a
log graph (isn’t it?)

Page 68 of 109
The only catch here is that using the above circuit in place of a log pot will reduce the input
resistance that the source voltage will see. So some amount of experimentation should be done to
choose the value of y. Similarly, reverse log pots can be emulated using linear pot by simply
putting R3 resistance across R1 and taking the output voltage across R2.

Ways to Connect Pot


· Trimmer resistance: Connecting pot as shown in the figure way makes it behave like a
variable resistance. When you turn the shaft you are basically reducing the resistance.

Page 69 of 109
It is advisable to short lug 1 and lug 2 because if the wiper shorts then there is resistance which
will prevent the full signal to pass to Vout.
· Voltage Divider: This is generally used to control the amount of input signal passing to the
output.

TRIMMING POTENTIOMETERS
These are also potentiometers but are “set and forget” devices which are directly mounted on to
PCB or bread board to fine tune the circuit. For example, you want to bias a transistor to an exact
potential which in turn relies on resistance, you can use a trim pot to get the exact voltage (by
changing the resistance) and then forget about it. One might have to use a screwdriver to change
the resistance which might not be very convenient but this way it is difficult to change the
resistance once you have set it to the desired resistance.

Page 70 of 109
This is a very basic instrument used for comparing emf two cells and for calibrating ammeter,
voltmeter and watt-meter. The basic working principle of potentiometer is very very simple.
Suppose we have connected two battery in head to head and tale to tale through a galvanometer.
That means the positive terminals of both battery are connected together and negative terminals
are also connected together through a galvanometer as shown in the figure below.

Here in the figure it is clear that if the voltage of both battery cells is exactly equal, there
will be no circulating current in the circuit and hence the galvanometer shows null deflection.
The working principle of potentiometer depends upon this phenomenon.

Now let's think about another circuit, where a battery is connected across a resistor via a
switch and a rheostat as shown in the figure below, there will be a voltage drop across the
resistor. As there is a voltage drop across the resistor, this portion of the circuit can be considered
as a voltage source for other external circuits. That means anything connected across the resistor
will get voltage. If the resistor has uniform cross section throughout its length, the electrical
resistance per unit length of the resistor is also uniform throughout its length. Hence, voltage
drop per unit length of the resistor is also uniform. Suppose the current through the resistor is i A
and resistance per unit length of the resistor is r Ω. Then the voltage appears per unit length
across the resistor would be 'ir' ans say it is v volt.
Now, positive terminal of a standard cell is connected to point A on the sliding resistor
and negative terminal of the same is connected with a galvanometer. Other end of the
galvanometer is in contact with the resistor via a sliding contact as shown in the figure above. By
Page 71 of 109
adjusting this sliding end, a point like B is found where, there is no current through the
galvanometer, hence no deflection of galvanometer. That means emf of the standard cell is just
balanced by the voltage drop appears across AB. Now if the distance between point A and B is
L, then it can be written emf of standard cell E = Lv volt. As v (voltage drop per unit length of
the sliding resistor) is known and L is measured from the scale attached to the resistor, the value
of E i.e. emf of standard cell can also be calculated from the above simple equation very easily.

We said earlier in this section that one of the uses of potentiometer is to compare emfs of
different cells. Let's discuss how a dc potentiometer can compare emfs of two different cells.
Let's think of two cells whose emf's are to be compared are joined as shown in the figure below.
The positive terminals of the cells and source battery are joined together. The negative terminals
of the cells are joined with the galvanometer in turn through a two way switch. The other end of
the galvanometer is connected to a sliding contact on the resistor. Now by adjusting sliding
contact on the resistor, it is found that the null deflection of galvanometer comes for first cell at a
length of L on the scale and after positioning to way switch to second cell and then by adjusting

Page 72 of 109
the sliding contact, it is found that the null deflection of galvanometer comes for that cell at a
length of L1 on the scale.

Let's think of the first cell as standard cell and it'semf is E and second cell is unknown cell whose
emf is E1. Now as per above explanation,

E=Lv volt

And

L1=L1vvolt

Dividing one equation by other, we get

As the emf of the standard cell is known, hence emf of the unknown cell can easily be
determined.

Page 73 of 109
CURRENT TRANSFORMER

Current transformer

In electrical engineering, a current transformer (CT) is used for measurement of electric currents.
Current transformers, together with voltage transformers (VT) (potential transformers (PT)), are

Page 74 of 109
known as instrument transformers. When current in a circuit is too high to directly apply to
measuring instruments, a current transformer produces a reduced current accurately proportional
to the current in the circuit, which can be conveniently connected to measuring and recording
instruments. A current transformer also isolates the measuring instruments from what may be
very high voltage in the monitored circuit. Current transformers are commonly used in metering
and protective relays in the electrical power industry.

Specifications

1. Input Current: 0-30A AC


2. Output Signal: DC 0-1 V
3. Non-linearity: 2-3 %
4. Build-in sampling resistance (RL): 62 Ω
5. Turn Ratio: 1800:1
6. Resistance Grade: Grade B
7. Work Temperature: -25 °C~+70 °C
8. Dielectric Strength (between shell and output): 1000 V AC / 1 min 5 mA

ZMPT101B AC Single Phase Voltage Sensor

The ZMPT101B AC Single Phase voltage sensor module is based on a high precision
ZMPT101B voltage Transformer used to measure the accurate AC voltage with a voltage
transformer. This is an ideal choice to measure the AC voltage using Arduino or ESP32.

Page 75 of 109
The Modules can measure voltage within 250V AC voltage & the corresponding analog output
can be adjusted. The module is simple to use and comes with a multi-turn trim
potentiometer for adjusting and calibrating the ADC output.

Specifications

1. Voltage up to 250 volts can be measured


2. Lightweight with on-board micro-precision voltage transformer
3. High precision on-board op-amp circuit
4. Operating temperature : 40ºC ~ + 70ºC
5. Supply voltage 5 volts to 30 volts

LED

LEDs are semiconductor devices. Like transistors, and other diodes, LEDs are made out
of silicon. What makes an LED give off light are the small amounts of chemical impurities that
are added to the silicon, such as gallium, arsenide, indium, and nitride.

When current passes through the LED, it emits photons as a byproduct. Normal light
bulbs produce light by heating a metal filament until it is white hot. LEDs produce photons
directly and not via heat, they are far more efficient than incandescent bulbs.

Fig 4.12(a): Typical LED Fig 4.12(b): circuit symbol


Page 76 of 109
Not long ago LEDs were only bright enough to be used as indicators on dashboards or
electronic equipment. But recent advances have made LEDs bright enough to rival traditional
lighting technologies. Modern LEDs can replace incandescent bulbs in almost any application.

Types of LED’S

LEDs are produced in an array of shapes and sizes. The 5 mm cylindrical package is the most
common, estimated at 80% of world production. The color of the plastic lens is often the same as the
actual color of light emitted, but not always. For instance, purple plastic is often used for infrared
LEDs, and most blue devices have clear housings. There are also LEDs in extremely tiny packages,
such as those found on blinkers and on cell phone keypads. The main types of LEDs are miniature,
high power devices and custom designs such as alphanumeric or multi-color.

Different types of LED’S

Colors and materials of LED’S

Conventional LED’S are made from a variety of inorganic semiconductor materials, the
following table shows the available colours with wavelength range, voltage drop and material.

Page 77 of 109
White LED’S

Light Emitting Diodes (LED) have recently become available that are white and bright,
so bright that they seriously compete with incandescent lamps in lighting applications. They are
still pretty expensive as compared to a GOW lamp but draw much less current and project a
fairly well focused beam.

The diode in the photo came with a neat little reflector that tends to sharpen the beam a
little but doesn't seem to add much to the overall intensity.

When run within their ratings, they are more reliable than lamps as well. Red LEDs are
now being used in automotive and truck tail lights and in red traffic signal lights. You will be
able to detect them because they look like an array of point sources and they go on and off
instantly as compared to conventional incandescent lamps.

LEDs are monochromatic (one color) devices. The color is determined by the band gap of
the semiconductor used to make them. Red, green, yellow and blue LEDs are fairly common.
White light contains all colors and cannot be directly created by a single LED. The most
Page 78 of 109
common form of "white" LED really isn't white. It is a Gallium Nitride blue LED coated with a
phosphor that, when excited by the blue LED light, emits a broad range spectrum that in addition
to the blue emission, makes a fairly white light.

There is a claim that these white LED's have a limited life. After 1000 hours or so of
operation, they tend to yellow and dim to some extent. Running the LEDs at more than their
rated current will certainly accelerate this process.

There are two primary ways of producing high intensity white-light using LED’S. One is
to use individual LED’S that emit three primary colours—red, green, and blue—and then mix all
the colours to form white light. The other is to use a phosphor material to convert
monochromatic light from a blue or UV LED to broad-spectrum white light, much in the same
way a fluorescent light bulb works. Due to metamerism, it is possible to have quite different
spectra that appear white.

1N4007
Diodes are used to convert AC into DC these are used as half wave rectifier or full wave
rectifier. Three points must he kept in mind while using any type of diode.
1. Maximum forward current capacity
2. Maximum reverse voltage capacity
3. Maximum forward voltage capacity

Page 79 of 109
The number and voltage capacity of some of the important diodes available in the market are as
follows:
• Diodes of number IN4001, IN4002, IN4003, IN4004, IN4005, IN4006 and IN4007 have
maximum reverse bias voltage capacity of 50V and maximum forward current capacity
of 1 Amp.
• Diode of same capacities can be used in place of one another. Besides this diode of more
capacity can be used in place of diode of low capacity but diode of low capacity cannot
be used in place of diode of high capacity. For example, in place of IN4002; IN4001 or
IN4007 can be used but IN4001 or IN4002 cannot be used in place of IN4007.The diode
BY125made by company BEL is equivalent of diode from IN4001 to IN4003. BY 126 is
equivalent to diodes IN4004 to 4006 and BY 127 is equivalent to diode IN4007.

PN JUNCTION OPERATION
Now that you are familiar with P- and N-type materials, how these materials are joined
together toform a diode, and the function of the diode, let us continue our discussion with the
operation of the PNjunction. But before we can understand how the PN junction works, we must
first consider current flow inthe materials that make up the junction and what happens initially
within the junction when these twomaterials are joined together.

Current Flow in the N-Type Material


Conduction in the N-type semiconductor, or crystal, is similar to conduction in a copper
wire. Thatis, with voltage applied across the material, electrons will move through the crystal
just as current wouldflow in a copper wire. This is shown in figure 1-15. The positive potential
of the battery will attract thefree electrons in the crystal. These electrons will leave the crystal
and flow into the positive terminal ofthe battery. As an electron leaves the crystal, an electron
from the negative terminal of the battery willenter the crystal, thus completing the current path.
Therefore, the majority current carriers in the N-typematerial (electrons) are repelled by the
negative side of the battery and move through the crystal towardthe positive side of the battery.

Page 80 of 109
Current Flow in the P-Type Material
Current flow through the P-type material is illustrated. Conduction in the P material isby
positive holes, instead of negative electrons. A hole moves from the positive terminal of the P
materialto the negative terminal. Electrons from the external circuit enter the negative terminal of
the material andfill holes in the vicinity of this terminal. At the positive terminal, electrons are
removed from the covalentbonds, thus creating new holes. This process continues as the steady
stream of holes (hole current) movestoward the negative terminal.

Specifications
• VRRM = 100V (Maximum Repetitive Reverse Voltage)
• IO = 200mA (Average Rectified Forward Current)
• IF = 300mA (DC Forward Current)
• IFSM = 1.0 A (Pulse Width = 1 sec), 4.0 A (Pulse Width = 1 uSec) (Non-Repetitive Peak
Forward Surge Current)
• PD = 500 mW (power Dissipation)
• TRR< 4ns (reverse recovery time)

Applications
• High- speed switching

Features
• Glass seale developer.(GSD)
• Highspeed.
Page 81 of 109
• High Reliability
Construction
• Silicone pitaxia planar

RESISTORS

A resistor is a two-terminal electronic component designed to oppose an electric current by


producing a voltage drop between its terminals in proportion to the current, that is, in accordance
with Ohm's law:
V = IR
Resistors are used as part of electrical networks and electronic circuits. They are extremely
commonplace in most electronic equipment. Practical resistors can be made of various
compounds and films, as well as resistance wire (wire made of a high-resistivity alloy, such as
nickel/chrome).
The primary characteristics of resistors are their resistance and the power they can
dissipate. Other characteristics include temperature coefficient, noise, and inductance. Less well-
known is critical resistance, the value below which power dissipation limits the maximum
permitted current flow, and above which the limit is applied voltage. Critical resistance depends
upon the materials constituting the resistor as well as its physical dimensions; it's determined by
design.
Resistors can be integrated into hybrid and printed circuits, as well as integrated
circuits. Size, and position of leads (or terminals) are relevant to equipment designers; resistors
must be physically large enough not to overheat when dissipating their power.

Page 82 of 109
A resistor is a two-terminalpassiveelectronic component which implements electrical
resistance as a circuit element. When a voltage V is applied across the terminals of a resistor, a
current I will flow through the resistor in direct proportion to that voltage. The reciprocal of the
constant of proportionality is known as the resistance R, since, with a given voltage V, a larger
value of R further "resists" the flow of current I as given by Ohm's law:

Resistors are common elements of electrical networks and electronic circuits and are
ubiquitous in most electronic equipment. Practical resistors can be made of various compounds
and films, as well as resistance wire (wire made of a high-resistivity alloy, such as nickel-
chrome). Resistors are also implemented within integrated circuits, particularly analog devices,
and can also be integrated into hybrid and printed circuits.
The electrical functionality of a resistor is specified by its resistance: common
commercial resistors are manufactured over a range of more than 9 orders of magnitude. When
specifying that resistance in an electronic design, the required precision of the resistance may
require attention to the manufacturing tolerance of the chosen resistor, according to its specific
application. The temperature coefficient of the resistance may also be of concern in some
precision applications. Practical resistors are also specified as having a maximum power rating
which must exceed the anticipated power dissipation of that resistor in a particular circuit: this is
mainly of concern in power electronics applications. Resistors with higher power ratings are

Page 83 of 109
physically larger and may require heat sinking. In a high voltage circuit, attention must
sometimes be paid to the rated maximum working voltage of the resistor.
The series inductance of a practical resistor causes its behavior to depart from ohms law;
this specification can be important in some high-frequency applications for smaller values of
resistance. In a low-noise amplifier or pre-amp the noise characteristics of a resistor may be an
issue. The unwanted inductance, excess noise, and temperature coefficient are mainly dependent
on the technology used in manufacturing the resistor. They are not normally specified
individually for a particular family of resistors manufactured using a particular technology. A
family of discrete resistors is also characterized according to its form factor, that is, the size of
the device and position of its leads (or terminals) which is relevant in the practical manufacturing
of circuits using them.

Units
The ohm (symbol: Ω) is the SI unit of electrical resistance, named after Georg Simon
Ohm. An ohm is equivalent to a volt per ampere. Since resistors are specified and manufactured
over a very large range of values, the derived units of milliohm (1 mΩ = 10−3 Ω), kilohm (1 kΩ =
103 Ω), and megohm (1 MΩ = 106 Ω) are also in common usage.
The reciprocal of resistance R is called conductance G = 1/R and is measured in Siemens
(SI unit), sometimes referred to as a mho. Thus a Siemens is the reciprocal of an ohm: S = Ω − 1.
Although the concept of conductance is often used in circuit analysis, practical resistors are
always specified in terms of their resistance (ohms) rather than conductance.

Variable resistors
Adjustable resistors
A resistor may have one or more fixed tapping points so that the resistance can be
changed by moving the connecting wires to different terminals. Some wirewound power resistors
have a tapping point that can slide along the resistance element, allowing a larger or smaller part
of the resistance to be used.
Where continuous adjustment of the resistance value during operation of equipment is
required, the sliding resistance tap can be connected to a knob accessible to an operator. Such a
device is called a rheostat and has two terminals.
Page 84 of 109
CAPACITORS

A capacitor or condenser is a passive electronic component consisting of a pair of


conductors separated by a dielectric. When a voltage potential difference exists between the
conductors, an electric field is present in the dielectric. This field stores energy and produces a
mechanical force between the plates. The effect is greatest between wide, flat, parallel, narrowly
separated conductors.
An ideal capacitor is characterized by a single constant value, capacitance, which is
measured in farads. This is the ratio of the electric charge on each conductor to the potential
difference between them. In practice, the dielectric between the plates passes a small amount of
leakage current. The conductors and leads introduce an equivalent series resistance and the
dielectric has an electric field strength limit resulting in a breakdown voltage.
The properties of capacitors in a circuit may determine the resonant frequency and
quality factor of a resonant circuit, power dissipation and operating frequency in a digital logic
circuit, energy capacity in a high-power system, and many other important aspects.

Page 85 of 109
A capacitor (formerly known as condenser) is a device for storing electric charge. The
forms of practical capacitors vary widely, but all contain at least two conductors separated by a
non-conductor. Capacitors used as parts of electrical systems, for example, consist of metal foils
separated by a layer of insulating film.
Capacitors are widely used in electronic circuits for blocking direct current while
allowing alternating current to pass, in filter networks, for smoothing the output of power
supplies, in the resonant circuits that tune radios to particular frequencies and for many other
purposes.
A capacitor is a passiveelectronic component consisting of a pair of conductors separated
by a dielectric (insulator). When there is a potential difference (voltage) across the conductors, a
static electric field develops in the dielectric that stores energy and produces a mechanical force
between the conductors. An ideal capacitor is characterized by a single constant value,
capacitance, measured in farads. This is the ratio of the electric charge on each conductor to the
potential difference between them.
The capacitance is greatest when there is a narrow separation between large areas of
conductor, hence capacitor conductors are often called "plates", referring to an early means of
construction. In practice the dielectric between the plates passes a small amount of leakage
current and also has an electric field strength limit, resulting in a breakdown voltage, while the
conductors and leads introduce an undesired inductance and resistance.

Theory of operation
Capacitance

Page 86 of 109
Charge separation in a parallel-plate capacitor causes an internal electric field. A dielectric
(orange) reduces the field and increases the capacitance.

A simple demonstration of a parallel-plate capacitor


A capacitor consists of two conductors separated by a non-conductive region. The non-
conductive region is called the dielectric or sometimes the dielectric medium. In simpler terms,
the dielectric is just an electrical insulator. Examples of dielectric mediums are glass, air, paper,
vacuum, and even a semiconductordepletion region chemically identical to the conductors. A
capacitor is assumed to be self-contained and isolated, with no net electric charge and no
influence from any external electric field. The conductors thus hold equal and opposite charges
on their facing surfaces, and the dielectric develops an electric field. In SI units, a capacitance of
one farad means that one coulomb of charge on each conductor causes a voltage of one volt
across the device.
The capacitor is a reasonably general model for electric fields within electric circuits. An ideal
capacitor is wholly characterized by a constant capacitance C, defined as the ratio of charge ±Q
on each conductor to the voltage V between them:

Sometimes charge build-up affects the capacitor mechanically, causing its capacitance to vary. In
this case, capacitance is defined in terms of incremental changes:

Energy storage
Work must be done by an external influence to "move" charge between the conductors in a
capacitor. When the external influence is removed the charge separation persists in the electric
Page 87 of 109
field and energy is stored to be released when the charge is allowed to return to its equilibrium
position. The work done in establishing the electric field, and hence the amount of energy stored,
is given by:

Current-voltage relation
The current i(t) through any component in an electric circuit is defined as the rate of flow of a
charge q(t) passing through it, but actual charges, electrons, cannot pass through the dielectric
layer of a capacitor, rather an electron accumulates on the negative plate for each one that leaves
the positive plate, resulting in an electron depletion and consequent positive charge on one
electrode that is equal and opposite to the accumulated negative charge on the other. Thus the
charge on the electrodes is equal to the integral of the current as well as proportional to the
voltage as discussed above. As with any antiderivative, a constant of integration is added to
represent the initial voltage v (t0). This is the integral form of the capacitor equation,

.
Taking the derivative of this, and multiplying by C, yields the derivative form,

.
The dual of the capacitor is the inductor, which stores energy in the magnetic field rather than the
electric field. Its current-voltage relation is obtained by exchanging current and voltage in the
capacitor equations and replacing C with the inductance L.

Page 88 of 109
HARDWARE TESTING

CONTINUITY TEST
In electronics, a continuity test is the checking of an electric circuit to see if current flows
(that it is in fact a complete circuit). A continuity test is performed by placing a small voltage
(wired in series with an LED or noise-producing component such as a piezoelectric speaker)
across the chosen path. If electron flow is inhibited by broken conductors, damaged components,
or excessive resistance, the circuit is "open".
Devices that can be used to perform continuity tests include multi meters which measure
current and specialized continuity testers which are cheaper, more basic devices, generally with a
simple light bulb that lights up when current flows.
An important application is the continuity test of a bundle of wires so as to find the two ends
belonging to a particular one of these wires; there will be a negligible resistance between the
"right" ends, and only between the "right" ends.
This test is the performed just after the hardware soldering and configuration has been
completed. This test aims at finding any electrical open paths in the circuit after the soldering.
Many a times, the electrical continuity in the circuit is lost due to improper soldering, wrong and
rough handling of the PCB, improper usage of the soldering iron, component failures and
presence of bugs in the circuit diagram. We use a multi meter to perform this test. We keep the
multi meter in buzzer mode and connect the ground terminal of the multi meter to the ground.
We connect both the terminals across the path that needs to be checked. If there is continuation
then you will hear the beep sound.

POWER ON TEST
This test is performed to check whether the voltage at different terminals is according to
the requirement or not. We take a multi meter and put it in voltage mode. Remember that this test
is performed without microcontroller. Firstly, we check the output of the transformer, whether
we get the required 12 v AC voltage.

Page 89 of 109
Then we apply this voltage to the power supply circuit. Note that we do this test without
microcontroller because if there is any excessive voltage, this may lead to damaging the
controller. We check for the input to the voltage regulator i.e., are we getting an input of 12v and
an output of 5v. This 5v output is given to the microcontrollers’ 40th pin. Hence we check for the
voltage level at 40th pin. Similarly, we check for the other terminals for the required voltage. In
this way we can assure that the voltage at all the terminals is as per the requirement

Page 90 of 109
CHAPTER 5

Our Work

Page 91 of 109
Page 92 of 109
Development Programming Mobile
of Smart of ESP 32 Application
Meter Processor Development

Integration With Working Of Data


Meter with Transmission
Mobile APP Protocols

Page 93 of 109
Development of Smart Meter Using ESP 32 Processor:

Current Sensor (ACS712)

Voltage Sensor (ZMPT101B)

We can connect both analog to digital sensor to ADC Pin Analog Pins (ADC)

• GPIO 34, GPIO 35, GPIO 36 (VP), GPIO 39 (VN): These pins can be used as analog
input pins for analog-to-digital conversion (ADC).

• GPIO 25, GPIO 26, GPIO 32, GPIO 33: These can also serve as ADC input pins.

Accordingly we can connect RTC ,LCD and other accessories to make a meter Prototype.

Sample Code for RTC & ESP Module

#include <Wire.h>

#include <RTClib.h>

Page 94 of 109
RTC_DS3231 rtc;

void setup() {

Serial.begin(115200);

if (!rtc.begin()) {

Serial.println("Couldn't find RTC");

while (1);

if (rtc.lostPower()) {

Serial.println("RTC lost power, setting the time!");

// Set the RTC to the date & time this sketch was compiled

rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

// Or set it to a specific date & time (YYYY, MM, DD, HH, MM, SS)

// rtc.adjust(DateTime(2025, 1, 5, 12, 0, 0));

void loop() {

DateTime now = rtc.now();

Serial.print("Current time: ");

Serial.print(now.year(), DEC);

Serial.print('/');

Serial.print(now.month(), DEC);

Serial.print('/');

Page 95 of 109
Serial.print(now.day(), DEC);

Serial.print(" ");

Serial.print(now.hour(), DEC);

Serial.print(':');

Serial.print(now.minute(), DEC);

Serial.print(':');

Serial.print(now.second(), DEC);

Serial.println();

delay(1000);

Programming of ESP 32 Processor:

Steps to Program ESP32 with PlatformIO

Step 1: Install VSCode and PlatformIO

1. Download and install Visual Studio Code from here.

2. Open VSCode and install the PlatformIO IDE extension:

o Go to the Extensions Marketplace (Ctrl+Shift+X).

o Search for "PlatformIO IDE" and click "Install."

Step 2: Create a New ESP32 Project

1. Open PlatformIO in VSCode:

o Click the PlatformIO Home icon (alien icon) on the left sidebar.

o Select New Project.

2. Configure the project:

o Name: Give your project a name.

Page 96 of 109
o Board: Select your ESP32 board (e.g., "Espressif ESP32 Dev Module").

o Framework: Choose "Arduino" or "ESP-IDF" (depending on your preferred


framework).

o Location: Select a folder to save your project.

3. Click Finish to create the project. PlatformIO will download required packages.

Mobile Application Development

To create an app using MIT App Inventor, you can follow these basic steps. MIT App Inventor is
a free, web-based application that allows you to build Android apps without any coding
experience. Here's a step-by-step guide to get you started:

1. Sign Up / Log In to MIT App Inventor

• Go to MIT App Inventor.


• Click on "Create Apps!".
• Log in using your Google account or create one if you don't have one.

2. Start a New Project

• After logging in, click on "Create New Project".


• Name your project (e.g., "MyFirstApp").
• You will be directed to the project’s interface.

3. Design the User Interface

• You will see two main panels:


o Viewer (on the right side): This is where you can see a live preview of your app’s
UI.
o Palette (on the left side): This contains components you can drag and drop into
the Viewer.
• Start by dragging and dropping components from the Palette to the Viewer:
o Buttons (for user interaction)
o Text Boxes (for input)

Page 97 of 109
o Labels (for displaying text)
o Images (to add pictures)
o Sliders, Checkboxes, etc.
• Arrange the components visually in the Viewer to design your app’s interface.

4. Set Properties of Components

• After adding components, you can set their properties.


• Select a component from the Viewer, and in the Properties panel (on the right), you can
adjust its properties such as color, text, size, and alignment.

5. Add Functionality with Blocks

• Once you’ve designed your UI, you’ll need to add functionality using the Blocks Editor.
• Click on the Blocks button in the top-right corner of the screen.
• In the Blocks Editor, you can use a visual programming language to define the behavior
of your app:
o Event Handlers (such as Button clicks, screen touches, etc.)
o Variables (to store data)
o Logic (such as conditions and loops)
o Sensors (such as accelerometer, GPS, etc.)
• Example: To make a button show a message when clicked, you’d use the Button.Click
block, and attach a Notifier.ShowMessageDialog block.

6. Connect Your Phone or Emulator

• You can test your app in real-time by connecting your Android phone or using an
emulator.
• Option 1: Connect via USB:
o Install the MIT AI2 Companion app from the Google Play Store.
o On MIT App Inventor, click the Connect button and select AI Companion.
o Scan the QR code shown on the screen with the MIT AI2 Companion app.
• Option 2: Use the Emulator:

Page 98 of 109
o Click on Connect and select Emulator.
o The emulator will open, and you can test your app in a virtual Android
environment.

7. Test and Debug Your App

• As you build your app, test it often to see if it works as expected.


• If something isn’t working, check for errors in the Blocks Editor and correct them.
• Use the Log (in the Designer mode) to see debugging information.

8. Package and Export Your App

• Once you’re satisfied with your app, you can package it as an APK file (Android app
file).
• Go to the Build menu in MIT App Inventor and select "App (provide QR code for
.apk)" or "Save .apk to my computer".
• If you choose the QR code, scan it with your phone to install the app.

9. Publish Your App (Optional)

• If you want to share your app with others, you can upload it to the Google Play Store.
• To do this, you’ll need to create a developer account on the Google Play Store, pay the
registration fee, and submit your app.

Working Of Data Transmission Protocols

MQTT
MQTT (Message Queuing Telemetry Transport) is a lightweight open messaging protocol that
was developed for constrained environments such as M2M (Machine to Machine) and IoT
(Internet of Things), where a small code footprint is required. MQTT is based on the Pub/Sub
messaging principle of publishing messages and subscribing to topics. The protocol efficiently
packs messages to minimize overhead. The MQTT specification recommends TLS as a transport
option to secure the protocol using port 8883 (secure-mqtt), as the MQTT protocol does not

Page 99 of 109
provide security on its own. Constrained devices can benefit from using TLS session resumption
to reduce the reconnection cost.
The wolfMQTT library is a client implementation of the MQTT written in C for embedded use.
It supports SSL/TLS via the wolfSSL library. From this, it can provide the security that the
MQTT protocol lacks. wolfMQTT was built from the ground up to be multi-platform, space
conscious and extensible. It supports all Packet Types, all Quality of Service (QoS) levels 0-2
and supports SSL/TLS using the wolfSSL library. This implementation provides support for
MQTT v5.0 and MQTT v3.1.1. Additionally, there is also client support for MQTT-SN (Sensor
Network).

An MQTT broker is a central hub that enables communication between devices using the
MQTT protocol. It acts as an intermediary, receiving messages from publishers and routing them
to subscribers based on their topic subscriptions1. This makes it a crucial component in IoT
(Internet of Things) ecosystems and other distributed applications
What Is an MQTT Broker?

MQTT is a lightweight protocol that supports the Internet of Things (IoT).

An MQTT broker is an intermediary entity that enables MQTT clients to communicate.


Functioning as a central hub, an MQTT broker efficiently handles the flow of messages between
devices and applications. Specifically, an MQTT broker receives messages published by clients,
filters the messages by topic, and distributes them to subscribers.

Using MQTT brokers to enable the publish/subscribe (pub/sub) communication model helps
make MQTT a highly efficient and scalable protocol.

This broker-mediated communication enables a lightweight, scalable, and reliable mechanism for
devices to share information in a networked environment, playing a crucial role in the
establishment of efficient and responsive IoT ecosystems and other distributed applications.

Integration With Meter with Mobile APP

General Steps to Send a File from ESP32 to Android App

Page 100 of 109


1. Set Up the ESP32 as a Server or Client:
o Wi-Fi Access Point (AP): The ESP32 creates a hotspot, and
the Android app connects to it.
o Wi-Fi Station (STA): The ESP32 connects to an existing Wi-
Fi network that the Android device is also connected to.
2. Establish Communication Protocol:
o Use HTTP, FTP, WebSocket, or a custom TCP/UDP protocol.
3. Transfer the File:
o The ESP32 serves or sends the file (e.g., text, image, or
binary) using the selected protocol.
4. Android App Receives the File:
o The Android app fetches or listens for the file and saves it
locally.

Page 101 of 109


CHAPTER 6
ADAVNTAGES

APPLICATION

Page 102 of 109


6.1 ADVANTAGES
Real Time Energy Consumption Insights

Achieve dramatic reduction and regularity in energy consumption and minimize environmental
impact with real-time insights. Read all electrical parameters for 3Phase AC / 1 Phase AC / DC
Metering/Diesel Generator systems.

Smart Energy Monitoring

Innomaint’s Smart Energy Solutions enables you to collect data from smart meters and display it
in near real-time on dynamic dashboards for facility owners or tenants to know the patterns in
energy consumption and associated parameters. Access the personalized energy dashboard in a
low-bandwidth consumption for initiating actions on regulating consumption. No shocking
electric bills anymore!

⚫ Reduction in energy spending

⚫ Avoid unnecessary penalty

⚫ Minimized carbon footprints

• High Accuracy over a wide current dynamic range.

• Reliability

• Automatic Meter Reading (AMR)

• More easily enables new facilities

• Tamper Proofing

• Power out range detection

• Power Factor Detection

• Easily Reconfiguration, Upgrade

Page 103 of 109


• Do not use gears that wear out or magnets that saturate with DC current

• Do not require precision mechanics or have large tolerance variations over temperature

6.2 APPLICATION

• By using this interfacing of prepaid energy meter with GSM system we can manage our
loads through mobile phone, by checking the load status.
• By using this system we can easily reduce the billing of our homes.
• Home Appliances
• Electricity Board
• Industries and Factories
• Commercial use

Page 104 of 109


CHAPTER 7

CONCLUSION

FUTURE SCOPE

Page 105 of 109


7.1 CONCLUSION

Power consumption monitoring using smart meter system includes ESP 32 , RELAY , sensors.
The system automatically reads the energy meter and provides home automation through an app
developed and power management done through this application. The proposed system
consumes less energy and it will reduce manual work. We can receive monthly energy
consumption from a remote location directly to centralize office. In this way we reduce human
effort needed to record the meter reading which are till now recorded by visiting the home
individually. In the present work wireless meter reading system is designed to continuously
monitor the meter reading and it avoids the human intervention, provides efficient meter reading,
avoid the billing error and reduce the maintenance cost, to reduce issues like unpaid bills, billing
irregularities, inaccurate meter readings and illicit payment from customer because of bribed
service man. This system can be a powerful tool for having efficient use of electricity. From all
the proposed methodology it can be concluded that this advanced energy metering system can be
really proved as a benefit for the consumers and electricity board

7.2 FUTURE SCOPE

The proposed hardware method can be improvised using RTOS (Real Time Operating System)
which runs the energy meter functions and commands in real time clock which ultimately
reduces the error present in the billing process. Other features like online monitoring systems
can be implemented in this system in order to make active participation of the consumers in
the grid system.

Page 106 of 109


CHAPTER 8

REFERANCES

Page 107 of 109


8.1 REFERANCES

[1] Anitha.k ,prathik, “Smart Energy Meter surveillance Using IoT” ,Institute of Electrical and
Electronics Engineers(IEEE), 2019.

[2] Devadhanishini, et.al” “Smart Power Monitoring Using IoT”5th International Conference on
Advanced Computing & Communication Systems (ICACCS) 2019.

[3] Mohammad Hossein Yaghmaee Design and Implementation of an Internet of Things Based
Smart Energy Metering” 6th IEEE International Conference on Smart Energy Grid Engineering
2018.

[4] Himanshu kpatel “arduino based smart energy meter” 2nd Int'l Conf. on Electrical
Engineering and Information &Communication Technology (ICEEICT) 2018.

[5] “Bibek Kanti Barman, et.al” proposed paper “smart meter using IoT” department of
international electronics and electrical engineering (IEEE) 2017.

[6] Garrab.A, Bouallegue.A, Ben Abdullah, A new AMR approach for energy savings in Smart
Grids using Smart meter and partial power line communication”, IEEE First International
Conference on ICICS,vol 3, pp. March 2012.

[7] Landi,c.: Dipt. Di Ing.dell”Inf, SecondaUniv di Napoli,Aversa,Italy; Merola p.”ARM-based


energy management system using smart meter and Web server”,IEEE instrumentation and
measurement technology conference binjing, pp.1-5 may 2011.

[8] B. S. Koay, S. S. Cheah, Y. H. Sng, P. H. Chong, P. Shum, Y. C. Tong, X. Y. Wang, Y. X.


Zuo and H. W. Kuek, "Design and implementation of Bluetooth energy meter", IEEE
Proceedings of the 4th International Joint Conference of the ICICS, vol. 3, pp. 1474-1477,
Dec,2003.

[9] N. Fathima, A. Ahammed, R. Banu, B.D. Parameshachari, and N.M. Naik, “Optimized
neighbor discovery in Internet of Things (IoT),” In Proc. of International Conference on
Electrical, Electronics, Communication, Computer, and Optimization Techniques (ICEECCOT),
pp. 1-5, 201

Page 108 of 109


Page 109 of 109

You might also like