8/17/2019 Mechatronics Session 6 Microcontroller n PLC
1/21
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
2/21
SESSION OUTCOMES
At the end of 6th session, Students will be able to:
1$ !n%erstan% the %igital control s#stem composition
&ase% on Microcontrollers' Cs
2$ !n%erstan% interacing issues in %igital architecture
&ase% on Microcontrollers ' Cs
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
3/21
Role of Digital Control Architecture in a MechatronicSystem
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
4/21
*ole o Microcontroller' C in a Digital Control Architecture
+ Stores data+ Processes arithmetic/logic functions+ Used for data acquisition+ Essentially used in embedded control systems
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
5/21
CPU, MICROPROCESSOR, MICROCONTROER
Microprocessor:CPU on a chip (memory, power source etc. need
to be eternally arranged!
Used for PCs, "es#tops, $aptops etc.
Microcontroller:
Computer on a Chip (usually de%oid of display!
Used for embedded control systems
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
6/21
MICRO CONTROER
&he 'icrocontroller, which is a single C containingspeciali)ed circuits and functions that are applicable to
'echatronic system design
e.g. Microchi!"s PIC, Motorola"s #$%C&&, an' Intel"s$()#
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
7/21
Applications:-
+ *ome appliances+ Entertainment equipment+ &elecommunication equipment+ +utomobiles
+ &ruc#s,+ +irplanes+ &oys+ ffice equipment
All of these !o*erful an' interesting 'e+ices arecontrolle' y microcontrollers an' the soft*arerunning on them-
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
8/21
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
9/21
Microcontroller based Digital Control Architecture: Composition
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
10/21
Microcontroller Board
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
11/21
Microcontroller ATmega328P
Operating Voltage ./
Input Voltage
(recommended) 01&2/Input Voltage
(limit)#12(/
Digital I/O Pins &3 4of *hich # !ro+i'e P5M out!ut6
PWM Digital I/O
Pins
#
Analog Input Pins #
D urrent per I/O
Pin2( mA
D urrent !or
3"3V Pin
.( mA
#las$ Memor%72 89 4ATmega72$P6
of *hich (-. 89 use' y ootloa'er
&'AM 2 89 4ATmega72$P6
P'OM & 89 4ATmega72$P6
loc &peed M%:
Microcontroller Specifications
http://www.atmel.com/Images/doc8161.pdfhttp://www.atmel.com/Images/doc8161.pdf
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
12/21
+ digitally operating electronic apparatus which uses a programmablememory for the internal storage of instructions by implementing specific
functions such as logic sequencing, timing, counting, and arithmetic to
control, through digital or analogue input/output modules, %arious types of
machines or processes.
Programmable Logic Controller
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
13/21
PC /ERSUSMICROCONTROER
ARDUINO
MICROCONTROER
PRO;RAMMA9E O;ICCONTROER 4%ITAC%I6
Pin &7ED
US9connect
or
9arrel
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
14/21
PLC vs. Microcontroller
Micro controller
• C!, *AM, *OM, 'O an% timer areall on a single chip
• i-e% amount o on.chip *OM, *AM,
'O ports• or applications in /hich cost, po/er
an% space are critical• single.purpose (control.oriente%)• o/ processing po/er • o/ po/er consumption• 0it.le"el operations•
nstruction sets ocus on control an%&it.le"el operations• #picall# '16 &it• #picall# single.c#cle't/o.stage
pipeline
Programmable Logic Controller + C! is stan%.alone, *AM,
*OM, 'O, timer are separate+ %esigner can %eci%e on the
amount o *OM, *AM an% 'O
ports$
+ e-pensi"e+ "ersatilit#+ general.purpose+ 3igh processing po/er + 3igh po/er consumption
+ nstruction sets ocus onprocessing.intensi"e operations
+ #picall# 2'64 5 &it+ #picall# %eep pipeline (.27
stages)
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
15/21
Digital Control Architecture: Meaning of nterfacing
+ nteracing is re8uire% to resol"e incompati&ilit# &et/een the
microprocessor an% peripheral %e"ices "i9$ sensors, :e#&oar%,
actuators etc$
+ eripheral %e"ices ma# either suppl# input to or recei"e output
signals rom the microprocessor$
+ 0ut usuall# peripheral %e"ices cannot &e %irectl# interace% to
microprocessor %ue to lac: o compati&ilit# in signal orms an%
le"els$
+ ;er# commonl# use% interaces are<
(i) eripheral interace a%apter e$g$ Motorola MC627
(ii) As#nchronous Communications nterace a%apter e$g$ MC67
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
16/21
Certain actions that are oten re8uire% o an interace circuit<
!" #lectrical Buffering$ solation: 0uering is re8uire% to isolate
microprocessor rom the peripheral %e"ices /hich operate at higher
po/er$ 0uering %e"ices pro"i%es isolation an% 'or current' "oltage
ampliication$
%" &iming Control: s#nchroni9ation o %ata transer rate &et/een
microprocessor an% the peripheral %e"ices$ Handshake lines are special
lines use% or the purpose$
'" Code con(ersion: or e$g$ an ED %ispla# ma# re8uire %eco%er to
con"ert 0CD output rom Microprocessor into &inar# co%e to operate a =.
Segment ED %ispla#$
Digital Control Architecture: nterfacing issues
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
17/21
Digital Control Architecture: nterfacing issues contd)*
+" Serial to parallel and (ice (ersa data transfer: microprocessor is
recei"ing serial %ata transer an% it nee% to output in parallel %ata transer
mo%e to the peripheral %e"ices or "ice."ersa, an interace is re8uire%$
" Con(ersion from Analogue to Digital and -ice.(ersa
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
18/21
Selection o Micro Controller
-actors of selecting micro controllers
+ o of inputs / out put pins+ nterfaces required+ 'emory requirements+ &he number of interrupts required
+ Processing speed required+ low cost+ 0ersatility+ ease of programming,
+ small si)e
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
19/21
Tem!erature Control
+ he temperature sensors gi"es a "oltage proportional to temperature$+ he output rom the temperature sensor is connecte% to the ADC+ he micro controller is programme% to con"ert temperature into 0CD
output /hich can s/itch on the elements o a 2.%igit se"en.element
%ispla#$+ 0ecause o luctuations in the temperature, a storage register is use% to
hol% %ata i$e$ =43C2=, lip.lop$
Case Stud/: &emperature Measurement S/stem Control
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
20/21
Case Stud/: #M0 controlled 1obot
8/17/2019 Mechatronics Session 6 Microcontroller n PLC
21/21
&han2 3 4 5ueries, if an/