0% found this document useful (0 votes)
387 views50 pages

Monitoring and Controlling of Single Phase Induction Motor Using Wi-Fi Module

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)
387 views50 pages

Monitoring and Controlling of Single Phase Induction Motor Using Wi-Fi Module

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/ 50

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/334680282

"MONITORING AND CONTROLLING OF SINGLE PHASE INDUCTION MOTOR


USING WI-FI MODULE"

Book · August 2018

CITATIONS READS

0 1,417

4 authors, including:

Sonam Gyaljen Tamang


SRH Hochschule Heidelberg
6 PUBLICATIONS   3 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

work function View project

Embedded System View project

All content following this page was uploaded by Sonam Gyaljen Tamang on 25 July 2019.

The user has requested enhancement of the downloaded file.


TRIBHUVAN UNIVERSITY
INSTITUTE OF ENGINEERING
DEPARTMENT OF ELECTRICAL ENGINEERING
KATHMANDU ENGINEERING COLLEGE

A
FINAL YEAR PROJECT REPORT
ON

“MONITORING AND CONTROLLING OF


SINGLE PHASE INDUCTION MOTOR USING WI-FI
MODULE”
(As a partial fulfillment of the requirement for the Bachelor’s degree in Electrical
Engineering)
(EG777EE)

PROJECT SUPERVISOR
Prof. Dr. Indraman Tamrakar
Er. Nischal Guruwacharya

PROJECT MEMBERS
RABIN LIMBU (071/BEL/026)

SAROJ KUMAR SAH (071/BEL/035)


SONAM GYALJEN TAMANG (071/BEL/039)
SUYOG LAL PRADHAN (071/BEL/042)

August 2018
COPYRIGHT

The copyright of this report is reserved solely on the authors and no part of this publication
may be reproduced, distributed, or transmitted in any form without the prior permission from
the authors or the supervisors involved with this publication. The authors have agreed that
the Library, Department of Electrical Engineering, Kathmandu Engineering College may
make this report freely available for inspection. Moreover, the author has agreed that
permission for extensive copying of this project report for scholarly purpose may be granted
by the supervisors who supervised the project work recorded herein or, in their absence, by
the Head of the Department wherein the project report was done. It is understood that the
recognition will be given to the author of this report and to the Department of Electrical
Engineering, Kathmandu Engineering College in any use of the material of this project
report. Copying or publication or the other use of this report for financial gain without
approval of to the Department of Electrical Engineering, Kathmandu Engineering College
and author’s written permission is prohibited. Request for permission to copy or to make
any other use of the material in this report in whole or in part should be addressed to:

Head of Department
Department of Electrical Engineering
Kathmandu Engineering College
Kathmandu, Nepal

iii
ACKNOWLEDGEMENT

We express our deep sense of gratitude to Department of Electrical Engineering, Kathmandu


Engineering College for accepting our proposal on “Monitoring and Controlling of Single
Phase Induction Motor using Wi-Fi Module” and providing the opportunity to complete the
work undertaken. We would also like to thank Er. Archana Maharjan, Head of Department
for her kind suggestions and guidelines which helped us build confidence and test our
knowledge.

We are very grateful to our supervisors Prof. Dr. Indraman Tamrakar and Er. Nischal
Guruwacharya for their supervision and for their guidance regarding the project which
helped us greatly strive in the right direction.

We are grateful to Er. Bhuban Dhamala for providing guidelines in project and for his
unconditional support and help. Thanks are dues to all the department lecturers and teachers
for their cooperation for the completion of this project.

At last, we’d like to express our deep appreciation to our lecturers and friends, for endless
support and help from the inception of this project till its end, whether directly or indirectly.

Suyog Lal Pradhan


Sonam Gyaljen Tamang
Saroj Kumar Sah
Rabin Limbu

iv
ABSTRACT

Now days, induction motor has remained the most popular type of motor for industrial
applications. The primary advantage of the induction motor is because of its straightforward
rotor construction leading to low cost, ruggedness, and low- maintenance requirements. This
project presents a remote controlling and monitoring system for a single phase induction
motor based on wireless communication with the help of a microcontroller (Arduino Uno)
and a Wi-Fi module (NodeMCU), for safe and economic data communication in industrial
fields. A module of transducers and sensors monitors the parameters like RPM, load current
and voltage of induction motor and the obtained measurements are sent to the
microcontroller, which will analyze and display the parameters, here the processing unit also
communicates with the Wi-Fi module, which acts as a server in order to send information to
the client for remote monitoring. The information sent by the server is available through a
webpage which can be opened either in any phone or computer. The system also presents
the automatic and manual control methods to stop or start the induction machine to avoid
system failures. In addition to the control methods, the system also allows to change the
speed of the induction motor. The control methods is also available in the webpage.

v
TABLE OF CONTENTS

COPYRIGHT ................................................................................................................... iii

ACKNOWLEDGEMENT ................................................................................................ iv

ABSTRACT...................................................................................................................... v

TABLE OF CONTENTS ................................................................................................. vi

LIST OF FIGURES ........................................................................................................ viii

LIST OF TABLES ........................................................................................................... ix

1. INTRODUCTION ......................................................................................................... 1
1.1. Background ......................................................................................................... 1
1.2. Objective............................................................................................................. 2
1.3. Scope of project .................................................................................................. 2
1.4. Methodology ....................................................................................................... 2

2. RELEVANT THEORY ................................................................................................. 3


2.1. Single Phase Induction Motor ................................................................................. 3
2.1.1. Working Principle of Single Phase Induction Motor ......................................... 4
2.1.2. Double-Field Revolving Theory ....................................................................... 4
2.2. Speed Control of Single Phase Induction Motor ...................................................... 5
2.2.1. Unidirectional and Bidirectional Control........................................................... 6
2.2.1.1. Unidirectional Control: .............................................................................. 6
2.2.1.2. Bidirectional Control: ................................................................................ 6
2.2.2. H-Bridge Inverter ............................................................................................. 7
2.2.3. Three-Phase Inverter Bridge: ............................................................................ 8
2.3. Current Measurement .............................................................................................. 9
2.4. Voltage Measurement ........................................................................................... 10
2.5. Power Factor Estimation ....................................................................................... 11
2.6. Speed Measurement .............................................................................................. 12

3. SIMULATION STUDIES ........................................................................................... 14


3.1. Schematics ............................................................................................................ 14

vi
3.2. Proteus Simulation ................................................................................................ 15
3.2.1. Simulation Results .......................................................................................... 16

4. HARDWARE DESIGN AND FABRICATION .......................................................... 17


