You are on page 1of 44

MNG511

Mechatronics System Design I

Course Introduction &


Overview
Dr. Ahmed Asker
Course Grading

 The total course grade is comprised of :


◦ Lab activities: 20%
◦ Midterm exam: 20%
◦ Research activity: 30%
◦ Final Exam: 30%
 Despite that no grade are earned for the attendance, University
attendance policy needs to be followed.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 2


Course contents

 Course Introduction & Overview


 Microprocessor/Microcontroller architecture
 Interrupts, Serial and Parallel Input/Output
 Timers and Control Applications.
 Introduction to C/assembly language
 Advanced modelling tools
 Optimum Design
 Embedded systems
 Embedded operating systems

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 3


Mechatronics - definition

 Mechatronics basically refers to mechanical electronic systems


and normally described as a synergistic integration of mechanical
engineering, electronics and intelligent computer control in design
and manufacture of products and processes.
 Mechatronics is a multidisciplinary field of science that includes a
combination of mechanical engineering, electronics, computer
engineering, telecommunications engineering, systems
engineering and control engineering.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 4


Typical Components of a Mechatronics System

 Actuators: Produce motion or cause some action. DC motor,


Stepper motors, servomotors, hydraulics, pneumatics
 Sensors: detect the state of the system parameters, inputs and
outputs. Switches, Potentiometer, Strain gauge, Thermocouple,
digital encoder
 Input signal conditioning and interfacing: provide connection b/w
the control circuits and the I/P Discrete circuits, Amplifiers, Filters,
A/D,D/D
 Control system: Control the system. Logic circuits, microcontroller,
PLC
 Output signal conditioning and interfacing: provide connection
b/w the control circuits and the O/P D/A, D/D, Amplifiers, Power
transistors.
 Graphical Display: Provide visual feedback to users.LEDs, Digital
displays, LCD, CRT

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 5


Levels of mechatronics system

 Stand-alone systems, for ex: washing machine, compact disk


player, auto focus camera, boat auto pilot, etc.
 Systems with high level of distributed Sensor-microcontroller-
relationships, for ex: wire aircraft.
 A large factory system that is also a distributed system but which
links a number of major subsystems such as machining centers,
robots for part handling, automated inspection stations etc,
 A system that incorporates intelligent control or artificial
intelligence, for ex: humanoid robot.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 6


Mechatronic Design Process

Modeling/Simulation Prototyping Deployment/Life cycle

Recognition of the need


Software in the loop Deployment of
Conceptual Design and
simulation Embedded systems
Functional Specification

First principle modular Design Optimization Life cycle optimization

Mathematical Modeling

Sensor and Actuator


selection

Detailed modular
Mathematical Modeling

Control system Design

Design optimization

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 7


Modeling of Dynamic Systems

 Mathematical models are obtained by applying the appropriate


laws of physics to each element of a system
◦ Some system parameters (such as damping) may be unknown, or
these parameters are often determined through experiments which
lead to empirical relations
 Engineering judgment must be used to trade model complexity
with accuracy of the analysis
◦ Nonlinearities (such as gear backlash) are often ignored in preliminary
design studies in order to derive linear models
◦ Sometimes, low-order linear models can be solved analytically
◦ Furthermore, simulations (e.g., MATLAB/Simulink) are easier to
construct with low-order linear models and therefore system-analysis
time is reduced

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 8


Modeling of Dynamic Systems

 Engineers must remember that the results from a model and/or


simulation are only approximate and are valid only to the extent of
the assumptions used to derive the model
 The model must be sufficiently sophisticated to demonstrate the
significant features of the dynamic response without becoming
too cumbersome for available analysis tools
◦ Higher-order, complex nonlinear models typically require smaller
integration time steps to accurately solve the governing differential
equations, which increases computer run time
◦ Consequently, there is usually a trade-off between model complexity
and analysis time
◦ The validity of a mathematical model can often be verified by
comparing the model solution (i.e., simulation results) with
experimental results

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 9


Balance: The Key to Success

Experimental
Modeling and Validation and
Simulation Hardware
implementation

Mechatronic System Design Process

System modelling and Computer Simulation Without Experimental


Verification Is At Best Questionable, And At Worst Useless!

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 10


Advantages to Simulation

 Can be used to study existing systems without disrupting the


