You are on page 1of 124

Addis Ababa Science and Technology University

Electromechanical Engineering Department

Introduction to mechatronics
Lecturer: Bereket Walle (MSc in Mechatronics engineering)
Chapter IV
Sensor Communication
&
Data acquision system
4. Sensor Interfacing/communcation
• As we try to discuss in the first chapter of this course; There are different types
of sensors and acutators that we use in our daily life.
Sensors; position/distance, speed, Temprature, presence sensors etc
Actuators; LEDs, motors, solonoids, spreakers etc.
• Those sensors and actuators have a means of communication with
the centeral processing unit or what it call microcontrollers or
microprocessors(Programmable logic device).
• Sensors may be digital or analog .
• Microcontrollers are capable of processing only digital data.
4. Sensor comm…
4. Sensor comm…
i. Analog Input ports
• Analog ports are necessary to connect sensors to our controller.
• Also are known as Analog to Digital Convertor(ADC)
• They receive analog signal and convert them to a digital number with in a
certain numerical range.
• The analog signal is measured after a predefined period of time passes. At
each time period, the voltage is recorded as a number.
• This number then defines a signal of 0's and 1's.
• Most microcontrollers today are 8 bit, meaning they have a range of 256 (2^8
= 256).
• There are a few that are 10 bit, 12 bit, and even 32 bit, but as we increase
precision we also need a much faster processor.
4. Sensor commu…
• For example, suppose a sensor reads 0V to an 8 bit ADC this would give us a
digital output of 0. 5V would be 255.
• Now suppose a sensor gave an output of 2.9V, doing the math:
2.9V/5V = X/255 → X = (2.9*255)/5 = 148
• This bit range could also be seen as a resolution.
• Higher resolutions mean higher accuracy, but occasionally can mean slower
processing and more susceptibility to noise.
• For example, suppose we had a 3 bit controller which has a range of 2^3 = 8.
• Then we have a distance sensor that outputted a number 0 → 7 (a total of 8)
that represents the distance between our robot and the wall.
4. Sensor commu…
• If our sensor can see only 8 feet, then we get a resolution of 1 bit per foot (8
resolution / 8 feet = 1).
• But then suppose we have an 8 bit controller,
we would get 256/8 = 32 ~ 1 bit per centimeter - way more accurate
and useful! With the 3 bit controlle.
• The sensor output must not exceed our digital logic voltage (usually 0V →
5V), and then plug that output directly to the analog port
4. Sensor commu…
ii. Digital I/O Ports
• Digital ports are like analog ports, but with only 1 bit (2^1 = 2)
hence a resolution of 2 - on and off.
• Digital ports for that reason are rarely used for sensors; except for maybe
on/off switches.
• We can use them to control motors or LED's.
• Send a high 5V signal to turn something on, or a low 0V to turn something off.
Or if we want to have an LED at only half brightness, or a motor at half speed,
send a square wave.
• Square waves are like turning something on and off so fast
4. Sensor commu…
iii. Serial Communication and Timers

• A serial connection on a microcontroller is very useful for communication.


• We can use it to program the controller from a computer, and to output data
from the controller to a computer (great for debugging), or even to operate
other electronics such as digitalvideo cameras.
• Usually the microcontroller would require an external IC to handle everything,
such as an RS232.
• I^2C (pronounced 'Isquared-C') is also useful for communicating.
• It's actually somewhat complicated, but usually the manufacturer has
simplified it.
4. Sensor commu…
• A timer is the method by which the microcontroller measures the
passing of time - such as for a clock, sonar, a pause/wait command,
timer interrupts, etc.
iv. Motor Driver
• To run a dc motor we need to either have an H-Bridge or a Motor Driver IC.
• The IC is great for small robots that do not exceed 1 or 2 amps per motor and
the rated motor voltage is not higher than about 12V.
• The home made H-Bridge would need to be used if we wanted to exceed those
specs with a heat sink onto the motor driver.
4. Sensor commu…
2- Standard Interfacing Circuits
i. Output Device Interfacing
• Many output devices will require a transistor switching circuit.
• In most cases a Darlington pair formed from two transistors is ideal.
4. Sensor commu…
• Note that it is usual to connect a back EMF suppression diode across the
output device.
• This is essential with devices such as relays, solenoids and motors which
create a back EMF when power is switched off.
4. Sensor commu…
• A relay can be used to switch higher power devices such as
motors and solenoids.
• If desired, the relay can be powered by a separate power supply, so, for
instance, 12V solenoids can be controlled by the microcontroller.
• Note the use of a back EMF suppression diode across the relay contacts. This
is to prevent damage to the transistor when the relay switches off.
4. Sensor commu…
Data acquisition system
• Data acquisition is the process by which physical phenomena from
the real world are transformed into electrical signals that are
measured and converted into a digital format for processing,
analysing, and storage by a computer
• A data acquisition system is a device or an integrated system used to
collect information about the state or condition of various
parameters of any process.
4. Sensor commu…
• A Data Acquisition System ( DAQ) is a combination of computer hardware
and software that gathers stores or processes data in order to control or
monitor some sort of physical process. The basic elements of a data
acquisition system
1. Sensors and transducers
2. Field wiring
3. Signal conditioning
4. Data acquisition hardware
5. PC (operating system)
6. Data acquisition software