4.1. Description of Proposed Scheme ........................................................................... 17
4.2. Hardware Components .......................................................................................... 18
4.2.1. Arduino Uno................................................................................................... 18
4.2.2. Induction Motor .............................................................................................. 19
4.2.3. NodeMCU ...................................................................................................... 20
4.2.4. Potential Transformer ..................................................................................... 21
4.2.5. LCD ............................................................................................................... 21
4.2.6. Triac ............................................................................................................... 23
4.2.7. Optocoupler .................................................................................................... 24
4.2.8. Hall Effect Sensor........................................................................................... 25
4.2.9. Infrared Sensor ............................................................................................... 26
4.2.10. Relay ............................................................................................................ 26
4.3. Hardware Circuits ................................................................................................. 27
4.4. Hardware Results .................................................................................................. 28
4.4.1 Output on LCD ................................................................................................ 28
4.4.1.1 Voltage Measurement............................................................................... 28
4.4.1.2 Current Measurement ............................................................................... 28
4.4.1.3 Speed and Power Factor Measurement ..................................................... 29
4.4.2 Output on Website ........................................................................................... 29

5. CONCLUSION AND RECOMMENDATION ............................................................ 30


5.1. Conclusion ............................................................................................................ 30
5.2. Recommendation .................................................................................................. 30

REFERENCES................................................................................................................ 32

APPENDIX A ................................................................................................................. 33

vii
LIST OF FIGURES

Figure 1.1 Single phase induction motor............................................................................ 1


Figure 2.1 Stator and rotor of single phase induction motor ............................................... 3
Figure 2.2 Operation of induction motor............................................................................ 4
Figure 2.3 Double-field revolving theory ........................................................................... 5
Figure 2.4 H-bridge inverter .............................................................................................. 7
Figure 2.5 Block diagram of current measurement circuit .................................................. 9
Figure 2.6 Block diagram of voltage measurement circuit ............................................... 10
Figure 2.7 Logic for speed sensor .................................................................................... 13
Figure 3.1 Schematic diagram ......................................................................................... 14
Figure 3.2 Layout for proteus simulation ......................................................................... 15
Figure 3.3 Voltage measurement output .......................................................................... 16
Figure 3.4 Current measurement output ........................................................................... 16
Figure 3.5 Abnormal condition output ............................................................................. 16
Figure 4.1 Block diagram of proposed scheme ................................................................ 17
Figure 4.2 Arduino uno board.......................................................................................... 18
Figure 4.3 Specification of the induction motor ............................................................... 20
Figure 4.4 NodeMCU development board ....................................................................... 20
Figure 4.5 LCD display 16x2 .......................................................................................... 22
Figure 4.6 Triac and its symbol ....................................................................................... 23
Figure 4.7 Optocoupler and its symbol ............................................................................ 24
Figure 4.8 ACS712 current sensor ................................................................................... 25
Figure 4.8 IR sensor ........................................................................................................ 26
Figure 4.9 Relay module ................................................................................................. 27
Figure 4.10 Whole system circuit .................................................................................... 27
Figure 4.11 LCD showing Vpeak and Vrms .................................................................... 28
Figure 4.12 LCD showing Ipeak and Irms ....................................................................... 28
Figure 4.13 LCD showing speed and power factor........................................................... 29
Figure 4.14 Website showing data at 100% speed............................................................ 29
Figure 4.15 Website showing data at 25% speed.............................................................. 29

viii
LIST OF TABLES

Table 4.1 Technical Specification of Arduino Uno .......................................................... 19


Table 4.2 Specification of induction motor used .............................................................. 19
Table 4.3 Specification of NodeMCU board .................................................................... 21
Table 4.4 Pin description of LCD .................................................................................... 22
Table 4.5 Pin description of triac ..................................................................................... 23
Table 4.6 Pin description of moc3021.............................................................................. 24
Table 4.7 Pin description of ACS712............................................................................... 26

ix
1. INTRODUCTION

1.1. Background

Before the invention of AC induction motors, DC motors were commonly used for industrial
needs. With the invention of AC induction motors due to their higher performance attributes
over DC motor, industrial automation is being frequently done with it. Induction motors are
electro-mechanical devices used in most industrial applications for the transformation of
power from electrical to mechanical form. Induction motors are utilized all over the world
as the workhorse as a part of mechanical provisions due to their simple, robust, reliable
behavior.

Figure 1.1 Single phase induction motor

Monitoring, controlling and specially, protection of induction motor, for that matter any
other electrical equipment is an important topic in industries and factories where there are
numerous numbers of motors run daily. Manually monitoring and controlling the motor is a
tedious to do so if there are large number of motors. Also, manually switching off the motors,
in case of any abnormal condition such as high voltage or high current, for large numbers of
motor in industry is even more tiresome. Hence, remote monitoring, controlling and
automatic protection of those motors is needed.

1
1.2. Objective

 To monitor the voltage, current, speed and power factor of the induction motor and
control the motor and the speed via Wi-Fi module.
The major objective of this project is to develop a system to remotely monitor the parameters
of the induction motor and protect the motor from any anomalous conditions as well as
develop a control strategy to change the speed as required.

1.3. Scope of project

In this project, there is provision of remotely observing the current, voltage, power factor
and speed of the induction motor, switching on or off of the motor and changing the speed
of the induction motor; all through the webpage. This project is microcontroller based and
is easily controllable. It has wide range of applications when employed for monitoring
required parameters and controlling speed of a single phase induction motor in industrial
sectors.

1.4. Methodology

The following methodology is took upon in order to carry out the specified objectives:
1. Primary study of induction motor and the speed sensors as well as analysis of current
and voltage measuring circuit and speed control circuit
2. Design of schematic for the circuitry of the measurement circuits as well as the speed
control circuit
3. Programming in Arduino IDE software for the Arduino Uno microcontroller
4. Simulation of the voltage and current measurement circuit and speed control circuit
in Proteus software to determine the required parameters of the hardware
5. Design and fabrication of hardware of proposed scheme
6. Testing and debugging of fabricated hardware
7. Documentation of the project with final report

2
2. RELEVANT THEORY

2.1. Single Phase Induction Motor

An induction motor or asynchronous motor is an AC electric motor in which the electric


current in the rotor needed to produce torque is obtained by electromagnetic induction from
the magnetic field of the stator winding. An induction motor can therefore be made without
electrical connections to the rotor. An induction motor's rotor can be either wound type or
squirrel-cage type. An induction motor comprises a magnetic circuit interlinking two electric
circuits which are placed on the two main parts of the machine: (i) the stationary part called
the stator and (ii) the rotating part called the rotor. Power is transferred from one part to the
other by electromagnetic induction.

