Introduction to Mechatronic Design Matthew Ohline

166
INTRODUCTION TO MECHATRONIC DESIGN J. EDWARD CARRYER R. MATTHEW OHLINE THOMAS W. KENNY Mechanical Engineering Stanford University Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo SOLUTION MANUAL FOR

description

mecatronica

Transcript of Introduction to Mechatronic Design Matthew Ohline

  • INTRODUCTION TOMECHATRONIC DESIGN

    J. EDWARD CARRYERR. MATTHEW OHLINETHOMAS W. KENNY

    Mechanical EngineeringStanford University

    Boston Columbus Indianapolis New York San Francisco Upper Saddle River

    Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto

    Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo

    SOLUTION MANUAL FOR

  • Vice President and Editorial Director, ECS: Marcia J. HortonSenior Editor: Tacy QuinnAcquisitions Editor: Norrin DiasEditorial Assistant: Coleen McDonaldVice President, Production: Vince OBrienSenior Managing Editor: Scott DisannoProduction Liaison: Jane BonnellProduction Editor: Pavithra Jayapaul, TexTech InternationalSenior Operations Supervisor: Alan FischerOperations Specialist: Lisa McDowellExecutive Marketing Manager: Tim GalliganMarketing Assistant: Mack PattersonSenior Art Director and Cover Designer: Kenny BeckCover Image Somatuscan/Shutterstock Art Editor: Greg DullesMedia Editor: Daniel SandinComposition/Full-Service Project Management: TexTech International

    Company and product names mentioned herein are the trademarks or registered trademarks of their respective owners. See p. xxiii f oradditional trademark acknowledgments.

    Copyright 2011 by Pearson Education, Inc., Upper Saddle River, New Jersey 07458. All rights reserved. Manufactured in the United States of America. This publication is protected by Copyright and permissions should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic,mechanical, photocopying, recording, or likewise. To obtain permission(s) to use materials from this work, please submit a writtenrequest to Pearson Higher Education, Permissions Department, 1 Lake Street, Upper Saddle River, NJ 07458.

    The author and publisher of this book have used their best eorts in preparing this book. These eorts include the development ,research, and testing of the theories and programs to determine their eectiveness. The author and publisher make no warranty ofany kind, expressed or implied, with regard to these programs or the documentation contained in this book. The author andpublisher shall not be liable in any event for incidental or consequential damages in connection with, or arising out of, thefurnishing, performance, or use of these programs.

    10 9 8 7 6 5 4 3 2 1

    ISBN-13: ISBN-10:

    Library of Congress Cataloging-in-Publication DataCarryer, J. Edward.

    Solution Manual for introduction to mechatronic design / J. Edward Carryer, R. Matthew Ohline, Thomas W. Kenny.p. cm.

    Includes bibliographical references and index.ISBN-13:ISBN-10:

    1. Mechatronics. I. Ohline, R. Matthew. II. Kenny, Thomas William. III. Title.TJ163.12.C37 2010

    317330010222cd126

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 2-1

    Chapter 2 Whats a Micro?

    1.1) Compile a list of at least 25 everyday objects that incorporate microcontrollers, microprocessors or digital signal processors.

    Cell phone Mp3 player Microwave oven PDA Automobiles (many!) Desktop computer Disk drives Digital cameras Dishwashers Washing machines Ovens DVD players CD players Stereo receivers Electronic musical keyboards Computer keyboards Computer mice Network routers / wireless access points Laser Printers Ink Jet printer Navigation systems Bicycle computers Noise cancelling headphones Video cameras TVs

    1.2) Using the internet, locate the data sheet for the Atmel ATmega128A microcontroller, and answer the following:

    a) Does the ATmega128A have a von Neumann or a Harvard architecture? b) How much non-volatile Flash program memory is incorporated? c) How much volatile RAM data memory is incorporated? d) List at least 5 other important peripheral systems that are included (there are many more than 5!)

    a) Harvard, but the data sheet doesnt explicitly call this out. You need to study the block diagram to see that the program flash is connected directly to the instruction register.

    b) 128K Bytes c) 4K Bytes d) UART

    16 bit Timer A/D Converter Analog comparator Brown out detector Pulse Width Modulation Real Time Clock Two Wire Interface Watchdog

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 2-2

    1.3) How is a microprocessor different from a microcontroller?

    A microprocessor does not contain program memory and data memory and I/O.

    1.4) How big is the address space for a microcontroller whose address bus is 24 bits wide?

    224-1 = 16,777,215 locations

    1.5) What is the biggest number that can be represented with 28 bits?

    228-1 = 268,435,455

    1.6) List three different types of non-volatile memory.

    Flash EEPROM ROM EEPROM

    1.7) Using the internet, locate the data sheet for the Microchip PIC16LF727, and answer the following:

    a) What is the fastest clock source that can be used with this chip? What is the slowest? b) Is there an analog-to-digital converter peripheral included on this chip? c) How wide is the program memory bus? That is, how many bits are the program instructions? d) How many input/output (I/O) pins does the PIC16LF727 have?

    a) 20MHz, DC (0Hz) b) YES: 8 bits c) 14 bits d) 36

    1.8) What kind of microcontroller peripheral is present on the PIC12F609 that is not present on the MC9S12C32?

    An analog comparator

    1.9) What prevents a microcontroller with a von Neumann architecture from attempting to execute data? What about a microcontroller with a Harvard architecture?

    Nothing prevents the processor from executing data in a von Neumann architecture.

    In a Harvard architecture, the instructions are not fetched from the data space so it is impossible to execute data.

    1.10) How many I/O pins are available in the largest HC9S12C32? How many are input only?

    60 total I/O pins: 58 are inputs or outputs (I/O) and 2 are input only

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 3-1

    Chapter 3 Microcontroller Math and Number Manipulation

    3.1) Convert the following binary patterns to hexadecimal: 1101 01010 10011 11001100 110011000001

    1101 = 0xD 01010 = 0xA 10011 = 0x13 11001100 = 0xCC 110011000001 = 0xCC1

    3.2) Construct a comparison expression that will test if bits 0, 2 & 4 in a byte are all in the high state without altering the state of the byte.

    If ((ByteToTest & 0x15) == 0x15) is true

    3.3) Construct an expression that will clear bits 1, 3 & 5 in a byte-sized variable called Bumpers while not altering any of other bits.

    Bumpers = (Bumpers & 0xD5)

    3.4) Construct an expression that will set bit 1 in a byte-sized variable called PortA without affecting any of the other bits in the variable.

    PortA = (Bumpers | 0x02)

    3.5) Write out the 16 bit hexadecimal representation of the following signed decimal numbers (assume the representation is 2s complement): 10 17 27 -45 -128 127

    10 = 0x000A 17 = 0x0011 27 = 0x001B -45 = 0xFFD3 -128 = 0xFF80 127 = 0x007F

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 3-2

    3.6) Construct an expression that will test if either bit 0 or bit 3 in a byte-sized variable is in the high state without altering the state of the byte.

    If ((ByteToTest & 0x09) != 0) is true

    3.7) Construct an expression that will test if either bit 1 or bit 3 in a byte-sized variable is in the low state without altering the state of the byte.

    If ((ByteToTest & 0x0A) != 0x0A) is true

    3.8) What result would you expect from the following expressions if all values were contained in byte-sized variables? (240 2)/4 (240 2)/10 (240/10) 2 (240/4) 2

    (240 2)/4 = 56 (240 2)/10 = 22 (240/10) 2 = 48 (240/4) 2 = 120

    3.9) Construct an expression that will clear bit 1 in a byte-sized variable called PortA without altering any of the other bits.

    Bumpers = (Bumpers & 0xFD)

    3.10) Construct an expression to toggle (change a zero to a 1 or a 1 to a zero) bit 3 in a byte-sized variable called PortB that doesnt alter the value of any of the other bits.

    PortB = (PortB ^ 0x08)

    3.11) Construct an expression that quickly divides an integer variable by 32 without using the division operator.

    Variable = Variable >> 5

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 3-3

    3.12) Complete the blank cells in the following table:

    Binary Hexadecimal 1 1100 0111 2 0110 1010 3 0001 1100 4 0101 1001 5 1011 0110 6 0xB4 7 0x1E 8 0x72 9 0x39

    10 0xFF

    Binary Hexadecimal

    1 1100 0111 0xC7 2 0110 1010 0x6A 3 0001 1100 0x1C 4 0101 1001 0x59 5 1011 0110 0xB6 6 1011 0100 0xB4 7 0001 1110 0x1E 8 0111 0010 0x72 9 0011 1001 0x39

    10 1111 1111 0xFF

    3.13) What is the range of a 24 bit twos compliment number?

    -524,288 to 524,287

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 4-1

    Chapter 4 Programming Languages

    4.1) Describe the differences between an interpreter and a compiler.

    An interpreter interprets (that is, extracts the meaning of the programmer) from every line of a program just before the actions associated with that line are to be executed. This is referred to as run time.

    A complier translates the program from the higher level language into the machine code for the processor once, before the code is placed into the memory of the processor, and the microprocessor then executes the translated version of the code.

    4.2) Explain how this line of BASIC code tests the state of bit 2: 10 IF ((V/4)-((V/8)*2)) = 1

    The expression (V/4) does an effective right shift by 2 positions on the variable V. This puts the original Bit2 into the Bit0 position. The expression ((V/8)*2)) does an effective right shift by 3 positions followed by a left shift by 1 position. The result of this will have a 0 in the LSB, but the other bits (bits 1-7) holding the same value as the result of the expression (V/4). After subtracting the two, the result will be the state of the bit that was originally in position bit 2 of the variable V.

    4.3) True or False: It is easy to improve the performance of a program written in an interpreted language by selectively coding in assembly language.

    False. It is generally very difficult to insert assembly language code segments into an interpreted program.

    4.4) True or False: Assembly language is considered a high-level language.

    False, assembly language is the lowest level language that is used to write programs.

    4.5) When is the meaning of a compiled program converted into actions?

    As with any program, the actions are associated with the run-time behavior, that is, when the program is executed by the micro-processor.

    4.6) True or False: Assembly language and machine language are synonymous.

    False. While it may be a common usage, it is sloppy to treat these two terms as synonymous. Assembly language is actually a set of (more or less) human readable mnemonics that have a 1:1 correspondence with the machine language of a micro-processor, but they are not the same as the true binary machine language that the processor executes.

    4.7) Which of the languages described in this chapter was designed to teach programming?

    BASIC by Kemney and Kurtz at Dartmouth College

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 4-2

    4.8) Which are the object-oriented languages described in this chapter?

    C++ and Java

    4.9) Describe a scenario in which programming in an interpreted language might be an advantage.

    Debugging untested hardware. In this situation, the interactive nature of the interpreted environment could prove to be significantly faster than the repeated compile-download-run cycles associate with a compiled language. This is one of the reasons that the Forth variant OpenBoot was developed for SUN workstations and used in some Apple and IBM workstations.

    4.10) Describe two similarities between Java and the PBASIC language used by the BASIC Stamp.

    Both are interpreters and both use byte-codes as the entity that is interpreted (as opposed to plain text in conventional BASIC interpreters).

    4.11) Name at least three other widely-used computer languages that were not mentioned in this chapter.

    COBOL (still used in some business applications over 50 years after it was invented). Delphi (sometimes referred to as Object Pascal) PASCAL (another language invented to teach programming) Wiring (a C-like language used on the Arduino platform)

    Clearly, there are many other possible answers to this question.

    4.12) You are beginning to test a new circuit in which a microcontroller is connected to a large number of peripheral devices a process commonly referred to as bring-up. What language(s) would you choose for this task? Why?

    An interpreted language such as BASIC or Forth would provide for a very fast incremental test cycle to explore the interaction between the processor and the hardware.

    4.13) You are writing final production code for a microcontroller used to control a servomotor. What language(s) would be reasonable choices for this application? Why?

    A compiled language such as C or a compiled version of BASIC would be appropriate here, as would be assembly language if the utmost in functionality needed to be extracted. Object oriented languages such as C++ may be suitable depending on the size of the memory available and the complexity of the application.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 5-1

    Chapter 5 Program Structures for Embedded Systems

    5.1) Work with a DVD player and develop an exhaustive set of events that you think the sofware must sense and respond to.

    There will be a wide variety of responses to this question. Grade based on reasonableness and thoroughness of the answer. Example: Any button pressed on the user interface (front panel or remote): Stop, Play/Pause, Forward pressed, Back pressed, Forward held down, Back held down, , Open/Close/Eject, Root Menu, Up Arrow, Down Arrow, Left Arrow, Right Arrow, Enter/Select, time to fetch digital data from DVD, time to convert digital data from DVD into analog video signal for output, etc.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 5-2

    5.2) Identify the events and draw an STD for the behavior of a DVD player. Limit yourself to the events generated by the DVD player (ignore the remote control).

    There will be a wide variety of responses to this question. Grade based on the reasonableness and thoroughness of the answer. For the state diagram, ensure that standard state diagram conventions are used.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 5-3

    5.3) Given a function GetRoomTemperature() that returns the room temperature and a variable, SetPoint, write a pair of functions in pseudo-code called IsTemperatureTooHot() and IsTemperatureTooCool() that return TRUE-FALSE values and together implement a hysterisis band around the SetPoint temperature.

    Both routines return TRUE or FALSE and adjust hysteresis threshold SetPoint as a side effect. IsTemperatureTooHot() Read GetRoomTemp() and store result in CurrentTemp If CurrentTemp > LastTemp If CurrentTemp > SetPoint Set SetPoint to LowerHysteresisThreshold EndIf Save CurrentTemp as LastTemp Report TRUE Else Save CurrentTemp as LastTemp Report FALSE EndIf End IsTemperatureTooCool() Read GetRoomTemp() and store result in CurrentTemp If CurrentTemp < LastTemp If CurrentTemp < SetPoint Set SetPoint to UpperHysteresisThreshold EndIf Save CurrentTemp as LastTemp Report TRUE Else Save CurrentTemp as LastTemp Report FALSE EndIf End

    5.4) Work with an answering machine to develop the list of events that the machine's software must respond to.

    There will be a wide variety of responses to this question. Grade based on reasonableness and thoroughness of the answer. Example: Phone call received, phone not answered, outgoing message completed, no speaking detected, phone hang-up detected, time to update clock, button pressed: Play, Back, Forward/Skip, Pause, Delete/Erase, Time/Date Set, Volume Up, Volume Down, etc.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 5-4

    5.5) You are writing code to implement cruise control for a car. Given a function GetVehicleSpeed() that returns the speed of a vehicle, write a single function TestAccelDecel() in pseudo-code that returns, NeedAccelerate, NeedDecelerate or SpeedOK based on the speed relative to a setpoint DesiredSpeed. To provide noise immunity, implement hysteresis around the switch point.

    Note: implement so that there is a hysteresis band around the DesiredSpeed, with an UpperThreshold some amount above DesiredSpeed and a LowerThreshold below DesiredSpeed:

    Routine returns NeedAccelerate, NeedDecelerate or SpeedOK and adjusts a hysteresis threshold called SetPoint as a side effect. TestAccelDecel() Read GetVehicleSpeed() and store result in CurrentSpeed If CurrentSpeed > SetPoint and LastSpeed < SetPoint (only happens when SetPoint = UpperThreshold) Set SetPoint to LowerThreshold Set LastSpeed equal to CurrentSpeed Report NeedDelerate Else If CurrentSpeed < SetPoint and LastSpeed > SetPoint (only happens when SetPoint = LowerThreshold Set SetPoint to UpperThreshold Set LastSpeed equal to CurrentSpeed Report NeedAccelerate Else If CurrentSpeed > LowerThreshold and CurrentSpeed < UpperThreshold Set LastSpeed equal to CurrentSpeed Report SpeedOK EndIf End

    DesiredSpeed

    UpperThreshold

    LowerThreshold

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 5-5

    5.6) In an application, the state of a switch is determined by reading a variable called PortA. The state of the switch is indicated by the state value of bit 4 within the byte variable PortA. In pseudo-code, write an event checking function TestSwitch() that returns Opened, Closed, or NoChange depending on what has happened since the last time TestSwitch() was called.

    Create SwitchMask constant = 0x10 (the switch is at bit 4 in PortA) Routine returns Opened, Closed or NoChange. TestSwitch() Read PortA, use SwitchMask to mask out all bits other than bit 4, and store result in CurrentSwitchState If CurrentSwitchState = LastSwitchState Set LastSwitchState = CurrentSwitchState Report NoChange Else If CurrentSwitchState = 0 and LastSwitchState 0 Set LastSwitchState = CurrentSwitchState Report Opened Else If CurrentSwitchState 0 and LastSwitchState = 0 Set Last SwitchState = CurrentSwitchState Report Closed EndIf End

    5.7) Work with a microwave oven to develop the list of events that the oven's software must respond to.

    There will be a wide variety of responses to this question. Grade based on reasonableness and thoroughness of the answer. Example: Door open, Door closed, Number pressed (any of 0 9), Start button pressed, Stop button pressed, Clear button pressed, Time to decrement timer, Timer expires, Power setting entered, quick minute button pressed, popcorn button pressed, time to update clock display etc.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 5-6

    5.8) Figure 5.7 shows a simple microwave oven. Draw an STD that captures the behavior described by the following description as follows: a) The Open button opens the door, stops cooking, holds time. b) The Clear button clears the timer. If cooking was active it is disabled. c) The Start button starts cooking for whatever time has been set. While cooking, the timer decrements to

    zero and turns off cooking when it reaches zero. d) The Popcorn button forces a time of 2 minutes to be set into the timer. e) The Def/Light button forces the power level to 50%. f) Time is set by twisting the dial and then pressing the button at the center of the dial. No action takes

    place until the button is pressed. At that point, the time on the dial is entered into the timer. g) There is a switch connected to the door to show whether it is open or closed.

    Figure 5.7: Front view of the microwave oven described in Problem 5.8.

    A representative solution is shown below. Wide variation in execution is likely. Grade based on whether the solution will function correctly, whether the ovens function is completely described, and whether state diagram conventions are used.

    IDLEDoor Closed

    OPEN PressedOpen Door

    CLEAR PressedPower = 100%, Timer = 0

    IDLEDoor Open

    Door ClosedDo nothing

    CLEAR PressedPower = 100%, Timer = 0

    START PressedStart/Resume Timer,Enable Magnetron

    DEF/LIGHT PressedPower = 50%

    POPCORN PressedTimer = 2 min.

    STOP PressedDisable Magnetron,

    Suspend Timer

    TIMER ExpiresDisable Magnetron,

    Power = 100%

    TIMER Button PressedLoad Timer with time

    indicated on Timer Dial

    DEF/LIGHT PressedPower = 50%

    POPCORN PressedTimer = 2 min.

    TIMER Button PressedLoad Timer with time

    indicated on Timer Dial

    OPEN PressedDisable Magnetron,

    Suspend Timer,Open Door

    CLEAR PressedDisable magnetron

    Timer = 0,Power = 100%

    COOKING

    This particular solution allows for changes to power setting and timer setting any time cooking isnt in process. Other solutions may require that these actions be done sequentially, and that CLEAR be pressed before a new time may be set or a new power setting selected.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 5-7

    5.9) Assume that the switches from the microwave oven in Problem 5.8 are available in a single variable (Switches), that the timer can be set with a function SetTimer(),that the timer can be read with a function IsTimerExpired(), and the power level can be set with a function SetPower(). In pseudo-code, write routines for the required event checkers, state machine function and main() to implement the your design from Problem 5.8.

    main() Initialize HW and variables: If door = closed, initialize state to IDLE, Door Closed Else if door = open, initialize state to IDLE, Door Open Loop forever: If state = IDLE, Door Closed Check for SwitchEvent(s) If SwitchEvent = CLEAR: SetPower = 100%, SetTimer = 0 If SwitchEvent = DEF/LIGHT: SetPower = 50% If SwitchEvent = POPCORN: SetTimer = 2 min. If SwitchEvent = TIMER: SetTimer to time indicated on dial If SwitchEvent = OPEN: OpenDoor, set state = IDLE, Door Open If SwitchEvent = START Enable magnetron Start/resume decrmenting timer Set state = COOKING End If state = IDLE, Door Closed If state = IDLE, Door Open Check for SwitchEvent(s) If SwitchEvent = CLEAR: SetPower = 100%, SetTimer = 0 If SwitchEvent = DEF/LIGHT: SetPower = 50% If SwitchEvent = POPCORN: SetTimer = 2 min. If SwitchEvent = TIMER: SetTimer to time indicated on dial If SwitchEvent = Door is Closed: set state = IDLE, Door Closed End If state = IDLE, Door Open If state = COOKING Check for SwitchEvent(s) If SwitchEvent = OPEN: Disable magnetron Suspend timer Open door Set state = IDLE, Door Open If SitchEvent = STOP: Disable magnetron Suspend timer Set state = IDLE, Door Closed If IsTimerExpired = TRUE: Disable magnetron SetPower = 100% Set state = IDLE, Door Closed If CLEAR button pressed: Disable magnetron Set timer = 0 Set power = 100% Set state = IDLE, Door Closed End If state = COOKING End Loop End main()

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 5-8

    Function SwitchEvent() returns one of the following constant values: NO_SWITCH_EVENT, CLEAR, OPEN, START, STOP, DEF/LIGHT, POPCORN, TIMER, DOOR_CLOSED. Events, with the exception of NO_SWITCH_EVENT, are reported when there is a change of state from not active (e.g. not being pressed) to active (e.g. being pressed). SwitchEvent() Read Switches and store in CurrentSwitchState If CurrentSwitchState = LastSwitchState Save CurrentSwitchState as LastSwitchState Report NO_SWITCH_EVENT End If Else If CurrentSwitchState LastSwitch State If OPEN switch is active in CurrentSwitchState and inactive in LastSwitchState: Save CurrentSwitchState as LastSwitchState Report OPEN If CLEAR switch is active in CurrentSwitchState and inactive in LastSwitchState: Save CurrentSwitchState as LastSwitchState Report CLEAR If START switch is active in CurrentSwitchState and inactive in LastSwitchState: Save CurrentSwitchState as LastSwitchState Report START If POPCORN switch is active in CurrentSwitchState and inactive in LastSwitchState: Save CurrentSwitchState as LastSwitchState Report POPCORN If DEF/LIGHT switch is active in CurrentSwitchState and inactive in LastSwitchState: Save CurrentSwitchState as LastSwitchState Report DEF/LIGHT If TIMER switch is active in CurrentSwitchState and inactive in LastSwitchState: Save CurrentSwitchState as LastSwitchState Report TIMER If DOOR CLOSED is active in CurrentSwitchState and inactive in LastSwitchState: Report DOOR_CLOSED End Else If End SwitchEvent() Function IsTimerExpired() returns TRUE if the value in the Timer register is 0, FALSE if the value is > 0 and TIMER_ERROR otherwise. Function will return TRUE in subsequent calls until Timer has been reloaded elsewhere with a time value > 0. IsTimerExpired() Read Timer variable and store in CurrentTIme If CurrentTime > 0 Report FALSE Else If CurrentTime = 0 Report TRUE Else Report TIMER_ERROR End IsTimerExpired()

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 5-9

    5.10) Draw the STD for a soft drink machine that accepts nickels, dimes and quarters and sells drinks that cost $0.75 each.

    A representative solution is shown below. Wide variation in solutions is likely. Grade this problem based on whether the solution will function properly and is reasonably complete, and whether correct state diagram conventions are used.

    5.11) Draw a state diagram for modified combination lock like that shown Figure 5.4. Make your lock such that it will not accept unlock if 4 or more digits are entered that end with the combinations that end in 2-1-8 sequence.

    A representative solution is shown below. Wide variation in solutions is likely. Grade this problem based on whether the solution functions as specified (does not unlock when more than 3 numbers that end with 218 are entered), and whether correct state diagram conventions are used.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 5-10

    5.12) There are many common behaviors that can be described using state machines. As an example, identify the relevant events and draw a state diagram to describe the behavior of a 'Shy Party Guest' (a guest who does not initiate conversations but participates when someone else initiates).

    A representative solution is shown below. Wide variation in execution is likely. Grade based on whether the student has devoted reasonable effort to the solution, whether the proposed solution adequately represents the behavior of a Shy Party Guest, and whether correct state diagram conventions are used.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 6-1

    Chapter 6 Software Design

    6.1) Describe three ways in which programming is different than writing prose.

    1) Writing code is about preparing a set of instructions while, in general, prose is not simply instructions. 2) In prose, it is possible to coin new words, while in most programming languages adding new key-

    words is not possible. (Forth is an exception.) 3) The goal of (most) code isnt to evoke an emotion in the reader, while this is often the case in prose. 4) Putting sentences one after the other to make a paragraph is highly frowned upon on programming.

    Using white-space to guide the reader is much more akin to writing some kinds of poetry. 5) Prose has but a single consumer: the reader, while code is written both for the reader and for the

    compiler/interpreter.

    6.2) Describe three ways in which programming is similar to building a house.

    1) You need a plan both for the design as well as the implementation stages before starting. 2) Requirements drive the architecture. 3) There are both structural as well as detail aspects to code and buildings. 4) The implementation involves the construction of the framework first followed by the interior (details). 5) Overall success depends on both the design and the implementation. There are clearly many more possible parallels that could be drawn. In general, the goal is to get the students to be reflective about the software design process and not treat it as a throw-away.

    6.3) Define decomposition in the context of software design.

    Decomposition: breaking down a big problem into a series of smaller problems that are easier to understand and that will, when linked together, solve the larger problem.

    6.4) True or False: Coupling is a desirable characteristic between modules.

    False. Coupling makes modules harder to test independently.

    6.5) True or False: All functions in a module should be represented in the public interface to the module.

    False. Only the public interface functions should be represented in the public interface.

    6.6) Write a pseudo-code test harness for the Morse Elements module described in Section 6.5.6.2.

    Print a message to the screen announcing that we are testing InitializeMorseElements() Call InitializeMorseElements() If the state of the appropriate bit in the DDR is not correct Print error message about port initialization Endif If the value of FirstDelta is not 0 Print error message about FirstDelta initialization Endif

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 6-2

    If the value of CurrentState is not correct Print error message about CurrentState initialization Endif Print a message to the screen announcing that we are finished testing InitializeMorseElements() Print a message to the screen announcing that we are testing CheckMorseEvents() With a legal Morse code signal applied to the input test CheckMorseEvents: Do Call CheckMorseEvents() Until return value is DotDetected Print a message that a dot was detected Do Call CheckMorseEvents() Until return value is DashDetected Print a message that a dash was detected Do Call CheckMorseEvents() Until return value is CharSpaceDetected Print a message that a character space was detected Do Call CheckMorseEvents() Until return value is WordSpaceDetected Print a message that a word space was detected Print a message to the screen announcing that we are finished testing CheckMorseEvents() Print a message to the screen announcing that we are testing MorseElementsSM() (prepare two arrays. One with a sequence of events and the other with the state that the state machine should be in after that event) For every element in the event array call MorseElementsSM(), passing the event test if the value of CurrentState matches the expected value. If test fails, print error message noting: index in the array, last event passed, expected value and actual value endFor Print a message to the screen announcing that we are testing MorseElementsSM() Print a message to the screen announcing that we are testing StartCalibration() Call StartCalibration() If the value of CurrentState is not correct Print error message that StartCalibration failed Endif

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 6-3

    6.7) Describe the function of a test harness in the context of an individual module.

    The test harness is a main() routine that is used to exercise and test the functions of the module. It will typically consist of a series of calls to the public functions of the module interspersed with tests to be sure that the public functions responded as they should have, given the full range of possible input values.

    6.8) True or False: Pseudo-code is a part of the design process, not the implementation process.

    True. The translation of the pseudo-code into real code is the first step in the implementation process.

    6.9) Using the pseudo-code from Section 6.5.6.2, write code in a real programming language to implement the InitializeMorseElements function.

    In C for the MC9S12C32: static MorseElementsStates_t CurrentState; static int FirstDelta Void InitializeMorseElements(void) { //Initialize the port line to receive Morse code DDRT &= BIT0LO; //Set CurrentState to be CalWaitForRise CurrentState = CalWaitForRise; //Set FirstDelta to 0 FirstDelta = 0; }

    6.10) Write code in a real programming language to implement the following snippet of pseudo-code: For every element in the array multiply the element value by Gain and add the result to the running sum

    In C: (assuming that Array is of type int) For (i=0; i

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 7-1

    Chapter 7 Inter-Processor Communications

    7.1) True or False: Asynchronous communications involves a shared clock line.

    False.

    Asynchronous means without clock, and does not incorporate a shared clock line.

    7.2) Describe the fundamental difference between bit-serial and bit-parallel communications.

    In bit-serial communications, one bit of data is relayed at a time from the source of the data to the recipient. The bits are thus relayed serially one at a time.

    In bit-parallel communications, more than one bit of data is relayed simultaneously from the data source to the recipient. Multiple bits (2 or more) are thus relayed in parallel more than one at a time.

    7.3) Under what conditions will the noise flag in a typical UART be set?

    In general, the noise flag will be asserted when there is disagreement between the three samples of a bits state that are collected by a UART while receiving data. The samples occur in the middle of a bit-time (start bit, data bit, or stop bit), so they should all agree and have the same state. Disagreement indicates the presence of noise (or possibly some other problem, such as a mismatch in baud- or bit-rate) on the connection.

    7.4) What is the role of the SS* line in synchronous serial communications?

    The SS* line is the slave select line, and the * indicates that it is asserted when it is in the logical low state (0). Its role is to indicate which slave device in an SPI (Serial Peripheral Interface) bus the master is exchanging data with. In effect, the master uses it to select a slave to communicate with using the MISO, MOSI and CLK lines.

    If a devices SS* line is not active, it must ignore the data present on the other SPI lines.

    7.5) True or False: All standard synchronous serial communications protocols involve 2 data lines and 1 clock line.

    False.

    While this is true for the SPI (Serial Peripheral Interface) protocol, it is not true of the I2C (Inter-Integrated Circuit) protocol, which uses 1 bi-directional data line instead of 2 uni-directional data lines.

    7.6) What is the purpose of the parity bit?

    The parity bit provides a degree of error-checking and is used in bit-serial data communications. It is an extra bit, added at the end of each frame of data, that ensures that the total number of 1s in the frame is always even (for even parity) or odd (for odd parity). However, because of the low level of error protection provided by this approach, it is no longer commonly used.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 7-2

    7.7) True or False: IR remote controls typically use FSK modulation.

    False.

    A typical IR remote uses OOSK to modulate the carrier, and an encoding technique such as pulse-, space-, or shift coded waveforms. A preamble is also commonly used to establish the bit rate.

    7.8) True or False: RS-485 is an example of a differential signaling standard.

    True.

    RS-485 is a differential signaling standard, where the voltage differential between two lines indicates 1s and 0s.

    7.9) Explain the basic difference between the RS-232 and RS-485 signaling standards.

    RS-232 is a single-ended signaling standard, which relies on the voltage difference between a single connection and ground to indicate a 1 (when the data line has a voltage between -3 V and -25 V) or a 0 (when the data line has a voltage between +3 V and +25 V). The wide range of valid voltages relative to ground is intended to prevent, or at the very least mitigate, data errors due to noise. It is point-to-point, and each data line is uni-directional.

    RS-485 is a balanced differential signaling standard, which relies on the voltage differential between two data lines (#1 and #2) to indicate a logical 1 (when #1 > #2 by at least 200 mV) and a logical 0 (#1 < #2 by at least 200 mV). This eliminates the dependence on the magnitude of the voltage present on any given line relative to ground, so that only the difference between the voltages on the lines is meaningful. RS-485 allows for multi-drop implementations (vs. point-to-point) and can support half-duplex (on a single shared pair of lines) or full-duplex (on two sets of paired lines).

    7.10) What UART error bit (if any) would be set if the center of the 10th bit time after the falling edge of the start bit in an 8N1 asynchronous serial bit stream was found to be at the spacing level?

    Framing error.

    The 10th bit should be the stop bit, which is required to be in the marking state (logical level 1). If this is not the case, the frame of data is likely to include errors, and the framing error bit would be set.

    7.11) Identify the type of modulation shown in Figure 7.28. Which types of devices use this scheme?

    Figure 7.28

    Frequency Shift Keying (FSK).

    This modulation scheme was used by early computer modems.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 7-3

    7.12) Identify the type of waveform shown in Figure 7.29, which is commonly implemented with OOSK. Which types of devices commonly use this scheme?

    Figure 7.29

    Pulse Coded Waveform.

    This encoding technique is commonly used in IR remote controls.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 8-1

    Chapter 8 Microcontroller Peripherals

    8.1) Based on the diagram of Figure 8.1, what value should you write into the DDR to make the pin an input?

    The topmost multiplexer labeling shows that if the Direction Control state is 0, the multiplexer will connect the pin state to the Port Data register.

    8.2) Given a microcontroller that implements separate input and output registers (call them INPUT & OUTPUT), write C code to sample input bit 3 and transfer its value to output bit 7 while leaving all other bits undisturbed.

    if ((INPUT & BIT3HI) != 0) OUTPUT |= BIT7HI; else OUTPUT &= BIT7LO;

    8.3) In terms of the registers introduced in this chapter, what architecture feature is necessary to be able to tell if an output pin is being loaded heavily enough that its output voltage is outside the input voltage range for that state?

    You must be able to read both the state on the pin and the state in the output latch.

    8.4) A particular application requires both high-resolution timing and timing of long enough intervals that the total time can not be counted using a single 16-bit register. Write pseudo-code using other features of the timer systems described in this chapter to implement a virtual 32-bit input capture timer. Write the pseudo-code using an events and services paradigm (a set of event checkers and associated services).

    TimerOverflowEventChecker: if TimerOverFlowFlag is set then ClearTimerOverFlowFlag return OverFlowOccurredEvent else return NoEvent endif TimerOverflowService: increment 16-bit overflow counter InputCaptureEventChecker: if InputCaptureFlagSet then ClearInputCaptureFlag return InputCaptureEvent else return NoEvent endif InputCaptureService: Concatenate the 16-bit overflow counter (as upper 16 bits) with the contents of the input capture register (as the lower 16 bits) to form a 32-bit input capture time.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 8-2

    8.5) Write pseudo-code for an initialization routine and an input capture event checker and service pair that would calculate the speed of a motor assuming that the output of a 100 pulse per revolution motor was connected to the input capture pin of a timer system being clocked by a 100 kHz clock.

    InitializationRoutine: clear module level variable LastCaptureTime program input capture system to capture on rising edges InputCaptureEventChecker: if InputCaptureFlag set then return NewEncoderEdgeEvent else return NoEvent NewEncoderEdgeEventService: save value in the input capture register as CurrentTime calculate DeltaT as (CurrentTime LastCaptureTime) * SecsPerTick calculate SpeedRPM as (60*100)/DeltaT

    8.6) Given a PWM subsystem like shown in Figure 8.6, what duty cycle would be generated if DUTY contained 128 and PERIOD contained 240 and POLARITY = 1?

    1-128/240 because with POLARITY = 1, DUTY sets the low time

    8.7) Given a PWM subsystem like shown in Figure 8.6, with DUTY = 128 and PERIOD = 129, what sequence of values would you expect to see in COUNTER?

    0,1,2,3,4,.126,127,128,129,0,1,2,3,4,5 The time spent with COUNTER = 129 would be very short since it is immediately reset to 0.

    8.8) Given a microcontroller with a clock rate of 24 MHz, an A/D converter clock prescaler with divide-by ratios of 2, 4, 6, 8, 10, 12, , 64, an A/D converter with a minimum clock speed of 500 kHz and a maximum clock speed of 2 MHz, what range of prescale dividers result in A/D clock speeds that fall within the A/D converter limits?

    Divide-bys greater than or equal to 12 (24 MHz/12 = 2 MHz) and less than or equal to 48 (24 MHz / 48 = 500 kHz) would work.

    8.9) How are the Freescale DDR registers and the Microchip TRIS registers alike?

    They both control the direction of input/output pins on a port.

    8.10) Given a PWM subsystem like that shown in Figure 8.6 with a Clock Source of 24 MHz, what is the maximum PWM output frequency that can still achieve 1% resolution on the duty cycle?

    1% duty cycle resolution requires that the period be set to at least 100, therefore the maximum frequency of the PWM would be 24 MHz/100 = 240 kHz.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 9-1

    Chapter 9 Basic Circuit Analysis and Passive Components

    9.1) If, for a particular two-terminal device the voltage and current entering one terminal is 7.5 V and 1 A and the voltage and current leaving the other terminal is 5 V and 1 A, how much power is being dissipated in the device?

    P = VI, in this case V=7.5 V 5 V = 2.5 V and I = 1 A, so P = 2.5 W

    9.2) What is the resistance seen across terminals A and B in Figure 9.61?

    Figure 9.61 Circuit for Problem 9.2.

    3108.131

    21

    111 =++= x

    kkkRtotal , Rtotal = 545

    9.3) Determine the Thevenin equivalent circuit for the subcircuit block labeled A in Figure 9.62.

    Figure 9.62 Circuit for Problems 9.3-9.6.

    6.3262V

    166.615K

    9.4) Determine the Thevenin equivalent circuit for the subcircuit block labeled B in Figure 9.62.

    15.641mV

    375.022

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 9-2

    9.5) What is the voltage at the point labeled V in Figure 9.62?

    Combining the Thevenin equivalents of Problems 9.3 and 9.4 gives us a circuit like that to the left. Now, with only one loop, it is a simple matter to determine the voltage at point V: 0 = 6.3262 V I 166.615 k I 375.022 + 15.641 mV 0 = 6.341841 V - I 166.99 k

    I = kV

    99.166341841.6

    = 37.977 A With that last bit of information we can calculate the voltage at point V as: -15.641mV + 37.977A375.022 =-1.39865mV

    9.6) If the voltage at point V in Figure 9.62 were measured with a voltmeter with a 100 k internal resistance, what voltage would be measured?

    The Thevenin equivalent resistance would simply be 166.615 k || 375.022 or 374 . This would form a voltage divider with the 100 k of the meter and we would read:

    mVk

    kmV 39344.1374100

    10039865.1 =

    +

    9.7) The graph in Figure 9.63 represents the output of an RC circuit excited by a 0-5 V rising edge. Draw the RC circuit configuration. Based on the data shown, what is the time constant?

    Figure 9.63 Waveform for Problem 9.7.

    The circuit configuration will be that of Fig 9.26. The voltage has risen to about 63% of the driving voltage at t = 0.1 s, so the time constant is 0.1 s.

    15. 641m V

    375.022

    6 . 3262V

    166.615KV

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 9-3

    9.8) Figure 9.64 shows the current waveform for a series RL circuit excited by a 0-5 V rising edge. a) Estimate the total resistance seen by the exciting voltage source. b) Estimate the inductance in the circuit.

    Figure 9.64 Waveform for Problem 9.8.

    a) The final value of the current is 50 mA, indicating a resistance of R = E/I = 5/50 mA = 100 . b) The current rises to the 63% point (31 mA) at about 0.1 s, so that time constant is 0.1 s. The time

    constant for an RL circuit is L/R so with a value of 100 for R, L = 100 0.1 s = 10 H.

    9.9) Design a circuit that takes a sinusoidal input of varying frequency at 1 V amplitude and produces an output amplitude of approximately 1 V when the frequency is 1 Hz and approximately 0.5 V when the frequency is 1,000 Hz. Choose real component values to get as close as possible to the specified amplitudes.

    Given that the amplitude at 1 kHz is smaller than at 1 Hz, we know that this is to be a low-pass filter, with a configuration like that of Fig. 9.37. We can use Equation 9.54 to calculate the RC product required as 2.76 10-4. We can achieve this, using 1% resistors, with a 102 k resistor and a 2.7 nF capacitor.

    9.10) For the circuit that you designed in Problem 9.9, at what frequency is the output approximately 0.707 V?

    Since 0.707 is the corner frequency point, we can use Eq. 9.55 to calculate the corner frequency:

    HzRC

    5782

    1 =

    9.11) What is the minimum voltage would you need to apply across a 10 k 1/8 W resistor in order to cause its power rating to be exceeded?

    P = I2R, 0.125 W/10 k = I2, I = 3.5 mA, E = IR, so E = 3.5 mA 10 k=35 V.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 9-4

    9.12) If a resistor with a temperature coefficient of 1,000 ppm that measures 997 at 25C is cooled to -40C (a cold night in Minnesota), what range of resistances would you expect to see? How about if it were heated to 65C (inside a car on a sunny summer day in Arizona)?

    On the cold night, the T is 65C, with a 1,000 ppm temperature coefficient, that would be a change of 6.5% yielding a resistance of 932.2 . In the sunny car, the T is only 40C, yielding a change of 4% and a resistance of 1036.9 .

    9.13) Which capacitor would you expect to be physically larger: a 0.1 F ceramic disk or a 0.1 F monolithic ceramic capacitor?

    The monolithic ceramic capacitor would be smaller, assuming similar voltage ratings.

    9.14) Which capacitor would you expect to be physically larger: a 10 F electrolytic or a 10 F tantalum capacitor?

    The 10 F electrolytic would be larger, assuming similar voltage ratings.

    9.15) If a monolithic ceramic capacitor were labeled 103X5F, what would you expect its capacitance value to be?

    103 means 10 103 pF = 0.01 F

    9.16) You have been presented with two monolithic ceramic capacitors. One is labeled 104C0G, the other 104Z5U. How are these capacitors alike? How are they different?

    They have the same capacitance value (0.1 F) but different compositions and therefore temperature coefficients (the COG capacitor will have a smaller change in value with temperature).

    9.17) If you were designing an RC low-pass filter to operate with a corner frequency of 10 kHz for a signal of a few volts amplitude at less than 0.1 mA, what types of resistors and capacitors (i.e., which values and technologies) would be good choices?

    For resistor accuracy, the metal film resistors would be best. For capacitance stability a film capacitor such as a mica, mylar, polyester, polypropylene, or polystyrene would be best.

    9.18) Design a circuit that takes a sinusoidal input of varying frequency at 1 V amplitude and produces an output amplitude of approximately 1 V when the frequency is 1,000 Hz and approximately 0.5 V when the frequency is 1 Hz. Choose real component values to get as close as possible to the specified amplitudes.

    Given that the amplitude at 1 kHz is larger than at 1 Hz, we know that this is to be a high-pass filter, with a configuration like that of Fig. 9.39. We can use Equation 9.57 to calculate the RC product required as 0.0919. We can achieve this, using 1% resistors, with a 511 k resistor and a 0.18 F capacitor.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 9-5

    9.19) Some monolithic ceramic capacitor materials exhibit a voltage dependency. What happens as the applied voltage is increased?

    The effective capacitance decreases.

    9.20) List two examples each of polar and nonpolar capacitor types.

    Polar: tantalum & electrolytic

    Non-polar: ceramic, monolithic ceramic, mylar, mica

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-1

    Chapter 10 Semiconductors

    10.1) If the forward voltage drop for D1 is 0.6 V, what is the current flowing in the circuit showing in Figure 10.42? Assume that the diode behaves as an ideal diode.

    Figure 10.42

    Vs Vr Vd = 0 6 V I 220 0.6 V = 0 V I = 5.4 V / 220 = 25 mA

    10.2) If the forward voltage drop for D1 is 0.6V, what is the current flowing in the circuit in Figure 10.43? Assume that the diode behaves as an ideal diode.

    Figure 10.43

    The supply voltage (Vs = 0.5 V) is insufficient to forward bias the diode D1 enough for current to flow. For an ideal diode, the current flowing in the circuit will be 0. (For a real diode, a small amount of leakage current will flow. The amount of leakage current will depend on the specifications for D1.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-2

    10.3) The arrangement of diodes shown in Figure 10.44 is known as a diode bridge or a full-wave rectifier. If the output of the AC voltage source VS is 24 V peak-to-peak (12 V) with a frequency of 100 Hz, draw a plot of the resulting voltage drop across the resistor (assume ideal diode characteristics).

    Figure 10.44

    Problem 10.3 Solution

    -14

    -12

    -10

    -8

    -6

    -4

    -2

    0

    2

    4

    6

    8

    10

    12

    14

    0 10 20 30 40 50 60 70 80 90 100

    Time (ms)

    Volta

    ge (V

    )

    Vin

    Vout

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-3

    10.4) For the circuit shown in Figure 10.45, use the diode specifications provided in Figure 10.46 to determine the maximum amount of current you can expect to flow when TA = 25C. If you were to increase the power supply voltage, how much could you increase it before exceeding the diodes reverse breakdown voltage?

    Figure 10.45

    Figure 10.46: Data sheet excerpt. (Courtesy of Diodes Incorporated. All rights reserved.)

    Because D1 is reverse biased, the specification needed is the Peak Reverse Current (IRM) at TA = 25C. For the 1N4935 (and all other diodes in this family of parts), the maximum value of IRM at this temperature is 5 A.

    The power supply voltage could be increased to 200 V (DC), at which point it would exceed the maximum allowable value for the 1N4935(VR). AC voltages are limited to 140 Vrms (VR(RMS)).

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-4

    10.5) If D1 and D2 are treated as ideal diodes: a) Draw a graph of Vout when the input voltage Vin ranges from -10 V to +10 V. b) Draw a graph of the current flowing through the resistor over the same range of values for Vin. c) Given that this type of circuit is commonly called a voltage clamp, briefly describe the function of

    this circuit.

    Figure 10.47

    a) Problem 10.5(a) Solution

    -1

    0

    1

    2

    3

    4

    5

    6

    -10 -8 -6 -4 -2 0 2 4 6 8 10

    Vin (V)

    Vout

    (V)

    From -10 V Vin -0.6 V, D2 is forward biased and conducting. Since we are treating D2 as ideal, we assume that VF = 0.6 V, and this holds Vout to a value of -0.6 V. D1 is reverse biased, and since we are treating it as ideal, there is no leakage current through D1.

    From -0.6 V < Vin 0 V, D2 is forward biased, but since Vin < VF, D2 is not conducting and there is no leakage current. D1 is reverse biased, and we assume no leakage current flows. Vout follows Vin.

    From 0 V < Vin 5 V, D2 is reverse biased and not conducting, as is D1.

    From 5 V < Vin 5.6 V, D2 is forward biased, but not high enough to cause D1 to conduct (Vin < 5 V + VF). D2 remains reverse biased and not conducting.

    From 5.6 V Vin 10 V, D1 is forward-biased and conducting. We assume that VF = 0.6 V, so Vout is held at 5.6 V.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-5

    b) Problem 10.5(b) Solution

    -0.10

    -0.08

    -0.06

    -0.04

    -0.02

    0.00

    0.02

    0.04

    0.06

    -10 -8 -6 -4 -2 0 2 4 6 8 10

    Vin (V)

    Ires

    (A)

    The current flowing through the resistor R is Ires = (Vin Vout)/R. Using the values from part (a) of the problem for Vin and Vout gives the above result.

    c) Vout is clamped (i.e., held) to within a diode forward voltage drop (VF) of the power supply voltage (0

    V / ground and +5 V).

    10.6) If the Zener voltage of the (ideal) Zener diode D1 (Figure 10.48) is 4.3 V, what is Vout when: a) Vs = 3.3 V b) Vs = 5 V c) Vs = 12 V d) Vs = -5 V

    Figure 10.48

    a) 3.3 V. The Zener diode is reverse biased, but not enough to cause it to go into reverse breakdown. b) 4.3 V. The Zener diode is reverse biased and beyond the reverse breakdown voltage of 4.3 V, holding

    Vout at the reverse breakdown voltage. c) 4.3 V. The Zener diode is further reverse biased and beyond the reverse breakdown voltage of 4.3 V,

    holding Vout at 4.3 V. d) -0.6 V. The Zener diode is forward biased, and under these conditions it behaves like a regular diode,

    with a typical value of VF = 0.6. This holds Vout at 0 V VF = 0 V 0.6 V = -0.6 V.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-6

    10.7) Design a circuit that uses a 5 V power supply to illuminate an LED that has a forward voltage drop of Vf = 2.2 V. Use only standard 5% resistors in your design, and insure that the current flowing through the LED is between 17 and 20 mA.

    +5V

    LED1

    R

    For the circuit shown, the value of R will determine the current flowing from the 5 V power supply to ground using Ohms law:

    RVV

    RVVI FS 2.25 ==

    The target current is 17 mA I 20 mA. Solving for the value of resistor that results in a current that is the average of 17 mA and 20 mA (18.5 mA) gives R = 151.4 , which is not a standard 5% resistor value. The nearest standard 5% tolerance resistor is 150 . Considering the tolerances, this could be as low as 142.5 (resulting in a current of 19.6 mA) or as high as 157.5 (resulting in a current of 17.8 mA). These satisfy the requirements, so we choose R = 150 .

    10.8) If Q2 in Figure 10.23 were replaced by an NPN transistor, what voltage would be necessary at Vin in order to insure that Q2 is on and saturated?

    The rules-of-thumb for the behavior of a typical NPN transistor tell us that it will be on and in saturation when its base is at least 0.6 V above its emitter (VBE 0.6 V). With an NPN transistor instead of the PNP transistor shown in Figure 10.23, when the transistor is on, the emitter will be one collector-emitter voltage drop below the power supply voltage. For a typical NPN transistor in saturation, VCE = 0.2 V, and for the circuit shown VS = VC = +10 V, so the base must be held at VB = VS VCE + VBE = 10 V 0.2 V + 0.6 V = 10.4 V.

    The voltage at Vin must be higher than the value of VB by the voltage drop across the base resistor, R3. The current flowing into the base must be sufficient to guarantee that Q2 is saturated, and from the rule-of-thumb described in this chapter IC:IB = 10:1. The current flowing through the lamp when Q2 is on and saturated will be:

    mAVVRVV

    ILAMP

    SATCESC 98100

    2.010, ===

    So the base current should be at least 1/10th of this, or 9.8 mA. Since the value of the base resistor R3 is fixed at 2.2 k, this requires Vin to be:

    VVVVkmAVin 96.314.1056.214.10)2.28.9( =+=+=

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-7

    10.9) What is the minimum value of Vin required to insure that at least 2.125 A flow through the load resistor in the circuit from Figure 10.49? Use the specifications included for the IRLZ34N N-channel MOSFET (Figure 10.50). What is the power dissipated in the resistor under these conditions? In the MOSFET?

    Figure 10.49

    Figure 10.50

    In order for the specified current to flow through the load, the RDS(on) for Q1 is determined from:

    == 047.06.5125.212

    )( AVR onDS

    From the data sheet, to have an RDS(on) of at most 0.047 Vin = VGS must be at least 5 V.

    For Vin = 5 V, RDS(on) = 0.046 , so the current that flows through the load and Q1 is

    AVI 125.2046.06.5

    12 =+= Power dissipation can then be determined as:

    WARIPLOAD 3.256.5)125.2(22 ===

    WARIPMOSFET 21.0046.0)125.2(22 ===

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-8

    10.10) For each of the following circuits from Figures 10.51 and 10.53, state whether the transistor is off, on but not operating in the linear region, or on and operating in the linear region. Where possible, calculate the minimum current that will flow through the load resistor using the specifications given in Figures 10.52 and 10.54.

    Figure 10.51

    Figure 10.52: IRL9Z34N data sheet excerpt. (Courtesy of International Rectifier 1998.)

    Figure 10.53

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-9

    Figure 10.54: IRFU5305 data sheet excerpt. (Courtesy of International Rectifier 2000.)

    For the circuits in Figure 10.51, using the IRL9Z34N: a) OFF (VGS = 0 V)

    b) ON and operating in the linear region (VGS = 5 V) From data sheet, RDS(on) = 0.046 when VGS = 5 V, so the minimum current flowing through the load is

    AVI 125.2046.06.5

    12 =+= c) ON and operating in the linear region (VGS = 12 V)

    From data sheet, RDS(on) = 0.035 when VGS = 10 V (not the exact VGS in the problem, but the closest thing to it that is given in the data sheet and a conservative choice), so the minimum current flowing through the load is

    AVI 130.2035.06.5

    12 =+=

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-10

    For the circuits in Figure 10.53, using the IRFU5305:

    a) ON and operating in the linear region (VGS = -12 V) From data sheet, RDS(on) = 0.06 when VGS = -10 V (not the exact VGS in the problem, but the closest thing to it that is given in the data sheet and a conservative choice), so the minimum current flowing through the load is

    AVI 120.206.06.5

    12 =+= b) ON, and operating in the linear region (VGS = -7 V with ID = ~-2.1 A)

    We cant read the value of RDS(on) from the data sheet table for VGS = -7 V. From the plot, when VGS = -7 V and ID is ~2.1 A, -VDS is ~0.1 V. Restate as RDS(on) = 0.048 when VGS = -7 V, so the minimum current flowing through the load will be

    AVI 125.2048.06.5

    12 =+= c) OFF (VGS = 0 V)

    10.11) Design a circuit that satisfies all of the following conditions: a) Use a single BJT (use rule-of-thumb characteristics for the BJT, and insure operation in the saturated

    region). b) Use the BJT to switch the current flowing through an LED (Vf = 2.2 V). c) Use a 5 V power supply. d) The base of the BJT is driven by a signal that is 0 V when the LED is to be off and 3 V when the LED

    is to be on. e) The current through the LED is approximately 0 mA in the off state and 100 mA ( 10%) in the on

    state. f) Use standard 5% resistor values. g) Answer the following:

    i. Is this a low-side drive or a high-side drive configuration? ii. How much steady-state current is required to drive the base of the BJT?

    a) f):

    +5V

    47R1

    NPNQ1

    240Rb

    Vin

    LED1

    92 mA ILED 101 mA

    g) i. Low-side drive ii. IB = IC/10 = 10 mA, and alternately

    mAVVRVVinI

    b

    BB 10240

    6.03 ===

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-11

    10.12) Design a circuit that satisfies all of the following conditions: a) Use a single IRL9Z34N N-channel MOSFET (the data sheet for this component may be found on the

    Internet). Operate the MOSFET in the linear region. b) Use the MOSFET to switch the current flowing through and LED (Vf = 2.2 V). c) Use a 5 V power supply. d) The gate of the IRL9Z34N is driven by a signal that is 0 V when the LED is to be off and 5 V when the

    LED is to be on. e) The current through the LED is approximately 0 mA in the off state and 100 mA ( 10%) in the on

    state. f) Use standard 5% resistor values. g) Answer the following:

    i. Is this a low-side drive or a high-side drive configuration? ii. How much steady-state current is required to drive the gate of the IRL9Z34N?

    a) f):

    +5V

    27R1

    Vin

    LED1

    IRLZ34NQ1

    97 mA ILED 107 mA

    g) i. Low-side drive ii. The steady state current required to drive the gate (IG) is very small due only to leakage current.

    According to the data sheet, the maximum gate-to-source forward leakage (when voltage at the gate, VG, is 16 V greater than the voltage at the source, VS) is 100 nA, and the gate-to-source reverse leakage (when VG is 16 V less than VS) is -100 nA. This is a very small current in either case.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-12

    10.13) Design a circuit that satisfies all of the following conditions: a. Use a single BJT (assume ideal characteristics, and operate the BJT in the saturated region). b. Use the BJT to switch the current flowing through a 50 load. c. Use a 5 V power supply. d. The base of the BJT is driven by a signal that is 5 V when the load is to be off and 0 V when the load is

    to be on. e. The current through the load is approximately 0 mA in the off state and 35 mA ( 10%) in the on state. f. Use standard 5% resistor values. g. Answer the following:

    i. Is this a low-side drive or a high-side drive configuration? ii. How much steady-state current is required to drive the base of the BJT?

    a) f):

    +5V

    50RLOAD

    1.3KRb

    Vin PNP BJTQ1

    87RCL

    33 mA ILOAD 35 mA

    g) i. High side drive configuration ii. -IB = IC/10 = -3.5 mA, and alternately

    mAVVVRVVinI

    b

    BB 4.31300

    )6.05(0 ===

    (NOTE: 1.2 k is another standard 5% resistor value that could have been used. This would have resulted in a IC:IB ratio of slightly less than 10:1, whereas the solution shown above has a ratio of slightly more than 10:1. Both answers are reasonable and acceptable.)

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-13

    10.14) Design a circuit that satisfies all of the following conditions: a. Use a single IRFU5305 P-channel MOSFET (the data sheet for this component may be found on the

    Internet). Operate the MOSFET in the linear region. b. Use the MOSFET to switch the current flowing through a 50 load. c. Use a 12 V power supply. d. The base of the BJT is driven by a signal that is 12 V when the load is to be off and 0 V when the load

    is to be on. e. The current through the load is approximately 0 mA in the off state and 200 mA ( 10%) in the on

    state. f. Use standard 5% resistor values. g. Answer the following:

    i. Is this a low-side drive or a high-side drive configuration? ii. How much steady-state current is required to drive the gate of the IRFU5305?

    a) f):

    +12V

    50RLOAD

    Vin IRFU5305Q1

    10RCL

    1/2 Watt

    198 mA ILOAD 201 mA

    g) i. High side drive configuration ii. The steady state current required to drive the gate (IG) is very small due only to leakage current.

    According to the data sheet, the maximum gate-to-source forward leakage (when voltage at the gate, VG, is 20 V greater than the voltage at the source, VS) is 100 nA, and the gate-to-source reverse leakage (when VG is 20 V less than VS) is -100 nA. This is a very small current in either case.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-14

    10.15) For the circuit shown in Figure 10.55, what is the voltage at Vout when Vin = 0 V? What is Vout when Vin = 3.3 V? How much current will Vin be required to source or sink in each state?

    Figure 10.55

    For Vin = 0 V: Q1 is off and the gate of Q2 is pulled high to 5 V through R2. This turns Q2 on and it operates in the linear region. The data sheet for the 2N7000 states that RDS(ON) is typically 1.8 and has a maximum value of 5.3 . Assuming that RDS(ON) = 5.3 represents the worst case design (the problem statement doesnt specify, but typically the goal is to get Vout as close to 0 V in this state as possible), we will determine Vout for this condition:

    mVk

    VRR

    RVV

    onDS

    onDSSOUT 4.1713.5

    3.53.33)(

    )( =

    +

    =

    +=

    When Vin = 0 V, it will sink the leakage current from the base of the Q1 (which is turned off). From the data sheet, this is IBL, the Base Cutoff Current, which has a maximum value of 50 nAdc. No minimum value is given, so the conservative assumption is that it could be as low as 0 nA (which is not physically possible, but is a safe assumption that allows us to bound the design). Thus, when Vin = 0:

    nAIA IN 500 For Vin = 3.3 V: Q1 is on and saturated (IC/IB = 13.5, which is slightly more than the rule-of-thumb goal of 10, but much less than the rule-of-thumb limit of 20). This pulls the gate of Q2 low, turning it off. Vout will be very close to the 3.3 V power supply voltage in this case. The amount of leakage current through Q2 determines how close (less leakage current results in Vout closer to 3.3 V). The most realistic scenario from the data sheet is for the case where TA = 25C, in which case the spec for IDSS (Zero Gate Voltage Drain Current) is 1 A and the resulting Vout is given by

    VAVRIVV DSSSOUT 299.3100013.33 === When Vin = 3.3 V, Q1 is on and saturated, so the base current is

    AVVRVVI BINB 2979100

    6.03.3

    1

    ===

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 10-15

    10.16) What is the current that flows through RL when Vin = 0 V? What is the current through RL when Vin = 5 V? How much current will Vin be required to source or sink in each state? Refer to Figure 10.56.

    Figure 10.56

    For Vin = 0 V: Q1 is off, and the gate of Q2 is pulled to 12 V through R1. Since Q2 is a P-channel MOSFET, this turns it off.

    The current that flows through RL when Q2 is off is the drain-source leakage current. From the data sheet, the maximum value for IDSS (Drain-to-Source Leakage Current) is -25 A at 25C and -250 A at 150C. With justification, either answer is acceptable, though -25 A at 25C is more realistic for most circuits. The minimum value for IDSS is not stated in the data sheet. The most conservative assumption we can make is that the minimum value is 0 A, which isnt physically possible but allows us to bound the problem completely:

    When Vin = 0 V, the current flowing is 0 A RL 25 A. For Vin = 5 V: Q1 is on and operating in the linear region, which will pull Q2s gate near 0 V, turning Q2 on. From the datasheet for the IRFU5305, RDS(on) 0.065 when VGS = -10 V. Thus, the minimum current flow through RL when Q2 is on will be:

    AVV

    VRR

    VILonDS

    SMIN 952.24065.0

    12

    )(

    =+=+=

    The minimum value for RDS(on) is not stated in the data sheet. The most conservative assumption we can make is that the minimum value is 0 , which isnt physically possible but allows us to bound the problem completely. In this case

    AVV

    VRR

    VILonDS

    SMAX 340

    12

    )(

    =+=+=

    Finally, the full range of possible currents flowing through RL is:

    AIA LOAD 3952.2

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 11-1

    Chapter 11 Operational Amplifiers

    11.1) Show how you could use the voltage divider expression to develop the transfer function (input-output relationship) for the non-inverting op-amp configuration.

    inif

    iout VRR

    RV =

    +

    ini

    ifout VR

    RRV

    +=

    ini

    i

    i

    fout VR

    RRR

    V

    +=

    ini

    fout VR

    RV

    += 1

    11.2) Which Golden Rule enables you to use the voltage divider expression in Problem 11.1?

    The inputs draw no current

    11.3) Design a circuit that will function as a non-inverting summer with a gain of 2 on the sum of the input voltages. Assume an ideal op-amp and choose standard 5% resistors

    2

    31

    411

    1100K

    R3

    100K

    R4

    30K

    R2

    VCC

    10K

    R1

    Vin1

    Vin2

    Vout

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 11-2

    11.4) Design a trans-resistive amplifier for a photo-transistor such that the circuit will have an output of 2.5 V with no light falling on the sensor and an output voltage that rises with increasing light levels. You have only a +5 V supply available, but may assume an ideal op-amp. Write the gain expression relating photo-current to output voltage for the circuit that you design.

    LTR3208E

    Q1

    2

    31

    411

    1

    Ideal Op-AmpU2A

    +52.7K

    R2

    10KR3

    10KR4

    +5

    Output

    25.2 RIVV PHOTOOUT +=

    11.5) If the voltage divider of Figure 11.9 was to produce a voltage of 2.5 V and deliver 0-2 mA into the external circuit, what values for R1 and R2 would keep the variation in Vref below 1% of its no-load value? What would the power rating of the resistors need to be?

    For the disturbance in voltage to be below 1%, the disturbance in current must also be below 1%. If we want 2 mA of current to flow out of the divider, then that must be 1% or less of the undisturbed current in the divider. Therefore, we need 100 2 mA = 200 mA flowing in the divider. This requires resistors of 25 capable of dissipating P = I2R = (200 mA 200 mA)(25 )= 1 W.

    11.6) Describe how the output stage of most comparators is different from the output stage of op-amps.

    The output stage of most comparators is an open-collector rather than a push-pull style used in op-amps.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 11-3

    11.7) In the circuit shown in Figure 11.24, as the input voltage, Vin, is ramped from 0 V to 5 V: a) Graph the state of the LED (D1) over the specified range of input voltages. b) Graph the output voltage over the specified range of input voltages and include the corresponding state

    of the LED.

    Figure 11.24 Circuit for Problem 11.7.

    0

    0.5

    1

    1.5

    2

    2.5

    3

    3.5

    4

    4.5

    5

    Vin Vout

    LED On

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 11-4

    11.8) Design a circuit to implement an inverting comparator with hysteresis having an approximately 200 mV hysteresis band centered at approximately 1 V. Choose standard 5% resistors and report the expected thresholds if the values of those resistors were exact.

    RPUR1

    R2

    +Vcc

    VinVout

    Vref

    R3

    +Vcc

    R2 = 30 k, R1 = 120 k, R3 = 560 , RPU=3.3 k. Thresholds will be at 1.164 V and 0.959 V.

    11.9) What range of thresholds (min to max) would you expect to see in the circuit of Problem 11.8 if the 5% resistors were at the outer limits of the tolerance?

    The lowest lower threshold would be if R2 & R3 were at their minimum values, and R1 was at its maximum. This results in a lower threshold of 0.883 V.

    The highest upper threshold would be if R2 was at its maximum and R1 & R3 were at their minimum values. This results in an upper threshold of 1.255 V.

    11.10) For the circuit of Figure 11.25, answer the following questions: a) What is Vout for the circuit as drawn? b) What would Vout be if R2 were changed to 2 k? c) How does the current through R1 change between the conditions of part a) and part b)? d) Write a general expression for Vout as a function of the value of R2.

    Figure 11.25 Circuit for Problem 11.10.

    a) 2.5 V + 0.25 V = 2.75 V b) 2.5 V+ 0.5 V = 3.5 V c) It doesnt change. d) Vout = 2.5V + 2.510-4 R2

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 11-5

    11.11) For the circuit shown in Figure 11.26, answer the following questions: a) If V1 = V2 = 1 V, what are the voltages at points A and B? b) If V1 = 1.1 V and V2 = 1 V, what are the voltages at points A and B? c) If V1 = 1 V and V2 = 1.1 V, what are the voltages at points A and B? d) Write an expression for the voltage at B minus the voltage at A in terms of V1, V2 and the values of

    the resistors.

    Figure 11.26 Circuit for Problem 11.11.

    a) VA = 1 V, VB = 1 V b) VA = 2.1 V, VB = 0 V c) VA = 0 V, VB = 2.1 V

    d) ( )

    +=

    2

    112

    21RRVVVV AB

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 12-1

    Chapter 12 Real Operational Amplifiers and Comparators

    12.1) Use the Internet to find the data sheet for the Microchip MCP6294 amplifier and use the specifications for the device when it is operated with a single 5 V supply to answer the following questions. a) For a circuit with a closed loop gain of 10 and desired maximum gain error of 10%, use the guidelines

    provided in this chapter to determine the maximum signal frequency that can be amplified? b) What would the actual gain be at that frequency? c) How would these answers change if the power supply voltage were reduced to 3.3 V?

    a) Only a typical GBW is specified at 10 MHz. To keep the gain error below 10% we need an open loop gain that is 10 times the desired closed loop gain. To achieve a closed loop gain of 10 we need an open loop gain of 100. With a GBW of 10 MHz, this corresponds to 100 kHz.

    b) The gain equation that accounts for non-infinite open-loop gain is:

    0.9)

    1101(1001

    )110

    10(100

    )(1

    )(=

    +++=

    +++=

    if

    i

    if

    f

    RRR

    A

    RRR

    AG

    c) The GBW spec is given for a power supply range from 2.4-5.5 V so lowering the supply to 3.3 V would not change the result.

    12.2) Use the Internet to find the data sheet for the Microchip MCP6294 amplifier. If the MCP6294 amplifier operates with a single 5 V supply across the full range of temperatures, what is the possible range of output voltages for the circuit shown in Figure 12.10? You may neglect the effects of temperature on all other circuit elements.

    Figure 12.10 Circuit for Problem 12.2.

    Ideal output = -0.1 V 100 k/10 k = 1 V, The maximum bias current of 200 pA will flow across Rf creating a voltage drop of 20 V. Since the bias current is shown as a positive number, it is flowing into the pin and must be supplied by the output, raising the output by the 20 V. The input offset voltage is listed as 5 mV, which will be amplified by the noise gain resulting in a 55 mV swing in the output. Since the bias current raises the output, the minimum output will be when it is zero and the input offset voltage is at its negative minimum: 1 V 55 mV = 0.945 V, The maximum output will be when both the bias and the input offset voltage are at the maximum: 1 V + 55 mV + 20 V = 1.05502 V.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 12-2

    12.3) How much GBW is required of an op-amp in order for it to amplify a 10 kHz sine wave by a factor of 10 with a gain error of less than 1%?

    To maintain a gain error of less than 2% requires that we have 50 times the open loop gain as the required closed loop gain, 10 50 = 500. To have an open loop gain of 500 at 10 kHz requires an op-amp with a GBW of 500 10 kHz = 5 MHz.

    12.4) Design a circuit to implement an inverting comparator with hysteresis having an approximately 200 mV hysteresis band centered at approximately 1 V. Choose standard 5% resistors and report the expected thresholds if the values of those resistors were exact.

    RPUR1

    R2

    +Vcc

    VinVout

    Vref

    R3

    +Vcc

    R2 = 30 k, R1 = 120 k, R3 = 560 k, RPU = 3.3 k. Thresholds will be at 1.164 V and 0.959 V.

    12.5) What range of thresholds (min to max) would you expect to see in the circuit of Problem 12.4 if the 5% resistors were at the outer limits of the tolerance?

    The lowest lower threshold would be if R2 and R3 were at their minimum values, and R1 was at its maximum value, resulting in a lower threshold of 0.883 V.

    The highest upper threshold would be if R2 was at its maximum value, and R1 and R3 were at their minimum values, resulting in an upper threshold of 1.255 V.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 12-3

    12.6) For the circuit shown in Figure 12.11, what is Vout? Write an expression for Vout in terms of the relevant device parameters.

    Figure 12.11 Circuit for Problem 12.6.

    Vout = 4.3 V. )1()3.3()1(3.3 221322211 +=+=+=+= kIkIkIVRIRIRIVV ZOUT

    Since the voltage at V+ and V will be driven to be the same, I1will equal I2.

    12.7) In the circuit of Figure 12.11, what purpose does resistor R1 serve?

    It limits the current through D1 and creates the voltage drop that will be matched to that at the non-inverting input.

    12.8) Using the Web, classify the following op-amps according to their input and output characteristics (i.e., RRI, RRO, RRIO): LM139A, MCP6031, OPA337, MC34072A, ADA4051-2, LT1012.

    LM139: The LM139 is a comparator, not an op-amp MCP6031: RRIO OPA337: RRO MC34072A: Neither RRI or RRO, but the output is close to RRO ADA4051-2: RRIO LT1012: Neither RRI nor RRO

    12.9) For the MC6294, across the range of temperatures from -40 to 125C, what is the maximum expected input offset voltage and input bias current? How do these numbers change if the temperature range is reduced to -40 to 85C?

    Across full temp range: the input offset voltage: 5 mV, and the input bias current: 2 nA. Limiting the temp to 85C lowers the bias current spec to 200 pA.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 12-4

    12.10) For the circuit of Error! Reference source not found., what is Vout ? Write an expression for Vout in terms of the relevant device parameters.

    Figure 12.12 Circuit for Problem 12.10.

    Vout = 1.09V;

    += 233RR

    RVVout z

    12.11) Locate a data sheet for a MAX9024 and answer the following questions: a) How does its pin-out compare with that of the comparator shown in Figure 12.9? b) How does its output stage compare with that described in Section 11.5? c) How does its propagation delay compare with that of the specifications for the LM339A?

    a) Even though it is a comparator, this device uses a pin-out that matches a quad op-amp. b) This device has a totem pole/push-pull output, unlike most comparators that have an open collector

    output. c) The LM339A is specified at typically 1.3 s with 5 mV of overdrive. The MAX9024 is specified at

    typically 8 S with 10 mV of overdrive.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 13-1

    Chapter 13 Sensors

    13.1) A microphone has a dynamic range of 88 dB and a maximum output of 2.5 V rms. What is the output signal (in V rms) that corresponds to the minimum sound level it is capable of detecting?

    Eq. 11.4

    =

    SignalMeasurableMinSignalMeasurableMaxdB 10log20 can be rewritten and solved as:

    VrmsVrmsSignalMeasurableMaxSignalMeasurableMin dBdB 5.9910

    5.2

    10 2020===

    13.2) From the list below, pick two sensor technologies and succinctly describe their theory of operation: a) Geiger counter b) Torque sensor c) LVDT d) pH sensor e) Vortex flow meter

    This is a go learn about it and tell us what you learned problem. Responses will vary. Check for a reasonably thorough and well-understood response. a) A tube filled with inert gas (e.g. helium, argon, etc.) briefly conducts electricity when a particle of

    radiation or a photon passes through it. This very small electrical signal is amplified and quantified to measure ambient radiation.

    b) There are several types of torque sensors, but one of the most common makes use of strain gages oriented at 45 to the longitudinal axis of a shaft. The strain exhibited by the shaft is proportional to the applied torque. Powering and measuring the strain on a rotating shaft is a more challenging problem (though not specifically required to answer this question). This is most commonly achieved by means of slip-rings or inductive coupling.

    c) A linear variable differential transformer uses a moveable ferrous core to measure displacements. A primary coil is externally excited by an AC signal, and the differential signal measured in two secondary coils is related to the position of the core. By measuring the signal in the secondary coils, the position of the core may be very precisely determined.

    d) A glass electrode immersed in a solution develops a potential (voltage) related to the concentration of hydrogen ions present in the solution. The concentration of hydrogen ions in a solution determines its pH. The glass electrode may be constructed with small amounts of other materials mixed in (dopants), such as Na, K, Li, Al, etc. Often, two electrodes are used to create a sensor assembly: a measurement electrode and a reference electrode. The measurement electrode is exposed to the solution to be measured, and the reference electrode provides a stable signal to compare with the reference electrode.

    e) A body is placed in the path of a flowing fluid, which sheds vortices downstream of the body. The period of oscillation of the vortices is related to the velocity of the flow.

  • Solution Manual for Introduction to Mechatronic Design Do Not Circulate

    Carryer, Ohline & Kenny Copyright 2011 13-2

    13.3) For one of the sensors you chose to describe in your answer to Problem 13.2, identify a commercially available example, locate the data sheet for the device that describes its performance, and answer the following questions: a) What is the range of the sensor? b) In what form is the output (e.g., voltage, resistance, capacitance, and so on)? c) What is the transfer function for the sensor? d) What are the categories of error for the sensor? What is the overall accuracy? e) Does the sensor exhibit hysteresis? If so, how much?

    This is a go learn about it and tell us what you learned problem. Responses will vary. Check for a reasonably thorough and well-understood response. The device data sheet used is required as part of a complete answer.

    13.4) Using PDL (also called pseudo-code, see Chapter 6, Software Design), describe an algorithm for performing switch debouncing in software. Does your routine report when the switch is initially activated or when it is released?

    Since this is a software design exercise, responses will vary. Evaluate answers based on plausibility and how thoroughly the solu