Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

GemsofWisdomfromPriorGenerations

Planning
Theinitialplanningphaseisveryimportant.Takethetimetoplanouttheentiredesignbeforegettingstarted
inthelab.
Designthesoftwaretogetherasateambeforecodinganything.Thiswillreducethechancesofhavingto
redesignthesoftwarelaterintheproject.Also,withmoreteammembersinvolved,theprocessshouldbe
quickerandeveryonewillbefamiliarwiththesoftwaredesign.
Putinlongworkdaysbeforethelastweekoftheproject.Thelabislesscrowdedearlyintheproject,andwork
canbemoreproductiveduringthesetimes.Also,mistakesaremorecriticalattheendoftheproject.Account
forsomemistakes.
Makesurethatyourteammatescanstepintoworkonanypartoftheprojectwhenneeded.Itisriskyifthereis
onlyoneexpertforagivenpartoftheproject.
Frontloadsoftwaredevelopmentandtrytohammeroutcommbugsasearlyaspossible;thiswillleaveyoutime
togethavefunandgetcreativewithmechanicaltowardstheendoftheproject.
Thinkaheadofthephysicallayout,especiallysoyoucanaccessthebatteriesandimportantswitcheseasily..
Atthefirstdesignmeeting,figureoutwhatthesimplestwaytomeetalltherequirementis.Thenaddbitsand
piecesthatyoujustthinkarecoolorfityourawesometheme.
Onthatnote,pickanawesomethemeandhavesomefunwithit!
Thecontrollertakesjustasmuchtime(ifnotmore)thanthethingthatmovesaround.Don'tneglectit.
Dontbedeadsetonathemeatthebeginningoftheproject.Lettheprojectthemedevelopasyoumove
throughtheproject.Youllbesurprisedhowmanygreatideaspopupasyougoalong.
Itseasytomakeadesignwithbadergonomicswhichmakeitimpossiblefortheusertoperformthetask.
Prototype/tryouttheuserscenarioyourselfasearlyaspossible.
Allocateyourpinsandsubsystemsearly.Aspreadsheetthatshowsallofyourpinsisveryhandy.
Sizedoesmatter.Thebiggerorlargerthemotionsinvolvedinyourcontroller,themoreentertainingitwillbeto
watch.
Startbymakingaschedulefortheprojectandincludeanyoutsideeventslikevacations,graduations,etc.to
avoidsurpriseslateron.
Pickyourbattlesearly.LearningtoprogramthePIC'sandtheZigbeesisalotofworkonitsown.Tryingtoadd
otherchallengescanbetough.

Mechanical
Iterateonyourhovercraftdesignearlytofigureoutwhatworksintermsofskirts,weightbalance,and
propulsionsystems.
Prototypequicklytotesttheprinciplefirst.
Dontbeafraidtoimproviseifthelasercuttersarenotavailable.
Remembertospendtimeonprototypingnewmechanicalsystems.Ittookusmultipledaysandover5
prototypestogetagoodhoveringplatform.
Makesureallmolexconnectionsaresecureandthatthecrimpsareprovidingstrainreliefonthewire.
Especiallyifyou'redoingyourfriendafavorandcrimpingawireforhim.
Donotmaketherobottooheavy.Actualrobotmightbewaydifferentfromtheprototype
Gettingittohoveriseasy,gettingittogowhereyouwantisnear-impossible.
Labelorcolor-codeyourconnectorssothatitseasytoplugthemintotherightplace.Connectorsthatcanonly
behookeduponeway(suchasMolex)preventundesirableincidentslikereversingthevoltageandground
connectionsandfryingcomponentsintheprocess.

Electrical
Ifapindoesnotseemtobereadingorwritingandyouhavecheckedyourcode,makesuretocheckyoucables
astheycanfailtoo.
Beverycarefulwhenlayingoutcircuitstosolder.Testthemincrementally.
Updateelectronicschematicsasyougoalong,soanyteammatecanreadilyunderstandwhatishappeningina
certainboardandpickupfromthere.
Neverunderestimatetheutilityofagoodconnectionoragoodmolex.
Apowercentralboardisagoodthingtohave,particularlyifyouredealingwithmultiplesupplyvoltages.
Thismakesthecircuitrycleaner,andcansaveyoufromsupplyingyourPICwith37volts.
Buildandtestallofyourcircuitsandsensorsonbreadboardbeforeyoumakethemhardmountedonperfboard.
Whenmovingyourcircuitsfrombreadboardtoperfboard,ratherthandismantlingyourbreadboards,leaveyour
workingbreadboardsintactandbuynewcomponentsandbuildentirelynewcircuitsontheperfboard.That
way,ifsomethinggoeswrongonceeverythingisbuilt,youwillalwayshaveabackupcopyofyourcircuitson
thebreadboardthatyouknowworkedbeforeyouintegratedeverything.
Isolateyourcircuitsontoindividualperf-boards(ratherthanhavingagiantperf-boardwithallofyourcircuits).
Makesitmucheasiertotakethemouttodebugthem.
Doyourcircuitcalculationstomakesureyouhaveenough/nottoomuchvoltage/current/power.
Movetosolderboardsorwirewrapboardsassoonasyoucan.Ifyouaredevelopingsimplehardwarethatyou
understandwell,don'tbeafraidtosolderitonaboard.Troubleshootingbadconnectionsonabreadboardisa
wasteofyourtime.
Keepcircuitdiagramsuptodateasyoumakethem.