Figure 2.1 Stator and rotor of single phase induction motor

Types of single phase induction motor:


1. Split phase induction motor
2. Capacitor start induction motor
3. Capacitor start capacitor run induction motor
4. Shaded pole induction motor

3
2.1.1. Working Principle of Single Phase Induction Motor

When the stator of a single phase motor is fed with single phase supply, it produces
alternating flux in the stator winding. The alternating current flowing through stator winding
causes induced current in the rotor bars (of the squirrel cage rotor) according to Faraday's
law of electromagnetic induction. This induced current in the rotor will also produce
alternating flux. Even after both alternating fluxes are set up, the motor fails to start (the
reason is explained below). However, if the rotor is given an initial start by external force in
either direction, then motor accelerates to its final speed and keeps running with its rated
speed. This behavior of a single phase motor can be explained by double-field revolving
theory.

Figure 2.2 Operation of induction motor

2.1.2. Double-Field Revolving Theory

The double-field revolving theory states that, any alternating quantity (here, alternating flux)
can be resolved into two components having magnitude half of the maximum magnitude of
the alternating quantity, and both these components rotating in opposite direction. Following
figures will help you understanding the double field revolving theory.

4
Figure 2.3 Double-field revolving theory

The stator of a single phase induction motor is wound with single phase winding. When the
stator is fed with a single phase supply, it produces alternating flux (which alternates along
one space axis only). Alternating flux acting on a squirrel cage rotor cannot produce rotation,
only revolving flux can. That is why a single phase induction motor is not self-starting.

2.2. Speed Control of Single Phase Induction Motor

Every day engineers design products that employ single-phase induction motors. Speed
control of single-phase induction motors is desirable in most motor control applications since
it not only provides variable speed but also reduces energy consumption and audible noise.
Most single-phase induction motors are unidirectional, which means they are designed to
rotate in one direction. Either by adding extra windings, external relays and switches, or by
adding gear mechanisms, the direction of rotation can be changed. Using microcontroller-
based control systems, one can add speed variation to the system. In addition to the option
of speed variation, the direction of rotation can also be changed, depending upon the motor
control algorithms used.

5
2.2.1. Unidirectional and Bidirectional Control

2.2.1.1. Unidirectional Control:

VF control in one direction makes the drive topology and control algorithm relatively easy.
The task is to generate a variable voltage and frequency power supply from a fixed voltage
and frequency power supply (such as a wall-outlet power supply). Motor windings are
connects to the center of each half bridge on the output-inverter section. Many motors
available off the shelf have both the main and start windings connected together with a
capacitor connected in series with the start winding. The motor may have only two
protruding wires (M1 and M2).

It is capable of outputting up to three pairs of PWMs with dead band in between the pairs.
Dead band is essential in an induction motor control application to avoid cross conduction
of the dc bus through the power switches when one turns OFF and the other turns ON. The
diagnostic circuit may include motor current monitoring, dc-bus voltage monitoring, and
temperature monitoring on the heat sink connected to the power switches and the motor.

2.2.1.2. Bidirectional Control:

Most PSC motors are designed to run in one direction. However, many applications call for
bidirectional motor rotation. Historically, gear mechanisms or external relays and switches
were used to achieve bidirectional rotation. When mechanical gears are used, the motor shaft
runs in one direction, and the gears for forward and reverse engage and disengage according
to the direction required. Using relays and switches, the polarity of the starting winding is
electrically reversed based on the direction required. Unfortunately, all of these components
increase the cost of the system for basic ON and OFF control in two directions.
The drive topologies discussed here produce effective voltages, which drive the main
winding and start winding at 90-degree phase shifts to each other. This enables the system
designer to remove the capacitor, which is in series with start winding, from the circuit
permanently thereby reducing the total system cost.

6
2.2.2. H-Bridge Inverter

This method has a voltage double on the input side; on the output side. One end of the main
and start windings are connected to each half bridge; the other ends are connected together
at the neutral point of the ac power supply, which also serves as the center point for the
voltage double. The control circuit requires four PWMs with two complementary pairs and
sufficient dead-band between the complementary outputs. PWM0-PWM1 and PWM2-
PWM3 are the PWM pairs with dead band. Using PWMs, the dc bus is synthesized to
provide two sine voltages at 90 degrees out of phase with varying amplitude and varying
frequency, according to the VF profile. If the voltage applied to the main winding lags the
start winding by 90 degrees, then the motor runs in the forward direction. To reverse the
direction of rotation, the voltage supplied to the main winding should lead the voltage
supplied to the start winding.

Figure 2.4 H-bridge inverter

This H-bridge inverter method of controlling a PSC type motor has following disadvantages.
The main and start windings have different electrical characteristics. Thus, the current
flowing through each switch is unbalanced. This can lead to the premature breakdown of
switching devices in the inverter. The common point of the windings is directly connected
to the neutral power supply. This may increase the switching signals creeping into the main

7
power supply, and may increase the noise emitted onto the line. In turn, this may limit the
EMI level of the product, violating certain design goals and regulations.

The effective dc voltage handled is relatively high due to the input-voltage double circuit.
Lastly, the cost of the voltage double circuit itself is high due to two large power capacitors.

2.2.3. Three-Phase Inverter Bridge:

The input section is replaced with a standard diode-bridge rectifier. The output section has
a three-phase inverter bridge. The main difference from the previous scheme is the method
used to connect the motor windings to the inverter. One end of the main and start windings
are connected to one half bridge each. The other ends are tied together and connected to the
third half bridge.

With this drive topology, control becomes more efficient. However, the control algorithm
becomes more complex. The winding voltages, Va, Vb, and Vc, should be controlled to
achieve the phase difference between the effective voltages across the main and starting
windings, in order to have a 90-degree phase shift to each other.

In order to have equal voltage-stress levels on all devices, which improves the device
utilization and provides the maximum possible output voltage for a given dc bus voltage, all
three inverter-phase voltages are kept at the same amplitude, as given by:

| Va | = | Vb | = | Vc | (2.1)

The effective voltage across the main and starting windings as given by:

Vmain = Va-Vc (2.2)


Vstart = Vb-Vc (2.3)

8
The direction of rotation can be easily controlled by the Vc phase angle with respect to Va

and Vb. Using the three-phase inverter control method on a 300W compressor gave a power
saving of 30 percent compared to the first two methods.

Another advantage of using the three-phase control method is that the same drive-hardware
topology can be used to control a three-phase induction motor. In this scenario, the
microcontroller should be reprogrammed to output sine voltages with 120-degree phase shift
to each other, which drives a three-phase induction motor. This reduces the development
time.

