Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 1
PROJECT REPORT ON
PC Based Industrial automation and electric machine
and device control.
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 2
Chapter 1
Introduction
Automation or automatic control is the use of various control systems for operating
equipment such as machinery, processes in factories, boilers and heat treating ovens,
switching in telephone networks, steering and stabilization of ships, aircraft and other
applications with minimal or reduced human intervention. Some processes have been
completely automated.
The biggest benefit of automation is that it saves labour, however, it is also used to save
energy and materials and to improve quality, accuracy and precision.
The term automation, inspired by the earlier word automatic (coming from automaton),
was not widely used before 1947, when General Motors established the automation
department. It was during this time that industry was rapidly adopting feedback
controllers, which were introduced in the 1930s.
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 3
Automation has been achieved by various means including mechanical, hydraulic,
pneumatic, electrical, electronic and computers, usually in combination. Complicated
systems, such as modern factories, airplanes and ships typically use all these combined
techniques.
1.1 Types of automation
Two common types of automation are feedback control, which is usually continuous and
involves taking measurements using a sensor and making calculated adjustments to
keep the measured variable within a set range, and sequence control, in which a
programmed sequence of discrete operations is performed, often based on system logic.
Cruise control is an example of the former while an elevator or an automated teller
machine (ATM) is an example of the latter.
The theoretical basis of feedback control is control theory, which also covers
servomechanisms, which are often part of an automated system. Feedback control is
called "closed loop" while non-feedback control is called "open loop."
1.2 Feedback control
Feedback control is accomplished with a controller. To function properly, a controller
must provide correction in a manner that maintains stability. Maintaining stability is a
principal objective of control theory.
As an example of feedback control, consider a steam coil air heater in which a
temperature sensor measures the temperature of the heated air, which is the measured
variable. This signal is constantly "fed back" to the controller, which compares it to the
desired setting (set point). The controller calculates the difference (error), then
calculates a correction and sends the correction signal to adjust the air pressure to a
diaphragm that moves a positioner on the steam valve, opening or closing it by the
calculated amount. All the elements constituting the measurement and control of a
single variable are called a control loop.
The complexities of this are that the quantities involved are all of different physical
types; the temperature sensor signal may be electrical or pressure from an enclosed
fluid, the controller may employ pneumatic, hydraulic, mechanical or electronic
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 4
techniques to sense the error and send a signal to adjust the air pressure that moves the
valve.
The first controllers used analog methods to perform their calculations. Analog methods
were also used in solving differential equations of control theory. The electronic analog
computer was developed to solve control type problems and electronic analog
controllers were also developed. Analog computers were displaced by digital computers
when they became widely available.
Common applications of feedback control are control of temperature, pressure, flow,
and speed.
1.3 Sequential control and logical sequence control
Sequential control may be either to a fixed sequence or to a logical one that will perform
different actions depending on various system states. An example of an adjustable but
otherwise fixed sequence is a timer on a lawn sprinkler. An elevator is an example that
uses logic based on the system states to perform certain actions in response to operator
input.
A development of sequential control was relay logic, by which electrical relays engage
electrical contacts which either start or interrupt power to a device. Relays were first
used in telegraph networks before being developed for controlling other devices, such
as when starting and stopping industrial-sized electric motors or opening and closing
solenoid valves. Using relays for control purposes allowed event-driven control, where
actions could be triggered out of sequence, in response to external events. These were
more flexible in their response than the rigid single-sequence cam timers. More
complicated examples involved maintaining safe sequences for devices such as swing
bridge controls, where a lock bolt needed to be disengaged before the bridge could be
moved, and the lock bolt could not be released until the safety gates had already been
closed.
The total number of relays, cam timers and drum sequencers can number into the
hundreds or even thousands in some factories. Early programming techniques and
languages were needed to make such systems manageable, one of the first being ladder
logic, where diagrams of the interconnected relays resembled the rungs of a ladder.
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 5
Special computers called programmable logic controllers were later designed to replace
these collections of hardware with a single, more easily re-programmed unit.
In a typical hard wired motor start and stop circuit (called a control circuit) a motor is
started by pushing a "Start" or "Run" button that activates a pair of electrical relays. The
"lock-in" relay locks in contacts that keep the control circuit energized when the push
button is released. (The start button is a normally open contact and the stop button is
normally closed contact.) Another relay energizes a switch that powers the device that
throws the motor starter switch (three sets of contacts for three phase industrial
power) in the main power circuit. (Note: Large motors use high voltage and experience
high in-rush current, making speed important in making and breaking contact. This can
be dangerous for personnel and property with manual switches.) All contacts are held
engaged by their respective electromagnets until a "stop" or "off" button is pressed,
which de-energizes the lock in relay. See diagram: Motor Starters Hand-Off-Auto With
Start-Stop (Note: The above description is the "Auto" position case in this diagram).
Commonly interlocks are added to a control circuit. Suppose that the motor in the
example is powering machinery that has a critical need for lubrication. In this case an
interlock could be added to insure that the oil pump is running before the motor starts.
Timers, limit switches and electric eyes are other common elements in control circuits.
Solenoid valves are widely used on compressed air or hydraulic fluid for powering
actuators on mechanical components. While motors are used to supply continuous
rotary motion, actuators are typically a better choice for intermittently creating a
limited range of movement for a mechanical component, such as moving various
mechanical arms, opening or closing valves, raising heavy press rolls, applying pressure
to presses.
1.4 Computer control
Computers can perform both sequential control and feedback control, and typically a
single computer will do both in an industrial application. Programmable logic
controllers (PLCs) are a type of special purpose microprocessor that replaced many
hardware components such as timers and drum sequencers used in relay logic. General
purpose process control computers have increasingly replaced standalone controllers,
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 6
with a single computer able to perform the operations of hundreds of controllers.
Process control computers can process data from a network of PLCs, instruments and
controllers in order to implement typical (such as PID) control of many individual
variables or, in some cases, to implement complex control algorithms using multiple
inputs and mathematical manipulations. They can also analyse data and create real time
graphical displays for operators and run reports for engineers and management.
Control of an automated teller machine (ATM) is an example of an interactive process in
which a computer will perform a logic derived response to a user selection based on
information retrieved from a networked database. The ATM process has a lot of
similarities to other online transaction processes. The different logical responses are
called scenarios. Such processes are typically designed with the aid of use cases and
flowcharts, which guide the writing of the software code.
1.5 Industrial automation
Industrial automation deals primarily with the automation of manufacturing, quality
control and material handling processes. General purpose controllers for industrial
processes include Programmable logic controllers and computers. One trend is
increased use of Machine vision to provide automatic inspection and robot guidance
functions, another is a continuing increase in the use of robots.
Energy efficiency in industrial processes has become a higher priority. Semiconductor
companies like Infineon Technologies are offering 8-bit micro-controller applications
for example found in motor controls, general purpose pumps, fans, and ebikes to reduce
energy consumption and thus increase efficiency.
1.6 Project Specifications
Our industrial automation project is having following features and specification.
1. Number of devices to be controlled: 4
2. Current rating : 10A
3. Voltage : 220V
4. PC based control
5. Hardware interface : USB
6. Control Software : computer interface(GUI)
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 7
7. The project is very user friendly because of the computer interface developed by
us, even layman could operate it.
8. The GUI is platform free and doesn’t require any tool like MATLAB. A single
setup file that can be executed on any both windows operating system i.e. 32/64
bits.
9. We have developed MATLAB based GUI as well.
10. The controlling hardware is using USB that makes it ultra-portable. Unlike to the
old systems of serial ports.
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 8
Chapter 2
Objective
The main objective of our project is to automate industrial devices. We have added 4
relays in our project. These relays are electromechanical switches and can handle
electrical device of AC and DC both. Thus our project is providing automation to a wide
range of industrial devices. Other objectives are to make the project to the possible low
cost. The material used to construct this project is selected after an extensive research
of the market. We have analysed hundreds of options before selecting the components.
We have taken care that low price doesn’t hamper the quality of project.
The optimal utilization of cost makes our project ultra-low cost. The PC based control
requires software that runs on PC. Our software is based on Graphical user interface.
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 9
This makes the project very easy to use. Lab assistants or the operator can use this
software even with proving any sort of training to them.
These are the objectives fulfilled by our project.
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 10
Chapter 3
Methodology
The following block diagram explains working of the system, later we shall discuss all of
the components of the diagram.
Fig.2 | Block diagram
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 11
Chapter 4
Programming of hardware controller
This chapter elaborate the programming of hardware controller.
4.1 Introduction to embedded C
Our project is made using embedded programming. The programming language
required for construction of the project is Embedded C. Here in this chapter we will see
the programming of the project and interfacing with the compiler. Before moving ahead
have a look on embedded system.
An embedded system is a computer system with a dedicated function within a larger
mechanical or electrical system, often with real-time computing constraints.It is
embedded as part of a complete device often including hardware and mechanical parts.
By contrast, a general-purpose computer, such as a personal computer (PC), is designed
to be flexible and to meet a wide range of end-user needs. Embedded systems control
many devices in common use today.
Modern embedded systems are often based on microcontrollers (i.e CPUs with
integrated memory and/or peripheral interfaces) but ordinary microprocessors (using
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 12
external chips for memory and peripheral interface circuits) are also still common,
especially in more complex systems. In either case, the processor(s) used may be types
ranging from rather general purpose to very specialised in certain class of
computations, or even custom designed for the application at hand. A common standard
class of dedicated processors is the digital signal processor (DSP).
The key characteristic, however, is being dedicated to handle a particular task. Since the
embedded system is dedicated to specific tasks, design engineers can optimize it to
reduce the size and cost of the product and increase the reliability and performance.
Some embedded systems are mass-produced, benefiting from economies of scale.
Physically, embedded systems range from portable devices such as digital watches and
MP3 players, to large stationary installations like traffic lights, factory controllers, and
largely complex systems like hybrid vehicles, MRI, and avionics. Complexity varies from
low, with a single microcontroller chip, to very high with multiple units, peripherals and
networks mounted inside a large chassis or enclosure.
Embedded systems are commonly found in consumer, cooking, industrial, automotive,
medical, commercial and military applications.
Telecommunications systems employ numerous embedded systems from telephone
switches for the network to cell phones at the end-user. Computer networking uses
dedicated routers and network bridges to route data.
Consumer electronics include personal digital assistants (PDAs), mp3 players, mobile
phones, videogame consoles, digital cameras, DVD players, GPS receivers, and printers.
Household appliances, such as microwave ovens, washing machines and dishwashers,
include embedded systems to provide flexibility, efficiency and features. Advanced
HVAC systems use networked thermostats to more accurately and efficiently control
temperature that can change by time of day and season. Home automation uses wired-
and wireless-networking that can be used to control lights, climate, security,
audio/visual, surveillance, etc., all of which use embedded devices for sensing and
controlling.
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 13
Transportation systems from flight to automobiles increasingly use embedded systems.
New airplanes contain advanced avionics such as inertial guidance systems and GPS
receivers that also have considerable safety requirements. Various electric motors —
brushless DC motors, induction motors and DC motors — use electric/electronic motor
controllers. Automobiles, electric vehicles, and hybrid vehicles increasingly use
embedded systems to maximize efficiency and reduce pollution. Other automotive
safety systems include anti-lock braking system (ABS), Electronic Stability Control
(ESC/ESP), traction control (TCS) and automatic four-wheel drive.
Medical equipment uses embedded systems for vital signs monitoring, electronic
stethoscopes for amplifying sounds, and various medical imaging (PET, SPECT, CT, MRI)
for non-invasive internal inspections. Embedded systems within medical equipment are
often powered by industrial computers. Embedded systems are used in transportation,
fire safety, safety and security, medical applications and life critical systems, as these
systems can be isolated from hacking and thus, be more reliable.[citation needed] For
fire safety, the systems can be designed to have greater ability to handle higher
temperatures and continue to operate. In dealing with security, the embedded systems
can be self-sufficient and be able to deal with cut electrical and communication systems.
A new class of miniature wireless devices called motes are quickly gaining popularity as
the field of wireless sensor networking is increasing. Wireless sensor networking, WSN,
makes use of miniaturization made possible by advanced IC design to couple full
wireless subsystems to sophisticated sensors, enabling people and companies to
measure a myriad of things in the physical world and act on this information through IT
monitoring and control systems. These motes are completely self-contained, and will
typically run off a battery source for years before the batteries need to be changed or
charged.
Embedded Wi-Fi modules provide a simple means of wirelessly enabling any device
which communicates via a serial port.
4.2 The compiler
Atmel® Studio 6 is the integrated development platform (IDP) for developing and
debugging Atmel ARM® Cortex®-M and Atmel AVR® microcontroller (MCU) based
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 14
applications. The Atmel Studio 6 IDP gives you a seamless and easy-to-use environment
to write, build and debug your applications written in C/C++ or assembly code.
Atmel Studio 6 is free of charge and is integrated with the Atmel Software Framework
(ASF)—a large library of free source code with 1,600 ARM and AVR project examples.
ASF strengthens the IDP by providing, in the same environment, access to ready-to-use
code that minimizes much of the low-level design required for projects. Use the IDP for
our wide variety of AVR and ARM Cortex-M processor-based MCUs, including our
broadened portfolio of Atmel SAM3 ARM Cortex-M3 and M4 Flash devices.
With the introduction of Atmel Gallery and Atmel Spaces, Atmel Studio 6 further
simplifies embedded MCU designs to reduce development time and cost. Atmel Gallery
is an online apps store for development tools and embedded software. Atmel Spaces is a
cloud-based collaborative development workspace allowing you to host software and
hardware projects targeting Atmel MCUs.
In summary, standard integrated development environments (IDEs) are suited for
creating new software for an MCU project. By contrast, the Atmel Studio 6 IDP also:
Facilitates reuse of existing software and, by doing so, enables design differentiation.
Supports the product development process with easy access to integrated tools and
software extensions through Atmel Gallery. Reduces time to market by providing
advanced features, an extensible software eco-system, and powerful debug integration.
fig | Atmel Studio
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 15
Chapter 5
The parts & Interfacing
Following are the parts of the project.
5.1. 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 contactor. Solid-state relays control power circuits with
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 16
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".
Fig | Relay
A simple electromagnetic relay consists of a coil of wire wrapped around a soft iron
core, an iron yoke which provides a low reluctance path for magnetic flux, a movable
iron armature, and one or more sets of contacts (there are two in the relay pictured).
The armature is hinged to the yoke and mechanically linked to one or more sets of
moving contacts. It is held in place by a spring so that when the relay is de-energized
there is an air gap in the magnetic circuit. In this condition, one of the two sets of
contacts in the relay pictured is closed, and the other set is open. Other relays may have
more or fewer sets of contacts depending on their function. The relay in the picture also
has a wire connecting the armature to the yoke. This ensures continuity of the circuit
between the moving contacts on the armature, and the circuit track on the printed
circuit board (PCB) via the yoke, which is soldered to the PCB.
When an electric current is passed through the coil it generates a magnetic field that
activates the armature, and the consequent movement of the movable contact(s) either
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 17
makes or breaks (depending upon construction) a connection with a fixed contact. If the
set of contacts was closed when the relay was de-energized, then the movement opens
the contacts and breaks the connection, and vice versa if the contacts were open. When
the current to the coil is switched off, the armature is returned by a force,
approximately half as strong as the magnetic force, to its relaxed position. Usually this
force is provided by a spring, but gravity is also used commonly in industrial motor
starters. Most relays are manufactured to operate quickly. In a low-voltage application
this reduces noise; in a high voltage or current application it reduces arcing.
When the coil is energized with direct current, a diode is often placed across the coil to
dissipate the energy from the collapsing magnetic field at deactivation, which would
otherwise generate a voltage spike dangerous to semiconductor circuit components.
Some automotive relays include a diode inside the relay case. Alternatively, a contact
protection network consisting of a capacitor and resistor in series (snubber circuit) may
absorb the surge. If the coil is designed to be energized with alternating current (AC), a
small copper "shading ring" can be crimped to the end of the solenoid, creating a small
out-of-phase current which increases the minimum pull on the armature during the AC
cycle.
A solid-state relay uses a thyristor or other solid-state switching device, activated by the
control signal, to switch the controlled load, instead of a solenoid. An optocoupler (a
light-emitting diode (LED) coupled with a photo transistor) can be used to isolate
control and controlled circuits.
5.3 The controller
Robotic arm controller comprises several electronic components. Here we will discuss
the important parts of the circuit.
5.3.1 The microcontroller (Atmega 16)
The ATmega16 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced
RISC architecture. By executing powerful instructions in a single clock cycle, the
ATmega16 achieves throughputs approaching 1 MIPS per MHz allowing the system
designer to optimize power consumption versus processing speed.
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 18
Fig.| Atmega 16 Pinout diagram. | PDIP package
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 19
Fig.| Atmega 16 Pinout diagram. | TQFP package
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 20
Fig.| Atmega 16 Pinout diagram. | MLF package
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 21
Fig.31 | Block diagram of Atmega 8
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 22
The AVR core combines a rich instruction set with 32 general purpose working
registers. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU),
allowing two independent registers to be accessed in one single instruction executed in
one clock cycle. The resulting architecture is more code efficient while achieving
throughputs up to ten times faster than conventional CISC microcontrollers. The
ATmega16 provides the following features: 16K bytes of In-System Programmable Flash
Program memory with Read-While-Write capabilities, 512 bytes EEPROM, 1K byte
SRAM, 32 general purpose I/O lines, 32 general purpose working registers, a JTAG
interface for Boundary scan, On-chip Debugging support and programming, three
flexible Timer/Counters with compare modes, Internal and External Interrupts, a serial
programmable USART, a byte oriented Two-wire Serial Interface, an 8-channel, 10-bit
ADC with optional differential input stage with programmable gain (TQFP package
only), a programmable Watchdog Timer with Internal Oscillator, an SPI serial port, and
six software selectable power saving modes. The Idle mode stops the CPU while
allowing the USART, Two-wire interface, A/D Converter, SRAM, Timer/Counters, SPI
port, and interrupt system to continue functioning. The Power-down mode saves the
register contents but freezes the Oscillator, disabling all other chip functions until the
next External Interrupt or Hardware Reset. In Power-save mode, the Asynchronous
Timer continues to run, allowing the user to maintain a timer base while the rest of the
device is sleeping. The ADC Noise Reduction mode stops the CPU and all I/O modules
except Asynchronous Timer and ADC, to minimize switching noise during ADC
conversions. In Standby mode, the crystal/resonator Oscillator is running while the rest
of the device is sleeping. This allows very fast start-up combined with low-power
consumption. In Extended Standby mode, both the main Oscillator and the
Asynchronous Timer continue to run. The device is manufactured using Atmel’s high
density non-volatile memory technology. The On chip ISP Flash allows the program
memory to be reprogrammed in-system through an SPI serial interface, by a
conventional non-volatile memory programmer, or by an On-chip Boot program
running on the AVR core. The boot program can use any interface to download the
application program in the Application Flash memory. Software in the Boot Flash
section will continue to run while the Application Flash section is updated, providing
true Re ad-While-Write operation. By combining an 8-bit RISC CPU with In-System Self-
Programmable Flash on a monolithic chip, the Atmel ATmega16 is a powerful
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 23
microcontroller that provides a highly-flexible and cost-effective solution to many
embedded control applications. The ATmega16 AVR is supported with a full suite of
program and system development tools including: C compilers, macro assemblers,
program debugger/simulators, in-circuit emulators, and evaluation kits.
5.3.1.1 Pin Description of ATmega 16.
 VCC: Digital supply voltage.
 GND: Ground.
 Port A (PA7..PA0): Port A serves as the analog inputs to the A/D