Software
Buildthesoftwareingraduallevelsofcomplexity.Spendtimeateachleveltomakesureeverythingworks.
Knowingthebaseissolidhelpsfocusdebuggingwhereyouneedit.
Thetimeittakestocyclethroughtheframeworkloopvarieswidelydependingonthenumberofeventsinthe
SMqueues.Keepthisinmindwhendecidingbetweenpollingforflagsorusinginterrupts.
DownloadandusetheProcompilerforthePIC,thiswillDRAMATICALLYcutdownyourprogramspaceand
evensomeofyourdataspace.
Becreativewithtimingwhenresourcesarelimited;thePIChasonlyoneoutputcomparebutthisdoesn't
preventyoufromusingtimeroverflowsfortiming.
Rememberyourbankselcommandsandsaveyourselfhoursofdebugging.
Don'tovercomplicatethingsbymakingstatemachinesforeverything.Manythingscanbedoneinasimple
serviceoreveninaninterruptresponseroutine(i.e.constructingpackets)
Thinkcarefullyaboutyourstatemachinesbeforeyoujumptothecode.Seewhatcaseswouldbreakit(andedit
accordingly,ofcourse).
Takethetimetopseudocode.
Commentyourcodesuchthatanyonecouldfollowwhatyouimplemented.
Ifanapparentsoftwarebugdoesnotmakesense,stopforafewminutes.Itmaybeelectrical.
Initializeallyourvariablestosomevaluewhenyoudeclarethem.
Watchoutforindexoutofboundserrorsonarrays.Thesehappensilentlyandcancompletelytrashyour
program,soitisworthwhiletohavealotoferrorcheckingforthis.
218Chasalotmoresoftwarethan218B.Getyourcommunicationbugsironedoutearly.
Writeallfunctionsasnon-blockingcodenomatterwheretheyfitintotheflowoftheprogram.
Ifachangecausesthingsnottoworkthefirstthingyoushouldcheckisifthecodeisinthecorrectbank.Itis
alwaysagoodideatouseabankselectcommandatthestartofeveryroutineratherthanassumeyou'llknow
whereitis.
Buildandtestthecodeinsmallmanageablepieces.Ifalotofchangesaremadeatonceandthenewprogram
doesn'twork,itisveryhardtoisolatetheproblemwithoutalotofwork.
Usethedebugger.Runningroutinesthroughthedebuggertoseewhatwillhappenwillsavelotsoftimeand
effort.Gettingaroutinetoworkinthedebuggerusuallyallowsyoutoassumeproblemsthatcomeupinactual
testingarehardwareratherthansoftwarerelated.
Developaclearunderstandingofthecommunicationsprotocolfromthebeginningofcodedevelopment.
Checkyour#definesandlabels.WithPICprogramming,youtendtohavealotofGOTOsandCALLswhich
meansyouneedalotoflabels.Trytohaveagoodsystemforlabelingthingsandcreatingyourconstantsand
variables.WeusedCAP_UNDERSCOREfor#definesandFirstCapitalLetterwithnospacesforvariables.Where
wewentwrongwascreatingFORWARDandFORWARD_CMDwhichwemisinterpretedandmessedusup
foralongtime.
Makeuseof#definesforlabelingpinsandvalueasmuchaspossible.Thismakesitveryeasytoseewhatpins
areconnectedtowhatandallowsfortheeasiestchanges.Ratherthansearchingforaspecificportandpin
throughoutthecodeyouonlyhavetochangeone#definevalue.
Makesurealldatatablesareinthecorrectlocation.