ongoing operations.

 Proposed systems can be “tested” before committing resources.

 Allows us to gain insight into which variables are most important


to system performance.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 11


Disadvantages to Simulation

 Model building is an art as well as a science. The quality of the


analysis depends on the quality of the model and the skill of the
modeler.
 Simulation results are sometimes hard to interpret.
 Simulation analysis can be time consuming and expensive.
 Should not be used when an analytical method would provide for
quicker results.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 12


Microprocessors and Microcontrollers
Microprocessors and Microcontrollers

 Microprocessor is a single, very-large-scale-integration (VLSI), chip


that contains many digital circuits that perform:
◦ arithmetic,
◦ logic,
◦ communication, and
◦ control functions.
 Microprocessor, also called the central processing unit (CPU) or
microprocessor unit (MPU), in which:
◦ the primary computation and control operations occur.
◦ the arithmetic logic unit (ALU) within the CPU executes mathematical
functions on data.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 14


Microprocessors and Microcontrollers

 A microprocessor requires several other components for its


operation, such as program memory and data memory, input-
output devices, and an external clock circuit. These components
are separately interfaced .
 Microprocessors which have memory and various input/output
arrangements all on the same chip are called microcontrollers.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 15


Microprocessors and Microcontrollers

 A microcontroller (MCU), has all the support chips (CPU, Memory,


I/O ports, ADC, DAC … ) incorporated inside its single chip.
 These components packed within one IC facilitates the
development process, as well as reduce the requirements of
external components. However, this also means you cannot
change, the number and type of integrated devices.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 16


Microprocessors and Microcontrollers

 All microcontrollers operate on a set of instructions (or the user program) stored in their
memory.
 A microcontroller fetches the instructions from its program memory one by one, decodes
these instructions, carries out the required operations, and then store the result back in
the memory . These steps is called machine cycle.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 17


Microprocessors and Microcontrollers

Instruction sets
 Any microprocessor will have its own instruction set.
 The instructions represent the basic operations which can be
carried out by the CPU.
 Microprocessors within the same family may have similar
instruction sets – otherwise there is no standard.
Assembly Language
 Assembly language means programming the processor directly
using its Instruction Set .
 This is the lowest possible level of programming .

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 18


Microprocessors and Microcontrollers

 Microcontrollers have traditionally been programmed using the


assembly language of the target device.

 Although the assembly language is fast, it has several


disadvantages.
◦ An assembly program consists of mnemonics, which makes learning
and maintaining a program written using the assembly language
difficult.
◦ Microcontrollers manufactured by different firms have different
assembly languages, so the user must learn a new language with
every new microcontroller
Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 19
Microprocessors and Microcontrollers

 Microcontrollers can also be programmed using a high-level


language, such as BASIC, PASCAL, or C. High-level languages are
much easier to learn than assembly languages.
 There are two reasons for learning the assembly language
◦ Optimize our application for maximum execution speed or minimum
memory size, and writing pieces of our code in assembly language is
one approach to such optimizations.
◦ observing the assembly code generated by the compiler for our C
code we can truly understand what our software is doing. Based on
this understanding, we can evaluate, debug, and optimize our system.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 20


Microprocessors and Microcontrollers

 The microcontroller is the integration of a microprocessor with


memory and input/output interfaces, and other peripherals such
as timers, on a single chip.
 Main parts
◦ Central processing unit (CPU)
◦ Memory
◦ Input and Output ports
◦ Timers
◦ ADC
◦ DAC

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 21


CPU

 Arithmetic and logic unit (ALU) is responsible for performing the


data manipulation
 Control unit determines the timing and sequence of operations. It
generates the timing signals used to fetch a program instruction
from memory and execute it.
 Group of Registers (8bit, 16 bits,. . ) . The Internal data that the
CPU is currently using is temporarily held in a group of registers
while instructions are being executed.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 22


CPU

 To use the microprocessor, other chips must be interfaced with


the microprocessor through data Bus , address Bus, Control Bus
 The basic two elements Interfaced with the microprocessor is the
I/O peripheral unit , and the memory

 Control Bus: A control bus is used by the Microprocessor to


communicate with devices that are contained within the system.
 Address Bus: The address bus requests a memory location from