Converter. Port A also serves as an 8-bit bi-directional I/O port, if the A/D
Converter is not used. Port pins can provide internal pull-up resistors
(selected for each bit). The Port A output buffers have symmetrical drive
characteristics with both high sink and source capability. When pins PA0
to PA7 are used as inputs and are externally pulled low, they will source
current if the internal pull-up resistors are activated. The Port A pins are
tri-stated when a reset condition becomes active, even if the clock is not
running.
 Port B (PB7..PB0): Port B is an 8-bit bi-directional I/O port with internal
pull-up resistors (selected for each bit). The Port B output buffers have
symmetrical drive characteristics with both high sink and source
capability. As inputs, Port B pins that are externally pulled low will source
current if the pull-up resistors are activated. The Port B pins are tri-stated
when a reset condition becomes active, even if the clock is not running.
 Port C (PC7..PC0): Port C is an 8-bit bi-directional I/O port with internal
pull-up resistors (selected for each bit). The Port C output buffers have
symmetrical drive characteristics with both high sink and source
capability. As inputs, Port C pins that are externally pulled low will source
current if the pull-up resistors are activated. The Port C pins are tri-stated
when a reset condition becomes active, even if the clock is not running. If
the JTAG interface is enabled, the pull-up resistors on pins PC5(TDI),
PC3(TMS) and PC2(TCK) will be activated even if a reset occurs.
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 24
 Port D (PD7..PD0): Port D is an 8-bit bi-directional I/O port with internal