4. Sensor commu…
• Sesors measure physical variables such as pressure, flow, & motion into
electrical signals.
• Field wiring used to connect different hardware components.
• The signal conditioning device amplifies and filters the sensor signal
• Data acquisition hardware is used to convert analog signal to digital and
digital signal to analog.
• The computer provides a processor, a system clock, a bus to transfer data,
memory and disc space to store data.
• Software includes both operating system and data acquisition software.
• The software allows exchanging information between the hardware and
computer.
4. Sensor commu…
Data acquisition system structure
4. Sensor commu…
Chapter V
Digital Logic Circuit
5. Digital Logic
Introduction:

• Digital electronic devices used for logic, display, sequencing, timing, and
other functions in mechatronic systems.
• The fundamentals presented in this chapter are important in understanding the
basic functioning of all digital components and systems used in the control of
mechatronic systems.
• Analog signal that changes in a continuous manner, a digital signal exists
only at specific levels or states and changes its level in discrete steps.
• Most digital signals have only two states: high and low.
• A system using two-state signals allows the application of Boolean logic and
binary number representations,
• which form the foundation for the design of all digital devices
5. Digital Logic
• Digital devices are categorized according to their function as combinational
logic or sequential logic devices.

Combinational Logic Circuit

• Combinational Logic circuit contains logic gates where its output is


determined by the combination of the current input, regardless of the output
or the prior combination of input.
• Basically, combinational circuit can be depicted by Diagram 1 below:
• Digital devices convert digital inputs into one or more digital outputs.
• The difference between the two categories is based on signal timing.
5. Digital Logic
• Logic circuits for half adder (HA)
5. Digital Logic
Sequential Logic Circuit

• Sequential Logic Circuit contains logic gates arranged in parallel and its output
is not only determined by the combination of the current input, but also the
prior output.
• The circuit also contains memory elements that enable it to store the
information of the prior output.
• Examples of sequential circuits in the computer system are like registers,
counters and serial adders
5. Digital Logic
Gated S/R Latch
5. Digital Logic

• The standard AND, NAND, OR, NOR, and XOR gates have only two inputs,
but other forms are available with more than two inputs.
• In the case of a multiple input AND gate, the output is 1 if and only if all
inputs are 1.
• Logic gates are built using transistors
NOT Gate -- Inverter

NOT X Y
X Y 0 1
1 0
Y = ~X
NOT

X ~X ~~X = X

X ~X ~~X
0 1 0
1 0 1
AND Gate

AND
X Y Z
X 0 0 0
0 1 0
Z
1 0 0
Y 1 1 1

Z = X & Y
OR Gate

OR
X Y Z
X 0 0 0
Z 0 1 1
Y 1 0 1
1 1 1
Z = X | Y
NAND Gate

NAND
X Y Z
X 0 0 1
0 1 1
Z
1 0 1
Y 1 1 0

Z = ~(X & Y)
nand(Z,X,Y)
NAND Gate

NOT-AND
X Y W Z
X 0 0 0 1
W 0 1 0 1
Z
1 0 0 1
Y 1 1 1 0

W = X & Y

Z = ~W = ~(X & Y)
NOR Gate

NOR
X Y Z
X 0 0 1
Z 0 1 0
Y 1 0 0
1 1 0
Z = ~(X | Y)
nor(Z,X,Y)
NOR Gate