Single-phase induction motors are very popular in appliances, and industrial and consumer
applications. PSCs are the most popular type of single-phase induction motors. Controlling
the motor speed has many advantages, such as power efficiency, reduced audible noise and
better control over the application. In this article, we discussed different methods of speed
control that can be used with a PSC motor in unidirectional and bidirectional. Controlling a
PSC motor using a three-phase inverter topology provides the best results.

2.3. Current Measurement

Figure 2.5 Block diagram of current measurement circuit

The circuit makes use of current sensor ACS712. One connection is done with the incoming
phase wire and the other connection is done with the wire on which the induction motor is
connected. For current the upper limit is set to certain value that should not be exceeded in

9
the circuit. The limit should be as such that the current should not damage the electrical
equipment. The limit can be easily altered in case the load is changed. When the current limit
is surpassed in the circuit, the microcontroller should act quickly in order to protect the
motor. Therefore, the relay is operated by the microcontroller as soon as the limit is crossed,
to cut off the supply from the motor. A message is displayed noting that overcurrent has
occurred.

2.4. Voltage Measurement

For the voltage measurement circuit, one connection is done with the incoming phase wire
and the other connection is done with the neutral wire. The suitable working voltage range
is set between 180V and 230V. The voltage is varied with the help of potentiometer or an
autotransformer for the purpose of testing in the project. The limit can be easily altered as
per the requirement. The circuit operates satisfactorily if the voltage is within the limits.
Similar to the current measurement circuit, the relay operates and isolates the circuit if the
voltage falls outside of the above limits. A message is displayed in the LCD screen stating
the sensed condition as under voltage when the voltage supply drops below 180V or over
voltage when the voltage supply rises above 230V. If the voltage comes back within the
limit, the relay again connects the motor with the supply.

Figure 2.6 Block diagram of voltage measurement circuit

10
2.5. Power Factor Estimation

The total input electrical apparent power to the motor is given as

P = √3VI (2.4)

Where, V and I are the line voltage and current respectively. The active power, accounting
for supplying the load, is given as

P = √3VI cos ϕ (2.5)

The PF is then defined as

P
PF = = cos ϕ (2.6)
P

The motor current, I would have two components, Iactive and Ireactive. Active part of the current
(Iactive) accounts for the torque, changing according to the load (from no-load to full/over-
load). Reactive part of the current (Ireactive) accounts for the magnetizing current of the
induction motor, without changing much from the no-load to the full-load condition,
practically remaining constant. This is because for induction motor, the magnetizing circuit,
i.e., the stator coil inductances remain same.

I= I +I (2.7)

I = I cos ϕ (2.8)

I = I sin ϕ (2.9)

Utilizing (2.6) in (2.9),

I = I sin(cos PF) (2.10)

11
Eq. (2.6) can be rewritten as

I
PF = cos ϕ = 1 − sin ϕ = 1−( ) (2.11)
I

As the reactive component remains constant, it can be estimated from the nominal condition
given by the manufacturer data and/or nameplate data using (2.10). Now, as the motor load
increases, the total motor current (I) in (2.11) would increase, while Ireactive remains constant.
Hence, the ratio of (Ireactive =I) in (2.6) decreases, causing the PF to increase towards unity.
Theoretically, at no-load condition, there is no active current flow. So, at no-load, I = I reactive,
making the PF = 0, theoretically. That is, physically, at no-load, there is not much mechanical
resistance, so the whole circuit is mostly inductive due to the stator coils, causing low power
factor. Increase in motor load is essentially similar to adding resistances to the circuit,
causing the PF to improve. Therefore, in the current-only PF estimation approach, we would
estimate the Ireactive using (2.10) from the nominal PF out of the nameplate data. Then, from
the measured motor current and the constant Ireactive, using (2.11), it is able to estimate the
operating PF. It would not require synchronized voltage and current measurement like in the
displacement PF measurement principle. The displacement PF measurement principle uses
the zero-crossing instants and compares the differences between the voltage and the current.
It will be shown later in details for comparative analysis of the results using different
approaches.

2.6. Speed Measurement

Speed is measured with the Infrared (IR) sensor. An aluminum foil is placed in the rotating
blades of the motor. The sensor senses the foil and the microcontroller records the time it is
being sensed. The microcontroller process the time in to RPM.

Aluminum foil is used set a reference point. Also it reflects light thus enhances sensitivity
of IR sensor. The sensor gives HIGH output, when aluminum foil comes in front of the
sensor.

12
Here in this project, we have used highest priority interrupt to detect rpm and we have
configured it in rising mode. So that whenever sensor output goes LOW to HIGH,
microcontroller. And as we have used one blade rotor, it means the function will be called 2
times in one revolution.

Figure 2.7 Logic for speed sensor

Once the time taken is known we can calculate the RPM by using the below formulae, Where
1000/time taken will give us the RPS and further multiplying it with 60 will give you the
RPM.

13
3. SIMULATION STUDIES

Before carrying out activities in hardware, schematics were made for the current
measurement circuit, voltage measurement circuit, speed sensing circuit and speed control
circuit in KiCad software. In addition to that, simulations were carried out in software such
as Proteus. This chapter is mainly concerned with the simulations in these software.

3.1. Schematics

The schematic of the project for software simulations and hardware fabrication is shown in
the figure 3.1.

Figure 3.1 Schematic diagram

14
3.2. Proteus Simulation

After designing schematics on KiCad software, simulations were carried out on Proteus
software. Before this, basic code was written in Arduino IDE to display the current and
voltage, sensed by their respective circuits, to the LCD screen. The hex code was generated
after compilation of the source code, was loaded in the microcontroller. The layout of
Proteus simulation is shown in figure 3.2. The load used in this simulation is an inductive
load, an inductor, as single phase induction motor was not available in the software.

Figure 3.2 Layout for proteus simulation

15
3.2.1. Simulation Results

The following figures depicts the results of the Proteus simulation. The voltage measurement
output is shown in figure 3.3 and the current measurement output is shown in figure 3.4.

Figure 3.3 Voltage measurement output

Figure 3.4 Current measurement output

The simulation also shows that when current exceeds the limit, “high current switch off”
message is shown on the LCD screen of the simulation as depicted in figure 3.5. Then the
system is isolated from the supply proving success in simulation part for the project.

Figure 3.5 Abnormal condition output

16
4. HARDWARE DESIGN AND FABRICATION

4.1. Description of Proposed Scheme

The scheme is the design of a system that monitors and controls the single phase induction
motor and also protects the motor from any abnormal conditions.

Figure 4.1 Block diagram of proposed scheme

