Escolar Documentos
Profissional Documentos
Cultura Documentos
Submitted by
Sushil Kumar Soni (11107149)
Sachin Rana (11108203)
Deepak Porwal (11108002)
BACHELOR OF TECHNOLOGY
IN
ELECTRICAL AND ELECTRONICS ENGINEERING
I hereby certify that the work which is being presented in the Capstone project entitled
Design of PLC using Arduino UNO in partial fulfillment of the requirement for the award of
degree of Bachelor of technology and submitted in Department of Electrical and Electronics
Engineering, Lovely Professional University, Punjab is an authentic record of my own work
carried out during period of Capstone/Dissertation under the supervision of Mr. Appala Naidu
K., Lecturer, Department of Electrical and Electronics Engineering, Lovely Professional
University, Punjab.
The matter presented in this dissertation has not been submitted by me anywhere for the
award of any other degree or to any other institute. .
Date:
Sushil Kumar Soni
Sachin Rana
Deepak Porwal
This is to certify that the above statement made by the candidate is correct to best of my
knowledge.
Date:
The B.tech Capstone project examination of Design of PLC using Arduino UNO has been held
on May27, 2015.
Signature of Examiner
DECLARATION
We hereby declare that the project work entitled DESIGN OF PLC USING ARDUINO UNO is an
authentic record of our own work carried out as requirements of Capstone Project for the
award of degree of Bachelor of Technology in ELECTRICAL AND ELECTRONICS ENGINEERING
from Lovely Professional University, Phagwara, under the guidance of Mr. Appala Naidu K.,
during January to April 2015.
All the information furnished in this capstone project report is based on our own intensive
work and is genuine.
SACHIN RANA
11108203
May, 2015
DEEPAK PORWAL
11108002
May, 2015
Acknowledgement
There are so many people attached to it directly or indirectly and this project bears no
exception to this fact. On the completion of this project we take the opportunity to express our
deep gratitude and sincere thanks to our project mentor, Mr. Appala Naidu K. whose support
and guidance had always been there since the start of this project to the end. We are highly
grateful to him for his time-to-time feedbacks and precious suggestions. He taught us how to
ask questions and express my ideas and how to work in corporate world.
On this occasion we would like to convey our special thanks to Mr. R.K. Sharma, HOD, School
of Electrical and Electronics Engineering, Lovely Professional University, Punjab. Who
gave us a wonderful chance to do project and provided us an immense learning experience.
We cannot fully express our gratitude to Mr. Appala Naidu K. for providing us the required
theoretical knowledge and clearing our concepts prerequisite for undergoing this project.
Abstract
The PLC (Programmable Logic Controller) has been and still is the basic component of the
industrial automation world. Programmable Logic Controllers were invented to replace relay
control systems. The Industrial application made the PLC systems being very expensive, both
to buy and repair, and also because of the highly specific skills requested to software designers
to extract the maximum potentials from controllers. Arduino is a kind of universal
programmable controller, although it is only the core and in any case it has been built for
general applications; with a little of external hardware (essentially interfaces capable of
transferring signals from sensors and to actuators, reducing the EMI which may damage the
microcontroller) and an appropriate software may, however, become something very similar
to a PLC. Also the software for coding is free of cost means it is an open source. The main
feature of this PLC is that it will be able to interface up to 4 analog input and output module,
means it interface all type of sensors like temperature sensors at input side. Here we are also
design our own scada by using c# programming in visual basic studio software.
So our overall aim is to provide a PLC for small scale industries or for home automation with a
very minimum cost. This Report tells a little about the history of PLC development. It also talks
about the components that make up PLCs. Ladder Logic is discussed briefly as a common way
to program PLCs. The need, and current effort, to standardize PLCs is mentioned.
Contents
Cover Page..1
Certificate2
Declaration.3
Acknowledgement.4
Abstract5
List of Figures8
Abbreviation...10
Chapter 1: Introduction...11
1.1 Automation..11
1.2 PLC..................12
1.3 PLC Language15
1.4 SCADA............16
1.5 Visual Studio...17
1.6 Arduino UNO..18
1.7 DC/AC Motor..19
1.8 PWM Theory...22
Chapter 2: Literature of review..25
Chapter 3: Equipment, Material and Experimental set-up10
3.1 Transformer26
3.2 MCB Miniature Circuit Breaker...27
3.3 Relay28
3.4 Regulators29
3.5 Diodes.30
3.6 LEDs.31
3.7 Crystal oscillator..31
3.8 IC L293D32
3.9 Arduino Kit..34
Chapter 4 Research Methodology37
4.1 Rectifier Circuit.37
4.2 Changer Circuit.40
4.3 Complete Circuit..41
4.4 Coding of Applications42
Chapter 5 Complete work plan with timeline52
Chapter 6 Working and Result53
6.1 Working Process53
6.2 Result..55
List of Figures
Sl. No.
Figure Name
Page No.
1.
PLC
12
2.
13
3.
Ladder Language
15
4.
Instruction
16
5.
SCADA
17
6.
Visual Studio
17
7.
Arduino
18
8.
20
9.
20
10.
AC motor
21
11.
PWM Graph
23
12.
Transformer
26
13.
MCB
27
14.
Relay
28
15.
Diode
30
16.
Leds
31
17.
Crystal
32
18.
IC-L293D
33
19.
Rectifier Ckts
37
20.
Changer Ckts
40
21.
Complete Ckts
41
22.
SCADA View
51
23.
Gantt Chart
52
24.
Working Process
53
Abbreviation
AC
Alternating Current
Capacitor
DC
Direct Current
Current
IC
Integrated Circuit
LED
MCB
MCU
Microcontroller
Np
Ns
Charge
Resistance
Real Power
Voltage
Vp
Primary Voltage
Vs
Secondary Voltage
ZL
Load Impedance
Chapter 1: Introduction
A Programmable Logic Controller (PLC) is a standard industrial control device that provides a
simple, yet robust, method of controlling manufacturing and dynamic processes. As a result of their
low cost, adaptability, and reliability, PLCs are by far the most common control mechanism used by
manufacturing businesses of all sizes for environment control, food processing, motion control, and
automated test equipment. Yet even though PLCs are heavily used by industry, their use in teaching
control theory concepts is uncommon for mechanical engineering programs.
1.1
Automation:
Automation is basically the delegation of human control functions to machines aimed towards
achieving
Higher productivity
Greater efficiency
Reduced errors
Advantages: reduced wiring and space requirements, energy saving, less maintenance and greater
reliability.
Limitations: in case of any change requirement in the control a lot of rework had to be done
which was time consuming and the technology up gradation was costly.
10
1.2
As the desired logic control is achieved through a program these controllers are referred to as
programmable logic controllers, the programmable controller have in recent years experienced
an unprecedented growth as universal element in industrial automation. Control engineering has
evolved over time. In the past humans was the main method for controlling a system. More
recently electricity has been used for control and early electrical control was based on relays.
These relays allow power to be switched on and off without a mechanical switch. It is common
to use relays to make simple logical control decisions. The development of low cost computer
has brought the most recent revolution; Most of this is because of the advantages they offer.
Advantages of PLCs:
PLCs not only are capable of performing the same tasks as hard-wired control, but are also capable
of many more complex applications. In addition, the PLC program and electronic communication
lines replace much of the interconnecting wires required by hard-wired control. Therefore, hardwiring, though still required to connect field devices, is less intensive. This also makes correcting
errors and modifying the application easier. Some of the additional advantages of PLCs are as
follows:
Smaller physical size than hard-wire solutions.
Easier and faster to make changes.
PLCs have integrated diagnostics and override functions.
Diagnostics are centrally available.
Applications can be immediately documented.
Applications can be duplicated faster and less expensively.
11
Input modules.
CPU with processor and program memory.
Output modules.
Bus system.
Power supply.
12
It converts the field signal into a standard control signal for processing by PLC. The standard
control signal delivered by input module could be 5V or 9V whereas the field signal
receiving by it could be say 24V or230V AC
It sends one input at the time to CPU by multiplexing action thus helping in the serial
communication.
Depending upon the nature of the input signal coming from the field the input module, could be:
Program memory
Flags.
The heart of the CPU is the micro processor or microcontroller chip, working of a CPU is fully
controlled by the instructions stores in user program memory, the user program directs and controls
the CPUs memory.
Output module:
The output module act as a link b/w the CPU and the output devices located in the field. The field
devices could be relays, contactor, lamps, and motorized potentiometers, actuators.
The output module converts the output signal delivered by CPU into an appropriate voltage level
suitable for output field devices. But the output module converts this voltage level into say 24 v dc,
120 v dc or 230 v ac etc. Thus the output module in receiving signal from the processor switches
voltage to the respective output terminals.
Power supply:
The power supply modules generate the voltage required by the electronic module of the PLC from
the main supply. typically one phase , 230v ac supply is converted into 24 v DC supply by the power
supply module , it should be noted that the CPU needs 24 V DC input and other voltages required by
the PLC hardware such as 5v dc etc is generated by CPU.
13
Statement list (STL) instructions: include an operation and an operand. The operation to be
performed is shown on the left. The operand, the item to be operated on, is shown on the right.
14
Fig.1.3.2. Instructions
1.4 SCADA:
SCADA (supervisory control and data acquisition) generally refers to industrial control systems
(ICS): computer systems that monitor and control industrial, infrastructure, or facility-based
processes, as described below:
Industrial processes include those of manufacturing, production, power generation,
fabrication, and refining, and may run in continuous, batch, repetitive, or discrete modes.
Infrastructure processes may be public or private, and include water treatment and
distribution, wastewater collection and treatment, oil and gas pipelines, electrical power
transmission and distribution, wind farms, civil defense siren systems, and large
communication systems.
Facility processes occur both in public facilities and private ones, including buildings,
airports, ships, and space stations. They monitor and control HVAC, access, and energy
consumption.
15
1.5
Visual Studio:
Visual Basic provides a graphical user interface GUI that allows the developer drag
and drop objects into the program as well as manually write program code.
16
1.6
Arduino UNO:
Overview:
The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic
resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains
everything needed to support the microcontroller; simply connect it to a computer with a USB cable
or power it with an AC-to-DC adapter or battery to get started.
The Uno differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip.
Instead, it features the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USB-to-serial
converter. 1.0 pin out: added SDA and SCL pins that are near to the AREF pin and two other new
pins placed near to the RESET pin, the IOREF that allow the shields to adapt to the voltage provided
from the board. In future, shields will be compatible with both the board that uses the AVR, which
17
operates with 5V and with the Arduino Due that operates with 3.3V. The second one is a not
connected pin that is reserved for future purposes.
Principle of DC Motor:
This DC or direct current motor works on the principal, when a current carrying conductor is
placed in a magnetic field; it experiences a torque and has a tendency to move. This is known as
motoring action. If the direction of current in the wire is reversed, the direction of rotation also
reverses. When magnetic field and electric field interact they produce a mechanical force, and based
on that the working principle of dc motor established.
18
The direction of rotation of a this motor is given by Flemings left hand rule, which states that if the index
finger, middle finger and thumb of your left hand are extended mutually perpendicular to each other and if
the index finger represents the direction of magnetic field, middle finger indicates the direction of current,
then the thumb represents the direction in which force is experienced by the shaft of the dc motor.
Structurally and construction wise a direct current motor is exactly similar to a DC generator, but electrically
it is just the opposite. Here we unlike a generator we supply electrical energy to the input port and derive
mechanical energy from the output port. We can represent it by the block diagram shown below.
Here in a DC motor, the supply voltage E and current I is given to the electrical port or the input port
and we derive the mechanical output i.e. torque T and speed from the mechanical port or output
port.
The input and output port variables of the direct current motor are related by the parameter K.
So from the picture above we can well understand that motor is just the opposite phenomena of a DC
generator, and we can derive both motoring and generating operation from the same machine by
simply reversing the ports.
19
AC Motors:
Commonly ran by an AC variable frequency drive, an AC electric motor operates by applying
alternating current (AC) power to the electric motor. An AC electric motor consists of several parts
but the main parts are the stator and rotor. The AC electric motors stator has coils that are supplied with
the alternating current and produces a rotating magnetic field. The AC electric motors rotor rotates inside
the electric motors coils and is attached to an output shaft that produces torque by the rotating magnetic
field. There are two different types of AC electric motors and each of them uses a different type of rotor.
The first type of AC motor is called an induction motor (also known as an asynchronous motor).An induction
motor uses a magnetic field on the rotor of an induction motor thats created by an induced current. The
other type of AC motor is called a synchronous motor and rotates precisely at the supply frequency or on a
sub-multiple of the supply frequency. A synchronous motor is able to operate with precision supply
frequency because it doesnt reply on induction. The magnetic field on a synchronous motor is generated
by current delivered through slip rings or a permanent magnet. Synchronous motors run faster than
induction motors because the speed is reduced by the slip of the asynchronous motor.
20
and with a certain duty cycle, the output will appear to behave like a constant voltage analog signal
when providing power to devices.
Example: To create a 3V signal given a digital source that can be either high (on) at 5V or low (off)
at 0V, you can use PWM with a duty cycle of 60% which outputs 5V 60% of the time. If the digital
signal is cycled fast enough, then the voltage seen at the output appears to be the average voltage. If
the digital low is 0V (which is usually the case) then the average voltage can be calculated by taking
the digital high voltage multiplied by the duty cycle, or 5V x 0.6 = 3V. Selecting a duty cycle of
80% would yield 4V, 20% would yield 1V, and so on.
PWM signals are used for a wide variety of control applications. Their main use is for controlling
DC motors but it can also be used to control valves, pumps, hydraulics, and other mechanical parts.
The frequency that the PWM signal needs to be set at will be dependent on the application and the
response time of the system that is being powered. Below are a few applications and some typical
minimum PWM frequencies required?
21
22
23
In early 20th century, microprocessors are used for Automation and controlling power distribution
among various units of an industry. The applications of microprocessor suffer from a basic
limitation that it fails to alter the maximum demand level during load fluctuations and not able to
operate number of outputs. This has resulted in development of PLC circuitry to be incorporated
in the place of microprocessor, in order that the demand level can be altered to suit the load
fluctuations resulting in a smooth uninterrupted and continuous power distribution and also it is
able to handle number of output. PLCs are miniature individual computers, using hardware and
software to perform the control functions. The PLCs consist of two basic sections namely CPU
and the Input/output interface systems. Various controllers that are normally used are
microprocessors, proportional interface derivative controls. The major disadvantages of the
controls are, the problem of fixed imaginary values used for comparing and controlling. PLCs are
preferred more for their merit of providing flexible and absolute real values. The first PLC was
traced back to when Bed Ford Associate developed a device called modular digital control for
general motors. This was used by General Motors to replace the traditional relay based machine
control system. Todays PLCs are designed not only to communicate with control systems, but
also to perform reporting functions and diagnose the failures. Now we are thinking that after that
much invention still we are not able to make a low cost PLC for small scale industries and for
home automation. So we are using an Arduino UNO which full fill that limitation and also
increase the analog input and output port which differentiate our PLC to others. Here we make a
table which shows difference between microprocessor based and Arduino based PLC
Table: PLCs in comparison with Microprocessor controls
PARTS
Inputs
3-5V
PLC
higher rating
Input condition
Non-isolated I/O
Isolated I/O
Programming
Programming of C
is complicated
Environment
C is affected by noise
Outputs
rugged outputs
24
3.1 Transformer:
A transformer is an electrical device that transfers energy between two or more circuits through
electromagnetic induction between 2 isolated coils placed near to each other, due to the principle
of mutual induction the power from one coil is transferred from one coil to the other.
A varying current in the transformer's primary winding creates a varying magnetic flux in the core
and a varying magnetic field impinging on the secondary winding. This varying magnetic field at
the secondary induces a varying electromotive force (emf) or voltage in the secondary winding.
Making use of Faraday's Law in conjunction with high magnetic permeability core properties,
transformers can thus be designed to efficiently change AC voltages from one voltage level to
another within power networks.
25
3.3 Relay:
A relay is an electrically operated switch. Many relays use an electromagnet to mechanically
operate a switch, but other operating principles are also used, such as solid-state relays. Relays are
used where it is necessary to control a circuit by a low-power signal (with complete electrical
isolation between control and controlled circuits), or where several circuits must be controlled by
one signal. The first relays were used in long distance telegraph circuits as amplifiers: they
repeated the signal coming in from one circuit and re-transmitted it on another circuit. Relays
were used extensively in telephone exchanges and early computers to perform logical operations.
A type of relay that can handle the high power required to directly control an electric motor or
other loads is called a contractor. Solid-state relays control power circuits with no moving parts,
instead using a semiconductor device to perform switching. Relays with calibrated operating
characteristics and sometimes multiple operating coils are used to protect electrical circuits from
overload or faults; in modern electric power systems these functions are performed by digital
instruments still called "protective relays".
A telegraph relay, repeating a weak signal received at the end of a long wire
Controlling a high-voltage circuit with a low-voltage signal, as in some types of modems
or audio amplifiers,
Controlling a high-current circuit with a low-current signal, as in the starter solenoid of an
automobile,
Detecting and isolating faults on transmission and distribution lines by opening and
closing circuit breakers (protection relays),
Isolating the controlling circuit from the controlled circuit when the two are at different potentials,
for example when controlling a mains-powered device from a low-voltage switch. The latter is
often applied to control office lighting as the low voltage wires are easily installed in partitions,
which may be often moved as needs change. They may also be controlled by room occupancy
detectors to conserve energy,
3.4 Regulators:
Regulators have an important place in the electrical switch boards. Fan regulators are very similar
to light dimmers. Their function is to regulate/control the speed of the fan and provide a
convenient environment for the residents.
The traditional regulators which are bulky use a resistance having taps and connected in series
with the fan. When we move the knob different amount of resistance gets inserted in the circuit.
Although cheap the biggest problem with such a regulator is that a considerable amount of energy
is lost in form of heat through the resistance. When the fan is operating at low speed the power
loss is significant.
The technologically superior electronic regulators overcome these problems by using electronic
components to control the speed of the fan.
Some of the advantages of electronic fan regulators are:
1.
They provide a continuous speed control.
2.
Power saving at all the speeds.
3.
Smaller size and weight.
The heart of the electronic fan regulator is TRIAC. TRIAC is a semiconductor device belonging
to the family of thyristors.
28
3.5 Diodes:
A diode is a two-terminal electronic component with asymmetric conductance; it has low (ideally
zero) resistance to current in one direction, and high (ideally infinite) resistance in the other. A
semiconductor diode, the most common type today, is a crystalline piece of semiconductor
material with a pn junction connected to two electrical terminals.
A vacuum tube diode has two electrodes, a plate (anode) and a heated cathode. Semiconductor
diodes were the first semiconductor electronic devices. The discovery of crystals' rectifying
abilities was made by German physicist Ferdinand Braun in 1874. The first semiconductor diodes,
called cat's whisker diodes, developed around 1906, were made of mineral crystals such as galena.
Today, most diodes are made of silicon, but other semiconductors such as selenium or germanium
are sometimes used.
29
3.6 LEDs:
A light-emitting diode (LED) is a two-lead semiconductor light source. It is a basic pn-junction
diode, which emits light when activated. When a fitting voltage is applied to the leads, electrons
are able to recombine with electron holes within the device, releasing energy in the form of
photons. This effect is called electroluminescence, and the colour of the light (corresponding to
the energy of the photon) is determined by the energy band gap of the semiconductor.
An LED is often small in area (less than 1 mm2) and integrated optical components may be used
to shape its radiation pattern.
Appearing as practical electronic components in 1962, the earliest LEDs emitted low-intensity
infrared light. Infrared LEDs are still frequently used as transmitting elements in remote-control
circuits, such as those in remote controls for a wide variety of consumer electronics. The first
visible-light LEDs were also of low intensity, and limited to red. Modern LEDs are available
across the visible, ultraviolet, and infrared wavelengths, with very high brightness.
Early LEDs were often used as indicator lamps for electronic devices, replacing small
incandescent bulbs. They were soon packaged into numeric readouts in the form of seven-segment
displays, and were commonly seen in digital clocks.
30
The most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits
incorporating them became known as crystal oscillators, but other piezoelectric materials
including polycrystalline ceramics are used in similar circuits.
3.8 IC L293D:
L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as current
amplifiers since they take a low-current control signal and provide a higher-current signal. This
higher current signal is used to drive the motors.
L293D contains two inbuilt H-bridge driver circuits. In its common mode of operation, two DC
motors can be driven simultaneously, both in forward and reverse direction. The motor operations
of two motors can be controlled by input logic at pins 2 & 7 and 10 & 15. Input logic 00 or 11 will
stop the corresponding motor. Logic 01 and 10 will rotate it in clockwise and anticlockwise
directions, respectively.
Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to start operating.
When an enable input is high, the associated driver gets enabled. As a result, the outputs become
active and work in phase with their inputs. Similarly, when the enable input is low, that driver is
disabled, and their outputs are off and in the high-impedance state.
31
Features:
Technical Specification:
Power Supply: Over FRC connector 5V DC
External Power 9V to 24V DC
Dimensional Size: 44mm x 37mm x 14mm (l x b x h)
Temperature Range: 0C to +70 C
32
The Uno differs from all preceding boards in that it does not use the FTDI USB-to-serial driver
chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USBto-serial converter.
SummaryMicrocontroller
Operating Voltage
Input Voltage (recommended)
Input Voltage (limits)
Digital I/O Pins
Analog Input Pins
DC Current per I/O Pin
DC Current for 3.3V Pin
Flash Memory
SRAM
EEPROM
Clock Speed
Length
Width
Weight
ATmega328
5V
7-12V
6-20V
14 (of which 6 provide PWM output)
6
40 mA
50 mA
32 KB (ATmega328) of which 0.5 KB used by boot loader
2 KB (ATmega328)
1 KB (ATmega328)
16 MHz
68.6 mm
53.4 mm
25 g
Power:
The Arduino Uno can be powered via the USB connection or with an external power supply. The
power source is selected automatically. External (non-USB) power can come either from an ACto-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm centrepositive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and VIN
pin headers of the POWER connector.The board can operate on an external supply of 6 to 20
volts.
33
If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board
may be unstable. If using more than 12V, the voltage regulator may overheat and damage the
board. The recommended range is 7 to 12 volts.
The power pins are as follows:
VIN. The input voltage to the Arduino board when it's using an external power source (as opposed
to 5 volts from the USB connection or other regulated power source). You can supply voltage
through this pin, or, if supplying voltage via the power jack, access it through this pin.
5V.This pin outputs a regulated 5V from the regulator on the board. The board can be supplied
with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of
the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can
damage your board. We don't advise it.
3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.
IOREF. This pin on the Arduino board provides the voltage reference with which the
microcontroller operates. A properly configured shield can read the IOREF pin voltage and select
the appropriate power source or enable voltage translators on the outputs for working with the 5V
or 3.3V
Memory:
The ATmega328 has 32 KB (with 0.5 KB used for the boot loader). It also has 2 KB of SRAM
and 1 KB of EEPROM.
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins
are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.
34
External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a
rising or falling edge, or a change in value. See the attach Interrupt () function for details.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analog Write () function.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using
the SPI library.
LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the
LED is on, when the pin is LOW, it's off.
The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution
(i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible
to change the upper end of their range using the AREF pin and the analog Reference function.
Additionally, some pins have specialized functionality:
TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire library.
There are a couple of other pins on the board:
AREF. Reference voltage for the analog inputs. Used with analog Reference().
Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to
shields which block the one on the board.
35
36
The no-load output DC voltage of an ideal half wave rectifier for a sinusoidal input voltage is
Where:
Vdc, Vav - the DC or average output voltage,
Vpeak, the peak value of the phase input voltages,
Vrms, the root-mean-square value of output voltage.
4.1.2. Full-wave rectification.
A full-wave rectifier converts the whole of the input waveform to one of constant polarity
(positive or negative) at its output. Full-wave rectification converts both polarities of the input
waveform to pulsating DC (direct current), and yields a higher average output voltage. Two
diodes and a center tapped transformer, or four diodes in a bridge configuration and any AC
source (including a transformer without center tap), are needed. Single semiconductor diodes,
double diodes with common cathode or common anode, and four-diode bridges, are manufactured
as single components.
For single-phase AC, if the transformer is center-tapped, then two diodes back-to-back (cathodeto-cathode or anode-to-anode, depending upon output polarity required) can form a full-wave
rectifier. Twice as many turns are required on the transformer secondary to obtain the same output
voltage than for a bridge rectifier, but the power rating is unchanged.
Fig. 4.1.2.2. Full-wave rectifier using a center tap transformer and 2 diodes
The average and root-mean-square no-load output voltages of an ideal single-phase full-wave
rectifier are:
Very common double-diode rectifier vacuum tubes contained a single common cathode and two
anodes inside a single envelope, achieving full-wave rectification with positive output. The 5U4
and 5Y3 were popular examples of this configuration.
38
39
40
41
Counter Up Down:
Counter ctr(10);
// Counts up or down in range 0-10, starting at zero
unsigned long TIMER0 = 0; // Define variable used to hold timer 0 elapsed time
unsigned long TIMER1 = 0; // Define variable used to hold timer 1 elapsed time
void setup() {
setupPLC();
// Setup inputs and outputs
}
void loop() {
in(X0);
// Read Input 0
timerOn(TIMER0, 10); // 10 ms switch debounce delay
ctr.countUp();
// Count up
in(X1);
// Read Input 1
timerOn(TIMER1, 10); // 10 ms switch debounce delay
ctr.countDown();
// Count down
in(X2);
// Read input X1
ctr.clear();
// Clear counter (counter at lower limit)
in(X3);
// Read input X2
ctr.preset();
// Preset counter (counter at upper limit)
ctr.lowerQ();
// Display Count Down output on Y0
out(Y0);
ctr.upperQ();
// Display Count Up output on Y1
out(Y1);
}
Digital input/output:
void setup()
{
setupPLC(); // Setup inputs and outputs
}
void loop() {
in(X0);
// Read Input 0
out(Y0);
// Send to Output 0
// Send to Output 1
in(X2);
// Read Input 2
42
Latch Command:
void setup() {
setupPLC();
}
void loop() {
in(X0);
latch(Y0, X1);
in(Y0);
outNot(Y1);
}
void loop() {
in(X0);
set(Y0);
in(X1);
reset(Y0);
43
// Read Input 0
in(X0);
// Read Input 0
in(X0);
// Read Input 0
in(X0);
// Read Input 0
// Read Input 0
// NOR
in(X0);
// Read Input 0
// XNOR
in(X0);
// Read Input 0
Delay Off:
void setup() {
setupPLC();
}
void loop() {
in(X0);
// Read Input 0
// Output to Output 0
Delay On:
void setup() {
setupPLC();
}
void loop() {
in(X0);
// Read Input 0
45
// Output to Output 0
in(X1);
// Read Input 1
// Output to Output 1
}
void loop() {
in(X0);
// Read Input 0
orNotBit(X1);
out(Y1);
{
serialPort1.WriteLine("B");
}
serialPort1.Close();
textBox3.Text = ("ON");
panel2.BackColor = Color.Green;
}
private void button4_Click(object sender, EventArgs e)
{
serialPort1.Open();
if (serialPort1.IsOpen)
{
serialPort1.WriteLine("b");
}
serialPort1.Close();
textBox3.Text = ("OFF");
panel2.BackColor = Color.Red;
}
private void button5_Click(object sender, EventArgs e)
{
serialPort1.Open();
if (serialPort1.IsOpen)
{
serialPort1.WriteLine("C");
}
serialPort1.Close();
textBox4.Text = ("ON");
panel3.BackColor = Color.Green;
}
private void button6_Click(object sender, EventArgs e)
{
serialPort1.Open();
if (serialPort1.IsOpen)
{
serialPort1.WriteLine("c");
}
serialPort1.Close();
textBox4.Text = ("OFF");
panel3.BackColor = Color.Red;
}
private void button7_Click(object sender, EventArgs e)
{
48
serialPort1.Open();
if (serialPort1.IsOpen)
{
serialPort1.WriteLine("D");
}
serialPort1.Close();
textBox5.Text = ("ON");
panel4.BackColor = Color.Green;
}
private void button8_Click(object sender, EventArgs e)
{
serialPort1.Open();
if (serialPort1.IsOpen)
{
serialPort1.WriteLine("d");
}
serialPort1.Close();
textBox5.Text = ("OFF");
panel4.BackColor = Color.Red;
}
private void button9_Click(object sender, EventArgs e)
{
serialPort1.Open();
if (serialPort1.IsOpen)
{
serialPort1.WriteLine("S");
}
serialPort1.Close();
panel1.BackColor = Color.Red;
panel2.BackColor = Color.Red;
panel3.BackColor = Color.Red;
panel4.BackColor = Color.Red;
textBox2.Text = ("OFF");
textBox3.Text = ("OFF");
textBox4.Text = ("OFF");
textBox5.Text = ("OFF");
}
}
}
49
After run this program we will get an own software for control the PLC which look like that,
mention below.
50
51
Block Diagram shows working process of my project. Let us study step by step process and
thinking for my project, how I create this.
Sensors or push button initiate the Input Module and input module send the signal to the
Arduino. Arduino link with the computer by serially interface in which programming software is
installed. Now according to the input and programming Arduino gives the result at output side.
Although operation of PLC as a DC or AC it depends upon connected load at output side and
status of change over system
52
Steps:
1-Firstly we are using Arduino Kit as a core of my project.
2- Then interfaces the push button with Input module at input side.
3- Then interface the relay board with output module at output side.
4- Now we are using a changer circuit to change the AC to DC and DC to AC by relay.
5- Now the output of that changer circuit is fed back to the main supply of PLC means at the
relay board.
6- For supply we are using 220v AC or 18v 6A DC power bank.
7- We are using 1K resistors at input side with all push button for pull up operation.
8- Now we are burn the program in Arduino by computer.
Example.
How counter application is done in that PLC.
For UP Counter initial value is zero (0) let us take we are programming in that way so that it
countess up to 10.
Now let us take input is ----X0
Output is ------Y0
When we press X0 then count increases (+1) now again we press X0 up to 10 times and when it
completes pre determine counters value it makes the Y0 high.
This is the simple working of counter application.
53
6.2 Result:
After complete of this project we are making a investigation on some point which are effect the
PLCs operation. The point is related to the controllers used for making PLC.
Now here I described why these points are important and how these are different in simple PLC
and Arduino based PLC.
These points are
Environmental issue:
Certain environments may affect the operation of a controller. For example, typical controllers
have an operating temperature of 0-55 degrees Celsius (32-130 degrees F).but Arduino have an
operating temperature range of 0-80 degrees Celsius. If your application will include any
extreme environmental conditions, or you have specific codes at your facility that must be met,
you will need to either research products that meet those specifications or design the installation
to meet requirements. Check appropriate entry.
Discrete Devices:
The number and type of devices your system will include is directly linked to the amount of I/O
that will be necessary for your system. You will need to choose a controller that supports your
I/O count requirements and has modules that support your signal types. Enter quantities and type
based on corresponding field devices. Arduino based PLC supports all types of sensors and
actuators.
Analog Devices:
The number and type of devices your system will include is directly linked to the amount of I/O
that will be necessary for your system. You will need to choose a controller that supports your
I/O count requirements and has modules that support your signal types. Enter quantities and type
based on corresponding field devices. Arduino based PLC have up to 6 analog outputs.
Communication:
Communication ports (other than the programming port) are not always included with a
controller. Knowing your system communication requirements will help you choose a CPU that
supports your communication requirements, or additional communication modules if necessary.
Check any/all communications functions required. Arduino communicate other networks,
systems or field devices.
Programming:
Certain controllers may not support every type of instruction. You will need to choose a model
that supports all instructions that you may need for a specific application. For example, built-in
PID functions are much easier to use than writing your own code to perform closed-loop process
control. Typical instructions such as timers, counters, etc. are available in most controllers; note
any other special instructions required here. Check any/all programming functions required.
54
55
References
1- https://www.wikipedia.org
2- http://www.open-electronics.org/arduino-as-a-programmable-logic-controller-plc/
3- http://www.arduino.cc/
4- http://www.freescale.com/
5- P.S. Bhimbhra , Power Electronics, Khanna Publishers-Delhi
6- Ashfaq Hussain, Electrical Machine, Dhanpat Rai Publications, 2012
7- Design of embedded based three phase preventer and selector system for
industrial applications-IJECET- ISSN 0976 6464, ISSN 0976 - 6472, Vol. 4,
Issue 1, January- February (2013), pp. 183 188
8- A cost effective approach to implementing change over system - ISSN-L: 22239553, ISSN: 2223-9944 Vol. 2, No. 2, March 2012
9- Smart phase change-over system with AT89C52 microcontroller, IOSR Journal of
Electrical and Electronics Engineering (IOSRJEEE) ISSN: 2278-1676 Volume 1,
Issue 3 (July-Aug. 2012), PP 31-34
10- Freescale Semiconductor Application Note Document Number: AN3471 Rev. 0,
07/2008
11- Siemens
AG,
2003a.
Siemens
http://www.control.com/thread/1254143982
LOGO
Manual.
56
57