NOT-OR
X Y W Z
X 0 0 0 1
W Z 0 1 1 0
Y 1 0 1 0
1 1 1 0
W = X | Y

Z = ~W = ~(X | Y)
Exclusive-OR Gate

XOR X Y Z
X
Z 0 0 0
Y
0 1 1
Z = X ^ Y 1 0 1
xor(Z,X,Y)
1 1 0
Exclusive-NOR Gate

XNOR X Y Z
X
Z 0 0 1
Y
0 1 0
Z = ~(X ^ Y)
1 0 0
Z = X ~^ Y
1 1 1
xnor(Z,X,Y)
5. Digital Logic

Note: The algebraic symbols used to represent the logic functions are: plus (+) for
logic OR, dot (·) for the logic AND, and an overbar for logic NOT, denoting inversion.
5. Digital Logic
5. Digital Logic
Timing diagrams
5. Digital Logic
Boolean algebra
5. Digital Logic
Boolean algebra
5. Digital Logic
Boolean algebra
5. Digital Logic
Boolean algebra
5. Digital Logic
Logical Expression Simplification

Note: K-map method take it as reading assignment


5. Digital Logic
5. Digital Logic
5. Digital Logic
5. Digital Logic
• NAND and NOR gates are called universal gate
5. Digital Logic
• Logic Chips are built from logic gates

• Integration levels may be Small(SSI), Medium(MSI), Large(LSI) or


Very Large Scale Integration (VLSI).
5. Digital Logic
Draw the Circuit Diagram
End of Chapter V
Chapter VI

Microcontroller and microprocessors


5. Micro-processors and Micro-controllers

Introduction
Programmable Logic Devices (PLD) are programmable systems and are
generally used in manufacturing.
There are following three types of PLDs are being employed in mechatronics
systems
1. Microprocessor
It is a digital integrated circuit which carries out necessary digital functions to process the
information obtained from measurement system.
2. Microcomputer
It uses microprocessor as its central processing unit and contains all functions of a
computer.
3. Programmable Logic Controller (PLC)
It is used to control the operations of electro-mechanical devices especially in tough and
hazardous industrial environments.
6. Micro…
A typical programmable machine has basic three components

1. Processor, which processes the information collected from measurement system and
takes logical decisions based on the information.
2. Memory, it stores the input data collected from sensors and the programs to process the
information and to take necessary decisions . A group of programs is called software.
3. Input/output devices: these are used to communicate with the outside world/operator.
6. Micro…

A. Microprocessor
It is a multi-purpose programmable device
• It reads binary instructions from a storage device called memory
• It processes the data according to the instructions, and then provides results as
output.
• known as CPU (central processing unit).
• CPU can be referred as complete computational engine on a single chip.
6. Micro…
A. Microprocessor
• Applications of microprocessors are classified in two categories:
i. Reprogrammable Systems
supports CPUs for the personal computer and workstation industry, where the
main constraints are high speed and large word size (32 and 64 bits).
ii. Embedded Systems
Used for development of the microcontroller, which is a single IC
containing specialized circuits and functions that are applicable to
mechatronic system design.
Eg. photocopying machine, Digital camera

• First Microcontroller, Intel 4004 was launched in 1971.