Debugging
Strivetomeetallthecheckpoints,butdonotlosesightoftheendgoal.Oftentheteamshouldaimtoachieve
morethanthatnecessarytocheckoff.
Whenstuck,consultotherteams.Often,yourclassmateswillhavehadthesameproblemasyou.Thiscansavea
lotoftime.
Bewillingtohelpothersaswell.
Haveanextrasetofchargedbatteries,soyoudonthavetowaittotest.
Integrateincrementally.Testincrementally.
LEDscanbeveryhelpful!Usethemtoyouradvantage,especiallywhenaPICisn'ttellingyoumuch.
Youaregoingtolovethedebuggerandthelogicanalyzer.Takeadvantage!Butrememberthat'snotagoodidea
todebuginterrupts!!
Alwayscheckifthingsarepoweredcorrectly,especiallyifyou'retired.
UseDebuggingLedsifusingPICs.Reserveafewoutputssoyoucantogglethebitsandseeifyougetintoloops
orstates.Thiswasreallyhelpfulwhenweweretryingtofigureoutwhatwaswrongwithourcode.
Thelogicanalyzerisyournewbestfriend.
Haveyoucheckedpowerandground?
Donotcontinueworkinguntiltheweehoursofthemorningunlessyouabsolutelyhavetobecauseerrors
propagatewhentired.Afreshlookatthingsinthemorningwillsaveyoualotofpainatnight.Sleepisnota
crutch,itisanecessity.
Tryworkingduringtheday(seriously!).Debuggingiswayeasierwithaclearhead.
Justbecausetwopointsonacircuitlooklikegroundwhenprobeddoesntmeantheyareconnected.
Ifyouarehavingintermittentproblems(e.g.itworksonlysomeofthetime)checkyourconnections
especiallythoseconnectingyourvariouscircuitstoacommonground.
Whenyou'retiredandeverythingstartstofaildon'tforgettocheckthebatteries.
Debugcodeextensivelypriortointegrationwithothersoftware/hardwareelements.
Ifyou'retiredandeverythingstartstofailandit'snotthebatteryconsidergoinghomeandlookingatitagain
thenextmorningratherthanchangingalotofcode.Oftenitissomesmalllittlechangeyouoverlookedandare
tootiredtonotice.

BigPicture
Dontforgetthattheultimategoalistolearnmechatronics.Havefun!
Aswithall218projects,KEEPITSIMPLE!Ifyoucangetawaywithmakingsomethingassimpleaspossible,DO
IT!
Practicehavingthewisdomofknowingwhentostopandsleeportakeabreak.
Remembertohavefun!
Takealotofpicturesasyougo.
Uselabnotebooksothatallinformationisatoneplaceandteammatescanhaveeasyaccesstoit.
Befriendlywithotherteamsyouneverknowwhenyouregoingtoneedhelp.
Batheasfrequentlyaspossible;encourageotherstodosoaswell.

Communications
Startearlyfortestingcommunicationcode
BesuretousetheLogicAnalyzerfordebuggingcommunication.Itwillhelpyoufinderrorsthatwouldbe
virtuallyimpossiblytofindotherwise
Getcommunicationupandrunningfirst.Onceit'sworkingeverythingelseinsoftwarefollowsquiteeasily.
Whendebuggingcommunication,usethelab'sZigbeewithaGUIasadebuggingtoolaswell
Gettheradioscorrectlysendingandreceivingmessagesasquicklyaspossible.
Sendingandreceivingasynchronousmessageswaseasierwithaninterruptresponseratherthangoingthrough
lotsofstates.Somemaydisagree,butthinkaboutit.
FigureoutearlyonhowmanyPICsyouwillneedsoyoucandesignthecommunicationnetworkearly.
Watchoutfortimingissuesinyourwirelesscommunications-trytoensurethatincomingandoutgoing
messageswon'tinterrupttheprevioustransmissionthroughproperuseofwaitingstates.
Useinterrupts,noteventcheckers,forcommunicationwiththeXBEE.Thetimingisalottighterthiswayand
leadstolessproblemswithcommunicationcollision.
GettheradioworkingwiththeTivafirst.
Testingourradiopairinthepresenceofotheractiveradiopairsrevealedproblemsthatdidntexist
whenwetestalone.
Testyourcomponentsforinteroperabilitywitheveryoneelsesbeforegameday.
Donotburyyourwirelessantennainabox.Trytokeepitoutintheopen.
Talktootherpeopleaboutthecommunicationprotocolsandhowtheyimplementtheircode.Itshardtofigure
outthedatasheetsbyyourselfwithnohelpfromanyone.



Teamwork
Yourteamshouldbeinconstantcommunication--openandclearaboutwhatishappeningandwhatthegoals
are.
Everyoneshouldbeonboardwithimportantdecisions.
Firstdefineasateamwhatyouwillneedtodo,andthenassignresponsibilitiestopeopletodothem.
Haveotherteammatesverifywhatyouaredoing.Divideworksuchthateverypersonislearningwhatshe/he
wantsandcouldeasilysubstituteforanotherteammate.
Establishclearexpectationsandengageinregularstatuscheckups.
Makesureatleasttwopeopleofthegroupunderstandoratleasthaveanideaofeachcomponentmechanical,
electrical,software.Doesnthavetobethesametwopeople,butitinsuresthatifsomeonesmissing,thatthe
groupisntstuck.
Communicatewellwithinyourteamsothatsometasksarenotoverlooked,whileothersareduplicated.

You might also like