main project documentation
TRANSCRIPT
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
CHAPTER-1
INTRODUCTION:
The aim of this project is used for automation of mechatronic processes, such as control of
machinery on factory assembly lines, control of amusement rides, or control of lighting fixtures.
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.
These systems are being advanced by ongoing research and development activities;
one major activity entails the application with sensors to material-handling,
inspection, and assembly operations.
1
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
CHAPTER-2
EMBEDDED SYSYTEMS
2.1: Introduction to Embedded System:
Embedded system is the combination of both software and hardware. A embedded system is a system which is going to do a predefined specified task is the embedded system and is even defined as combination of both software and hardware
A general-purpose definition of embedded systems is that they are devices used to
control, monitor or assist the operation of equipment, machinery or plant.
"Embedded" reflects the fact that they are an integral part of the system. In many
cases their embedded may be such that their presence is far from obvious to the
casual observer and even the more technically skilled might need to examine the
operation of a piece of equipment for some time before being able to conclude that an
embedded control system was involved in its functioning. At the other extreme a
general-purpose computer may be used to control the operation of a large complex
processing plant, and its presence will be obvious.
All embedded systems are including computers or microprocessors. Some of these
computers are however very simple systems as compared with a personal computer.
The very simplest embedded systems are capable of performing only a single function
or set of functions to meet a single predetermined purpose. In more complex systems
an application program that enables the embedded system to be used for a particular
purpose in a specific application determines the functioning of the embedded system.
The ability to have programs means that the same embedded system can be used for a
variety of different purposes. In some cases a microprocessor may be designed in
such a way that application software for a particular purpose can be added to the basic
software in a second process, after which it is not possible to make further changes.
The applications software on such processors is sometimes referred to as firmware
2
Embedded System
Software Hardware
ALPCVB Etc.,
ProcessorPeripheralsmemory
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
The simplest devices consist of a single microprocessor (often called a "chip”), which
may itself be packaged with other chips in a hybrid system or Application Specific
Integrated Circuit (ASIC). Its input comes from a detector or sensor and its output
goes to a switch or activator which (for example) may start or stop the operation of a
machine or, by operating a valve, may control the flow of fuel to an engine.
Block diagram of Embedded System:
FIG 2.1.1: BLOCK DIAGRAM OF EMBEDDED SYSTEM
Software deals with the languages like ALP, C, and VB etc., and Hardware deals with
Processors, Peripherals, and Memory.
Memory: It is used to store data or address.
Peripherals: These are the external devices connected
Processor: It is an IC which is used to perform some task
Processors are classified into four types like:
1. Micro Processor (µp)
2. Micro controller (µc)
3. Digital Signal Processor (DSP)
3
EEPROM, ADC, DAC, Timers,
USART, OscillatorsEtc.,
ALU
CU
Memory
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
4. Application Specific Integrated Circuits (ASIC)
Micro Processor (µp):
It is an electronic chip which performs arithmetic and logical operations with
assistance of internal memory.
Block Diagram of Micro Processor (µp):
ALU
CU
MEMORY
FIG 2.1.2: BLOCK DIAGRAM OF MICRO PROCESSOR (µP)
Micro Controller (µc):
It is a highly integrated micro processor designed for specific use in embedded
systems.
Block Diagram of Micro Controller (µc):
FIG 2.1.3: BLOCK DIAGRAM OF MICRO CONTROLLER (µC)
4
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
Digital Signal Processor (DSP):
It is the study of signals in digital representation and processing methods of
these signals. It is used where large mathematical and scientific calculations are
required.
Application Specific Integrated circuits (ASIC):
It is an IC designed for a specific application. This IC designed for specific
application can’t be used for other applications.
5
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
CHAPTER-3
HARDWARE DESCRIPTION
3.1: INTRODUCTION WITH BLOCK DIAGRAM:
1. THEFT IDENTIFICATION:
6
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
2. AUTOMATIC VEHICLE PARKING:
7
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
3. STREET LIGHTING:
LM393
GND
4. FIRE ALARM:
LM393
GND
8
LDR
+
POT
THERMISTOR
+
POT
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
3.2: MICROCONTROLLER AT89S52:
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with
8K bytes of in-system programmable Flash memory. The device is manufactured
using Atmel’s high-density non volatile memory technology and is compatible with
the industry standard 80C51 instruction set and pin out. The on-chip Flash allows the
program memory to be reprogrammed in-system or by a conventional non volatile
memory programmer. By combining a versatile 8-bit CPU with in-system
programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful
microcontroller which provides a highly-flexible and cost-effective solution to many
embedded control applications.
The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes
of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters,
a six-vector two-level interrupt architecture, a full duplex serial port, on-chip
oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic
for operation down to zero frequency and supports two software selectable power
saving modes. The Idle Mode stops the CPU while allowing the RAM,
timer/counters, serial port, and interrupt system to continue functioning. The Power-
down mode saves the RAM contents but freezes the oscillator, disabling all other chip
functions until the next interrupt or hardware reset.
Features:
• Compatible with MCS®-51 Products
• 8K Bytes of In-System Programmable (ISP) Flash Memory
– Endurance: 10,000 Write/Erase Cycles
• 4.0V to 5.5V Operating Range
• Fully Static Operation: 0 Hz to 33 MHz
• Three-level Program Memory Lock
9
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
• 256 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Three 16-bit Timer/Counters
• Eight Interrupt Sources
• Full Duplex UART Serial Channel
• Low-power Idle and Power-down Modes
• Interrupt Recovery from Power-down Mode
• Watchdog Timer
• Dual Data Pointer
• Power-off Flag
• Fast Programming Time
• Flexible ISP Programming (Byte and Page Mode)
• Green (Pb/Halide-free) Packaging Option
Block Diagram of AT89S52:
FIG 3.2.1: BLOCK DIAGRAM OF AT89S52
10
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
Pin Configurations of AT89S52:
FIG 3.2.2: PIN DIAGRAM OF AT89S52
Pin Description:
VCC: Supply voltage.
GND: Ground.
Port 0:
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can
sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as
high-impedance inputs. Port 0 can also be configured to be the multiplexed low-order
address/data bus during accesses to external program and data memory. In this mode,
P0 has internal pull-ups. Port 0 also receives the code bytes during Flash
programming and outputs the code bytes during program verification. External pull-
ups are required during program verification.
Port 1:
Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins
11
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
that are externally being pulled low will source current (IIL) because of the internal
pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2
external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX).
Port 2:
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins
that are externally being pulled low will source current (IIL) because of the internal
pull-ups. Port 2 emits the high-order address byte during fetches from external
program memory and during accesses to external data memory that uses 16-bit
addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups
when emitting 1s. During accesses to external data memory that uses 8-bit addresses
(MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register.
Port 3:
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins
that are externally being pulled low will source current (IIL) because of the pull-ups.
RST:
Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device. This pin drives high for 98 oscillator periods after the Watchdog
times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this
feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled.
ALE/PROG:
Address Latch Enable (ALE) is an output pulse for latching the low byte of the
address during accesses to external memory. This pin is also the program pulse input
12
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
(PROG) during Flash programming. In normal operation, ALE is emitted at a
constant rate of 1/6 the oscillator frequency and may be used for external timing or
clocking purposes. Note, however, that one ALE pulse is skipped during each access
to external data memory.
PSEN:
Program Store Enable (PSEN) is the read strobe to external program memory. When
the AT89S52 is executing code from external program memory, PSEN is activated
twice each machine cycle, except that two PSEN activations are skipped during each
access to external data memory.
EA/VPP:
External Access Enable. EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH.
Note, however, that if lock bit 1 is programmed, EA will be internally latched on
reset. EA should be strapped to VCC for internal program executions. This pin also
receives the 12-volt programming enable voltage (VPP) during Flash programming.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.
XTAL2:
Output from the inverting oscillator amplifier
Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier
which can be configured for use as an on-chip oscillator, as shown in Figure 1. Either
a quartz crystal or ceramic resonator may be used. To drive the device from an
external clock source, XTAL2 should be left unconnected while XTAL1 is driven as
13
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
shown in Figure 6.2. There are no requirements on the duty cycle of the external
clock signal, since the input to the internal clocking circuitry is through a divide-by-
two flip-flop, but minimum and maximum voltage high and low time specifications
must be observed.
FIG 3.2.3: OSCILLATOR CONNECTIONS
FIG 3.2.4: EXTERNAL CLOCK DRIVE CONFIGURATION
Idle Mode:
In idle mode, the CPU puts itself to sleep while all the on chip peripherals remain
active. The mode is invoked by software. The content of the on-chip RAM and all the
special functions registers remain unchanged during this mode. The idle mode can be
terminated by any enabled interrupt or by a hardware reset.
14
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
Power down Mode:
In the power down mode the oscillator is stopped, and the instruction that invokes
power down is the last instruction executed. The on-chip RAM and Special Function
Registers retain their values until the power down mode is terminated. The only exit
from power down is a hardware reset. Reset redefines the SFRs but does not change
the on-chip RAM. The reset should not be activated before VCC is restored to its
normal operating level and must be held active long enough to allow the oscillator to
restart and stabilize.
3.3 REGULATED POWER SUPPLY:
Power supply is a supply of electrical power. A device or system that supplies electrical
or other types of energy to an output load or group of loads is called a power supply
unit or PSU. The term is most commonly applied to electrical energy supplies, less
often to mechanical ones, and rarely to others.
A power supply may include a power distribution system as well as primary or
secondary sources of energy such as
Conversion of one form of electrical power to another desired form and
voltage, typically involving converting AC line voltage to a well-regulated
lower-voltage DC for electronic devices. Low voltage, low power DC power
supply units are commonly integrated with the devices they supply, such
as computers and household electronics.
Batteries.
Chemical fuel cells and other forms of energy storage systems.
Solar power.
Generators or alternators.
15
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
Block Diagram:
FIG 3.3.1 REGULATED POWER SUPPLY
The basic circuit diagram of a regulated power supply (DC O/P) with led connected
as load is shown in fig: 3.3.2.
FIG 3.3.2 CIRCUIT DIAGRAM OF REGULATED POWER SUPPLY WITH
LED CONNECTION
The components mainly used in above figure are:
230V AC MAINS
TRANSFORMER
BRIDGE RECTIFIER(DIODES)
CAPACITOR
VOLTAGE REGULATOR(IC 7805)
RESISTOR
16
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
LED(LIGHT EMITTING DIODE)
The detailed explanation of each and every component mentioned above is as
follows:
Transformation: The process of transforming energy from one device to another is
called transformation. For transforming energy we use transformers.
Transformers: A transformer is a device that transfers electrical energy from
one circuit to another through inductively coupled conductors without changing its
frequency. A varying current in the first or primary winding creates a
varying magnetic flux in the transformer's core, and thus a varying magnetic
field through the secondary winding. This varying magnetic field induces a
varying electromotive force (EMF) or "voltage" in the secondary winding. This effect
is called mutual induction.
If a load is connected to the secondary, an electric current will flow in the secondary
winding and electrical energy will be transferred from the primary circuit through the
transformer to the load. This field is made up from lines of force and has the same
shape as a bar magnet.
If the current is increased, the lines of force move outwards from the coil. If the
current is reduced, the lines of force move inwards.
If another coil is placed adjacent to the first coil then, as the field moves out or in, the
moving lines of force will "cut" the turns of the second coil. As it does this, a voltage
is induced in the second coil. With the 50 Hz AC mains supply, this will happen 50
times a second. This is called MUTUAL INDUCTION and forms the basis of the
transformer.
The input coil is called the PRIMARY WINDING; the output coil is the
SECONDARY WINDING. Fig: 3.3.4 shows step-down transformer.
17
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
FIG 3.3.3: STEP-DOWN TRANSFORMER
The voltage induced in the secondary is determined by the TURNS RATIO.
For example, if the secondary has half the primary turns; the secondary will have half
the primary voltage.
Another example is if the primary has 5000 turns and the secondary has 500 turns,
then the turn’s ratio is 10:1.
If the primary voltage is 240 volts then the secondary voltage will be x 10 smaller =
24 volts. Assuming a perfect transformer, the power provided by the primary must
equal the power taken by a load on the secondary. If a 24-watt lamp is connected
across a 24 volt secondary, then the primary must supply 24 watts.
To aid magnetic coupling between primary and secondary, the coils are wound on a
metal CORE. Since the primary would induce power, called EDDY CURRENTS,
into this core, the core is LAMINATED. This means that it is made up from metal
sheets insulated from each other. Transformers to work at higher frequencies have an
iron dust core or no core at all.
18
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
Note that the transformer only works on AC, which has a constantly changing current
and moving field. DC has a steady current and therefore a steady field and there
would be no induction.
Some transformers have an electrostatic screen between primary and secondary. This
is to prevent some types of interference being fed from the equipment down into the
mains supply, or in the other direction. Transformers are sometimes used for
IMPEDANCE MATCHING.
We can use the transformers as step up or step down.
Step Up transformer: In case of step up transformer, primary windings are every
less compared to secondary winding.
Because of having more turns secondary winding accepts more energy, and it
releases more voltage at the output side.
Step down transformer: In case of step down transformer, Primary winding induces
more flux than the secondary winding, and secondary winding is having less number
of turns because of that it accepts less number of flux, and releases less amount of
voltage.
Battery power supply: A battery is a type of linear power supply that offers benefits
that traditional line-operated power supplies lack: mobility, portability and reliability.
A battery consists of multiple electrochemical cells connected to provide the voltage
desired. Fig: 3.3.5 shows Hi-Watt 9V battery
19
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
FIG 3.3.4: HI-WATT 9V BATTERY
The most commonly used dry-cell battery is the carbon-zinc dry cell battery. Dry-cell
batteries are made by stacking a carbon plate, a layer of electrolyte paste, and a zinc
plate alternately until the desired total voltage is achieved. The most common dry-cell
batteries have one of the following voltages: 1.5, 3, 6, 9, 22.5, 45, and 90. During the
discharge of a carbon-zinc battery, the zinc metal is converted to a zinc salt in the
electrolyte, and magnesium dioxide is reduced at the carbon electrode. These actions
establish a voltage of approximately 1.5 V.
The lead-acid storage battery may be used. This battery is rechargeable; it consists of
lead and lead/dioxide electrodes which are immersed in sulphuric acid. When fully
charged, this type of battery has a 2.06-2.14 V potential (A 12 volt car battery uses 6
cells in series). During discharge, the lead is converted to lead sulphate and the
sulphuric acid is converted to water. When the battery is charging, the lead sulphate is
converted back to lead and lead dioxide A nickel-cadmium battery has become more
popular in recent years. This battery cell is completely sealed and rechargeable. The
electrolyte is not involved in the electrode reaction, making the voltage constant over
the span of the batteries long service life. During the charging process, nickel oxide is
oxidized to its higher oxidation state and cadmium oxide is reduced. The nickel-
cadmium batteries have many benefits. They can be stored both charged and
uncharged. They have a long service life, high current availabilities, constant voltage,
and the ability to be recharged. Fig: 3.3.6 shows pencil battery of 1.5V.
20
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
FIG 3.3.5: PENCIL BATTERY OF 1.5V
RECTIFICATION: The process of converting an alternating current to a pulsating
direct current is called as rectification. For rectification purpose we use rectifiers.
Rectifiers: A rectifier is an electrical device that converts alternating current (AC) to
direct current (DC), a process known as rectification. Rectifiers have many uses
including as components of power supplies and as detectors of radio signals.
Rectifiers may be made of solid-state diodes, vacuum tube diodes, mercury arc
valves, and other components.
A device that it can perform the opposite function (converting DC to AC) is known as
an inverter.
When only one diode is used to rectify AC (by blocking the negative or positive
portion of the waveform), the difference between the term diode and the term rectifier
is merely one of usage, i.e., the term rectifier describes a diode that is being used to
convert AC to DC. Almost all rectifiers comprise a number of diodes in a specific
arrangement for more efficiently converting AC to DC than is possible with only one
diode. Before the development of silicon semiconductor rectifiers, vacuum tube
diodes and copper (I) oxide or selenium rectifier stacks were used.
Bridge full wave rectifier: The Bridge rectifier circuit is shown in fig: 3.3.7, which
converts an ac voltage to dc voltage using both half cycles of the input ac voltage.
21
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
The Bridge rectifier circuit is shown in the figure. The circuit has four diodes
connected to form a bridge. The ac input voltage is applied to the diagonally opposite
ends of the bridge. The load resistance is connected between the other two ends of the
bridge.
For the positive half cycle of the input ac voltage, diodes D1 and D3 conduct,
whereas diodes D2 and D4 remain in the OFF state. The conducting diodes will be in
series with the load resistance RL and hence the load current flows through RL.
For the negative half cycle of the input ac voltage, diodes D2 and D4 conduct
whereas, D1 and D3 remain OFF. The conducting diodes D2 and D4 will be in series
with the load resistance RL and hence the current flows through RL in the same
direction as in the previous half cycle. Thus a bi-directional wave is converted into a
unidirectional wave.
FIG 3.3.6: BRIDGE RECTIFIER
3.4: PIR SENSORS:
A Passive Infra Red sensor (PIR sensor) is an electronic device that measures infrared
(IR) light radiating from objects in its field of view. PIR sensors are often used in the
construction of PIR-based motion detectors . Apparent motion is detected when an
infrared source with one temperature, such as a human, passes in front of an infrared
source with another temperature, such as a wall.
22
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
All objects emit what is known as black body radiation. It is usually infrared radiation
that is invisible to the human eye but can be detected by electronic devices designed
for such a purpose. The term passive in this instance means that the PIR device does
not emit an infrared beam but merely passively accepts incoming infrared radiation.
“Infra” meaning below our ability to detect it visually, and “Red” because this colour
represents the lowest energy level that our eyes can sense before it becomes invisible.
Thus, infrared means below the energy level of the colour red, and applies to many
sources of invisible energy.
The PIR (Passive Infra-Red) Sensor is a pyroelectric device that detects motion by
measuring changes in the infrared levels emitted by surrounding objects. This motion
can be detected by checking for a high signal on a single I/O pin.
Features:
Single bit output
Small size makes it easy to conceal
Compatible with all Parallax microcontrollers
Theory of Operation:
Pyroelectric devices, such as the PIR sensor, have elements made of a crystalline
material that generates an electric charge when exposed to infrared radiation. The
changes in the amount of infrared striking the element change the voltages generated,
which are measured by an on-board amplifier. The device contains a special filter
called a Fresnel lens, which focuses the infrared signals onto the element. As the
ambient infrared signals change rapidly, the on-board amplifier trips the output to
indicate motion.
Pin Definitions and Ratings:
Pin Name Function
23
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
- GND Connects to Ground or Vss.
+ V+ Connects to +5 VDC or Vdd.
OUT Output Connects to an I/O pin set to INPUT mode
Once the sensor warms up (settles) the output will remain low until there is motion, at
which time the output will swing high for a couple of seconds, then return low. If
motion continues the output will cycle in this manner until the sensors line of sight of
still again
Calibration:
The PIR Sensor requires a ‘warm-up’ time in order to function properly. This is due
to the settling time involved in ‘learning’ its environment. This could be anywhere
from 10-60 seconds. During this time there should be as little motion as possible in
the sensors field of view.
Sensitivity:
The PIR Sensor has a range of approximately 20 feet. This can vary with
environmental conditions. The sensor is designed to adjust to slowly changing
conditions that would happen normally as the day progresses and the environmental
conditions change, but responds by toggling its output when sudden changes occur,
such as when there is motion..
3.5: LIGHT SENSOR:
Light Dependent Resistor (LDR) also known as photoconductor or photocell, is a
device which has a resistance which varies according to the amount of light falling on
its surface. Since LDR is extremely sensitive in visible light range, it is well suited for
the proposed application.
24
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
FIG 3.5.1: LIGHT DEPENDENT RESISTOR
Features of the light sensor:
The Light Dependent Resistor (LDR) is made using the semiconductor Cadmium Sulphide (CdS).
The light falling on the brown zigzag lines on the sensor causes the resistance of the device to fall. This is known as a negative co-efficient. There are some LDRs that work in the opposite way i.e. their resistance increases with light (called positive co- efficient).
The resistance of the LDR decreases as the intensity of the light falling on it increases.
Incident photons drive electrons from the valence band into the conduction band.
Fig3.5.2: Structure of a Light Dependent Resistor, showing Cadmium Sulphide track and an atom to illustrate electrons in the valence and conduction bands
Functional description:
• An LDR and a normal resistor are wired in series across a voltage, as
shown in the circuit below. Depending on which is tied to the 5V and
which to 0V, the voltage at the point between them, call it the sensor node,
25
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
will either rise or fall with increasing light. If the LDR is the component
tied directly to the 5V, the sensor node will increase in voltage with
increasing light
• The LDR's resistance can reach 10 k ohms in dark conditions and about
100 ohms in full brightness.
• The circuit used for sensing light in our system uses a 10 kΩ fixed
resistor which is tied to +5V. Hence the voltage value in this case decreases
with increase in light intensity.
FIG3.5.3: LIGHT SENSOR CIRCUIT
• The sensor node voltage is compared with the threshold voltages for
different levels of light intensity corresponding to the four conditions-
Optimum, dim, dark and night.
• The relationship between the resistance RL and light intensity
Lux for a typical LDR
RL = 500 / Lux kΩ ………………….(4.1)
•With the LDR connected to 5V through a 10K resistor, the output voltage of the LDRis:
26
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
Vo = 5*RL / (RL+10) (4.2)
• In order to increase the sensitivity of the sensor we must reduce the value of
the fixed resistor in series with the sensor. This may be done by putting
other resistors in parallel with it.
3.6: DC MOTOR
A DC motor is an electric motor that runs on direct current (DC) electricity. In any
electric motor, operation is based on simple electromagnetism. A current-carrying
conductor generates a magnetic field; when this is then placed in an external magnetic
field, it will experience a force proportional to the current in the conductor, and to the
strength of the external magnetic field. As you are well aware of from playing with
magnets as a kid, opposite (North and South) polarities attract, while like polarities
(North and North, South and South) repel. The internal configuration of a DC motor
is designed to harness the magnetic interaction between a current-carrying conductor
and an external magnetic field to generate rotational motion.
Let's start by looking at a simple 2-pole DC electric motor (here red represents a
magnet or winding with a "North" polarization, while green represents a magnet or
winding with a "South" polarization).
FIG 3.6.1: DC MOTOR
Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator,
commutator, field magnet(s), and brushes. In most common DC motors, the external
magnetic field is produced by high-strength permanent magnets. The stator is the
27
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
stationary part of the motor -- this includes the motor casing, as well as two or more
permanent magnet pole pieces. The rotor rotates with respect to the stator. The rotor
consists of windings (generally on a core), the windings being electrically connected
to the commutator. The above diagram shows a common motor layout -- with the
rotor inside the stator (field) magnets.
The geometry of the brushes, commutator contacts, and rotor windings are such that
when power is applied, the polarities of the energized winding and the stator
magnet(s) are misaligned, and the rotor will rotate until it is almost aligned with the
stator's field magnets. As the rotor reaches alignment, the brushes move to the next
commutator contacts, and energize the next winding. Given our example two-pole
motor, the rotation reverses the direction of current through the rotor winding, leading
to a "flip" of the rotor's magnetic field, driving it to continue rotating.
In real life, though, DC motors will always have more than two poles (three is a very
common number). In particular, this avoids "dead spots" in the commutator. You can
imagine how with our example two-pole motor, if the rotor is exactly at the middle of
its rotation (perfectly aligned with the field magnets), it will get "stuck" there.
Meanwhile, with a two-pole motor, there is a moment where the commutator shorts
out the power supply (i.e., both brushes touch both commutator contacts
simultaneously). This would be bad for the power supply, waste energy, and damage
motor components as well. Yet another disadvantage of such a simple motor is that it
would exhibit a high amount of torque "ripple".
So since most small DC motors are of a three-pole design, let's tinker with the
workings of one via an interactive animation.
28
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
You'll notice a few things from this -- namely, one pole is fully energized at a time
(but two others are "partially" energized). As each brush transitions from one
commutator contact to the next, one coil's field will rapidly collapse, as the next coil's
field will rapidly charge up. We'll see more about the effects of this later, but in the
meantime you can see that this is a direct result of the coil windings' series wiring.
3.7: MOTOR DRIVER (L293D)
Features:
Wide supply-voltage range: 4.5V to 36V
Separate input- logic supply
Internal ESD protection
Thermal shutdown
High-Noise-Immunity input
Functional Replacements for SGS L293 and SGS L293D
Output current 1A per channel (600 mA for L293D)
Peak output current 2 A per channel (1.2 A for L293D)
Output clamp diodes for Inductive Transient Suppression(L293D)
The L293 and L293D are quadruple high-current half-H drivers. The L293 is
designed to provide bidirectional drive currents of up to 1 A at voltages from 4.5 V to
36 V. The L293D is designed to provide bidirectional drive currents of up to 600-mA
at voltages from 4.5 V to 36 V. Both devices are designed to drive inductive loads
such as relays, solenoids, dc and bipolar stepping motors, as well as other high-
current/high-voltage loads in positive-supply applications.
29
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
FIG 3.7.1: L293D PIN DIAGRAM
All inputs are TTL compatible. Each output is a complete totem-pole drive circuit,
with a Darlington transistor sink and a pseudo-Darlington source. Drivers are enabled
in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by
3,4EN.When an enable input is high, the associated drivers are enabled and their
outputs are active and in phase with their inputs. When the enable input is low, those
drivers are disabled and their outputs are off and in the high-impedance state. With
the proper data inputs, each pair of drivers forms a full-H (or bridge) reversible drive
suitable for solenoid or motor applications.
On the L293, external high-speed output clamp diodes should be used for inductive
transient suppression. A VCC1 terminal, separate from VCC2, is provided for the
logic inputs to minimize device power dissipation. The L293and L293D is
characterized for operation from 0°C to 70°C.
DESCRIPTION:
The L293 and L293D are quadruple high- current half-H drives. The L293 is
designed to provide bi-directional drive current of up to 1 A at voltage from 4.5V to
36 v. The L293D is designed to provide bidirectional drive current of up to 600-mA
at voltage from 4.5V to 36V.both drives are designed to drive inductive load such as
30
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
relay, solenoids, dc and bipolar stepping motors, as well as other high-current/high-
voltage loads in positive- supply applications. All inputs are TTL compatible. Each
output is a complete totem drive circuit, with a Darlington transistor sink and a
pseudo-Darlington source.
Drives are enabled in pairs, with drives 1 and 2 enabled by 1,2EN and drives 3 and 4
enabled by 3,4EN.When and enable input is high, the associated drives are enabled
and their outputs are active and in phase with their inputs. When the enable input is
low, those are disabled and their outputs are off and in the high-impedance state.
With the proper date inputs, each pair of drives from a full-H (or bridge) reversible
derives suitable for solenoid or motor applications. On the L293, external high- speed
output clamp diodes should be used for inductive transient suppression. A VCC1
terminal, separate from VCC2, is provided for the logic input to minimize drives
power dissipation. The L293 and L293D are characterized for operation from 0C to
70C.
BLOCK DIAGRAM OF L293D:
FIG3.7.2: BLOCK DIAGRAM OF L293D
The basic idea is that five electrically controlled switches (transistors) are arranged to
control an output, usually a motor, using a separate input voltage. Two of the inputs,
‘ch1’ and ‘ch2’, control two switches each. If one channel is logic high and other is
logic low, then there is a voltage across the output terminals equal to the input
31
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
voltage. If the channels are switched then the output voltage changes the voltage
polarity.
If both channels are at the same (high or low) then the output terminals are short-
circuited. If the circuit is being used to drive a dc motor, then this setting will make
the motor stop quickly. The fifth switch is connected in series with one of the output
terminals and is controlled by the ‘enable’ (EN) input. If enable is logic high, (on)
then the switch closes and the output behave according to guidelines above. If the
enable is logic low (off) then there is open circuit (very high resistance) between the
output terminals. This state supersedes anything done with the input channels. When
using this circuit to control a DC motor, the enable low setting allows the motor to
float to a stop.
3.8: LM393:
It is called as DUAL DIFFERENTIAL COMPARATOR
DESCRIPTION:
The UTC LM393 consists of two independent voltage comparators, designed
specifically to operate from a single power supply over a wide voltage range.
FEATURES:
*Single or dual supply operation.
*Wide operating supply range (Vcc=2V~36V or +- 1 to +- 18V).
*Input common-mode voltage includes ground.
*Low supply current drain ICC=0.8mA (Typical).
*Low input bias current Ibias=25nA (Typical).
*Output compatible with TTL, DTL, and CMOS logic
32
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
FIG 3.8.1: PIN CONFIGURATION
SCHEMATIC DIAGRAM OF LM393:
FIG 3.8.2: SCHEMATIC DIAGRAM OF LM393
3.9: THERMISTOR:
33
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
Thermistors are thermal resistors. Thermistors are the negative temperature resistance
co-efficient materials that imply the resistance of the thermistor decreases when the
temperature increases. The output of the thermistor is given to the comparator-
LM393, which compares the thermistor output with the prefixed voltage signal. In
comparator there are two terminals. One is inverting terminal (-) and the other one is
non-inverting terminal (+).
Conditions for comparator:
If + > - the output will be high
If + < - the output will be low
The output of the comparator is given to the microcontroller.
Like the RTD, the thermistor is also a temperature-sensitive resistor. While the
thermocouple is the most versatile temperature transducer and the PRTD is the most
stable, the word that best describes the thermistor is sensitive. Of the three major
categories of sensors, the thermistor exhibits by far the largest parameter change with
temperature.
Thermistors are generally composed of semiconductor materials. Although positive
temperature coefficient units are available, most thermistors have a negative
34
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
temperature coefficient (TC); that is, their resistance decreases with increasing
temperature. The negative TC can be as large as several percent per degree C,
allowing the thermistor circuit to detect minute changes in temperature which could
not be observed with an RTD or thermocouple circuit. The price we pay for this
increased sensitivity is loss of linearity. The thermistor is an extremely non-linear
device which is highly dependent upon process parameters. Consequently,
manufacturers have not standardized thermistor curves to the extent that RTD and
thermocouple curves have been standardized. An individual thermistor curve can be
very closely approximated through use of the Steinhart-Hart equation:
1 = A + B (ln R) + C (ln R)3T
Where:
T = Kelvin’s
R = Resistance of the thermistor
A,B,C = curve-fitting constants
A, B, and C are found by selecting three data points on the published data curve and
solving the three simultaneous equations. When the data points are chosen to span no
more than 100° C within the nominal center of the thermistors temperature range, this
equation approaches a rather remarkable ±.02° C curve fit.
35
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
Somewhat faster computer execution time is achieved through a simpler equation:
T = (ln R)1 – A -C
where A, B, and C are again found by selecting three (R,T) data points and solving
the three resultant simultaneous equations. This equation must be applied over a
narrower temperature range in order to approach the accuracy of the Steinhart-Hart
equation. Measurement The high resistivity of the thermistor affords it a distinct
measurement advantage. The four-wire resistance measurement may not be required
as it is with RTD’s. For example, a common thermistor value is 5000W at 25° C.
With a typical TC of 4%/° C, a measurement lead resistance of 10W produces
only .05° C error. This error is a factor of 500 times less than the equivalent RTD
error.
THERMISTOR OVERVIEW:
A thermistor is a piece of semiconductor made from metal oxides, pressed into a
small bead, disk, wafer, or other shape, sintered at high temperatures, and finally
coated with epoxy or glass. The resulting device exhibits an electrical resistance that
varies with temperature.
There are two types of thermistors – negative temperature coefficient (NTC)
thermistors, whose resistance decreases with increasing temperature, and positive
temperature coefficient (PTC) thermistors, whose resistance increases with increasing
36
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
temperature. NTC thermistors are much more commonly used than PTC thermistors,
especially for temperature measurement applications.
A main advantage of thermistors for temperature measurement is their extremely high
sensitivity. For example, a 2252 W thermistor has a sensitivity of -100 W/°C at room
temperature. Higher resistance thermistors can exhibit temperature coefficients of -10
kW/°C or more. In comparison, 100 W platinum RTD has a sensitivity of only 0.4
W/°C. The physically small size of the thermistor bead also yields a very fast
response to temperature changes.
Another advantage of the thermistor is its relatively high resistance. Thermistors are
available with base resistances (at 25° C) ranging from hundreds to millions of ohms.
This high resistance diminishes the effect of inherent resistances in the lead wires,
which can cause significant errors with low resistance devices such as RTDs. For
example, while RTD measurements typically require 3-wire or 4-wire connections to
reduce errors caused by lead wire resistances, 2-wire connections to thermistors are
usually adequate.
The major tradeoff for the high resistance and sensitivity of the thermistor is its
highly nonlinear output and relatively limited operating range. Depending on the type
of thermistors, upper ranges are typically limited to around 300° C. Figure 1 shows
the resistance-temperature curve for a 2252 W thermistor. The curve of a 100 W RTD
is also shown for comparison.
The temperature is detected by the thermistor and the heat passes through it. The
heater is on if the temperature is in low state than the set point. The heater will be off
if the temperature reaches the set point.
NTC THERMISTORS:
The NTC thermistors which are discussed herein are composed of metal oxides. The
most commonly used oxides are those of manganese, nickel, cobalt, iron, copper and
titanium. The fabrication of commercial NTC thermistors uses basic ceramics
37
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
technology and continues today much as it has for decades. In the basic process, a
mixture of two or more metal oxide powders are combined with suitable binders, are
formed to a desired geometry, dried, and sintered at an elevated temperature. By
varying the types of oxides used, their relative proportions, the sintering atmosphere,
and the sintering temperature, a wide range of resistivities and temperature coefficient
characteristics can be obtained.
NTC thermistors are available in a wide variety of configurations and protective
coatings to suit almost any application. The most stable and accurate thermistors
available are those which are hermetically sealed in glass. Hermetically sealed
thermistors are also used, almost exclusively, for applications that require continuous
exposure to temperatures above 150°C.
In general, bead-type thermistors offer high stability and reliability, fast response
times, and operation at high temperatures. They are available in small sizes and,
consequently, exhibit comparatively low dissipation constants. They are more costly
to manufacture than metalized surface contact type thermistors and interchangeability
is normally achieved by using matched pairs of units connected in either series or
parallel circuits.
PROPERTIES OF NTC THERMISTORS:
NTC thermistors have thermal and electrical properties which are important
considerations in each application. These properties are a function of the geometry of
the thermistor, of the particular “material system” of metal oxides that is being used
and of the additional materials (electrodes, inks, solders, lead wires, etc.) that are
applied to the basic device. These properties and other product data are presented in
the manufacturers catalogs as nominal resistance values, resistance- vs -temperature
curves (tables), thermal time constant values, dissipation constant values and power
ratings.
38
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
THERMAL PROPERTIES:
When an NTC thermistor is connected in an electrical circuit, power is dissipated as
heat and the body temperature of the thermistor will rise above the ambient
temperature of its environment. The rate at which energy is supplied must equal the
rate at which energy is lost plus the rate at which energy is absorbed (the energy
storage capacity of the device).
dH/dt = dHL/dt +dHA/dt.
ELECTRICAL PROPERTIES:
There are three basic electrical characteristics that account for virtually all of the
applications in which NTC thermistors may be used.
a) Current-Time Characteristic
b) Voltage-Current Characteristic
c) Resistance-Temperature Characteristic
There are also several applications where the NTC thermistor is indirectly heated by
resistive devices or even other thermistors. These applications are merely special
cases of one of the three basic electrical characteristics.
NTC THERMISTOR APPLICATIONS:
The NTC thermistor is a versatile component that can be used in a wide variety of
applications where the measured is temperature dependent. Table gives a partial
listing of thermistor applications that are grouped according to one of the three
fundamental electrical characteristics; the current-time characteristics, the voltage-
current characteristic, and the resistance-temperature characteristic. Applications
based on the voltage-current characteristic generally involve changes in the
environmental conditions or the electrical circuit parameters of a self-heated
thermistor. In turn, these changes will result in a shift of the operating point on any
39
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
given voltage-current curve or family of such curves. These applications are further
subdivided into four major categories depending on the type of excitation that causes
the operating point to change.
The KE range of NTC disc thermistors is designed for use in temperature
measurement, control and compensation applications, particularly where moderate
power levels are expected to be dissipated in the thermistor.
3.10: BC 547:
TECHNICAL SPECIFICATIONS:
The BC547 transistor is an NPN Epitaxial Silicon Transistor. The BC547 transistor is
a general-purpose transistor in small plastic packages. It is used in general-purpose
switching and amplification BC847/BC547 series 45 V, 100 mA NPN general-
purpose transistors.
FIG 3.10.1: BC 547 TRANSISTOR PINOUTS
The BC547 transistor is an NPN bipolar transistor, in which the letters "N" and "P"
refer to the majority charge carriers inside the different regions of the transistor. Most
bipolar transistors used today are NPN, because electron mobility is higher than hole
mobility in semiconductors, allowing greater currents and faster operation. NPN
transistors consist of a layer of P-doped semiconductor (the "base") between two N-
doped layers. A small current entering the base in common-emitter mode is amplified
in the collector output. In other terms, an NPN transistor is "on" when its base is
pulled high relative to the emitter. The arrow in the NPN transistor symbol is on the
emitter leg and points in the direction of the conventional current flow when the
device is in forward active mode.
One mnemonic device for identifying the symbol for the NPN transistor is "not
pointing in." An NPN transistor can be considered as two diodes with a shared anode
40
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
region. In typical operation, the emitter base junction is forward biased and the base
collector junction is reverse biased. In an NPN transistor, for example, when a
positive voltage is applied to the base emitter junction, the equilibrium between
thermally generated carriers and the repelling electric field of the depletion region
becomes unbalanced, allowing thermally excited electrons to inject into the base
region. These electrons wander (or "diffuse") through the base from the region of
high concentration near the emitter towards the region of low concentration near the
collector. The electrons in the base are called minority carriers because the base is
doped p-type which would make holes the majority carrier in the base.
3.11. IR PAIRS:
Basics of IR transmitter Infrared transmitter emits IR rays in planar wave front manner.Even though infra red rays spread in all directions, it propagates along straight line in forward direction. IR rays have the characteristics of producing secondary wavelets when it collides with any obstacles in its path. This property of IR is discussed here.
.
FIG 3.11.1: IR PAIRS
When IR rays gets emitted from LED, it moves in the direction it is angled. When any obstacle
interferes in the path, the IR rays get cut and it produces secondary wavelets which propagates
mostly in return direction or in a direction opposite to that of the primary waves, which
produces the net result like reflection of IR rays.
Basics of IR receiver: Infrared photo receiver is a two terminal PN junction device, which operates in a reverse bias. It has a small transparent window, which allows light to strike the
41
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
PN junction. A photodiode is a type of photo detector capable of converting light into either current or voltage, depending upon the mode of operation. Most photodiodes will look similar to a light emitting diode. They will have two leads, or wires, coming from the bottom.
The shorter end of the two is the cathode, while the longer end is the anode.
INFRARED DETECTORS BASICS:
An infrared emitter is an LED made from gallium arsenide, which emits near-infrared energy
at about 880nm.
The infrared phototransistor acts as a transistor with the base voltage determined by the
amount of light hitting the transistor. Hence it acts as a variable current source. Greater
amount of IR light cause greater current to flow through the collector-emitter leads. As shown
in the diagram below, the phototransistor is wired in a similar configuration to the voltage
divider. The variable current traveling through the resistor causes a voltage drop in the pull-up
resistor.
This voltage is measured at the output of the device
3.12. LED:
A light-emitting diode (LED) is a semiconductor light source. LED’s are used as
indicator lamps in many devices, and are increasingly used for lighting. Introduced as
a practical electronic component in 1962, early LED’s emitted low-intensity red light,
42
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
but modern versions are available across the visible, ultraviolet and infrared
wavelengths, with very high brightness. The internal structure and parts of a led are
shown in figures 3.4.1 and 3.4.2 respectively.
Fig
3.12.1: Inside a LED Fig 3.12.2: Parts of a LED
Working:
The structure of the LED light is completely different than that of the light bulb.
Amazingly, the LED has a simple and strong structure. The light-emitting
semiconductor material is what determines the LED's colour. The LED is based on
the semiconductor diode.
When a diode is forward biased (switched on), electrons are able to recombine with
holes within the device, releasing energy in the form of photons. This effect is called
electroluminescence and the color of the light (corresponding to the energy of the
photon) is determined by the energy gap of the semiconductor. An LED is usually
small in area (less than 1 mm2), and integrated optical components are used to shape
its radiation pattern and assist in reflection. LED’s present many advantages over
incandescent light sources including lower energy consumption, longer lifetime,
improved robustness, smaller size, faster switching, and greater durability and
43
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
reliability. However, they are relatively expensive and require more precise current
and heat management than traditional light sources. Current LED products for general
lighting are more expensive to buy than fluorescent lamp sources of comparable
output. They also enjoy use in applications as diverse as replacements for traditional
light sources in automotive lighting (particularly indicators) and in traffic signals. The
compact size of LED’s has allowed new text and video displays and sensors to be
developed, while their high switching rates are useful in advanced communications
technology. The electrical symbol and polarities of led are shown in fig: 3.4.3.
FIG 3.12.3: ELECTRICAL SYMBOL & POLARITIES OF LED
LED lights have a variety of advantages over other light sources:
High-levels of brightness and intensity
High-efficiency
Low-voltage and current requirements
Low radiated heat
High reliability (resistant to shock and vibration)
No UV Rays
Long source life
Can be easily controlled and programmed
Applications of LED fall into three major categories:
44
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
Visual signal application where the light goes more or less directly from the
LED to the human eye, to convey a message or meaning.
Illumination where LED light is reflected from object to give visual response
of these objects.
Generate light for measuring and interacting with processes that do not
involve the human visual system.
3.13: Buzzer
Basically, the sound source of a piezoelectric sound component is a piezoelectric
diaphragm. A piezoelectric diaphragm consists of a piezoelectric ceramic plate which
has electrodes on both sides and a metal plate (brass or stainless steel, etc.). A
piezoelectric ceramic plate is attached to a metal plate with adhesives. Applying D.C.
voltage between electrodes of a piezoelectric diaphragm causes mechanical distortion
due to the piezoelectric effect. For a misshaped piezoelectric element, the distortion
of the piezoelectric element expands in a radial direction. And the piezoelectric
diaphragm bends toward the direction. The metal plate bonded to the piezoelectric
element does not expand. Conversely, when the piezoelectric element shrinks, the
piezoelectric diaphragm bends in the direction Thus, when AC voltage is applied
across electrodes, the bending is repeated, producing sound waves in the air.
To interface a buzzer the standard transistor interfacing circuit is used. Note that if a
different power supply is used for the buzzer, the 0V rails of each power supply must
be connected to provide a common reference.
If a battery is used as the power supply, it is worth remembering that piezo sounders
draw much less current than buzzers. Buzzers also just have one ‘tone’, whereas a
piezo sounder is able to create sounds of many different tones.
To switch on buzzer -high 1
To switch off buzzer -low 1
45
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
Notice (Handling) In Using Self Drive Method:
1. When the piezoelectric buzzer is set to produce intermittent sounds, sound
may be heard continuously even when the self drive circuit is turned ON /
OFF at the "X" point shown in Fig. 9. This is because of the failure of turning
off the feedback voltage.
2. Build a circuit of the piezoelectric sounder exactly as per the recommended
circuit shown in the catalog. hfe of the transistor and circuit constants are
designed to ensure stable oscillation of the piezoelectric sounder.
3. Design switching which ensures direct power switching.
4. The self drive circuit is already contained in the piezoelectric buzzer. So there
is no need to prepare another circuit to drive the piezoelectric buzzer.
5. Rated voltage (3.0 to 20Vdc) must be maintained. Products which can operate
with voltage higher than 20Vdc are also available.
6. Do not place resistors in series with the power source, as this may cause
abnormal oscillation. If a resistor is essential to adjust sound pressure, place a
capacitor (about 1μF) in parallel with the piezo buzzer.
7. Do not close the sound emitting hole on the front side of casing.
8. Carefully install the piezo buzzer so that no obstacle is placed within 15mm
from the sound release hole on the front side of the casing.
FIG 3.13.1: PICTURE OF BUZZER
CHAPTER-4
46
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
4. SOFTWARE REQUIREMENTS
4.1: INTRODUCTION TO KEIL MICRO VISION (IDE):
Keil an ARM Company makes C compilers, macro assemblers, real-time kernels,
debuggers, simulators, integrated environments, evaluation boards, and emulators for
ARM7/ARM9/Cortex-M3, XC16x/C16x/ST10, 251, and 8051 MCU families.
Keil development tools for the 8051 Microcontroller Architecture support every level
of software developer from the professional applications engineer to the student just
learning about embedded software development. When starting a new project, simply
select the microcontroller you use from the Device Database and the µVision IDE
sets all compiler, assembler, linker, and memory options for you.
Keil is a cross compiler. So first we have to understand the concept of compilers and
cross compilers. After then we shall learn how to work with keil.
4.2: CONCEPT OF COMPILER:
Compilers are programs used to convert a High Level Language to object code.
Desktop compilers produce an output object code for the underlying microprocessor,
but not for other microprocessors. I.E the programs written in one of the HLL like
‘C’ will compile the code to run on the system for a particular processor like x86
(underlying microprocessor in the computer). For example compilers for Dos
platform is different from the Compilers for Unix platform So if one wants to define
a compiler then compiler is a program that translates source code into object code.
The compiler derives its name from the way it works, looking at the entire piece of
source code and collecting and reorganizing the instruction. See there is a bit little
difference between compiler and an interpreter. Interpreter just interprets whole
program at a time while compiler analyses and execute each line of source code in
succession, without looking at the entire program.
47
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
The advantage of interpreters is that they can execute a program immediately.
Secondly programs produced by compilers run much faster than the same programs
executed by an interpreter. However compilers require some time before an
executable program emerges. Now as compilers translate source code into object
code, which is unique for each type of computer, many compilers are available for the
same language.
4.3: CONCEPT OF CROSS COMPILER:
A cross compiler is similar to the compilers but we write a program for the target
processor (like 8051 and its derivatives) on the host processors (like computer of
x86). It means being in one environment you are writing a code for another
environment is called cross development. And the compiler used for cross
development is called cross compiler. So the definition of cross compiler is a
compiler that runs on one computer but produces object code for a different type of
computer.
4.4: KEIL C CROSS COMPILER:
Keil is a German based Software development company. It provides several
development tools like
• IDE (Integrated Development environment)
• Project Manager
• Simulator
• Debugger
• C Cross Compiler, Cross Assembler, Locator/Linker
The Keil ARM tool kit includes three main tools, assembler, compiler and linker. An
assembler is used to assemble the ARM assembly program. A compiler is used to
compile the C source code into an object file. A linker is used to create an absolute
object module suitable for our in-circuit emulator.
48
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
4.5: Building an Application in µVision2:
To build (compile, assemble, and link) an application in µVision2, you must:
1. Select Project -(forexample,166\EXAMPLES\HELLO\HELLO.UV2).
2. Select Project - Rebuild all target files or Build target.µVision2 compiles,
assembles, and links the files in your project.
4.6: Creating Your Own Application in µVision2:
To create a new project in µVision2, you must:
1. Select Project - New Project.
2. Select a directory and enter the name of the project file.
3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device
from the Device Database™.
4. Create source files to add to the project.
5. Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and
add the source files to the project.
6. Select Project - Options and set the tool options. Note when you select the
target device from the Device Database™ all special options are set
automatically. You typically only need to configure the memory map of your
target hardware. Default memory model settings are optimal for most
applications.
7. Select Project - Rebuild all target files or Build target.
4.7: Debugging an Application in µVision2:
To debug an application created using µVision2, you must:
1. Select Debug - Start/Stop Debug Session.
2. Use the Step toolbar buttons to single-step through your program. You may
enter G, main in the Output Window to execute to the main C function.
3. Open the Serial Window using the Serial #1 button on the toolbar.
49
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
Debug your program using standard options like Step, Go, Break, and so on.
4.8: Starting µVision2 and creating a Project:
µVision2 is a standard Windows application and started by clicking on the program
icon. To create a new project file select from the µVision2 menu Project – New
Project…. This opens a standard Windows dialog that asks you for the new project
file name. We suggest that you use a separate folder for each project. You can simply
use the icon Create New Folder in this dialog to get a new empty folder. Then select
this folder and enter the file name for the new project, i.e. Project1. µVision2 creates
a new project file with the name PROJECT1.UV2 which contains a default target and
file group name. You can see these names in the Project.
4.9: Window – Files:
Now use from the menu Project – Select Device for Target and select a CPU for your
project. The Select Device dialog box shows the µVision2 device data base. Just
select the microcontroller you use. We are using for our examples the Philips
80C51RD+ CPU. This selection sets necessary tool Options for the 80C51RD+
device and simplifies in this way the tool Configuration.
4.10: Building Projects and Creating a HEX Files:
Typical, the tool settings under Options – Target are all you need to start a new
application. You may translate all source files and line the application with a click on
the Build Target toolbar icon. When you build an application with syntax errors,
µVision2 will display errors and warning messages in the Output Window – Build
page. A double click on a message line opens the source file on the correct location in
a µVision2 editor window. Once you have successfully generated your application
you can start debugging.
50
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
After you have tested your application, it is required to create an Intel HEX file to
download the software into an EPROM programmer or simulator. µVision2 creates
HEX files with each build process when Create HEX files under Options for Target –
Output is enabled. You may start your PROM programming utility after the make
process when you specify the program under the option Run User Program #1.
4.11 CPU Simulation:
µVision2 simulates up to 16 Mbytes of memory from which areas can be mapped for
read, write, or code execution access. The µVision2 simulator traps
and reports illegal memory accesses. In addition to memory mapping, the simulator
also provides support for the integrated peripherals of the various 8051 derivatives.
The on-chip peripherals of the CPU you have selected are configured from the
Device.
4.12 Database selection:
You have made when you create your project target. Refer to page 58 for more
Information about selecting a device. You may select and display the on-chip
peripheral components using the Debug menu. You can also change the aspects of
each peripheral using the controls in the dialog boxes.
4.13 Start Debugging:
You start the debug mode of µVision2 with the Debug – Start/Stop Debug Session
Command. Depending on the Options for Target – Debug Configuration, µVision2
will load the application program and run the startup code µVision2 saves the editor
screen layout and restores the screen layout of the last debug session. If the program
execution stops, µVision2 opens an editor window with the source text or shows CPU
instructions in the disassembly window. The next executable statement is marked
with a yellow arrow. During debugging, most editor features are still available.
51
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
For example, you can use the find command or correct program errors. Program
source text of your application is shown in the same windows. The µVision2 debug
mode differs from the edit mode in the following aspects:
The “Debug Menu and Debug Commands” described on page 28 are
available. The additional debug windows are discussed in the following.
The project structure or tool parameters cannot be modified. All build
commands are disabled.
4.14 Disassembly Window:
The Disassembly window shows your target program as mixed source and assembly
program or just assembly code. A trace history of previously executed instructions
may be displayed with Debug – View Trace Records. To enable the trace history, set
Debug – Enable/Disable Trace Recording.
If you select the Disassembly Window as the active window all program step
commands work on CPU instruction level rather than program source lines. You can
select a text line and set or modify code breakpoints using toolbar buttons or the
context menu commands.
You may use the dialog Debug – Inline Assembly… to modify the CPU instructions.
That allows you to correct mistakes or to make temporary changes to the target
program you are debugging. Numerous example programs are included to help you
get started with the most popular embedded 8051 devices.
The Keil µVision Debugger accurately simulates on-chip peripherals (I²C, CAN,
UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM
Modules) of your 8051 device. Simulation helps you understand hardware
configurations and avoids time wasted on setup problems. Additionally, with
simulation, you can write and test applications before target hardware is available.
4.15 EMBEDDED C:
52
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
Use of embedded processors in passenger cars, mobile phones, medical equipment,
aerospace systems and defense systems is widespread, and even everyday domestic
appliances such as dish washers, televisions, washing machines and video recorders
now include at least one such device.
Because most embedded projects have severe cost constraints, they tend to use low-
cost processors like the 8051 family of devices considered in this book. These popular
chips have very limited resources available most such devices have around 256 bytes
(not megabytes!) of RAM, and the available processor power is around 1000 times
less than that of a desktop processor. As a result, developing embedded software
presents significant new challenges, even for experienced desktop programmers. If
you have some programming experience - in C, C++ or Java - then this book and its
accompanying CD will help make your move to the embedded world as quick and
painless as possible.
CHAPTER-5
PROJECT DESCRIPTION
53
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
5.1: THEFT IDENTIFICATION:
Now a day’s everyone knows what type of security we need, security in
almost all the cases. But even after taking care we are still unsatisfied with the
security which we provide by ourselves. So as the technology is growing we are
implementing new ideas over security purpose. One such thing is using PIR sensor
which is used to detecting the human motion.
The project title “THEFT IDENTIFICATION” indicates itself that whenever
someone wants to theft which is present in the industry then the theft will be
automatically arrested with the help of some human detecting sensors and make the
buzzer and leds ON. If the sensor detects then automatically the buzzer will be ‘on’
for indicating that someone is inside the industry.
5. 2 AUTOMATICVEHICLE:
The aim of this project is to atomize the parking for allowing the vehicles into the
industry. Whenever a vehicle comes in front of the gate, the IR signal gets disturbed
and the microcontroller will open the gate by rotating the stepper motor. The gate will
be closed only after the car leaves the second IR pair since the microcontroller should
know whether the vehicle left the gate or not.
.
This project uses regulated 5V, 500mA power supply. Unregulated 12V DC is used
for relay. 7805 three terminal voltage regulator is used for voltage regulation. Bridge
type full wave rectifier is used to rectify the ac output of secondary of 230/12Vstep
down transformer
5.3 STREET LIGHTING USING SCHMITT TRIGGER:
54
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
These devices consist of two independent voltage comparators that are designed to
operate from a single power supply over a wide range of voltages. Operation from
dual supplies also is possible as long as the difference between the two supplies is 2 V
to 36 V, and VCC is at least 1.5 V more positive than the input common-mode voltage.
Current drain is independent of the supply voltage. The outputs can be connected to
other open-collector outputs to achieve wired-AND relationships. The LM393 and
LM393A are characterized for operation from 0°C to 70°C.
5.4 FIRE ALARM:
In this fire alarm circuit, a Thermistor works as the heat sensor. When temperature
increases, its resistance decreases, and vice versa. At normal temperature, the
resistance of the Thermistor (TH1) is approximately 10 kilo-ohms, which reduces to a
few ohms as the temperature increases beyond 100 C.
CHAPTER-6
CODING:
55
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
The program code which is dumped in the microcontroller of our project is shown below.1.THEFT IDENTIFICATION:
#include <16F72.h>
#fuses HS,NOWDT,PROTECT,brownout,put
#use delay (clock=20000000)
void main()
output_high(pin_c3);
delay_ms(500);
output_low(pin_c3);
delay_ms(500);
output_high(pin_c3);
delay_ms(500);
output_low(pin_c3);
output_low(pin_c4); //Relay OFF (Door opened)
while(1)
if(input(pin_A0))
output_high(pin_c3);
delay_ms(500);
output_low(pin_c3);
delay_ms(500);
output_high(pin_b0);
output_low(pin_b1);
56
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
output_low(pin_b3);
delay_ms(1000);
output_high(pin_b3);
output_high(pin_c4);
2.AUTOMATIC VEHICLE PARKING:
#include<REG52.h>
void T1M1Delay(void);void delay(unsigned char);
sbit SENSOR1=P1^0;sbit SENSOR2=P1^1;
sbit RED_LED=P3^0;sbit GREEN_LED=P3^1;
sbit BUZZER=P2^0;
sbit EN1=P2^7;sbit EN2=P2^2;
sbit IN1=P2^6;sbit IN2=P2^5;
sbit IN3=P2^4;sbit IN4=P2^3;
void main()
57
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
EN1=1;EN2=1;
RED_LED=1; //initially turn off LEDs motors GREEN_LED=1;
IN1=0;IN2=0;
IN3=0; //initially turn off gate motorsIN4=0;
while(1) unsigned char x; if(SENSOR1==1) BUZZER=0; T1M1Delay(); BUZZER=1;
IN1=1;IN2=0; //OPEN the Gate1
RED_LED=0; // Red LED is on & Green LED is off GREEN_LED=1; // create some delay for(x=0;x<10;x++) T1M1Delay();
else if(SENSOR2==1) BUZZER=0; T1M1Delay(); BUZZER=1; IN1=0; //CLOSE the Gate2 IN2=1; RED_LED=1; // Red LED is off & Green LED is on GREEN_LED=0;
58
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
// create some delay for(x=0;x<10;x++) T1M1Delay();
IN1=0; IN2=0; IN3=0; IN4=0;
void delay(unsigned char n)
int x,y; /* delay function */for(x=0;x<n;x++)for(y=0;y<600;y++);
// End of the program
void T1M1Delay(void) unsigned char y; for(y=0;y<=1;y++) TMOD=0x10; //timer 1, mode 1(16 bits) TL1=0xFE; // load TL1 TH1=0xA5; //load TH1 TR1=1; // turn ON T1 while(TF1==0); //wait until TF1 gets empty TR1=0; // turn off T1 TF1=0; // clear TF1 // FFFH-A5FEH=23042 //timer delay= 23042*1.0825uSec = 25ms. //20*25ms=500ms
CHAPTER-7
RESULTS ANALYSIS:
59
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
The project “Theft Identification” was designed such that the system is
capable of alerting the owner through buzzer remotely if thieves enter into the
industry. The project was executed successfully and reached the expected
results.
The compact parking system has been successfully designed for automating
the parking system in huge complexes, Trade centers, Multiplexes etc, and the
problems due to non availability of adequate space for parking of four
wheelers is solved out.
Ensures high security in contrast to conventional parking system, if any
disturbances occurs to the normal operation buzzer provided sounds and also
as the total status present at the administration ,he comes and directs the user
as the per the operation required.
If anyone tries to misuse the system, the administrator safeguards it ensuring
protection to the vehicle user.
CHAPTER-8
FUTURE SCOPE
60
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
Scope for Further Development:
Our project “THEFT IDENTIFICATION” is mainly intended capable of
alerting the owner through buzzer remotely if thieves enter into the industry.
This system has a PIR sensor which detects live human beings in its presence
and sends this information to the system (Microcontroller). As soon as micro
controller receives the signal it sends logic HIGH to buzzer and leds. Buzzer
is horned to intimate the thieves’ presence.
This project can be extended by using a GSM Modem so that the limitation of
distance is eliminated and the information is sent to predefined phone
numbers.
A speaking voice alarm could be used instead of the normal buzzer.
This system can be connected to communication devices such as modems,
cellular phones or satellite terminal to enable the remote collection of recorded
data or alarming of certain parameters.
A multi-controller system can be developed that will enable a master controller
along with its slave controllers to automate multiple security process
simultaneously.
By this implementation in the circuit, parking problem is solved an also it
prevents vehicle thefts.
CHAPTER-9
CONCLUSION:
61
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
The project “IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION” has been successfully completed and tested. Integrating the features of every hardware component used has developed it. Presence of every block has been reasoned out and placed carefully thus contributing to the best working of the unit.
The project was finished using very simple and easily available components making it lightweight and portable.
Integrating features of all the hardware components used have been developed in it. Presence of every module has been reasoned out and placed carefully, thus contributing to the best working of the unit.
Secondly, using highly advanced IC’s with the help of growing technology, the project has been successfully implemented. Thus the project has been successfully designed and tested.
Finally we conclude that “IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION“ is an emerging field and there is huge scope for further research and development making the usage of sensors for excitement as well as security purposes.
CHAPTER-10
BIBLIOGRAPHY:
62
IMPLEMENTING SECURITY IN INDUSTRIAL AUTOMATION
1. The ATMEGA32 Microcontroller, ATMEL, Designers data sheet.
2. Linear Integrated Circuit –Roy Chowdhary.
3. The Microcontroller Architecture, Programming Application--Kenneth
J.Ayala second edition
63