• It was able to process just 4 bits. It started a new era in electronics engineering
6. Micro…
• Microprocessor works or operates in binary digits i.e. 0 and 1, bits.
• These bits are nothing but electrical voltages in the machine,
• Generally 0 - low voltage level, and 1 - high voltage level.
• A group of bits form a ‘word’. In general, the word length is about 8 bits. This is
called as a ‘byte’.
• A word with a length of 4 bits is called as a ‘Nibble’
6. Micro…
Basic blocks of a microprocessor functions
• ALU: ALU stands for Arithmetical Logical Unit. As name indicates it
has two parts:
a. Arithmetical unit which is responsible for mathematical
operations like
addition, subtraction, multiplication and division,
b. Logical unit which is dedicated to take logical decisions like
greater than, less than, equal to, not equal to etc. (Basically
AND/OR/NOT Operations)
• Register Array: Registers are small storage devices that are available to
CPU or processors. They act as temporary storage for processing of
intermediate data by mathematical or logical operations.
6. Micro…
• Control: This part of CPU is dedicated to coordinate data flow and signal
flow through various types of buses i.e. Data Bus, Control Bus, and Address
Bus etc. It directs data flow between CPU and storage and I/O devices.
• Memory: There are two different types of memory segments being used by
the CPU. First is the ROM which stands for Read Only Memory while other
is R/W which stands for Read and Write Memory or Random Access
Memory (RAM).
• Input Devices: Input devices are used to enter input data to microprocessor
from Keyboard or from ADC which receives data from sensors/signal
conditioning systems.
• Output Devices: These devices display the results/conclusions coming out
from ALUs either in soft copy (Monitor) or in Hard Copy (Printer).
End of Chapter VI
Chapter VII
Programable logic Controller (PLC)
7. PLC…
• Introduction:
• PLC was introduced in late 1960’s.
• First commercial & successful Programmable Logic
Controllers was designed and developed by Modicon as a
relay replacer for General Motors.
• Earlier, it was a machine with thousands of electronic parts.
Later ,in late 1970’s,the microprocessor became reality &
greatly enhanced the role of PLC permitting it to evolve form
simply relay to the sophisticated system as it is today.
7. PLC…
• PLC is actually an industrial microcontroller system where you
have hardware and software specifically adapted to industrial
environment.
• PLC is a digital computer designed for multiple inputs and output
arrangements, extended temperature ranges, immunity to electrical
noise, and resistance to vibration and impact.
• A PLC is an example of a real time system.
• Program unit is usually a computer used for writing a program
(often in ladder diagram).
7. PLC…
Key Terminologies:
1. Control task definition
• Control task is determining what needs to be done.
• This information provides the foundation for the control program.
• Proper definition of the task is directly related to the success of the control
program.
2. Control strategy
• After the control task has been defined, the planning of its solution can begin.
• It is determining the sequence of steps that must occur within the program to
produce the desired output control.
• This part of the program development is known as the development of an
algorithm.
7. PLC…
3. Creating flowcharts
• Flowcharting is a method of pictorially representing the operation of a
process in a sequential manner.
• It is a technique often used when planning a program after a written
description has been developed.
• A flowchart is a pictorial representation that records, analyzes, and
communicates information, as well as describes the operational process in a
sequential manner.
• Each step in the chart performs an operation, whether it is an input/output,
decision, or data process.
7. PLC…
7. PLC…

Figure Simple flowchart


7. PLC…
• Program coding—the process of translating a logic or relay diagram into PLC ladder
program form.
• Once the flowchart is completed, the user can employ either logic gates or contact
symbology to implement the logic sequences.
• Logic gates implement a logical output sequence given specific real and/or internal input
conditions, while PLC contact symbology directly implements the logic necessary to
program an output rung.
7. PLC…
Major Components of a Common PLC
7. PLC…
1. POWER SUPPLY; Provides the voltage needed to run the primary PLC components
2. I/O MODULES; Provides signal conversion and isolation between the internal logic
level signals inside the PLC and the field’s high level signal.
Input Signals can be AC or DC, Analog or Digital
1. PROCESSOR; Provides intelligence to command and govern the activities of the entire
PLC systems.
2. PROGRAMMING DEVICE; Used to enter the desired program that will determine the
sequence of operation and control of process equipment or driven machine.
3. Output Modules: Outputs are either AC or DC Analog Signals (Although it is possible to
‘Construct’ Digital Outputs)
• Modern PLC’s have Expansion Ports to Increase the Number of Available Inputs and
Outputs.
7. PLC…
PLC operation sequence

1. Self test: Testing of its own hardware and software for faults.
2. Input scan: If there are no problems, PLC will copy all the
inputs and copy their values into memory.
3. Logic solve/scan: Using inputs, the ladder logic program is
solved once and outputs are updated.
4. Output scan: While solving logic the output values are updated
only in memory when ladder scan is done, the outputs will be
updated using temporary values in memory.
7. PLC…
Programming Languages of PLC
 There are four most common PLC programming languages;
1. Ladder Logic
 The ladder logic is the oldest programming language for PLC.
 It is well suited to express Combinational logic.
 The main ladder logic symbols represent the elements:
 Ladder Logic Diagrams Provide a Method to Symbolically Show
How Relay Control Schemes are Implemented
 Relay Contacts and Coils, Inputs and Outputs lie on “Rungs”
