A Guide To using IMU Accelerometer and Gyroscope Devices in Embedded Applications.docx

上传人:b****6 文档编号:6620561 上传时间:2023-01-08 格式:DOCX 页数:17 大小:193.06KB
下载 相关 举报
A Guide To using IMU Accelerometer and Gyroscope Devices in Embedded Applications.docx_第1页
第1页 / 共17页
A Guide To using IMU Accelerometer and Gyroscope Devices in Embedded Applications.docx_第2页
第2页 / 共17页
A Guide To using IMU Accelerometer and Gyroscope Devices in Embedded Applications.docx_第3页
第3页 / 共17页
A Guide To using IMU Accelerometer and Gyroscope Devices in Embedded Applications.docx_第4页
第4页 / 共17页
A Guide To using IMU Accelerometer and Gyroscope Devices in Embedded Applications.docx_第5页
第5页 / 共17页
点击查看更多>>
下载资源
资源描述

A Guide To using IMU Accelerometer and Gyroscope Devices in Embedded Applications.docx

《A Guide To using IMU Accelerometer and Gyroscope Devices in Embedded Applications.docx》由会员分享,可在线阅读,更多相关《A Guide To using IMU Accelerometer and Gyroscope Devices in Embedded Applications.docx(17页珍藏版)》请在冰豆网上搜索。

A Guide To using IMU Accelerometer and Gyroscope Devices in Embedded Applications.docx

AGuideTousingIMUAccelerometerandGyroscopeDevicesinEmbeddedApplications

Introduction

ThisguideisintendedtoeveryoneinterestedininertialMEMS(Micro-Electro-MechanicalSystems)sensors,inparticularAccelerometersandGyroscopesaswellascombinationIMUdevices(InertialMeasurementUnit).

ExampleIMUunit:

  Acc_Gyro_6DOF ontopofMCUprocessingunit UsbThumb providingUSB/Serialconnectivity

I'lltrytrytocoverfewbasicbutimportanttopicsinthisarticle:

–whatdoesanaccelerometermeasure

–whatdoesagyroscope(akagyro)measure 

–howtoconvertanalog-to-digital(ADC)readingsthatyougetfromthesesensortophysicalunits(thosewouldbegforaccelerometer,deg/sforgyroscope)

–howtocombineaccelerometerandgyroscopereadingsinordertoobtainaccurateinformationabouttheinclinationofyourdevicerelativetothegroundplane

ThroughoutthearticleIwilltrytokeepthemathtotheminimum.IfyouknowwhatSine/Cosine/Tangentarethenyoushouldbeabletounderstandandusetheseideasinyourprojectnomatterwhatplatformyou'reusingArduino,Propeller,BasicStamp,Atmelchips,MicrochipPIC,etc.TherearepeopleouttherewhobelievethatyouneedcomplexmathinordertomakeuseofanIMUunit(complexFIRorIIRfilterssuchasKalmanfilters,Parks-McClellanfilters,etc).Youcanresearchallthoseandachievewonderfulbutcomplexresults.Mywayofexplainingthingsrequirejustbasicmath.Iamagreatbelieverinsimplicity.Ithinkasystemthatissimpleiseasiertocontrolandmonitor,besidesmanyembeddeddevicesdonothavethepowerandresourcestoimplementcomplexalgorithmsrequiringmatrixcalculations.

I'lluseasanexampleanewIMUunitthatIdesigned–the Acc_GyroAccelerometer+GyroIMU. We'lluseparametersofthisdeviceinourexamplesbelow.Thisunitisagooddevicetostartwithbecauseitconsistsof3devices:

–LIS331AL(datasheet)–analog3-axis2Gaccelerometer 

–LPR550AL(datasheet)–adual-axis(PitchandRoll),500deg/secondgyroscope 

–LY550ALH(datasheet)–asingleaxis(Yaw)gyroscope(thislastdeviceisnotusedinthistutorialbutitbecomesrelevantwhenyoumoveonto DCMMatriximplementation)

Togethertheyrepresenta6-DegreesofFreedomInertialMeasurementUnit.Nowthat'safancyname!

Nevertheless,behindthefancynameisaveryusefulcombinationdevicethatwe'llcoverandexplainindetailbelow.

