应用指南.docx

上传人:b****6 文档编号:16267682 上传时间:2023-07-12 格式:DOCX 页数:10 大小:123.89KB
下载 相关 举报
应用指南.docx_第1页
第1页 / 共10页
应用指南.docx_第2页
第2页 / 共10页
应用指南.docx_第3页
第3页 / 共10页
应用指南.docx_第4页
第4页 / 共10页
应用指南.docx_第5页
第5页 / 共10页
应用指南.docx_第6页
第6页 / 共10页
应用指南.docx_第7页
第7页 / 共10页
应用指南.docx_第8页
第8页 / 共10页
应用指南.docx_第9页
第9页 / 共10页
应用指南.docx_第10页
第10页 / 共10页
亲,该文档总共10页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

应用指南.docx

《应用指南.docx》由会员分享,可在线阅读,更多相关《应用指南.docx(10页珍藏版)》请在冰点文库上搜索。

应用指南.docx

应用指南

SharpGP2D12

Applicationnoteforaninfrared,triangultation-baseddistancesensorwithananalog,non-linearoutput

|Backtohomepage|Displaynavigationbar|

∙Overview

ThisapplicationnoteisintendedtoprovideagoodoverviewoftheSharpGP2D12sensor(Fig.1)anditsuse,especiallyfordynamicsapplication.Ihopeitwillhelpsomerobotiststomakethissensorworkquiteeasilyandtoavoidcertainpitfalls.Thisrangefinderisoneofthemostcommonlyusedinautonomousroboticsapplicationsforhobbyistsandalsoinacademicresearch.Thereasonsforthisareessentiallyitslowprice(about14$atAcroname,forexample),itscompact(~40x14x13mm)andlightweightpackage(acomparisonbetweenseveralsensorsmaybefoundhere).TheGP2D12isbasedonthetriangulationprinciplewithacollimatedinfraredLEDfortheemittingelementandaPSD(PositionSensingDevice)whichconstitutesthereceiver.

Fig.1-SharpGP2D12distancesensor

Fig.2-SharpGP2D12outputpattern

Althoughitexistsaverysimilarsensorwithadigitaloutput(theGP2D02),IwillfocusonlyontheGP2D12whichhasananalogoutput(seeFig.2).ThemainmotivationforthischoiceisthatthedigitalversionisalmosttwiceslowerthantheGP2D12(updateperiodabout75msagainst40msfortheanalogversion).Table1givesabriefoverviewoftheGP2D12specifications(Hereisthefullandlatestofficialdatasheet).

Range:

10to80cm

Updatefrequency/period:

25Hz/40ms

Directionofthemeasureddistance:

Verydirectional,duetotheIRLED

Maxadmissibleangleonflatsurface:

>40°

Powersupplyvoltage:

4.5to5.5V

Noiseontheanalogoutput:

<200mV

Meanconsumption:

35mA

Peakconsumption:

about200mA

Table1-OverviewoftheSharpGP2D12specifications

Note:

itisveryimportanttoputagoodcapacitor(somethinglike22uF)betweenGNDandVcc,directlyonthesensoritself,inordertoreducethenoiseonthe5VpowersupplyduetothecurrentrequiredbytheemittingLED.Intheotherhand,avoidtheuseofacapacitorbetweenthesignaloutputandGNDorVcc:

itmaydramaticallyreducethesensordynamics(lowpassfilter).Below,wewillseehowtonumericallyfilterthisoutputinordertoimprovetheprecisionwithoutdecreasingthedynamics.

∙ADconversionofthesensoranalogoutput

Whenpoweredwitha5Vpotential,theSharpsensorhasamaximumoutputvoltageofabout2.45V,forclosedistances.Thehighestuseabledistancegivesapproximately0.45V(seeFig.2).ItisthereforewisetouseanADconverterwithtwoexternaladjustablevoltagereferences:

VrefandCOM(theoneIemployedistheMAX148BCAP).Inordertoobtainthebestprecision,thehighestlimitoftheconverter(255on8bits)shouldmoreorlesscorrespondtothehighestoutputvoltageofthesensor,thatisthelowestmeasurabledistance,andviceversa.Indoingso,thefullscaleoftheconverterisused.Fig.3showsthemeasuredresult.

Fig.3-GP2D12outputpatternafterADconversion(0->~0.45V&250->~2.45V)

Basedonthesemeasurements,alookuptablecanbeimplementedinamicrocontroller.Formyownapplication,IusedaUbicomSX52microcontrollerwitha256entrieslookuptable.

∙Statisticalanalysisofthesensoroutput

Inordertomeasurethenoisepresentonthesensoroutput,ImadesometestsandstatisticswithaGP2D12sensorplacedatabout25cminfrontofaflatwhitewall.Thedistributionof10'000successivevaluesacquiredbythemicrocontroller(at1kHz)isshownonFig.4.

Fig.4-StatisticalanalysisoftheSharpGP2D12output

ThevaluespresentedherearecharacteristicoftheGP2D12output.Inparticular,thestandarddeviationdoesnotdependonthemeasureddistance.However,theprecisionofthedistancecannotbedirectlydeducedbecausetheoutputisnonlinear.Aconstantstandarddeviationoverthefullrangeofthesensoroutputdoesnotleadtoaconstantprecisionofthecomputeddistance.

Thisgraph(Fig.4)showsthatthenoiseoftheSharpsensoroutputfollowsanormal-likedistributionlaw.Therefore,itwouldbewisetoaverageseveralsuccessiveoutputvaluestoimprovetheprecision.

Notethatthisquiteimportantnoiseisessentiallyduetothesensoritself(electronicnoise).Thenoiseintroducedbytheconverterismarginal.SeeFig.8bellowtoconvinceyourself.