pull-up resistors (selected for each bit). The Port D output buffers have
symmetrical drive characteristics with both high sink and source
capability. As inputs, Port D pins that are externally pulled low will source
current if the pull-up resistors are activated. The Port D pins are tri-stated
when a reset condition becomes active, even if the clock is not running.
 RESET: Reset Input. A low level on this pin for longer than the minimum
pulse length will generate a reset, even if the clock is not running.
 XTAL1: Input to the inverting Oscillator amplifier and input to the
internal clock operating circuit.
 XTAL2: Output from the inverting Oscillator amplifier.
 AVCC: AVCC is the supply voltage pin for Port A and the A/D Converter. It
should be externally connected to VCC, even if the ADC is not used. If the
ADC is used, it should be connected to VCC through a low-pass filter.
 AREF: AREF is the analog reference pin for the A/D Converter.
5.3 Serial Communication:
Serial communication is a way enables different equipments to communicate with their
outside world. It is called serial because the data bits will be sent in a serial way over a
single line.
A personal computer has a serial port known as communication port or COM Port used
to connect a modem for example or any other device, there could be more than one COM
Port in a PC.
Serial ports are controlled by a special chip called UART (Universal Asynchronous
Receiver Transmitter). Different applications use different pins on the serial port and
this basically depend of the functions required. If we need to connect our PC for
example to some other device by serial port, then we have to read instruction manual
for that device to know how the pins on both sides must be connected and the setting
required.
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 25
5.3.1 Advantages of Serial Communication
Serial communication has some advantages over the parallel communication. One of the
advantages is transmission distance, serial link can send data to a remote device more
far then parallel link. Also the cable connection of serial link is simpler then parallel link
and uses less number of wires.
Serial link is used also for Infrared communication, now many devices such as laptops &
printers can communicate via inferred link.
5.3.2 Communication methods
There are two methods for serial communication, Synchronous & Asynchronous.
5.3.2.1 Synchronous serial communication:
In Synchronous serial communication the receiver must know when to “read” the next
bit coming from the sender, this can be achieved by sharing a clock between sender and
receiver.
In most forms of serial Synchronous communication, if there is no data available at a
given time to transmit, a fill character will be sent instead so that data is always being
transmitted. Synchronous communication is usually more efficient because only data
bits are transmitted between sender and receiver, however it will be more costly
because extra wiring and control circuits are required to share a clock signal between
the sender and receiver.
5.3.2.2 Asynchronous serial communication:
Asynchronous transmission allows data to be transmitted without the sender having to
send a clock signal to the receiver. Instead, special bits will be added to each word in
order to synchronize the sending and receiving of the data.
When a word is given to the UART for Asynchronous transmissions, a bit called the
“Start Bit” is added to the beginning of each word that is to be transmitted. The Start Bit
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 26
is used to alert the receiver that a word of data is about to be sent, and to force the clock
in the receiver into synchronization with the clock in the transmitter.
Fig.32 | Example of serial data transmission
After the Start Bit, the individual bits of the word of data are sent, each bit in the word is
transmitted for exactly the same amount of time as all of the other bits
When the entire data word has been sent, the transmitter may add a Parity Bit that the
transmitter generates. The Parity Bit may be used by the receiver to perform simple
error checking. Then at least one Stop Bit is sent by the transmitter.
If the Stop Bit does not appear when it is supposed to, the UART considers the entire
word to be garbled and will report a Framing Error.
5.4 USB to Serial Converter
Since latest computers and laptops don’t come with serial ports. Because the popularity
of the USB. So we are using USB to serial converter. That makes our project ultra-
portable. A typical USB to serial converter creates a comport on the computer or laptop
and connects that comport to the external world.
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 27
Fig.33 | USB to Serial Converter.
5.5 Software
The software we have got, is very easy to use. It requires the comport no. to
the project controller is attached. The complete operations of the project
can be controlled through the buttons provided in the software.
This software provide axis wise control.
Fig | The software Controller.
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 28
Chapter 7
References
1. Atmega 16 data sheet.
2. USB to serial data sheet.
3. Serial communication manual of MS .net frame work
4. Serial communication manual of MATLAB.
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 29
Appendix 1
The codding
/*
* at8_pc_deviceCtrl.c
*
* Created: 27/Mar/2014 06:23:13
* Author: acer
*/
#include <avr/io.h>
#include "lcd.h"
/*Macros definition*/
#define BIT(x) (1 << (x)) //Set a particular bit mask
#define CHECKBIT(x,b) x&b //Checks bit status
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 30
#define SETBIT(x,b) x|=b; //Sets the particular bit
#define CLEARBIT(x,b) x&=~b; //Sets the particular bit
#define TOGGLEBIT(x,b) x^=b; //Toggles the particular bit
#define TOGGLEBIT(x,b) x^=b; //Toggles the particular bit
/*Macros definition ends*/
void USARTInit(uint16_t ubrr_value)
{
//Set Baud rate
UBRRL = ubrr_value;
UBRRH = (ubrr_value>>8);
/*Set Frame Format
>> Asynchronous mode
>> No Parity
>> 1 StopBit
>> char size 8
*/
UCSRC=(1<<URSEL)|(3<<UCSZ0);
//Enable The receiver and transmitter
UCSRB=(1<<RXEN)|(1<<TXEN);
}
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 31
//This function is used to read the available data
//from USART. This function will wait untill data is
//available.
char USARTReadChar()
{
//Wait untill a data is available
while(!(UCSRA & (1<<RXC)))
{
//Do nothing
}
//Now USART has got data from host
//and is available is buffer
return UDR;
}
//This fuction writes the given "data" to
//the USART which then transmit it via TX line
void USARTWriteChar(unsigned char data)
{
//Wait untill the transmitter is ready
while(!(UCSRA & (1<<UDRE)))
{
//Do nothing
}
//Now write the data to USART buffer
UDR=data;
}
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 32
int main(void)
{
//InitLCD(LS_BLINK);
//LCDClear();
USARTInit(103);
//LCDWriteStringXY(0,0,"ROBO INDIA");
_delay_ms(500);
SETBIT(DDRC,BIT(7));
SETBIT(DDRD,BIT(2));
SETBIT(DDRD,BIT(3));
SETBIT(DDRD,BIT(4));
CLEARBIT(PORTC,BIT(5));
CLEARBIT(PORTD,BIT(2));
CLEARBIT(PORTD,BIT(3));
CLEARBIT(PORTD,BIT(4));
while(1)
{
//TODO:: Please write your application code
char data = USARTReadChar();
//LCDWriteIntXY(0,1,data,3);
if(data == 'A')
{
SETBIT(PORTC,BIT(5));
}
if(data == 'B')
{
CLEARBIT(PORTC,BIT(5));
}
if(data == 'C')
{
SETBIT(PORTD,BIT(2));
A Project report on PC Based Industrial Automation by ROBO INDIA
R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 33
}
if(data == 'D')
{
CLEARBIT(PORTD,BIT(2));
}
if(data == 'E')
{
SETBIT(PORTD,BIT(3));
}
if(data == 'F')
{
CLEARBIT(PORTD,BIT(3));
}
if(data == 'G')
{
SETBIT(PORTD,BIT(4));
}
if(data == 'H')
{
CLEARBIT(PORTD,BIT(4));
}
}
}