Part1.Accelerometer

Tounderstandthisunitwe'llstartwiththeaccelerometer.Whenthinkingaboutaccelerometersitisoftenusefultoimageaboxinshapeofacubewithaballinsideit.Youmayimaginesomethingelselikeacookieoradonut,butI'llimagineaball:

Ifwetakethisboxinaplacewithnogravitationfieldsorforthatmatterwithnootherfieldsthatmightaffecttheball'sposition–theballwillsimplyfloatinthemiddleofthebox.Youcanimaginetheboxisinouter-spacefar-farawayfromanycosmicbodies,orifsuchaplaceishardtofindimagineatleastaspacecraftorbitingaroundtheplanetwhereeverythingisinweightlessstate.Fromthepictureaboveyoucanseethatweassigntoeachaxisapairofwalls(weremovedthewallY+sowecanlookinsidethebox).Imaginethateachwallispressuresensitive.Ifwemovesuddenlytheboxtotheleft(weaccelerateitwithacceleration1g=9.8m/s^2),theballwillhitthewallX-.Wethenmeasurethepressureforcethattheballappliestothewallandoutputavalueof-1gontheXaxis.

Pleasenotethattheaccelerometerwillactuallydetectaforcethatisdirectedintheoppositedirectionfromtheaccelerationvector.Thisforceisoftencalled InertialForceorFictitiousForce .Onethingyoushouldlearnfromthisisthatanaccelerometermeasuresaccelerationindirectlythroughaforcethatisappliedtooneofit'swalls(accordingtoourmodel,itmightbeaspringorsomethingelseinreallifeaccelerometers).Thisforcecanbecausedbytheacceleration,butaswe'llseeinthenextexampleitisnotalwayscausedbyacceleration.

IfwetakeourmodelandputitonEarththeballwillfallontheZ-wallandwillapplyaforceof1gonthebottomwall,asshowninthepicturebelow:

Inthiscasetheboxisn'tmovingbutwestillgetareadingof-1gontheZaxis.Thepressurethattheballhasappliedonthewallwascausedbyagravitationforce.Intheoryitcouldbeadifferenttypeofforce–forexample,ifyouimaginethatourballismetallic,placingamagnetnexttotheboxcouldmovetheballsoithitsanotherwall.Thiswassaidjusttoprovethatinessenceaccelerometermeasuresforcenotacceleration.Itjusthappensthataccelerationcausesaninertialforcethatiscapturedbytheforcedetectionmechanismoftheaccelerometer.

WhilethismodelisnotexactlyhowaMEMSsensorisconstructeditisoftenusefulinsolvingaccelerometerrelatedproblems.Thereareactuallysimilarsensorsthathavemetallicballsinside,theyarecalledtiltswitches,howevertheyaremoreprimitiveandusuallytheycanonlytellifthedeviceisinclinedwithinsomerangeornot,nottheextentofinclination.

Sofarwehaveanalyzedtheaccelerometeroutputonasingleaxisandthisisallyou'llgetwithasingleaxisaccelerometers.Therealvalueoftriaxialaccelerometerscomesfromthefactthattheycandetectinertialforcesonallthreeaxes.Let'sgobacktoourboxmodel,andlet'srotatethebox45degreestotheright.Theballwilltouch2wallsnow:

Z-andX-asshowninthepicturebelow:

Thevaluesof0.71arenotarbitrary,theyareactuallyanapproximationforSQRT(1/2).Thiswillbecomemoreclearasweintroduceournextmodelfortheaccelerometer.

Inthepreviousmodelwehavefixedthegravitationforceandrotatedourimaginarybox.Inlast2exampleswehaveanalyzedtheoutputin2differentboxpositions,whiletheforcevectorremainedconstant.Whilethiswasusefulinunderstandinghowtheaccelerometerinteractswithoutsideforces,itismorepracticaltoperformcalculationsifwefixthecoordinatesystemtotheaxesoftheaccelerometerandimaginethattheforcevectorrotatesaroundus.

