lecture 9 - combining signals and system in imu 9 - combining... · for this course, we will be...

18
PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 1 In this lecture, I will highlight SEVEN most important lessons about systems – the topic in the previous week. One objective is to provide you with a “birds eye’s” view of this topic before I start the new topic next week on discrete systems. I will also integrate everything I have covered so far on signals and systems using the example of the IMU module. IMU stands for Inertia Measurement Unit. I will consider the accelerometer and gyroscope data produced by the IMU, and show you how you can estimate the pitch and roll angles from these readings using a system (known as Complementary Filter).

Upload: phunghuong

Post on 17-Dec-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 1

Inthislecture,IwillhighlightSEVENmostimportantlessonsaboutsystems– thetopicinthepreviousweek.Oneobjectiveistoprovideyouwitha“birdseye’s”viewofthistopicbeforeIstartthenewtopicnextweekondiscretesystems.IwillalsointegrateeverythingIhavecoveredsofaronsignalsandsystemsusingtheexampleoftheIMUmodule.IMUstandsforInertiaMeasurementUnit.IwillconsidertheaccelerometerandgyroscopedataproducedbytheIMU,andshowyouhowyoucanestimatethepitchandrollanglesfromthesereadingsusingasystem(knownasComplementaryFilter).

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 2

Inthiscourse,Istartedwithsignalsinthefirstfivelectures.ThenImovedtotheanalysisofsystems(andthesesystemsaredesignedtoprocessthesignals).Herearethefirstfourofthemostimportantlessonsthatyouaremeanttohavegrasped.Remember,itisnotsoimportanttomemorise anything,particularlydon’tmemorise formulae– youcanalwayslooktheseup.However,theconceptualideasbehindeachofthesepointsareimportant.

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 3

Herearetheremainingpointswhathavebeencoveredsofar.IwillnowgothrougheachoftheseSEVENpointsinthefollowingslides.

Furthermore,thereareafewissuesthatIhavedeliberatelyomittedthisyear.Imayormaynotcovertheminlaterlectures,dependingonhowmuchtimeIhavegotleft.

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 4

Thefirsttwolessonsarerelated.Intimedomain,wearefamiliarwithusingdifferentialequationstomodelaphysicalsystem.Aboveisthedifferentialequationmodellingamassconnectedtoafixedceilingwithaspringandadamper.TherelativebetweentheforceappliedF(input)andtheverticaldisplacementx(output)isgiveninthe2nd orderdifferentialequation.IfweapplyLaplacetransformtotheinput,outputandthedifferentialequation,mappingd/dt tos,andd2/dt2 tos2,weobtainthetransferfunctionofthesystemintheLaplacevariablesasshown.H(s)isknownasthetransferfunctionofthesystem.

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 5

Thetransferfunctionisveryusefulconcept.YoutransfertheinputX(s)totheoutputY(s)throughthisfunctionH(s).Therefore,throughverysimplemultiplication,wecanpredicttheoutputgiventheinput:

Y(s)=H(s)X(s).

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 6

IfyougobacktothebasicdefinitionofLaplaceandFouriertransforms,youcanimmediatelyseethat,assumingcausality(i.e.signalisonlynon-zerofort≥0),thenitisclearthatyoucanevaluatethefrequencyresponseofasystembysubstitutings=jw intothetransferfunctionH(s).

ItisimportanttounderstandtherelationshipbetweenFourierandLaplace.FourierisaspecialcaseofLaplacetransformforspecificvalueofs.

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 7

Thisfollowsfromthelastidea.Fouriertransformisusefultopredictbehaviourforeverlastingsinusoids.ThereforefrequencyresponseH(jw)isusefulforstudyingthesteadystatebehaviourofasystem.Steadystatemeansthatalltransientbehaviourhasdieddown.Incontrast,Laplacetransformandtransferfunctionareusefultomodelsysteminbothtransientconditionandsteadystatecondition.ThatiswhywehavetolearnaboutLaplacetransform.Studyingasystemintermsofitstransferfunctionallowsusetopredict(andunderstand)itsbehaviourwhatinputarechangingfast.Oneveryimportantquestionistoask:howwouldthesystemrespondtoaunitstepinputu(t).(ThisisknownastheStepResponse.)

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 8

