Sunteți pe pagina 1din 4

2/13/2017 ControllingARoboticCarThroughMATLABGUI|ElectronicsProject

Controlling A Robotic Car Through MATLAB GUI


By Saikat Patra, Suman Nag and Shibendu Mahata

February 2, 2017

ThisprojectpresentstheimplementationofaMATLABbasedgraphicaluserinterface(GUI)tocontrolthemovement
ofaroboticcar.Thecommandstomovethecarinforward,reverse,rightandleftdirectionsaresentfromtheGUI
andprocessedbyArduinoUnoboardmountedontopofthecar.AuthorsprototypeisshowninFig.1.

Fig.1:AuthorsprototypeoftheMATLABGUIbasedroboticcar

Circuit and working


Inthisproject,MATLABbasedGUIcommunicateswithArduinothroughaUSBdatacable.YoucansendcommandstoArduinotomovethe
carinaspecificdirectionbypressingthecorrespondingpushbuttonintheGUI.Theparticularpushbutton,whenpressed,executescallback
functioncorrespondingtothatpushbuttonintheMATLABprogram,car.m.Withinthatfunction,instructionstoset/resetthedigitalI/Opins
(10,11,12and13)ofArduinoareexecutedtodrivethecarinthedesireddirection.

Fig.2:Blockdiagramforcontrollingtheroboticcarthrough
MATLABbasedGUI

http://electronicsforu.com/electronicsprojects/controllingroboticcarmatlabgui 1/4
2/13/2017 ControllingARoboticCarThroughMATLABGUI|ElectronicsProject

Fig.3:CircuitdiagramforcontrollingtheroboticcarthroughMATLABbasedGUI

BlockandcircuitdiagramsforcontrollingtherobotareshowninFigs2and3,respectively.
ArduinoUnoboard.ArduinoUnoisanAVRATmega328Pmicrocontroller(MCU)baseddevelopmentboardwithsixanalogueinputpinsand14
digitalI/Opins.TheMCUhas32kBofISPflashmemory,2kBSRAMand1kBEEPROM.Theboardprovidesserialcommunicationcapability
viaUART,SPIandI2C.TheMCUcanoperateataclockfrequencyof16MHz.Inthisproject,digitalI/Opins10,11,12and13ofArduinoare
configuredasoutputpins.

L293DIC.ThisisadualHBridgehighcurrentmotordriverIC.ThisICisusedsincethedigitalpinsofArduinoUnocannotsourceenough
currenttodrivethemotorsoftheroboticcar.Hbridgesarealsousefulincontrollingthedirectionofrotationofamotor.Enablepins(pins1
and9)oftheICbeingactivehighareconnectedto9V.

DimmingTechnologyHasUndergoneMassiveMetamorphosisSince
READ
LastFewYears

FourinputpinsIN1,IN2,IN3andIN4ofL293DhavebeenconnectedtodigitalI/Opins10,11,12and13,respectively,ofArduino.Four
outputpins(OUT1,OUT2,OUT3andOUT4)oftheICareconnectedtothetwomotors(M1andM2)withtheirterminalsmarkedasA,B,C
andD,respectively,asshowninFig.3.

OnpressingaparticularpushbuttonintheGUI,digitalsignalssentfromArduinotoL293DarelistedinTableI.

Software program
CircuitoperationisperformedusingthesoftwareprogramloadedintotheinternalmemoryofArduinoboard.Theprogramimplementsall
requiredfunctionalitiesincludinguserinputsthroughMATLABGUIinterface.Thestepsarelistedbelow:

1.ArduinoIDE1.6.5isusedforprogrammingArduinoUno.ThelatestIDEcanbedownloadedforfreefromArduinosofficialwebsite.After
downloadingArduinoIDE,installit.NotethedirectoryofArduinoIDEinstallation.

2.DownloadLegacyMATLABandSimulinkSupportforArduinopackagefromMathWorkswebsite.Extractthecompressedfoldernamed
ArduinoIO.Fromthisfolder,copypdefolderandpasteitinC:\ProgramFiles(orProgramfilesx86)\Arduino\Libraries(pathmaybedifferent

http://electronicsforu.com/electronicsprojects/controllingroboticcarmatlabgui 2/4
2/13/2017 ControllingARoboticCarThroughMATLABGUI|ElectronicsProject

dependingontheinstallationdirectoryoftheIDE).

Afterpastingpdefolderincorrectlocation,openArduinoIDE.Ifyouhavepastedthefolderincorrectlocation,youwouldfindpdein
FileExamplespde.OpenthecodebyFileExamplespdeadioes.

3.ConnectArduinoUnoboardtoyourPC.FromDeviceManager,notetheCOMportatwhichArduinoUnoboardisinstalled.FromToolsmenu
inArduinoIDE,selecttheboardasArduinoUnoandselecttheCOMPortnumbernotedearlier.UploadadioescodetoArduinoUnoboardby
pressingUploadbuttonintheIDE.

READ World'sTop20RoboticsProjectIdeas

4.CopytheentirecontentsoftheextractedArduinoIOfoldertoafolderinMyDocuments(ForWindowsPC).

5.OurapplicationprogramhasbeendevelopedinR2014aversionofMATLAB.AfterinstallingthisversionofMATLABinyourPC,open
install_arduino.mfilepresentinthedirectorywhereyouhavecopiedthecontentsofArduinoIOfolder.Now,runinstall_arduino.mfile.This
codewillcorrectlyinstallandsavethepathofArduinosupportpackage.

6.Openthesourcecodefileforthisprojecttitledcar.m.EdittheCOMport[inthelinea=arduino(COM9)]withtheportnumberinyourPC
whereArduinoUnoboardhasbeeninstalled.Afterrunningthefile,MATLABwilltrytocommunicatewiththeboard.
Aftersuccessfulcommunicationisestablished,youcancontroltherobotbypressingtheappropriatepushbuttonintheGUI.

Constructing and testing


Anactualsize,singlesidePCBforthecircuitcontrollingtheroboticcarusingMATLABbasedGUIusingArduinoisshowninFig.4andits
componentlayoutinFig.5.SuitableconnectorsareprovidedonthePCBforinput(CON1)fromArduinoandoutput(CON2andCON3)for
motors.

Fig.4:ActualsizePCBpatternforthecircuittocontroltheroboticcar

Fig.5:ComponentlayoutofthePCB

Download PCB and component layout PDFs: click here

Downloadsource folder: click here

http://electronicsforu.com/electronicsprojects/controllingroboticcarmatlabgui 3/4
2/13/2017 ControllingARoboticCarThroughMATLABGUI|ElectronicsProject

Assembletheroboticcarbyconnectingtwomotors,twowheels(rear)andacastorwheel(front).Connectthecircuitasperthecircuit
diagramshowninFig.3.ConnectthebatterywithcorrectpolarityotherwiseyoumightendupdamagingArduinoboardandL293D.For
troubleshooting,checkthevoltagesatvarioustestpointsgiveninTableII.

READ SolidStateDrives(SSDs)In,HardDiskDrives(HDDs)Out!

ShibenduMahataisM.Tech(goldmedallist)ininstrumentationandelectronicsengineeringfromJadavpurUniversity.Currently,heis
pursuingPh.DfromNIT,Durgapur.HeisinterestedinMCUbasedrealtimeembeddedsignalprocessingandprocesscontrolsystems

SaikatPatraispassionateaboutelectronicsandMCUbasedembeddedsystemapplications
SumanNagenjoyselectronicsandlikestoreadaboutwirelesssensornetworks

http://electronicsforu.com/electronicsprojects/controllingroboticcarmatlabgui 4/4

S-ar putea să vă placă și