Between the Positive and Ground Rails
7. PLC…
Basic Ladder Logic Symbol
7. PLC…
Simple Ladder Logic
7. PLC…
Simple Ladder Logic
7. PLC…
7. PLC…
7. PLC…

• Ladder Logic Program for Start/Stop of Motor :


7. PLC…
7. PLC…
Starting of Motor:
7. PLC…
Ladder Logic Diagram
Example 1
Draw a ladder diagram that will cause the output, pilot light PL2, to be on when selector
switch SS2 is closed, push button PB4 is closed and limit switch LS3 is open.

Example 2
Draw a ladder diagram that is
equivalent to the following
digital logic diagram
7. PLC…
Y is on when (A is on, B is on and C is off ) or D is on, or E is off

 What happens if the D


contact refers to Y?
7. PLC…
 Output Y is set (latched) indefinitely
7. PLC…
Repeated Output
• Do not repeat normal output coils that refer to the same address

• The coils for first and second rung refer to Out1


 Second rung overrides the logic in first rung
7. PLC…
Repeated Output Correction
First consider the output
Next, consider ALL the conditions that drive the output (Out1)
(Implement the conditions in parallel)
7. PLC…
Reverse Power Flow
• This is not allowed:

• If the reverse power flow path is truly needed, then put it as a


separate path, where the power flows from left to right:
7. PLC…
Reverse Power Flow
7. PLC…
Ladder Logic Evaluation
Ladder Logic Evaluation
Ladder Logic Evaluation
Ladder Logic Evaluation
Ladder Logic Evaluation
Ladder Logic Evaluation
Ladder Logic Evaluation
Push Button (PB) Scan Timing Diagram
7. PLC…
Advantage of PLCs;
• Reliability.
• Flexibility in programming and reprogramming.
• Cost effective for controlling complex systems.
• Small physical size, shorter project time.
• High speed of operation.
• Ability to communicate with computer systems in the
plant.
• Ease of maintenance /troubleshooting.
• Reduced space.
• Energy saving.
7. PLC…
Disadvantage of PLCs;
• PLC devices are proprietary it means that part or software of one manufacturer
can’t be used in combination with parts of another manufacturer.
• Limited design and cost option
• Fixed Circuit Operations.
7. PLC…
Applications
• Wherever automation is desired the PLCs are best suited to meet the task.
• Few examples of industries where PLCs are used :
1. Robots manufacturing and control
2. Car park control
3. Train control station system
4. Food processing
5. Materials handling
6. Machine tools
7. Conveyer system etc.
Chapter VIII

Micro sensors and Micro actuators in


Mechatronics
(Smart Materials)
8. Micro Sensor…
• The fundamental mechanism for both sensing and actuation is
energy transduction.
• The primary forms of physical electromechanical transduction can
be grouped into two categories.
1. The first is multicomponent transduction,
 Which utilizes “action at a distance” behavior between multiple
bodies.
 Which includes electromagnetic transduction based upon the
Lorentz equation
and Faraday’s law
 Which also includes electrostatic interaction based upon
Coulomb’s law
8. Micro Sensor…
2. The second is deformation-based or solid-state transduction,
 which utilizes mechanics-of-material phenomena such
as crystalline phase changes or molecular dipole alignment.
 Which includes piezoelectric effects, shape memory alloys,
and magnetostrictive, electrostrictive, and photostrictive
materials.
• Due to their importance, electrostatic and electromagnetic
transduction is treated separately in the sections that follow.
8. Micro Sensor…
• Characteristics of concern for both microactuator and microsensor
technology are repeatability,
• The ability to fabricate at a small scale, immunity to extraneous
influences, sufficient bandwidth, and if possible, linearity.
• Characteristics typically of concern specifically for microactuators
are achievable force, displacement, power, bandwidth (or speed of
response), and efficiency.
• Characteristics typically of concern specifically for microsensors are
high resolution and the absence of drift and hysteresis.
• The most widely utilized multicomponent microactuators are those
based upon electrostatic transduction.
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
8. Micro Sensor…
End of Chapter VIII
Chapter IX
Fault finding in Mechatronics
9. Fault finding…
 At the end of this chapter students will be able;
• To perform diagnostic checks on prepared (simple) systems,
and make deductions from the results of these checks which
lead to a correct fault diagnosis
• To carry out fault finding on pneumatic, hydraulic,
mechanical and electrical actuation systems
9. Fault finding…

You might also like