LaplaceandFouriertransforms,frequencyresponseandtransferfunctions,areallapplicableONLYtosystemsthatarelinear(i.e.obeyprincipleofsuperposition)andtime-invariant(i.e.itsparametersdonotchangeovertime).Manyreal-lifesystemsarenon-linear.Forexample,fortheBulbBoxexperiment,theoutputlightintensityisanon-linearfunctionoftheinputvoltage(asshownabove).However,inorderforustoanalysesuchassystem,wecanalwaysoperatethesystematacertainregion,knownastheoperatingpoint,anduseaverysmallsignal.Intheexperiment,youwerestudyingthesystemresponsetoasquarewaveinputatVmin =1.5vandVmax=2.5v.Ifweassumethatthesignalisrelativelysmallinamplitude,thenwecouldassumethatthesystemismore-or-lesslinear.Youarenowoperatingalongtheredlinesshowninthegraphabove.

Underthisassumption,theysystemisregardedaslinear.Wethenusethetransferfunctionshowntomodelthesystem.WewouldhoweverneedtoadjustthesystemDCgain,whichislowerat1.5vthanat2.5v.

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 9

Whydowebothertomodelsystemsinthes-domainatall?Theansweris:itprovidesexcellentINSIGHTStothebehaviourofthesysteminverysimply(butfairlyaccurate)way.Ifwetakethe2ndordersystemintheBulbBox,wehavethetransferfunctionH(s)asshown.Wecanalwaysre-arrangethedenominatorequationintermsofthedampingfactor𝜁 andthenaturalfrequencyw0.w0 tellsusthefrequencyatwhichthesystemLIKEStooscillateat.𝜁tellsustherateatwhichthisoscillationwilldiedown.Thedampingfactoralsocharacterisethesystemintovariouscategories.If𝜁 is>1,thenthesystemisover-damped– itresponsestoaunitstepfunctionslowerthanitiscapable.If𝜁 is<1,thesystemisunder-damped,anditwilloscillateifhitbyatransientinput.If𝜁 is=1,thesystemiscritically-damped.Thesystemresponsesfastestwithoutanyovershootsoroscillation.

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 10

Fortherestofthislecture,thematerialsarehighlyintegratedwiththeLabSessiononIMU.Youwilllearnaboutprocessingrealelectricalsignalsfromtransducers,andproduceestimatesofthepitchandrollanglesusinganelectricalsystemknownasafilter.TheIMUisanimportantcomponentthatyouwillhavetouseforyourself-balancingsegway projectlater.Theobjectivehereisforyoutounderstandwherethemeasurementscomefrom,andwhyyouneedtoprocessthesignalthusproducedinordertomakeituseful.

First,letusgothroughpartofwhathavebeencoveredlastyearinElectronics1duringthe“Sense”lecture.Acommonsensingapproachusedinaccelerometersiscapacitancesensinginwhichaccelerationisrelatedtochangeinthecapacitanceofamovingmass.Thissensingtechniqueisknownforitshighaccuracy,stability,lowpowerdissipation,andsimplestructuretobuild.Itisnotpronetonoiseandvariationwithtemperature.BandwidthforacapacitiveaccelerometerisonlyafewhundredHertzbecauseoftheirphysicalgeometry(spring)andtheairtrappedinsidetheICthatactsasadamper.

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 11

Thedisplacementofthemovablemass(micrometer)iscausedbyacceleration,anditcreatesanextremelysmallchangeincapacitanceforproperdetection.ThereforewhenimplementsuchaccelerometeronMEMS,manyparallelcapacitorsarecreatedasshowninthechipphotohere.Theconfigurationenablesagreaterchangeincapacitance,whichcanbothbedetectedmoreaccurately,andultimatelymakescapacitancesensingamorefeasibletechnique.