Pleasehavealookatthemodelabove,Ipreservedthecolorsoftheaxessoyoucanmakeamentaltransitionfromthepreviousmodeltothenewone.Justimaginethateachaxisinthenewmodelisperpendiculartotherespectivefacesoftheboxinthepreviousmodel.ThevectorRistheforcevectorthattheaccelerometerismeasuring(itcouldbeeitherthegravitationforceortheinertialforcefromtheexamplesaboveoracombinationofboth).Rx,Ry,RzareprojectionoftheRvectorontheX,Y,Zaxes.Pleasenoticethefollowingrelation:

R^2=Rx^2+Ry^2+Rz^2     (Eq.1)

whichisbasicallytheequivalentofthe Pythagoreantheoremin3D.

RememberthatalittlebitearlierItoldyouthatthevaluesofSQRT(1/2)~0.71arenotrandom.Ifyouplugthemintheformulaabove,afterrecallingthatourgravitationforcewas1gwecanverifythat:

1^2=(-SQRT(1/2))^2+0^2+(-SQRT(1/2))^2

simplybysubstitutingR=1,Rx=-SQRT(1/2),Ry=0,Rz=-SQRT(1/2)in Eq.1

Afteralongpreambleoftheorywe'regettingclosertoreallifeaccelerometers.ThevaluesRx,Ry,Rzareactuallylinearlyrelatedtothevaluesthatyourreal-lifeaccelerometerwilloutputandthatyoucanuseforperformingvariouscalculations.

Beforewegettherelet'stalkalittleaboutthewayaccelerometerswilldeliverthisinformationtous.Mostaccelerometerswillfallintwocategories:

digitalandanalog.DigitalaccelerometerswillgiveyouinformationusingaserialprotocollikeI2C,SPIorUSART,whileanalogaccelerometerswilloutputavoltagelevelwithinapredefinedrangethatyouhavetoconverttoadigitalvalueusinganADC(analogtodigitalconverter)module.IwillnotgointomuchdetailabouthowADCworks,partlybecauseitissuchanextensivetopicandpartlybecauseitisdifferentfromoneplatformtoanother.Somemicrocontrollerwillhaveabuilt-inADCmodulessomeofthemwillneedexternalcomponentsinordertoperformtheADCconversions.NomatterwhattypeofADCmoduleyouuseyou'llendupwithavalueinacertainrange.Forexamplea10-bitADCmodulewilloutputavalueintherangeof0..1023,notethat1023=2^10-1.A12-bitADCmodulewilloutputavalueintherangeof0..4095,notethat4095=2^12-1.

Let'smoveonbyconsideringasimpleexample,supposeour10bitADCmodulegaveusthefollowingvaluesforthethreeaccelerometerchannels(axes):

AdcRx=586

AdcRy=630

AdcRz=561

EachADCmodulewillhaveareferencevoltage,let'sassumeinourexampleitis3.3V.Toconverta10bitadcvaluetovoltageweusethefollowingformula:

VoltsRx=AdcRx*Vref/1023

Aquicknotehere:

thatfor8bitADCthelastdividerwouldbe255=2^8-1,andfor12bitADClastdividerwouldbe4095=2^12-1.

Applyingthisformulatoall3channelsweget:

VoltsRx=586*3.3V/1023=~1.89V(weroundallresultsto2decimalpoints)

VoltsRy=630*3.3V/1023=~2.03V

VoltsRz=561*3.3V/1023=~1.81V

Eachaccelerometerhasazero-gvoltagelevel,youcanfinditinspecs,thisisthevoltagethatcorrespondsto0g.Togetasignedvoltagevalueweneedtocalculatetheshiftfromthislevel.Let'ssayour0gvoltagelevelisVzeroG=1.65V.Wecalculatethevoltageshiftsfromzero-gvoltageasfollows:

:

DeltaVoltsRx=1.89V–1.65V=0.24V

DeltaVoltsRy=2.03V–1.65V=0.38V

DeltaVoltsRz=1.81V–1.65V=0.16V

WenowhaveouraccelerometerreadingsinVolts,it'sstillnoting(9.8m/s^2),todothefinalconversionweapplytheaccelerometersensitivity,usuallyexpressedinmV/g.LetssayourSensitivity=478.5mV/g=0.4785V/g.Sensitivityvaluescanbefoundinaccelero

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 节日庆典

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1