the memory or an I/O location from the I/O devices
 Data Bus: is communication Lines that transfers data between
different components

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 23


Arithmetic Logic Unit

 Arithmetic logic unit (ALU) : is a


combinational digital circuit that performs ALU
arithmetic and bitwise operations on
integer binary numbers.
 Mathematician John von Neumann
proposed the ALU concept in 1945
 In 1967, Fairchild introduced the first ALU
implemented as an integrated circuit, the
Fairchild 3800,
 In 1970,Texas Instruments 74181 is a 4-bit
arithmetic logic unit (ALU), was used as
the arithmetic/logic in minicomputers and
other devices.
 Containing the equivalent of 75 logic gates
Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 24
CPU registers

 Accumulator register is a temporary holding register for data to


be operated on by the arithmetic and logic unit and after the
operation, the register for holding the results.
 Flag register contains information concerning the result of the
latest process carried out in the arithmetic and logic unit. It
contains individual bits with each bit having special significance.
The bits are called flags.
 Program counter register (PC) or instruction pointer (IP). This
register points to the address of the memory location that
contains the next program instruction.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 25


CPU registers

 Memory address register (MAR). This contains the address of data.


 For example, in the summing of two numbers
1. The memory address register is loaded with the address of the first
number.
2. The data at the address is then moved to the accumulator.
3. The memory address of the second number is then loaded into the
memory address register.
4. The data at this address is then added to the data in the
accumulator.
5. The result is then stored in a memory location addressed by the
memory address register.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 26


CPU registers

 Instruction register (IR) stores an instruction. After fetching an


instruction from the memory via the data bus, the CPU stores it in
the instruction register. The instruction can then be decoded and
used to execute an operation.
 General-purpose registers may serve as temporary storage for
data or addresses and be used in operations involving transfers
between other registers
 Stack pointer register (SP) form an address which defines the top
of the stack in RAM. The stack is a special area of the memory
which held a subroutine part of the user program .

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 27


Types of Memory

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 28


Types of Memory

 Random Access Memory ( RAM ) is a kind of memory which


needs constant power to retain the data in it, once the
power supply is disrupted the data will be lost, that’s why it is
known as volatile memory. Reading and writing in RAM is easy and
rapid and accomplished through electrical signals , used to store
working data
 The two main types of volatile random-access memory are
◦ Static random-access memory (SRAM)
◦ Dynamic random-access memory (DRAM).
 SRAM and DRAM are the modes of integrated-circuit RAM where
SRAM uses transistors and latches while DRAM uses capacitors
and transistors.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 29


Types of Memory

Key Differences Between SRAM and DRAM


 SRAM is a memory whose access time is small while DRAM is
a memory which has a large access time.
 DRAM is available in larger storage capacity while SRAM is of
smaller size.
 SRAM used in most Microcontroller.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 30


Types of Memory

 Read Only Memory ( ROM ): is a type of non-volatile memory


used in computers and other electronic devices. Data stored in
ROM cannot be electronically modified after the
manufacture of the memory device. as firmware.
 Erasable programmable Read Only Memory ( EPROM ): is a type of
programmable read-only memory that retains its data when
its power supply is switched off. EPROM can be erased by
exposing it to strong ultraviolet
 Electric Erasable programmable Read Only Memory ( EEPROM ): is
a type of non-volatile memory, integrated in microcontrollers,
EPROM can be programmed and erased in-circuit by applying
special programming signals. Originally .

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 31


Programming of AVR Microcontrollers

Atmel Studio USB ASP Programmer

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 32


Embedded Systems

 What are embedded systems?


 Challenges in embedded
computing system design.
 Design methodologies.

• Sophisticated functionality.
• Real-time operation.
• Low manufacturing cost.
• Low power.
• Designed to tight deadlines
by small teams.
Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker
Definition

 Embedded system: any device that includes a programmable


computer but is not itself a general-purpose computer.
 Focuses on application characteristics to optimize:
◦ Don’t need all the general-purpose bells and whistles.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker


Embedded System Vs Desktop System

 Desktop / Laptop
◦ General purpose computer
◦ Used for playing games, word processing, accounting, SDT
etc.,
 Embedded System
◦ Single Purpose and
◦ fixed embedded software for specific job
 Typical Examples