CapacitiveMEMSaccelerometer• Highprecisiondualaxisaccelerometerwithsignalconditionedvoltageoutputs,

allonasinglemonolithicIC• Sensitivityfrom20to1000mV/g• Highaccuracy• Hightemperaturestability• Lowpower(lessthan700uA typical)• 5mmx5mmx2mmLCCpackage• Lowcost($5~$14/pc.inYr.2004)

MEMSbasedaccelerometerchipsnowcomewith3-axes,withthreeseparatesensorswhosemassesmoveinthreeorthogonaldirections:X,YandZ.Makersofaccelerometersinclude:Analog Devices,Bosch,STMicro,TexasInstruments.

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 12

TounderstandCoriolis effect,hereisanexcellentvideothatexplainshowangularaccelerationresultsinlinearacceleration:

https://www.youtube.com/watch?v=mcPs_OdQOYU

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 13

Thisvideocanbefoundon:

https://www.youtube.com/watch?v=i2U49usFo10

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 14

Forthiscourse,wewillbeusingalow-costIMU,theMPU-6050.Datasheetisavailableonthecoursewebpage.TheMEMSdevice(atthecentreofthemodule)providesaccelerometerandgyroscopedataasdiscretemeasurementsthroughtheI2Cinterface(seenotesfromElectronics1lecture“Link”).

PyBench.m providestwomethodstotakereadingseasily:pb.get_accel()andpb.get_gyro()

Thereturnedvaluesarepitchandrollanglesasestimatedbytheaccelerometer,andtheangularvelocityofrotationfromthegyroscopeonthex,yandzaxes.

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 15

InLab3,Exercise1,youwillbeplottingtheaccelerometerdatavstimeaspitchandrollangles.Youwillfindthatthemeasurementsare“noisy”.Thisisbecauseaccelerometermeasuresforceexertedonamassduetogravity.However,anyotherforces(suchasthoseduetovibrationormovement)willalsomanifestthemselvesasnoiseontheanglesignals.

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 16

Whenyouconsiderthesignals producedbythegyroscope,youneedtoperformintegrationofthereadingovertimeinordertoobtaintheanglereadingbecausetheoutputofthegyroscopeisrateofchangeofangle(orangularvelocity).Integrationisnumericallyperformusingsummation.However,anyerrorinsuchanoperationwillproduceanerrorbecauseoncesummed,theerrorstays.

Theconsequenceofthiswayofderivinganglesfromgryscope readingsisthattheestimatedanglewillhaveanaccumulatederrorovertime– somethingwecalleda“drift”oran“offset”.

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 17

InLab3,youwillalsouseaMatlabfunctionIhavewrittentodisplaytheIMUboardasa3-Dmodel.Thisshouldgiveyourealfeelaboutthemeasurementsfromtheaccelerometerandgyroscope.

Therestoftheexperimentistoanswerthefollowingquestion:

Giventhattheaccelerometerhasnoisymeasurements,andthegyroscopesdatahaslownoise,buthashighdrift(increasedoffseterrorovertime),howcanwecombinethesetworeadingstogivemuchmorereliablepitchandrollanglereading?

PYKC 29 Jan 2018 EA2.3 – Electronics 2 Lecture 9 - 18

Iwillbegoingthroughthecomplementaryfiltersindetailsinalaterlecture.Fornow,itissufficienttoseewhatistheequivalentsystemweareusingtocombinethesetwosignals.

Sincetheaccelerometerhaslotsofnoise,wewillsuppressthiswithalowpass filter(passlowfrequencycomponents,butsuppresshighfrequencycomponentsthatcontributetothenoise).

Sincethegyroscopeproducesangularvelocitythatweintegrate(sum)togettheangle,andresultsinhighdrift(orincreasingoffseterrorovertime),wewillsuppressthiserrorusingahighpassfilter.

Finallywecombinethesetwobyaddingabitofbothtomakeupthefinalangleestimation.