More Related Content

PC Based Industrial Automation With AVR Atmega 16 - Project Report

  • 1. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 1 PROJECT REPORT ON PC Based Industrial automation and electric machine and device control.
  • 2. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 2 Chapter 1 Introduction Automation or automatic control is the use of various control systems for operating equipment such as machinery, processes in factories, boilers and heat treating ovens, switching in telephone networks, steering and stabilization of ships, aircraft and other applications with minimal or reduced human intervention. Some processes have been completely automated. The biggest benefit of automation is that it saves labour, however, it is also used to save energy and materials and to improve quality, accuracy and precision. The term automation, inspired by the earlier word automatic (coming from automaton), was not widely used before 1947, when General Motors established the automation department. It was during this time that industry was rapidly adopting feedback controllers, which were introduced in the 1930s.
  • 3. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 3 Automation has been achieved by various means including mechanical, hydraulic, pneumatic, electrical, electronic and computers, usually in combination. Complicated systems, such as modern factories, airplanes and ships typically use all these combined techniques. 1.1 Types of automation Two common types of automation are feedback control, which is usually continuous and involves taking measurements using a sensor and making calculated adjustments to keep the measured variable within a set range, and sequence control, in which a programmed sequence of discrete operations is performed, often based on system logic. Cruise control is an example of the former while an elevator or an automated teller machine (ATM) is an example of the latter. The theoretical basis of feedback control is control theory, which also covers servomechanisms, which are often part of an automated system. Feedback control is called "closed loop" while non-feedback control is called "open loop." 1.2 Feedback control Feedback control is accomplished with a controller. To function properly, a controller must provide correction in a manner that maintains stability. Maintaining stability is a principal objective of control theory. As an example of feedback control, consider a steam coil air heater in which a temperature sensor measures the temperature of the heated air, which is the measured variable. This signal is constantly "fed back" to the controller, which compares it to the desired setting (set point). The controller calculates the difference (error), then calculates a correction and sends the correction signal to adjust the air pressure to a diaphragm that moves a positioner on the steam valve, opening or closing it by the calculated amount. All the elements constituting the measurement and control of a single variable are called a control loop. The complexities of this are that the quantities involved are all of different physical types; the temperature sensor signal may be electrical or pressure from an enclosed fluid, the controller may employ pneumatic, hydraulic, mechanical or electronic
  • 4. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 4 techniques to sense the error and send a signal to adjust the air pressure that moves the valve. The first controllers used analog methods to perform their calculations. Analog methods were also used in solving differential equations of control theory. The electronic analog computer was developed to solve control type problems and electronic analog controllers were also developed. Analog computers were displaced by digital computers when they became widely available. Common applications of feedback control are control of temperature, pressure, flow, and speed. 1.3 Sequential control and logical sequence control Sequential control may be either to a fixed sequence or to a logical one that will perform different actions depending on various system states. An example of an adjustable but otherwise fixed sequence is a timer on a lawn sprinkler. An elevator is an example that uses logic based on the system states to perform certain actions in response to operator input. A development of sequential control was relay logic, by which electrical relays engage electrical contacts which either start or interrupt power to a device. Relays were first used in telegraph networks before being developed for controlling other devices, such as when starting and stopping industrial-sized electric motors or opening and closing solenoid valves. Using relays for control purposes allowed event-driven control, where actions could be triggered out of sequence, in response to external events. These were more flexible in their response than the rigid single-sequence cam timers. More complicated examples involved maintaining safe sequences for devices such as swing bridge controls, where a lock bolt needed to be disengaged before the bridge could be moved, and the lock bolt could not be released until the safety gates had already been closed. The total number of relays, cam timers and drum sequencers can number into the hundreds or even thousands in some factories. Early programming techniques and languages were needed to make such systems manageable, one of the first being ladder logic, where diagrams of the interconnected relays resembled the rungs of a ladder.
  • 5. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 5 Special computers called programmable logic controllers were later designed to replace these collections of hardware with a single, more easily re-programmed unit. In a typical hard wired motor start and stop circuit (called a control circuit) a motor is started by pushing a "Start" or "Run" button that activates a pair of electrical relays. The "lock-in" relay locks in contacts that keep the control circuit energized when the push button is released. (The start button is a normally open contact and the stop button is normally closed contact.) Another relay energizes a switch that powers the device that throws the motor starter switch (three sets of contacts for three phase industrial power) in the main power circuit. (Note: Large motors use high voltage and experience high in-rush current, making speed important in making and breaking contact. This can be dangerous for personnel and property with manual switches.) All contacts are held engaged by their respective electromagnets until a "stop" or "off" button is pressed, which de-energizes the lock in relay. See diagram: Motor Starters Hand-Off-Auto With Start-Stop (Note: The above description is the "Auto" position case in this diagram). Commonly interlocks are added to a control circuit. Suppose that the motor in the example is powering machinery that has a critical need for lubrication. In this case an interlock could be added to insure that the oil pump is running before the motor starts. Timers, limit switches and electric eyes are other common elements in control circuits. Solenoid valves are widely used on compressed air or hydraulic fluid for powering actuators on mechanical components. While motors are used to supply continuous rotary motion, actuators are typically a better choice for intermittently creating a limited range of movement for a mechanical component, such as moving various mechanical arms, opening or closing valves, raising heavy press rolls, applying pressure to presses. 1.4 Computer control Computers can perform both sequential control and feedback control, and typically a single computer will do both in an industrial application. Programmable logic controllers (PLCs) are a type of special purpose microprocessor that replaced many hardware components such as timers and drum sequencers used in relay logic. General purpose process control computers have increasingly replaced standalone controllers,
  • 6. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 6 with a single computer able to perform the operations of hundreds of controllers. Process control computers can process data from a network of PLCs, instruments and controllers in order to implement typical (such as PID) control of many individual variables or, in some cases, to implement complex control algorithms using multiple inputs and mathematical manipulations. They can also analyse data and create real time graphical displays for operators and run reports for engineers and management. Control of an automated teller machine (ATM) is an example of an interactive process in which a computer will perform a logic derived response to a user selection based on information retrieved from a networked database. The ATM process has a lot of similarities to other online transaction processes. The different logical responses are called scenarios. Such processes are typically designed with the aid of use cases and flowcharts, which guide the writing of the software code. 1.5 Industrial automation Industrial automation deals primarily with the automation of manufacturing, quality control and material handling processes. General purpose controllers for industrial processes include Programmable logic controllers and computers. One trend is increased use of Machine vision to provide automatic inspection and robot guidance functions, another is a continuing increase in the use of robots. Energy efficiency in industrial processes has become a higher priority. Semiconductor companies like Infineon Technologies are offering 8-bit micro-controller applications for example found in motor controls, general purpose pumps, fans, and ebikes to reduce energy consumption and thus increase efficiency. 1.6 Project Specifications Our industrial automation project is having following features and specification. 1. Number of devices to be controlled: 4 2. Current rating : 10A 3. Voltage : 220V 4. PC based control 5. Hardware interface : USB 6. Control Software : computer interface(GUI)
  • 7. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 7 7. The project is very user friendly because of the computer interface developed by us, even layman could operate it. 8. The GUI is platform free and doesn’t require any tool like MATLAB. A single setup file that can be executed on any both windows operating system i.e. 32/64 bits. 9. We have developed MATLAB based GUI as well. 10. The controlling hardware is using USB that makes it ultra-portable. Unlike to the old systems of serial ports.
  • 8. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 8 Chapter 2 Objective The main objective of our project is to automate industrial devices. We have added 4 relays in our project. These relays are electromechanical switches and can handle electrical device of AC and DC both. Thus our project is providing automation to a wide range of industrial devices. Other objectives are to make the project to the possible low cost. The material used to construct this project is selected after an extensive research of the market. We have analysed hundreds of options before selecting the components. We have taken care that low price doesn’t hamper the quality of project. The optimal utilization of cost makes our project ultra-low cost. The PC based control requires software that runs on PC. Our software is based on Graphical user interface.
  • 9. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 9 This makes the project very easy to use. Lab assistants or the operator can use this software even with proving any sort of training to them. These are the objectives fulfilled by our project.
  • 10. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 10 Chapter 3 Methodology The following block diagram explains working of the system, later we shall discuss all of the components of the diagram. Fig.2 | Block diagram
  • 11. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 11 Chapter 4 Programming of hardware controller This chapter elaborate the programming of hardware controller. 4.1 Introduction to embedded C Our project is made using embedded programming. The programming language required for construction of the project is Embedded C. Here in this chapter we will see the programming of the project and interfacing with the compiler. Before moving ahead have a look on embedded system. An embedded system is a computer system with a dedicated function within a larger mechanical or electrical system, often with real-time computing constraints.It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal computer (PC), is designed to be flexible and to meet a wide range of end-user needs. Embedded systems control many devices in common use today. Modern embedded systems are often based on microcontrollers (i.e CPUs with integrated memory and/or peripheral interfaces) but ordinary microprocessors (using
  • 12. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 12 external chips for memory and peripheral interface circuits) are also still common, especially in more complex systems. In either case, the processor(s) used may be types ranging from rather general purpose to very specialised in certain class of computations, or even custom designed for the application at hand. A common standard class of dedicated processors is the digital signal processor (DSP). The key characteristic, however, is being dedicated to handle a particular task. Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale. Physically, embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, and largely complex systems like hybrid vehicles, MRI, and avionics. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure. Embedded systems are commonly found in consumer, cooking, industrial, automotive, medical, commercial and military applications. Telecommunications systems employ numerous embedded systems from telephone switches for the network to cell phones at the end-user. Computer networking uses dedicated routers and network bridges to route data. Consumer electronics include personal digital assistants (PDAs), mp3 players, mobile phones, videogame consoles, digital cameras, DVD players, GPS receivers, and printers. Household appliances, such as microwave ovens, washing machines and dishwashers, include embedded systems to provide flexibility, efficiency and features. Advanced HVAC systems use networked thermostats to more accurately and efficiently control temperature that can change by time of day and season. Home automation uses wired- and wireless-networking that can be used to control lights, climate, security, audio/visual, surveillance, etc., all of which use embedded devices for sensing and controlling.
  • 13. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 13 Transportation systems from flight to automobiles increasingly use embedded systems. New airplanes contain advanced avionics such as inertial guidance systems and GPS receivers that also have considerable safety requirements. Various electric motors — brushless DC motors, induction motors and DC motors — use electric/electronic motor controllers. Automobiles, electric vehicles, and hybrid vehicles increasingly use embedded systems to maximize efficiency and reduce pollution. Other automotive safety systems include anti-lock braking system (ABS), Electronic Stability Control (ESC/ESP), traction control (TCS) and automatic four-wheel drive. Medical equipment uses embedded systems for vital signs monitoring, electronic stethoscopes for amplifying sounds, and various medical imaging (PET, SPECT, CT, MRI) for non-invasive internal inspections. Embedded systems within medical equipment are often powered by industrial computers. Embedded systems are used in transportation, fire safety, safety and security, medical applications and life critical systems, as these systems can be isolated from hacking and thus, be more reliable.[citation needed] For fire safety, the systems can be designed to have greater ability to handle higher temperatures and continue to operate. In dealing with security, the embedded systems can be self-sufficient and be able to deal with cut electrical and communication systems. A new class of miniature wireless devices called motes are quickly gaining popularity as the field of wireless sensor networking is increasing. Wireless sensor networking, WSN, makes use of miniaturization made possible by advanced IC design to couple full wireless subsystems to sophisticated sensors, enabling people and companies to measure a myriad of things in the physical world and act on this information through IT monitoring and control systems. These motes are completely self-contained, and will typically run off a battery source for years before the batteries need to be changed or charged. Embedded Wi-Fi modules provide a simple means of wirelessly enabling any device which communicates via a serial port. 4.2 The compiler Atmel® Studio 6 is the integrated development platform (IDP) for developing and debugging Atmel ARM® Cortex®-M and Atmel AVR® microcontroller (MCU) based
  • 14. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 14 applications. The Atmel Studio 6 IDP gives you a seamless and easy-to-use environment to write, build and debug your applications written in C/C++ or assembly code. Atmel Studio 6 is free of charge and is integrated with the Atmel Software Framework (ASF)—a large library of free source code with 1,600 ARM and AVR project examples. ASF strengthens the IDP by providing, in the same environment, access to ready-to-use code that minimizes much of the low-level design required for projects. Use the IDP for our wide variety of AVR and ARM Cortex-M processor-based MCUs, including our broadened portfolio of Atmel SAM3 ARM Cortex-M3 and M4 Flash devices. With the introduction of Atmel Gallery and Atmel Spaces, Atmel Studio 6 further simplifies embedded MCU designs to reduce development time and cost. Atmel Gallery is an online apps store for development tools and embedded software. Atmel Spaces is a cloud-based collaborative development workspace allowing you to host software and hardware projects targeting Atmel MCUs. In summary, standard integrated development environments (IDEs) are suited for creating new software for an MCU project. By contrast, the Atmel Studio 6 IDP also: Facilitates reuse of existing software and, by doing so, enables design differentiation. Supports the product development process with easy access to integrated tools and software extensions through Atmel Gallery. Reduces time to market by providing advanced features, an extensible software eco-system, and powerful debug integration. fig | Atmel Studio
  • 15. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 15 Chapter 5 The parts & Interfacing Following are the parts of the project. 5.1. 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 contactor. Solid-state relays control power circuits with
  • 16. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 16 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". Fig | Relay A simple electromagnetic relay consists of a coil of wire wrapped around a soft iron core, an iron yoke which provides a low reluctance path for magnetic flux, a movable iron armature, and one or more sets of contacts (there are two in the relay pictured). The armature is hinged to the yoke and mechanically linked to one or more sets of moving contacts. It is held in place by a spring so that when the relay is de-energized there is an air gap in the magnetic circuit. In this condition, one of the two sets of contacts in the relay pictured is closed, and the other set is open. Other relays may have more or fewer sets of contacts depending on their function. The relay in the picture also has a wire connecting the armature to the yoke. This ensures continuity of the circuit between the moving contacts on the armature, and the circuit track on the printed circuit board (PCB) via the yoke, which is soldered to the PCB. When an electric current is passed through the coil it generates a magnetic field that activates the armature, and the consequent movement of the movable contact(s) either
  • 17. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 17 makes or breaks (depending upon construction) a connection with a fixed contact. If the set of contacts was closed when the relay was de-energized, then the movement opens the contacts and breaks the connection, and vice versa if the contacts were open. When the current to the coil is switched off, the armature is returned by a force, approximately half as strong as the magnetic force, to its relaxed position. Usually this force is provided by a spring, but gravity is also used commonly in industrial motor starters. Most relays are manufactured to operate quickly. In a low-voltage application this reduces noise; in a high voltage or current application it reduces arcing. When the coil is energized with direct current, a diode is often placed across the coil to dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise generate a voltage spike dangerous to semiconductor circuit components. Some automotive relays include a diode inside the relay case. Alternatively, a contact protection network consisting of a capacitor and resistor in series (snubber circuit) may absorb the surge. If the coil is designed to be energized with alternating current (AC), a small copper "shading ring" can be crimped to the end of the solenoid, creating a small out-of-phase current which increases the minimum pull on the armature during the AC cycle. A solid-state relay uses a thyristor or other solid-state switching device, activated by the control signal, to switch the controlled load, instead of a solenoid. An optocoupler (a light-emitting diode (LED) coupled with a photo transistor) can be used to isolate control and controlled circuits. 5.3 The controller Robotic arm controller comprises several electronic components. Here we will discuss the important parts of the circuit. 5.3.1 The microcontroller (Atmega 16) The ATmega16 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the ATmega16 achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed.
  • 18. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 18 Fig.| Atmega 16 Pinout diagram. | PDIP package
  • 19. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 19 Fig.| Atmega 16 Pinout diagram. | TQFP package
  • 20. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 20 Fig.| Atmega 16 Pinout diagram. | MLF package
  • 21. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 21 Fig.31 | Block diagram of Atmega 8
  • 22. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 22 The AVR core combines a rich instruction set with 32 general purpose working registers. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be accessed in one single instruction executed in one clock cycle. The resulting architecture is more code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers. The ATmega16 provides the following features: 16K bytes of In-System Programmable Flash Program memory with Read-While-Write capabilities, 512 bytes EEPROM, 1K byte SRAM, 32 general purpose I/O lines, 32 general purpose working registers, a JTAG interface for Boundary scan, On-chip Debugging support and programming, three flexible Timer/Counters with compare modes, Internal and External Interrupts, a serial programmable USART, a byte oriented Two-wire Serial Interface, an 8-channel, 10-bit ADC with optional differential input stage with programmable gain (TQFP package only), a programmable Watchdog Timer with Internal Oscillator, an SPI serial port, and six software selectable power saving modes. The Idle mode stops the CPU while allowing the USART, Two-wire interface, A/D Converter, SRAM, Timer/Counters, SPI port, and interrupt system to continue functioning. The Power-down mode saves the register contents but freezes the Oscillator, disabling all other chip functions until the next External Interrupt or Hardware Reset. In Power-save mode, the Asynchronous Timer continues to run, allowing the user to maintain a timer base while the rest of the device is sleeping. The ADC Noise Reduction mode stops the CPU and all I/O modules except Asynchronous Timer and ADC, to minimize switching noise during ADC conversions. In Standby mode, the crystal/resonator Oscillator is running while the rest of the device is sleeping. This allows very fast start-up combined with low-power consumption. In Extended Standby mode, both the main Oscillator and the Asynchronous Timer continue to run. The device is manufactured using Atmel’s high density non-volatile memory technology. The On chip ISP Flash allows the program memory to be reprogrammed in-system through an SPI serial interface, by a conventional non-volatile memory programmer, or by an On-chip Boot program running on the AVR core. The boot program can use any interface to download the application program in the Application Flash memory. Software in the Boot Flash section will continue to run while the Application Flash section is updated, providing true Re ad-While-Write operation. By combining an 8-bit RISC CPU with In-System Self- Programmable Flash on a monolithic chip, the Atmel ATmega16 is a powerful
  • 23. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 23 microcontroller that provides a highly-flexible and cost-effective solution to many embedded control applications. The ATmega16 AVR is supported with a full suite of program and system development tools including: C compilers, macro assemblers, program debugger/simulators, in-circuit emulators, and evaluation kits. 5.3.1.1 Pin Description of ATmega 16.  VCC: Digital supply voltage.  GND: Ground.  Port A (PA7..PA0): Port A serves as the analog inputs to the A/D Converter. Port A also serves as an 8-bit bi-directional I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up resistors (selected for each bit). The Port A output buffers have symmetrical drive characteristics with both high sink and source capability. When pins PA0 to PA7 are used as inputs and are externally pulled low, they will source current if the internal pull-up resistors are activated. The Port A pins are tri-stated when a reset condition becomes active, even if the clock is not running.  Port B (PB7..PB0): Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running.  Port C (PC7..PC0): Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port C output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running. If the JTAG interface is enabled, the pull-up resistors on pins PC5(TDI), PC3(TMS) and PC2(TCK) will be activated even if a reset occurs.
  • 24. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 24  Port D (PD7..PD0): Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running.  RESET: Reset Input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running.  XTAL1: Input to the inverting Oscillator amplifier and input to the internal clock operating circuit.  XTAL2: Output from the inverting Oscillator amplifier.  AVCC: AVCC is the supply voltage pin for Port A and the A/D Converter. It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter.  AREF: AREF is the analog reference pin for the A/D Converter. 5.3 Serial Communication: Serial communication is a way enables different equipments to communicate with their outside world. It is called serial because the data bits will be sent in a serial way over a single line. A personal computer has a serial port known as communication port or COM Port used to connect a modem for example or any other device, there could be more than one COM Port in a PC. Serial ports are controlled by a special chip called UART (Universal Asynchronous Receiver Transmitter). Different applications use different pins on the serial port and this basically depend of the functions required. If we need to connect our PC for example to some other device by serial port, then we have to read instruction manual for that device to know how the pins on both sides must be connected and the setting required.
  • 25. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 25 5.3.1 Advantages of Serial Communication Serial communication has some advantages over the parallel communication. One of the advantages is transmission distance, serial link can send data to a remote device more far then parallel link. Also the cable connection of serial link is simpler then parallel link and uses less number of wires. Serial link is used also for Infrared communication, now many devices such as laptops & printers can communicate via inferred link. 5.3.2 Communication methods There are two methods for serial communication, Synchronous & Asynchronous. 5.3.2.1 Synchronous serial communication: In Synchronous serial communication the receiver must know when to “read” the next bit coming from the sender, this can be achieved by sharing a clock between sender and receiver. In most forms of serial Synchronous communication, if there is no data available at a given time to transmit, a fill character will be sent instead so that data is always being transmitted. Synchronous communication is usually more efficient because only data bits are transmitted between sender and receiver, however it will be more costly because extra wiring and control circuits are required to share a clock signal between the sender and receiver. 5.3.2.2 Asynchronous serial communication: Asynchronous transmission allows data to be transmitted without the sender having to send a clock signal to the receiver. Instead, special bits will be added to each word in order to synchronize the sending and receiving of the data. When a word is given to the UART for Asynchronous transmissions, a bit called the “Start Bit” is added to the beginning of each word that is to be transmitted. The Start Bit
  • 26. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 26 is used to alert the receiver that a word of data is about to be sent, and to force the clock in the receiver into synchronization with the clock in the transmitter. Fig.32 | Example of serial data transmission After the Start Bit, the individual bits of the word of data are sent, each bit in the word is transmitted for exactly the same amount of time as all of the other bits When the entire data word has been sent, the transmitter may add a Parity Bit that the transmitter generates. The Parity Bit may be used by the receiver to perform simple error checking. Then at least one Stop Bit is sent by the transmitter. If the Stop Bit does not appear when it is supposed to, the UART considers the entire word to be garbled and will report a Framing Error. 5.4 USB to Serial Converter Since latest computers and laptops don’t come with serial ports. Because the popularity of the USB. So we are using USB to serial converter. That makes our project ultra- portable. A typical USB to serial converter creates a comport on the computer or laptop and connects that comport to the external world.
  • 27. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 27 Fig.33 | USB to Serial Converter. 5.5 Software The software we have got, is very easy to use. It requires the comport no. to the project controller is attached. The complete operations of the project can be controlled through the buttons provided in the software. This software provide axis wise control. Fig | The software Controller.
  • 28. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 28 Chapter 7 References 1. Atmega 16 data sheet. 2. USB to serial data sheet. 3. Serial communication manual of MS .net frame work 4. Serial communication manual of MATLAB.
  • 29. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 29 Appendix 1 The codding /* * at8_pc_deviceCtrl.c * * Created: 27/Mar/2014 06:23:13 * Author: acer */ #include <avr/io.h> #include "lcd.h" /*Macros definition*/ #define BIT(x) (1 << (x)) //Set a particular bit mask #define CHECKBIT(x,b) x&b //Checks bit status
  • 30. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 30 #define SETBIT(x,b) x|=b; //Sets the particular bit #define CLEARBIT(x,b) x&=~b; //Sets the particular bit #define TOGGLEBIT(x,b) x^=b; //Toggles the particular bit #define TOGGLEBIT(x,b) x^=b; //Toggles the particular bit /*Macros definition ends*/ void USARTInit(uint16_t ubrr_value) { //Set Baud rate UBRRL = ubrr_value; UBRRH = (ubrr_value>>8); /*Set Frame Format >> Asynchronous mode >> No Parity >> 1 StopBit >> char size 8 */ UCSRC=(1<<URSEL)|(3<<UCSZ0); //Enable The receiver and transmitter UCSRB=(1<<RXEN)|(1<<TXEN); }
  • 31. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 31 //This function is used to read the available data //from USART. This function will wait untill data is //available. char USARTReadChar() { //Wait untill a data is available while(!(UCSRA & (1<<RXC))) { //Do nothing } //Now USART has got data from host //and is available is buffer return UDR; } //This fuction writes the given "data" to //the USART which then transmit it via TX line void USARTWriteChar(unsigned char data) { //Wait untill the transmitter is ready while(!(UCSRA & (1<<UDRE))) { //Do nothing } //Now write the data to USART buffer UDR=data; }
  • 32. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 32 int main(void) { //InitLCD(LS_BLINK); //LCDClear(); USARTInit(103); //LCDWriteStringXY(0,0,"ROBO INDIA"); _delay_ms(500); SETBIT(DDRC,BIT(7)); SETBIT(DDRD,BIT(2)); SETBIT(DDRD,BIT(3)); SETBIT(DDRD,BIT(4)); CLEARBIT(PORTC,BIT(5)); CLEARBIT(PORTD,BIT(2)); CLEARBIT(PORTD,BIT(3)); CLEARBIT(PORTD,BIT(4)); while(1) { //TODO:: Please write your application code char data = USARTReadChar(); //LCDWriteIntXY(0,1,data,3); if(data == 'A') { SETBIT(PORTC,BIT(5)); } if(data == 'B') { CLEARBIT(PORTC,BIT(5)); } if(data == 'C') { SETBIT(PORTD,BIT(2));
  • 33. A Project report on PC Based Industrial Automation by ROBO INDIA R O B O I N D I A | w w w . r o b o i n d i a . c o m Page 33 } if(data == 'D') { CLEARBIT(PORTD,BIT(2)); } if(data == 'E') { SETBIT(PORTD,BIT(3)); } if(data == 'F') { CLEARBIT(PORTD,BIT(3)); } if(data == 'G') { SETBIT(PORTD,BIT(4)); } if(data == 'H') { CLEARBIT(PORTD,BIT(4)); } } }