◦ A/C, VCD/DVD Player, Printer, Fax m/c, Mobile phone etc
◦ Customized embedded hw + fixed embedded sw (firmware) +
specific processor
 to meet the specific requirement

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker


Characteristics of Embedded System

 Sophisticated functionality - differ by appliances


 Low manufacturing cost
 Application dependent processor and not GPP
 Restricted memory
 Low power
◦ critical in battery operated devices
◦ excessive power consumption increases system cost even in wall
powered devices
 A typical automobile now contains an average of ten
microcontrollers!

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker


Characteristics of Embedded System

 Single Functional - cannot be programmed to do different things


 Limited Resources - fixed RAM, ROM
◦ No secondary storage CD-ROM, FDD
 Work against deadlines - Real Time systems
◦ Missing deadline cause catastrophe
 Power constrained - Battery powered products
 Highly reliable - cannot afford to reset
 Extreme environment conditions - Temperature and humidity
 Diversified processors and OS unlike desktop (intel + MS - Wintel)
◦ complex to chose right platform

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker


Constraints in Embedded Systems

Tightly constrained than traditional software systems


 Cost
◦ Cannot have high end or fast processor
◦ Cannot have more memory – processor footprint should be less
 Size
◦ Processor footprint should be less
 Ex: gun stabilization control for Tanks in Defense
 Cooling requirements + Processor should take less space
 Performance
◦ Ex: Digital camera snaps, Mobile phone address book contact list etc.,
 Power
◦ Battery power products – Mobile phones
◦ Optimized power saving algorithms and operating modes – reduce power dissipation
◦ SW Program size + # of instructions – affect processor’s energy consumption
 Available System Memory and Processor Speed
 Limited power dissipation when running system continuously
 Reactive and Real Time – Adaptive cruise control and radar missile detection systems

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker


Non-functional requirements

 Many embedded systems are mass-market items that must have


low manufacturing costs.
◦ Limited memory, microprocessor power, etc.
 Power consumption is critical in battery-powered devices.
◦ Excessive power consumption increases system cost even in wall-
powered devices.
 Must finish operations by deadlines.
◦ Hard real time: missing deadline causes failure.
◦ Soft real time: missing deadline results in degraded performance.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker


Microprocessor alternatives for embedded systems

 Ordinary microprocessor: CPU plus on-chip cache units.


 Microcontroller: includes I/O devices, on-board memory.
 Digital signal processor (DSP): microprocessor optimized for digital
signal processing.
 FPGA (Field Programmable Gate Array) is an integrated circuit that
can be programmed after it has been manufactured. It can be
reprogrammed to perform different tasks.
 GPUs used in applications such as image processing.
 ASIC (Application-Specific Integrated Circuit)

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker


Embedded microprocessors

 ARM, MIPS, Power PC, Freescale, 8051, X86


 Various purposes
◦ Networks – MIPS, PowerPC
◦ Mobile phone – ARM dominated
◦ Industrial – Freescale Coldfire
◦ Security – 8051 based, Infineon, BlueRISC
◦ High performance – X86, Intel Epic, other VLIW and superscalars,
multi-core ARM, Tilera tiled processor

 Typical embedded word sizes: 8-bit, 16-bit, 32-bit.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker


Von Neumann CPU Architecture

 Memory holds data and instructions.


 Central processing unit (CPU) fetches instructions from memory.
◦ Separation between CPU and memory distinguishes programmable
computer.
 CPU registers:
◦ program counter (PC)
◦ general-purpose registers

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker


RISC vs. CISC

 Complex instruction set computer (CISC):


◦ many addressing modes
◦ most operations can access memory
◦ variable length instructions
 Reduced instruction set computer (RISC):
◦ only load/store can access memory
◦ fixed-length instructions

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker


Assignment 1

 Read the first chapter of this book " Practical Arduino Robotics,
Lukas Kaul".
 Read the datasheet of the ATmega328P Microcontroller.
 Read the datasheet of the Eta32 kit.
 Write a short report summarizing the capability of the
ATmega328P Microcontroller and Arduino Uno board and explain
the differences in programming each of them.
 The report summarizes the capabilities of the Eta32 kit and how it
can simplify learning Microcontroller programming.

Nile University MNG511 Mechatronics System Design I Dr. Ahmed Asker 45

You might also like