The system is proposed using two Arduino Uno microcontroller. The first Arduino Uno is
used to change the speed of the microcontroller and the second Arduino Uno is used for the
purpose of processing the data from sensors. The main advantage of using the Arduino Uno
microcontrollers is its real time approach as instantaneous values of various components
such as phase voltage, phase current, power factor, speed etc. will be displayed on the screen

17
in real time. Various sensors are used to measure the voltage, current and rotor speed of the
induction motor. Other perimeters such as voltage, current, power factor and speed are also
displayed on the laptop screen or phone screen through the website as well as on the LCD
display.

4.2. Hardware Components

The component we have used to design each circuit are discussed briefly in the following
topics:

4.2.1. Arduino Uno

For the purpose of the project two Arduino Uno microcontroller has been used; one for the
processing of sensor values and the other for the control of the speed of the induction motor.
Arduino Uno is a microcontroller board based on 8-bit ATmega328P microcontroller. Along
with ATmega328P, it consists other components such as crystal oscillator, serial
communication, voltage regulator, etc. to support the microcontroller. Arduino Uno has 14
digital input/output pins (out of which 6 can be used as PWM outputs), 6 analog input pins,
a USB connection, A Power barrel jack, an ICSP header and a reset button.

Figure 4.2 Arduino uno board

18
Table 4.1 Technical Specification of Arduino Uno

Microcontroller ATmega328P – 8 bit AVR family microcontroller

Operating Voltage 5V

Recommended Input Voltage 7-12V

Input Voltage Limits 6-20V

Analog Input Pins 6 (A0 – A5)

Digital I/O Pins 14 (Out of which 6 provide PWM output)

DC Current on I/O Pins 40 mA

DC Current on 3.3V Pin 50 mA

Flash Memory 32 KB (0.5 KB is used for Bootloader)

SRAM 2 KB

EEPROM 1 KB

Frequency (Clock Speed) 16 MHz

4.2.2. Induction Motor

Single phase induction motor is used for the project. Basically, the induction motor used for
the project was a household water pump. The specification of the pump is given in the
following table:

Table 4.2 Specification of induction motor used


Nominal voltage 220 V
Nominal current 4A
Rated power 0.7 kW
Rated speed 2850

19
Figure 4.3 Specification of the induction motor

4.2.3. NodeMCU

The Wi-Fi module used in the project is the NodeMCU. NodeMCU is an open source IoT
platform. It includes firmware which runs on the ESP8266 Wi-Fi SoC from Espressif
Systems, and hardware which is based on the ESP-12 module. The term "NodeMCU" by
default refers to the firmware rather than the development kits. The firmware uses the Lua
scripting language. It is based on the eLua project, and built on the Espressif Non-OS SDK
for ESP8266. It uses many open source projects, such as lua-cjson and SPIFFS. NodeMCU
provides access to the GPIO (General Purpose Input/Output) and a pin mapping table is part
of the API documentation.

Figure 4.4 NodeMCU development board

20
Table 4.3 Specification of NodeMCU board

Developer ESP8266 Open source Community

Type Single-board microcontroller

Operating system XTOS

CPU ESP8266

Memory 128kBytes

Storage 4Mbytes

Power By USB

3v, 5v (used with 3.3v Regulator which inbuilt on Board


Power Voltage
using Pin VIN)

Code Arduino Cpp

IDE Used Arduino IDE

GPIO 10

4.2.4. Potential Transformer

The voltage is sensed using a simple potential transformer connected in parallel. It steps
down the voltage value that can be used by the microcontroller.

4.2.5. LCD

LCD stands for Liquid Crystal Display. It is a device that can be used with microcontrollers
to display different messages. Here, this information about the present load consumption,
rate at the real time, units consumed and total cost of energy consumed till date is displayed
in LCD display unit. LCD has a controller chip that controls the action of LCD. To control
the LCD, different command word as to be sent to this controller using the pins of LCD. In
this way, any messages can be displayed using microcontroller, which provide an easy way
to communicate with the hardware.

21
Table 4.4 Pin description of LCD

Pin no. Name Description

1 VSS GND

2 VCC Power supply (+5v)

3 VEE Contrast Adjust

0=Instruction Input
4 RS
1=Data Input

0=Write to LCD
5 R/W
1=Read From LCD

6 EN Enable Signal

7 D0 Bit 0 LSB

8 D1 Bit 1

9 D2 Bit 2

10 D3 Bit 3

11 D4 Bit 4

12 D5 Bit 5

13 D6 Bit 6

14 D7 Bit 7 MSB

Figure 4.5 LCD display 16x2

22
4.2.6. Triac

Triacs are a subset of thyristors and are related to silicon controlled rectifiers (SCRs). Triacs
differ from SCRs in that they allow current flow in both directions, whereas an SCR can
only conduct current in a single direction. Most triacs can be triggered by applying either a
positive or negative voltage to the gate (an SCR requires a positive voltage). Once triggered,
SCRs and TRIACs continue to conduct, even if the gate current ceases, until the main current
drops below a certain level called the holding current.

Figure 4.6 Triac and its symbol

For the purpose of the project, BT139 has been used which has the following features:
 High blocking voltage capability
 Planar passivated for voltage ruggedness and reliability
 Less sensitive gate for high noise immunity
 Triggering in all four quadrants

Table 4.5 Pin description of triac


Pin Symbol Description
1 T1 Main terminal 1
2 T2 Main terminal 2
3 G Gate
Mb T2 Mounting base; main terminal 2

23
4.2.7. Optocoupler

An opto-isolator (also called an optocoupler, photocoupler, or optical isolator) is an


electronic component that transfers electrical signals between two isolated circuits by using
light. Opto-isolators prevent high voltages from affecting the system receiving the signal.
For triggering the triac, MOC3021 optocoupler has been used in the project. MOC3021 is
an opto-coupler designed for triggering triacs. By using this we can trigger anywhere in the
cycle, so can call them as non-zero opto-coupler. MOC3021 are very widely used and can
be quite easily obtained from many sources. It comes in 6-pin DIP shown in figure.

Figure 4.7 Optocoupler and its symbol

Table 4.6 Pin description of moc3021


Pin 1 Anode
Pin 2 Cathode
Pin 3 No connection (NC)
Pin 4 Main terminal
Pin 5 No connection (NC)
Pin 6 Main terminal

Features:
 400 V Photo-triac driver output
 Gallium-Arsenide-Diode Infrared Source and Optically-Coupled Silicon triac driver
 Output Driver Designed for 220 Vac
 Standard 6-terminal plastic DIP

24
4.2.8. Hall Effect Sensor

The ACS712 Module uses the famous ACS712 IC to measure current using the Hall Effect
principle. The module gets its name from the IC (ACS712) used in the module, so for you
final products use the IC directly instead of the module.

