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
• 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.
• 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
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
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…
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