Lecture Lab2 PartB

download Lecture Lab2 PartB

of 31

Transcript of Lecture Lab2 PartB

  • 7/29/2019 Lecture Lab2 PartB

    1/31

    Lab2,PartB:RobotDCMotor

    ECEN2270 1ElectronicsDesignLaboratory

    Speedmeasurementcircuitdesign

  • 7/29/2019 Lecture Lab2 PartB

    2/31

    Discussion

    Comepreparedtothelab Reviewlectureslides,preparetoaskquestions

    Reviewlabtasks

    LTspice simulationscanbecompletedoutsidethelab

    FinishPartA:LTspice simulationsStartPartB:paperdesignandLTspice simulations,before youstartbuildingyourcircuit

    Inthelab

    Attendanceismandatory

    Donotrushthroughexperiments,stopifyouhavequestionsaboutwhyorwhatyouaredoing

    Reports Donotleavereportforlater,workonitasyoudolabtasks

    Followreportguidelines

    Makesureyouincludeeverythingstatedinthelabtask

    ElectronicsDesignLaboratory 2ECEN2270

  • 7/29/2019 Lecture Lab2 PartB

    3/31

    ECEN2270 3ElectronicsDesignLaboratory

    Robotplatform

    TwoDCmotors,eachdrivingawheel

    +

    _

    VDC

    IDC

    wheel

    64:1

    gearOptical

    encoder:

    12 pulses

    permotor

    shaft

    rotation

    DCmotor

    1 2 3 4

    1EncoderpowersupplyVCC=+710V

    2Encoderground

    3EncoderoutputpulsesA,frequencyfenc4EncoderoutputpulsesB,frequencyfenc

    DCsupply

    10

  • 7/29/2019 Lecture Lab2 PartB

    4/31

    Lab2objectives

    PartA

    MeasureDCmotorcharacteristics

    DevelopaSpicecircuitmodelfortheDCmotoranddetermine

    modelparametersbasedonexperiments

    Validatethemodel:compareexperimentalandsimulationresults

    PartB

    Designaspeedsensorcircuit(tachometer)thatoutputsvoltage

    proportionaltowheelspeed

    UseLTspice simulationstoverifyanddebugthedesign

    Build,testanddemothespeedsensorcircuit

    ElectronicsDesignLaboratory 4ECEN2270

  • 7/29/2019 Lecture Lab2 PartB

    5/31

    PartB:SpeedSensorCircuit

    ElectronicsDesignLaboratory 5ECEN2270

    Encoderoutputpulses,frequencyfenc [Hz]isproportionalto speed

    Goal:Convertfrequencytovoltage

    Approach:

    Convertencoderoutputfrequencytodutycycleusingaoneshotcircuit

    Lowpassfiltertheoneshotcircuitoutputtoproduceavoltageproportional

    toencoderfrequency

    CanuseLab2PartAdatatodeterminetheexpectedrange

    ofencoderoutputfrequencies,particularlythemaximum

    frequency

    Althoughfrequencyvaries,thedutycycleisconstant

    (50%),thustheaverageencoderoutputvoltageisconstant

  • 7/29/2019 Lecture Lab2 PartB

    6/31

    Oneshotcircuit

    Frequencyoftheoneshotoutputtracksthefrequencyoftheencoder

    Thedutycycleoftheoneshotoutputisproportionaltofrequency

    Theaveragevalue(lowpassfiltered)oftheoneshotoutputisproportionaltofrequency

    ElectronicsDesignLaboratory 6ECEN2270

    Oneshot

    Fixedton output

    Oneshotout

    Oneshotout

    Inputtrigger

  • 7/29/2019 Lecture Lab2 PartB

    7/31

    SpeedSensor(Tachometer)Circuit

    ElectronicsDesignLaboratory 7ECEN2270

  • 7/29/2019 Lecture Lab2 PartB

    8/31

    Howtoapproachtheanalysis(ordesign,ordebugging)

    ofacomplexcircuit

    1.DONT:diverightinandstartwritingalotofloopand

    nodeequations

    Youwillmakeanalgebraicmessandgetnowhere

    Whendebugging:dontjustbuildthewholethingandturniton,expectingittoworkfirsttime

    2.DO:Breakthecircuitdownintosmallerfunctionalblocks

    thatcanbeseparatelyunderstood

    Firsttrytoexplaininwords(aparagraph)howeachblockworks

    Getthefirstblocktoworkbeforemovingontothenext

    ElectronicsDesignLaboratory 8ECEN2270

  • 7/29/2019 Lecture Lab2 PartB

    9/31

    3.DO:Foreachblock,decidewhatyouneedtoknow,

    andwhatanalysiswillbetractableandfeasible

    Identifytheinputandoutputsignals.Thegoalistofindthe

    functionalrelationshipbetweenthese.

    Writesimpleequationsthatyoucanreasonablysolve

    Solvetheequationsfortheelementvalues;oftenthereis

    morethanonevalidanswer

    Develop

    additional

    constraints

    based

    on

    your

    understanding

    of

    how

    thecircuitissupposedtowork

    Choseimpedancelevelssothatcurrentsandpowerconsumption

    arereasonable,e.g.mAnotA

    ElectronicsDesignLaboratory 9ECEN2270

  • 7/29/2019 Lecture Lab2 PartB

    10/31

    Breakingthetachometercircuitintoblocks

    ElectronicsDesignLaboratory 10ECEN2270

    Trigger

    Block

    Oneshot

    Block

    Lowpassfilter

    Block

  • 7/29/2019 Lecture Lab2 PartB

    11/31

    Oneshotblockpreliminaries:insidethe555timer

    11

    Includestwocomparators,aflipflop,dischargetransistor,

    outputbufferandaninternal

    resistordivider

    Upperthreshold,THRESH,is2/3VCC usedforinternal

    Reset

    Lowerthreshold,TRIG_BAR,is

    1/3VCC usedforinternalSet

    TransistorshortsDISCHpinto

    groundwhileoutputisLOW

    Canbeeasilysetupas

    monostable (oneshot)or

    astable (oscillator)

    Viewtheyoutube 555tutorialpostedontheLab2page

  • 7/29/2019 Lecture Lab2 PartB

    12/31

    Oneshotcircuit

    ElectronicsDesignLaboratory 12ECEN2270

    Input:Setpulsefromtriggercircuit

    Output:Outsignalhavingpulsewidthton

    Thiscircuitresetsthelatchwhenthe

    capacitorvoltagevC2(t)reachesthe

    thresholdvoltageCTRL

    Thingswewanttoknow:

    Howdoesthiscircuitgeneratethetonpulse?

    Howlongiston,andhowshouldwechoose

    R2 andC2?

    Equivalentcircuit

    Inputandoutputwaveforms

  • 7/29/2019 Lecture Lab2 PartB

    13/31

    555Timer:Monostable oneshotoperation

    Oneshottiming

    ttrig:triggermustdropbelowthreshold(1.6VatVcc=5V)longenoughfor

    reliabletrigger(>1s),butshorterthanton Vtrigger_low

  • 7/29/2019 Lecture Lab2 PartB

    14/31

    Breakingthetachometercircuitintoblocks

    ElectronicsDesignLaboratory 14ECEN2270

    Trigger

    Block

    Oneshot

    Block

    Lowpassfilter

    Block

  • 7/29/2019 Lecture Lab2 PartB

    15/31

    Triggercircuit

    ElectronicsDesignLaboratory 15ECEN2270

    Input:venc(t),squarewavefromencoder

    Output:Setpulsegoingtolatch

    Thiscircuitsetsthelatchatthefalling

    edgeofvenc(t)

    Soonafterthelatchisset,wewantthesetpulsetogoaway:thesetpulseneeds

    toterminatebeforeitistimetoresetthe

    latch.Butthedatasheetforthe555timer

    specifiesaminimumpulsewidthof

    approximately1sec.

    Thingswewanttoknow:

    Howisfrelatedtothegroundspeedofthe

    wheels?(leftasexerciseforstudents)

    Howdoesthiscircuitgeneratetheset

    pulse?

    Howlongisttrig,andhowshouldwechoose

    R1 andC1?

    Equivalentcircuit

    Inputandoutputwaveforms

    ttrig

  • 7/29/2019 Lecture Lab2 PartB

    16/31

    TriggerCircuit

    ElectronicsDesignLaboratory 16ECEN2270

    DiodeD1clampstrignodetoVCConrisingedgeofencsquarewave

    CapC1pullstrignodedownonfalling

    edgeofencsquarewave

    ResistorR1chargesC1andpullstrig

    backuptocompletetriggerpulse

    ttrig

  • 7/29/2019 Lecture Lab2 PartB

    17/31

    Breakingthetachometercircuitintoblocks

    ElectronicsDesignLaboratory 17ECEN2270

    Trigger

    Block

    Oneshot

    Block

    Lowpassfilter

    Block

  • 7/29/2019 Lecture Lab2 PartB

    18/31

    Lowpassfiltercircuit

    ElectronicsDesignLaboratory 18ECEN2270

    Input:PulsewidthmodulatedsignalOUT

    Output:speedsignalhavingaDCvalue

    proportionaltof

    Thiscircuitisalowpassfilterthatpasses

    theDCcomponentofOUTbutremoves

    thefundamentalandhigherfrequency

    components

    Thingswewanttoknow:

    Howdoesthiscircuitoperateonthepulse

    widthmodulatedOUTsignaltoproducethe

    speedsignal? HowshouldwechooseR3 andC3?

    Equivalentcircuit

    Inputandoutputwaveforms

  • 7/29/2019 Lecture Lab2 PartB

    19/31

    TimeConstantsintheTachometercircuit

    Threetimeconstantstoselect R1,C1

    1s>Rencoder R1,C1determinesttrig

    R2,C2

    Setton todetermineoutputvoltageofspeedsensoratmaximumspeed(basedonVCCanddutycycle)

    R3,C3

    LowpassfilterPWMoutput;determinesvoltagerippleonthe

    speedsensoroutputvoltage

    R3*C3>>lowestexpectedPWMperiod

    R3*C3

  • 7/29/2019 Lecture Lab2 PartB

    20/31

    Lab2,PartB

    DesignandsimulatethespeedsensorcircuitBuild,testanddemothespeedsensorcircuit

    Seethe

    Lab

    2Tasks,

    Part

    B,for

    task

    specifications

    ElectronicsDesignLaboratory 20ECEN2270

  • 7/29/2019 Lecture Lab2 PartB

    21/31

    Appendix:MoreDetails

    TriggerCircuit

    OneShotCircuit

    LowPassFilterCircuit

    ElectronicsDesignLaboratory 21ECEN2270

  • 7/29/2019 Lecture Lab2 PartB

    22/31

    Triggercircuit

    ElectronicsDesignLaboratory 22ECEN2270

    Input:venc(t),squarewavefromencoder

    Output:Setpulsegoingtolatch

    Thiscircuitsetsthelatchatthefalling

    edgeofvenc(t)

    Soonafterthelatchisset,wewantthesetpulsetogoaway:thesetpulseneeds

    toterminatebeforeitistimetoresetthe

    latch.Butthedatasheetforthe555timer

    specifiesaminimumpulsewidthof

    approximately1sec.

    Thingswewanttoknow:

    Howisfrelatedtothegroundspeedofthe

    wheels?(leftasexerciseforstudents)

    Howdoesthiscircuitgeneratethesetpulse?

    Howlongisttrig,andhowshouldwechoose

    R1 andC1?

    Equivalentcircuit

    Inputandoutputwaveforms

    ttrig

  • 7/29/2019 Lecture Lab2 PartB

    23/31

    Triggercircuitanalysis:preliminaries

    ElectronicsDesignLaboratory 23ECEN2270

    1. V+

    isdetermined

    by

    voltage

    divider:

    V

    +

    =VCC (5

    k

    )/(15k

    )=VCC/3

    =1.67

    V

    2.DiodeD1 behavesasanonoffswitch(aonewayvalve).Theconductingstate

    dependsonthevoltageandcurrentappliedtothediodebythecircuit:

    Ifthecircuitmakesthevoltageattheanodeterminalgreaterthanthevoltageatthecathode(or

    ifthecircuitappliespositivecurrenttothediode),thenthediodeturnson.Thisclampstheanodetoavoltageslightlygreaterthanthecathodevoltage(i.e.,thediodeisapproximatelya

    shortcircuit).

    Ifthecircuitattemptstoapplyreversecurrent(fromcathodetoanode)orreversevoltage,then

    thediodeturnsoff.Thiscausesthediodetobecome(approximately)anopencircuit.

    Characteristics of silicon pn diode

  • 7/29/2019 Lecture Lab2 PartB

    24/31

    Triggercircuit:waveforms

    ElectronicsDesignLaboratory 24ECEN2270

    vC1 chargestoVCC throughR1

    vC1 discharges

    to

    0

    throughD1

    D1 doesnotallowTRIG >VCCsovC1 =0

    D1 OND

    1OFF

    ttrig

  • 7/29/2019 Lecture Lab2 PartB

    25/31

    Triggercircuit:analysistofindttrig

    ElectronicsDesignLaboratory 25ECEN2270

    Duringthesetpulseinterval: DiodeD1 isOFF(opencircuit)

    venc(t)=0

    vC1 isinitiallyzero,andC1 charges

    throughR1

    Therefore,forthisintervalthecircuitreducesto:

    Letsdefine

    t=

    0atthe

    beginning

    of

    thisinterval,andtaketheLaplace

    transformofthecircuittosolvefor

    thecapacitorvoltage:

    Nowusepartialfractionexpansiontotake

    inverseLaplacetransform(exercisefor

    thestudent);theresultis:

    Thetriggercircuitcomparatorcausesthe

    setpulsetoendwhenvC1 =VCC/3,attime

    t=ttrig.

    Hence:

    Solveforttrig: ttrig

    11/

    1 1)(CRt

    CCC

    trigeVtv

  • 7/29/2019 Lecture Lab2 PartB

    26/31

    Oneshotcircuit

    ElectronicsDesignLaboratory 26ECEN2270

    Input:Setpulsefromtriggercircuit

    Output:Outsignalhavingpulsewidthton

    Thiscircuitresetsthelatchwhenthe

    capacitorvoltagevC2(t)reachesthethresholdvoltageCTRL

    Thingswewanttoknow:

    Howdoesthiscircuitgeneratethetonpulse?

    Howlongiston,andhowshouldwechooseR2 andC2?

    Equivalentcircuit

    Inputandoutputwaveforms

    ttrig

  • 7/29/2019 Lecture Lab2 PartB

    27/31

    Oneshotcircuit:waveforms

    ElectronicsDesignLaboratory 27ECEN2270

    Thetransistoroperatesasanon/offswitch: WhenQishighthenthetransistorisoff,

    andviceversa.

    Whenon,thetransistorshortsoutC2andholdsvC2 =0.

    Whenthetransistorisoff,capacitorC2chargesthroughR2.

    vC2 chargestowardsVCC throughR2

    TransistorON OFF

    ComparatorresetslatchwhenvC2 reachesCTRL

    (=2VCC/3)

    ttrig

  • 7/29/2019 Lecture Lab2 PartB

    28/31

    Oneshotcircuit:analysis

    ElectronicsDesignLaboratory 28ECEN2270

    Exerciseforthestudent:deriveanexpressionfortonShowthestepsof:

    TheLaplacetransformedcircuittobesolved

    Deriverelevantequationandtakeinversetransform

    SolvefortonThenuseyourresulttoselectvaluesforR2 andC2.

  • 7/29/2019 Lecture Lab2 PartB

    29/31

    Lowpassfiltercircuit

    ElectronicsDesignLaboratory 29ECEN2270

    Input:PulsewidthmodulatedsignalOUT

    Output:speedsignalhavingaDCvalue

    proportionaltof

    Thiscircuitisalowpassfilterthatpasses

    theDCcomponentofOUTbutremoves

    thefundamentalandhigherfrequency

    components

    Thingswewanttoknow:

    Howdoesthiscircuitoperateonthepulse

    widthmodulatedOUTsignaltoproducethe

    speedsignal? HowshouldwechooseR3 andC3?

    Equivalentcircuit

    Inputandoutputwaveforms

  • 7/29/2019 Lecture Lab2 PartB

    30/31

    Lowpassfiltercircuit:analysis

    ElectronicsDesignLaboratory 30ECEN2270

    ThepulsewidthmodulatedsignalOUT(t)canberepresentedbyFourieranalysisasa

    DCcomponentV0 plusasumofsinusoidscalledharmonics:

    Theharmonicshavefrequenciesthatareintegralmultiplesofthefundamental

    frequencyf.TheDCcomponentisgivenbytheaveragevalue:

    Theamplitude spectrum isaplotoftheharmonicamplitudesvs.frequency:

  • 7/29/2019 Lecture Lab2 PartB

    31/31

    Filterdesign

    ElectronicsDesignLaboratory 31ECEN2270,

    TheeffectoftheR3C3 filteroneachindividualharmoniccanbefoundbyphasor

    analysisofthecircuit:usephasors tosolvethecircuitandfindhowtheamplitudeofa

    sinusoidischangedbythecircuit,asafunctionoffrequency.

    WewanttochooseR3 andC3 sothatthefilterpassestheDCcomponentandanyverylowfrequencyvariationsthatoccurasaresultofthechangingspeedoftherobot.But

    wewantthefiltertorejectthecomponentsofOUTatthefundamentalfrequencyf

    anditsharmonics.Sothefiltershouldhaveatransferfunction (i.e.,theratioofitsoutputvoltageamplitudetoitsinputvoltageamplitude,vs.frequency)thatlookslike

    this:

    Exerciseforstudents:usephasor analysistosolveforthetransferfunctionoftheR3

    C3 filter.SelectappropriatevaluesforR3 andC3.