∙Lookuptableforlinearization&Precisionevaluation

Astheemployed8-bitmicrocontrollerisnotabletoefficientlyhandlemultiplicationsanddivisions,alookuptablepreferabletoconverttheoutputvaluesofthesensorsintodistances(anotherapproach,usingapowerregression,isexplainedhere).AstheconvertedvaluesfromtheADconverterare8-bitcoded,thebestwecandoistousealookuptablewith256entries.Themicrocontrolleroffersthepossibilitytostore12-bitdataintheprogrammemory.Itisthereforeeasytostorethedistancesinmillimeters(from100to800)thatwouldrequire10bits.

Asthemicrocontrollerhasnotalotofprogrammemory,inthecaseoftheuseofseveralGP2D12,itseemswisetohaveasingletableforallthesensors.Thefollowinggraph(Fig.5)showsthemeasuredoutputpatternsof4differentsensorsredsimultaneouslyandseveraltimesatthesamedistance(onlytheaverageforeachdistancesandeachsensorsareshown).

Fig.5-CharacteristicsoffourdifferentSharpGP2D12sensors

40referencedistancesforeachsensorhavebeendefinedinordertoplotthesegraphs.Alinearapproximationbetweeneachpairofsuccessivepointsismade.Onthefollowinggraph(Fig.6),onlytheactuallymeasuredpoints(foroneofthefoursensors)andtheircorrespondingstandarddeviationareshown.

Fig.6-Setof40measuredvaluesandtheircorrespondingstandarddeviation

Basedonthisgraph,arapidevaluationoftheprecisioncanbedone.Itiseasytounderstandthatthevaluesabove700mmarealmostunusable.At600mm,theprecisionisonly20mmandbecomesbetterwithcloserdistance(about2mmat200mm).Ofcourse,usingauniquelookuptableforseveralsensorsslightlydecreasestheprecision,buthowevermustrepresentagoodcompromiseincertaincases.

∙Dynamicdistancemeasurement

TheanalogoutputoftheSharpGP2D12sensorsmovesinvoltagestepswhenthemeasureddistancechanges.Thesestepslastabout40ms(seeFig.7).

Fig.7-SharpGP2D12operationovertime

Thisbehavioriscertainlyduetothefactthatitprocessesanoutputsignalbyinternallyaveragingsuccessivevalues.Let'sassumethatthebestwaytointerpretthissignalistotakethesteplevelasthevaluemeasuredatitsmiddle.Becausethereissomenoiseonthesensoroutput,wecangetanimprovedvalueofthedistancebyaveragingtheoutputalongthestep.

Fig.8showsthetypicalsensoroutputduringafastmovementofthetargetobject.Asyoucansee,thenoiseonthestepscanreachabout±100mV.

Fig.8-Sharpsensoroutputduringdynamicmeasurement(200mVand20msperdivision)

Whatismoreinterestingforusisthesamesignalseenbythemicrocontroller(Fig.9).

Fig.9-Sharpsensoroutputseenbythemicrocontrollerduringdynamicmeasurement

Thereadingfrequencyoftheconverteris1kHz.Thereforetheprocessorcanhaveanupdatedvalueevery1msandthusabout40valuesperstep.These40valueswillbeaveragedovertimeinordertoobtainagoodapproximationofthesteplevelwithoutnoise(thisprocedureactslikeadigitallow-passfilter).Toachievethis,thepointsbelongingtothesamestepsmustberecognizedandclustered.

Thereareessentiallytwocriteriatoachievethisclustering.Thefirstiscertainlythedifferencebetweensuccessivedata.Ifthedifferenceisgreaterthanaspecifiedthreshold,theprocessorcanknowthatitisthenextstep.Thesecondoneisthemaximumtimeallowableforastep.Iftwoofthemaremerged,wecanendthesetofsuccessivevaluesbelongingtothesamestepbyknowingthemaximumlengthofthisset.Themaximumnumberofconversionduringastepis43.Soifthereisnosignificanttransitionafter43readings,wecanassumethatfuturedataarepartofthenextstep.Ifsomedataarenotwellclassified,inthiscase,thisisnotsoimportantbecauseitwillnotsignificantlychangethemeanvalueofthesteps.

Ifallthestepsareatthesameheight(staticcase),thisclusteringprocesswilllosethesynchronization.But,assoonasatransitionappears,thealgorithmwillautomaticallysynchronizeagain.

Thisalgorithmhasbeenimplementedinthemicrocontroller.ThecomputedmeansofthestepsarerepresentedinblackonFig.10.Pleasenotethattheclusteringisappliedtotheroughsensorvaluesandnottothedistancesafterconversionthroughthelookuptable.Thisalgorithmisintendedtofilterthenoiseofthesensoroutput,whichisconstantoverthefullscaleofdistances.Ifthesuccessivevaluesfromthesensorwerefirstconvertedintodistances,thenoisewouldhavenotalwaysthesamemagnitude.

Fig.10-Resultoftheclusteringprocess

Thethresholdforthedifferenceissetto15andthemaximumnumberofpointsbelongingtothesamestepwas43.

Wecanseethattherewasnotenoughdifferencebetweenthefourthandthefifthsteps.Thereforethe43firstpointshavebeenallocatedtothefourthstep.Andthelastpoints(actually38)beforethenextrecognizedtransitionarepartofthefifthstep.

Notethatthecomputationofthisaveragedoesnotrequire40or43registersinmemory.Asumvariableon16-bitisupdatedateachreadingoftheconverter.Whentheendofaclusterisdetected,thesumisdividedbythenumberofdataintheset.Eachcomputedaveragewillbethentransformedintoadistanceviathelookuptable.Thisdistanceistime

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

当前位置:首页 > 工作范文 > 行政公文

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2