These ACS712 module can measure current AC or DC current ranging from +5A to -5A,
+20A to -20A and +30A to -30A. You have to select the right range for your project since
you have to trade off accuracy for higher range modules. This modules outputs Analog
voltage (0-5V) based on the current flowing through the wire; hence it is very easy to
interface this module with any microcontroller.

Figure 4.8 ACS712 current sensor

Specifications:
 Measures both AC and DC current
 Available as 5A, 20A and 30A module
 Provides isolation from the load
 Easy to integrate with MCU, since it outputs analog voltage
 Voltage at 0A is 2.5VDC(dc offset)

25
Table 4.7 Pin description of ACS712
Pin Number Pin Name Description

1 Vcc Input voltage is +5V for typical applications

2 Output Outputs Analog voltage proportional to current

3 Ground Connected to ground of circuit

T1 Wire In The wire through current has to be measured is


T2 Wire Out connected here

4.2.9. Infrared Sensor

An infrared sensor is an electronic instrument that is used to sense certain characteristics of


its surroundings. It does this by either emitting or detecting infrared radiation. Infrared
sensors are also capable of measuring the heat being emitted by an object and detecting
motion. The IR sensor in the project is used for the purpose to sense the speed of the motor.

Figure 4.8 IR sensor

4.2.10. Relay

Relays are switches that open and close circuits electromechanically or electronically.
Relays control one electrical circuit by opening and closing contacts in another circuit. As
relay diagrams show, when a relay contact is normally open (NO), there is an open contact
when the relay is not energized.

26
Figure 4.9 Relay module

4.3. Hardware Circuits

This section includes the discussion of various hardware circuits actually used.

Figure 4.10 Whole system circuit

The first Arduino Uno processes all the data that is received by it from the microcontroller
while the second Arduino Uno’s sole responsibility is to change the speed of the motor at
suitable times only when the zero crossing is detected in the supply. The user can switch on
or off the motor through the controls provided in the website and also change the speed of
the motor. The first Arduino Uno is also interfaced with the NodeMCU which is the Wi-Fi
module. The module acts as a server and sends the data to the webpage which is the client
in the case for this project.

27
4.4. Hardware Results

After proper design and fabrication of the hardware, the results were observed on the LCD
screen and the website on laptop screen. The following pictures depict the results with this
project.

4.4.1 Output on LCD

4.4.1.1 Voltage Measurement

Figure 4.11 LCD showing Vpeak and Vrms

4.4.1.2 Current Measurement

Figure 4.12 LCD showing Ipeak and Irms

28
4.4.1.3 Speed and Power Factor Measurement

Figure 4.13 LCD showing speed and power factor

4.4.2 Output on Website

Figure 4.14 Website showing data at 100% speed

Figure 4.15 Website showing data at 25% speed

29
5. CONCLUSION AND RECOMMENDATION

5.1. Conclusion

The schematics and Proteus simulation proved to be successful to check for the circuitry of
the system to monitor and control the induction motor. The simulation was also conducted
with success for automatic turning off the motor, when high voltage is supplied to motor and
similarly proved to be successful in case of high currents flowing through the circuits.

The aforementioned hardware components was successfully fabricated. The fabricated


system gave the desired output, proving their capability to operate. The induction motor’s
speed, voltage and current of the motor, as well as the power factor were successfully
displayed on the LCD screen and on the computer or phone screen as well.

5.2. Recommendation

Monitoring, controlling and protection system for the single phase induction motor was
successfully designed and fabricated with success as per the aim of the project, but there is
always room for improvement in any project to enhance the project. The following are the
recommended suggestions for future enhancement:

 The project only considers single phase induction motors but in reality, other
electrical equipment can also be controlled and monitored using the same system.
 There are other parameters of motors such as temperature, frequency, etc. that can
also be monitored in addition to the parameters in the project.
 The wireless system in this project requires the remote monitor to be specifically
connected to the Wi-Fi module i.e. it has a limited range but for future works using
internet the range can be improved.
 Estimation of power factor is done with the measured current and manufacturer data,
which may not be accurate. Instead of using this estimation technique circuits can be
developed that measures the actual power factor of the system.

30
 In addition to only monitoring the power factor of the motor, another feature or
addition to the project may be the inclusion of a system that has the strategy to
improve the power factor in case of any abnormalities.

31
REFERENCES

[1] A. Cakir, H. Calis, G. Turan, “Remote Controlling and Monitoring of Induction Motors
through Internet”, TELKOMNIKA Indonesian Journal of Electrical Engineering,
Vol.12, No.12, pp.8051 ~ 8059, 2014.
[2] R. Singh, R, Nayak, “Monitoring and Controlling of Single Phase Induction Motor for
Advancement Speed Control in Forward and Reverse Direction Using PLC and
SCADA”, ISSN 2321 3361 © 2016 IJESC.
[3] V.S.D Rekha, Dr. K.S Ravi, “Induction Motor Condition Monitoring and Controlling
Based on IoT”, IJEECS ISSN 2348-117X, Vol.6, Issue 9, 2017.
[4] M.A Velan, M.A Raj, K. Kannadasan, D.Kirubakaran, “Monitoring and Control of
Three Phase Induction Motor Using Iota Based Concept”, IOSR Journal of Engineering
(IOSRJEN), ISSN 2250-3021, pp.27-31, 2018.
[5] P. Ahuja, R. Kumar, K. Dhiraj, “Control and Monitoring of 3 – Phase Induction Motor
Using PLC”, IJIRSET, Vol.5, Issue 2, 2016.
[6] A. Hayat, M.N Khan, “Speed Control and Power Factor Improvement of a Single Phase
AC Motor”, Universal Journal of Electrical and Electronic Engineering, pp.328-336,
2014.
[7] A. Ukil, R. Bloch, A. Andenna, “Estimation of Induction Motor Operating Power Factor
From Measured Current and Manufacturer Data”, IEEE Transactions on Energy
Conversion, 2011.

32
APPENDIX A
SOURCE CODE

Code for 2nd Arduino Uno to Control Speed


#include <TimerOne.h>
volatile int i = 0;
volatile boolean zero_cross = 0;
int AC_pin = 3;
int ZERO_CROSS_PIN = 2;
volatile long dim = 0;
int inc = 1;
int freqStep = 75;

void setup() {
pinMode(AC_pin, OUTPUT);
attachInterrupt(digitalPinToInterrupt(ZERO_CROSS_PIN),
zero_cross_detect, RISING);
Timer1.initialize(freqStep);
Timer1.attachInterrupt(dim_check, freqStep);
Serial.begin(115200);
}

void zero_cross_detect() {
zero_cross = true;
i = 0;
digitalWrite(AC_pin, LOW);
}

void dim_check() {
if (zero_cross == true) {
if (i >= dim) {
digitalWrite(AC_pin, HIGH);
i = 0;
zero_cross = false;
}
else {
i++;
}
}
}

void loop() {
if (Serial.available()) {
String msg = Serial.readStringUntil('@');

33
if (msg.toInt() > 0) {
dim = msg.toInt();
}
Serial.println(dim);
}
}

Code for 1st Arduino Uno to Process Sensor Values


#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
#include <math.h>
SoftwareSerial SoftSerial(6, 7);
const int rs = 8, en = 9, d4 = 10, d5 = 11, d6 = 12, d7 = 13;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
const int CURRENT_IN_PIN = 1;
const int VOLTAGE_IN_PIN = A0;
const int RELAY_IN_PIN = 5;
const int SPEED_IN_PIN = 2; //Analog pin 2
const int SENSITIVITY = 66;
const int OFFSET_VOLTAGE = 503;
double Vpeak = 0;
double Vrms = 0;
double Irms = 0;
double Ipeak = 0;
int rpm = 0;
double pf = 0;
int rawMaxCurrent = 0;
int rawAvgVoltage = 0;
int rawAvgSpeed = 0;
long displayRefreshTime = 0;
int displayMenuNumber = 0;
bool overCurrent = false;
bool overVoltage = false;

void setup()
{
pinMode(RELAY_IN_PIN, OUTPUT);
digitalWrite(RELAY_IN_PIN, LOW);

lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("Monitor and control");
lcd.setCursor(0, 1);
lcd.print(" of Induction Motor");
delay(500);
Serial.begin(115200);

34
SoftSerial.begin(115200);
}

void loop()
{
readRawVoltageAndCurrentAndSpeed();
calcVoltage();
calcCurrent();
calcSpeed();
calcPf();
checkOverCurrentAndVoltage();
lcdDisp();
updateStatus();
}

void readRawVoltageAndCurrentAndSpeed() {
long startTime = millis();
int rawCurrent = 0;
long voltageCounter = 0;
long rawVoltageSum = 0;
int lastSpeedValue = 0;
int newSpeedValue = 0;
int speedCounter = 0;
rawMaxCurrent = 0;
while (millis() - startTime < 500) {
rawCurrent = analogRead(CURRENT_IN_PIN);
if (rawCurrent > rawMaxCurrent) {
rawMaxCurrent = rawCurrent;
}
rawVoltageSum += analogRead(VOLTAGE_IN_PIN);
voltageCounter++;
lastSpeedValue = newSpeedValue;
newSpeedValue = analogRead(SPEED_IN_PIN);
if (newSpeedValue < 50 && lastSpeedValue > 50) {
speedCounter++;
}
}
rawAvgVoltage = rawVoltageSum / voltageCounter;
rawAvgSpeed = speedCounter;
}

void calcSpeed() {
rpm = rawAvgSpeed * 120;
Serial.print("Speed=");
Serial.println(rpm);
String rpmStr = String(rpm);

35
rpmStr = "Speed" + rpmStr + "rpm!";
SoftSerial.print (rpmStr);
}

void calcVoltage() {
Vrms = rawAvgVoltage / 3.69 ;
Vpeak = Vrms * sqrt(2);
Serial.print("Vrms=");
Serial.println(Vrms);
String VrmsStr = String(Vrms);
VrmsStr = "Vrms" + VrmsStr + "V!";
SoftSerial.print (VrmsStr);
String VpeakStr = String(Vpeak);
VpeakStr = "Vpeak" + VpeakStr + "V!";
SoftSerial.print (VpeakStr);
}

void calcCurrent() {
float equivalentVoltage = (rawMaxCurrent / 1023.0) * 5000; //
Gets you mV
Ipeak = ((equivalentVoltage - OFFSET_VOLTAGE) / SENSITIVITY) ;
Irms = Ipeak / sqrt(2);
Serial.print("Irms= ");
Serial.println(Irms);
String IrmsStr = String(Irms);
IrmsStr = "Irms" + IrmsStr + "A!";
SoftSerial.println (IrmsStr);
String IpeakStr = String(Ipeak);
IpeakStr = "Ipeak" + IpeakStr + "A!";
SoftSerial.println (IpeakStr);
}

void checkOverCurrentAndVoltage() {
if (Vrms > 250) {
overVoltage = true;
SoftSerial.print ("Over Voltage!");
} else {
overVoltage = false;
}
if (Irms > 5) {
overCurrent = true;
SoftSerial.print ("Over Current!");
} else {
overCurrent = false;
}
}

36
void calcPf() {
float Ireactive = 2.10;
Serial.println("Ireactive==");
Serial.println(Ireactive);
float I = (Ireactive / Irms);
Serial.println("Ireactive/Irms==");
Serial.println(I);
float Isquare = pow(I, 2);
Serial.println("Isquare==");
Serial.println(Isquare);
pf = sqrt(1 - Isquare);
Serial.println("pF==");
Serial.println(pf);
String pfStr = String(pf);
pfStr = "PF" + pfStr + "!";
SoftSerial.print (pfStr);
}

void updateStatus() {
if (SoftSerial.available()) {
String msg = SoftSerial.readStringUntil('@');
Serial.print("message is ");
Serial.println(msg);
if (msg.indexOf("OFF") >= 0) {
digitalWrite(RELAY_IN_PIN, HIGH);
} else if (msg.indexOf("ON") >= 0) {
digitalWrite(RELAY_IN_PIN, LOW);
}
}
}
void lcdDisp()
{
if (millis() - displayRefreshTime > 1000) {
displayRefreshTime = millis();
lcd.clear();
if (overVoltage) {
//Show Over Voltage
lcd.setCursor(0, 0);
lcd.print("Over Voltage");
lcd.setCursor(0, 1);
lcd.print("Switch off");
digitalWrite(RELAY_IN_PIN, HIGH);
}
else if (overCurrent) {
//Show Over Current

37
lcd.setCursor(0, 0);
lcd.print("Over Current");
lcd.setCursor(0, 1);
lcd.print("Switch off");
digitalWrite(RELAY_IN_PIN, HIGH);
}
else if (displayMenuNumber == 0) {
lcd.setCursor(0, 0);
lcd.print("Ipeak="); lcd.print(Ipeak); lcd.print(" ");
lcd.print("A");
lcd.setCursor(0, 1);
lcd.print("Irms="); lcd.print(Irms); lcd.print(" ");
lcd.print("A");
} else if (displayMenuNumber == 1) {
lcd.setCursor(0, 0);
lcd.print("Vpeak="); lcd.print(Vpeak); lcd.print(" ");
lcd.print("V");
lcd.setCursor(0, 1);
lcd.print("Vrms="); lcd.print(Vrms); lcd.print(" ");
lcd.print("V");
} else if (displayMenuNumber == 2) {
lcd.setCursor(0, 0);
lcd.print("Speed="); lcd.print(rpm); lcd.print(" ");
lcd.print("rpm");
lcd.setCursor(0, 1);
lcd.print("PF="); lcd.print(pf);
}
displayMenuNumber++;
if (displayMenuNumber > 2) {
displayMenuNumber = 0;
}
}
}

Code for NodeMcu for Remote Monitor and Control


#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <WebSocketsServer.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <Hash.h>
#define USE_SERIAL Serial
long oldtime = 0;
ESP8266WiFiMulti WiFiMulti;
ESP8266WebServer server(80);

38
WebSocketsServer webSocket = WebSocketsServer(81);

void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload,


size_t length) {
switch(type) {
case WStype_DISCONNECTED:
USE_SERIAL.printf("[%u] Disconnected!\n", num);
break;
case WStype_CONNECTED: {
IPAddress ip = webSocket.remoteIP(num);
}
break;
case WStype_TEXT:
String strPayload = (char*)payload;
if (strPayload.indexOf("#0") >=0 ){
Serial.print("OFF@");
}else if(strPayload.indexOf("#1") >=0 ){
Serial.print("ON@");
}else if(strPayload.indexOf("*100") >=0 ){
Serial.print("1@");
}else if(strPayload.indexOf("*75") >=0 ){
Serial.print("40@");
}else if(strPayload.indexOf("*50") >=0 ){
Serial.print("68@");
}else if(strPayload.indexOf("*25") >=0 ){
Serial.print("98@");
}else if(strPayload.indexOf("*1") >=0 ){
Serial.print("127@");
}
}
}

void setup() {
USE_SERIAL.begin(115200);
USE_SERIAL.println();
USE_SERIAL.println();
USE_SERIAL.println();
for(uint8_t t = 4; t > 0; t--) {
USE_SERIAL.printf("[SETUP] BOOT WAIT %d...\n", t);
USE_SERIAL.flush();
delay(1000);
}
pinMode(13 , OUTPUT);
digitalWrite(13, 1);
WiFiMulti.addAP("smps", "432FACC99A");
while(WiFiMulti.run() != WL_CONNECTED) {

39
delay(100);
}
webSocket.begin();
webSocket.onEvent(webSocketEvent);
if(MDNS.begin("esp8266")) {
USE_SERIAL.println("MDNS responder started");
USE_SERIAL.println(WiFi.localIP());
}
server.on("/", []() {
server.send(200, "text/html", " <html> <head> <script> var
connection = new WebSocket('ws://' + location.hostname + ':81/',
['arduino']); connection.onopen = function()
{connection.send('Connect ' + new Date()); }; connection.onerror =
function(error) {console.log('WebSocket Error ', error); };
connection.onmessage = function(e) {console.log('Server: ',
e.data); if (e.data.indexOf('Irms') >= 0) {var ret =
e.data.replace('Irms',''); console.log('Irms:',ret);
document.getElementById('Irms').innerHTML=ret; } else
if(e.data.indexOf('Ipeak') >= 0){var ret =
e.data.replace('Ipeak',''); console.log('Ipeak:',ret);
document.getElementById('Ipeak').innerHTML=ret; } else
if(e.data.indexOf('Vrms') >= 0){var ret =
e.data.replace('Vrms',''); console.log('Vrms:',ret);
document.getElementById('Vrms').innerHTML=ret; } else
if(e.data.indexOf('Vpeak') >= 0){var ret =
e.data.replace('Vpeak',''); console.log('Vpeak:',ret);
document.getElementById('Vpeak').innerHTML=ret; }else
if(e.data.indexOf('Speed') >= 0){var ret =
e.data.replace('Speed',''); console.log('Speed:',ret);
document.getElementById('Speed').innerHTML=ret; }else
if(e.data.indexOf('PF') >= 0){var ret = e.data.replace('PF','');
console.log('PF:',ret);
document.getElementById('powerFactor').innerHTML=ret; } };
function on(){console.log('on'); connection.send('#1'); } function
off(){console.log('off:'); connection.send('#0'); } function
sendSpeed(spd){console.log('speed percentage:' + spd); spd = '*' +
spd; connection.send(spd); } </script> </head> <title>Group
8</title> <body> <!--header start --> <h2>MONITORING AND
CONTROLLING <br /> SINGLE PHASE INDUCTION MOTOR </h2> <h3>Motor
Operation</h3> <button id=\"send\" onclick=\"on();\">ON</button>
<button id=\"send\" onclick=\"off();\">OFF</button> <h3>Data
Readings</h3> <table width=\"283\" border=\"0\" > <tr> <td
width=\"55\">Vrms : </td> <td width=\"73\" id=\"Vrms\">&nbsp;</td>
<td width=\"10\">&nbsp;</td> <td width=\"55\">Vpeak : </td> <td
width=\"73\" id=\"Vpeak\">&nbsp;</td> </tr> <tr> <td>Irms : </td>
<td id=\"Irms\">&nbsp;</td> <td>&nbsp;</td> <td>Ipeak : </td> <td

40
View publication stats

id=\"Ipeak\">&nbsp;</td> </tr> <tr> <td>Speed : </td> <td


id=\"Speed\">&nbsp;</td> <td>&nbsp;</td> <td>PF:</td> <td id =
\"powerFactor\">&nbsp;</td> </tr> </table> </br> <div>Speed</br>
<button id=\"100\" onclick=\"sendSpeed('100');\">100%</button>
<button id=\"75\" onclick=\"sendSpeed('75');\">75%</button>
<button id=\"50\" onclick=\"sendSpeed('50');\">50%</button>
<button id=\"25\" onclick=\"sendSpeed('25');\">25%</button>
<button id=\"25\" onclick=\"sendSpeed('1');\">0%</button> </div>
</br> <div id=\"fault\"></div> </body> </html>");
});
server.begin();
MDNS.addService("http", "tcp", 80);
MDNS.addService("ws", "tcp", 81);
digitalWrite(13, 0);
}

void loop() {
webSocket.loop();
server.handleClient();
int numchars=Serial.available();
if (numchars>0){
String str=Serial.readStringUntil('!');
Serial.println(str);
webSocket.sendTXT((uint8_t)0,str);
}
}

41

You might also like