Catalog Label printers MACH4 - cab Product Marking: Label ...
Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485)...
Transcript of Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485)...
![Page 1: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/1.jpg)
ConnectingaVFDtoMach4throughModbus(RS485)
V2
June2019BillCaldwell
Connectingaspindlecontroller(VFD)toMach4throughtheModbus(RS-485serialport)isnotaneasytask,sincethereisnoformalMach4Modbusdocumentationyet,andnooverallLUAscript(thatIcouldfind)tosupportaVFDthroughModbus.
ThispostisasetofstepbystepinstructionsthathopefullywillhelpsomeoneelsegettheirVFDupandrunningquickly.
ForreferenceIamusingWindows10,Mach4V4.2.0.3804,andFDTIserialdriverV2.12.16.0
TheHuanyangVFDispopularonmanyInternetsites,howeverthereareseveralmodelsoutthereandmostofthemarenottrulyModbuscompatible.IchosetheHuanyangGTseries2.2KWformySpindlesinceitdoessupporttheModbusprotocolandinterfaceswithMach4’sModbuscorrectly.OtherVFDscaneasilybecontrolledaslongastheyareModbuscompliant.
Thesestepswillgiveyouthenecessarysetuptodothefollowingspindlecommands:
1. M3(CWspindle)2. M4(CCWspindle)3. M5(Stopspindle)4. Sxxxxx(Setspindlespeed)
InadditionthespindlewillbecontrollablethroughthefrontpanelbuttonsandexecutingGcode.
Step1
SetupyourVFDtocontrolyourparticularspindleusingthefrontpanelontheVFD.Thiswillincludemaxfrequency,minfrequency,maxcurrent,maxvoltage,rampparameters,etc.
RefertotheVFDmanualfortheinstructionsonhowtousethefrontpanelcontrolsontheVFDtomodifytheseparameters.Theywillbesavedacrosspoweron/offcycles,sothisonlyneedstobedoneonce.Pleasenoteoncethesesettingsarechanged,youwillnolongerbeabletocontrolthemotorfromtheVFDfrontpanel.
![Page 2: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/2.jpg)
OnceyoucanturnthespindleonandoffandsetthespeedfromthefrontpaneloftheVFDyouarereadytomodifytheVFDparametersnecessarytoenabletheModbuscommunicationsportontheVFDsocommandsandstatuscanbesentandreceivedbetweenthecomputerandtheVFD,disablingthefrontpanelmotorcontrol.
TheHuanyangGTVFDrequiredthreevaluestobemodifiedfromthedefaultvalues.
1. P0.01=2(defaultis1)RuncommandsourceistheRS485port2. P0.07=7(defaultis0)FrequencysourceistheRS485port3. PC.00=1(defaultis0)SettheModbusnodeaddressto1
(6/29/2019update)MostGTseriesVFDsdefaulttoRTUmode1start,8data,noparity(1N8)at19.2KBPS.However,Ihavebeentoldthatsomedonot,somakesuretocheckalltheseparametersintheVFDandcorrectthemasnecessary.
TheVFDisnowsettoreceivecommandsandsendstatusto/fromtheserialModbus(RS-485port)at19.2Kbaud,noparityinRTUmode.
PleasenotethatcomputersdonotimplementRS-485directly.YoumustpurchaseaUSBtoRS-485converter.AllRS-485datawillbesentouttheselectedUSBportonthecomputerthroughtheconverter,acrosstheRS-485cabletotheVFD.TheRS-485protocolimplementsadifferentialelectricalconnectionthatprovidesagreatdealofcommonmodenoiseimmunity,whichisusefulintheCNCenvironment.
ConnecttheVFDtotheRS485converterwiththedifferentialRS485signalsconnectedD+toD+andD-toD-ontheVFD.Ifthesignalsarecrossed,nocommunicationswilloccur.
PlugintheUSBcablefromtheRS485convertortothecomputer.
TheHuanyangGTVFDusesthefollowingregisteraddressesandcommandbits.Inthefollowingstepsyouwillbereferencingthoseaddresses.
Commandregisteraddress4096decimalStatusregisteraddress4097decimalSpeedregister8192decimalThecommandregisterissetto:Runforward1Runreverse2Stop5TheStatusregisterreturns:Forward1Reverse2Standby3Fault4
![Page 3: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/3.jpg)
Powergoingoff5IfyouuseadifferentVFDmostlikelytheseaddressesandvalueswillneedtobechangedintheModbusfunctionsandtheLUAcode.
Step2
ItisnecessarytoinstalltheUSBtoRS-485windowsdriverneededfortheconvertor.Followtheinstructionssuppliedwithyourconvertortoinstallthedriver.Oncethedriverisinstalled,notethecomportnumberitisassociatedwith(Com3inthiscase).
![Page 4: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/4.jpg)
Step3
ThisstepsetsuptheMach4ModbuscontrollertosendcommandstotheselectedVFDandreceivestatusbackfromtheselectedVFD.OncethesechangesaremadetheywillbepermanentlystoredintheMach4profileyouarecurrentlyrunning.
Intheconfiguration/controlmenu,selectthePluginstabandenablethefollowingplugins.
![Page 5: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/5.jpg)
SelectthespindletabandfillintheMaxRPMasshownbelow.
![Page 6: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/6.jpg)
IntheConfigure/Controlmenu,selectthePluginspulldownmenuthenselecttheModbusplugin.
![Page 7: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/7.jpg)
BegincreatingthecommunicationspathfromtheComporttotheMach4Modbuscontroller.Fillintheboxexactlyasseeninthefollowingscreen.
ThiscreatesaninstanceoftheModbuscontrollercalledmodbus0settoRTUmode.Generallythedefaultvalueswillwork.Makesuretocheckthezerobasedregisteraddressingmodebox.
![Page 8: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/8.jpg)
SelecttheporttocorrespondtotheportattachedtotheUSBtoRS484convertershownintheWindowsdevicemangerwindow(Com3inthisexample).Continuesettingtheparametersasshownbelow.
![Page 9: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/9.jpg)
Whenyouaredonewiththisstepyouwillseetheconfirmationwindowasseenbelow.Yourcomportmaybedifferentthanshowninthisexample.
![Page 10: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/10.jpg)
YouwillnowseetheModbuscontroller,justcreated,intheleftcolumnandasummaryoftheModbussettingsjustselectedontheright.SelectOK.
![Page 11: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/11.jpg)
Step4
ThenextstepscreatethreenecessaryModbusfunctionstowritetotheVFDcommandregister,writetotheVFDspeedregister,andreadtheVFDstatusregister.Pleasemakesurethefunctionnamesareenteredexactlyasshown.TheyneedtomatchthecorrespondingfunctionnamescontainedintheLUAscripttofollow.
HighlighttheModbuscontrollerandselectthecreatefunctionbutton.Fromthepulldowncommandlist,select(0x06).Fillinthevariousparametersexactlyasshownbelow.Thenameofthisfunctioniswrtvfdcmd(typedin2places).Pressnext.
![Page 12: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/12.jpg)
Thenextscreenconfirmsyoursettingsforthefirstfunction.PressOK
![Page 13: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/13.jpg)
HighlighttheModbuscontrollerandselectthecreatefunctionbutton.Fromthepulldowncommandlist,select(0x03).Fillinthevariousparametersexactlyasshownbelow.Thenameofthisfunctionisrdvfdstatus(typedin2places).Pressnext.
![Page 14: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/14.jpg)
Thenextscreenconfirmsyoursettingsforthesecondfunction.PressOK
![Page 15: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/15.jpg)
HighlighttheModbuscontrollerandselectthecreatefunctionbutton.Fromthepulldowncommandlist,select(0x06).Fillinthevariousparametersexactlyasshownbelow.Thenameofthisfunctioniswrtvfdspeed(typedin2places).Pressnext.
![Page 16: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/16.jpg)
Thenextscreenconfirmsyoursettingsforthethirdfunction.PressOK
![Page 17: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/17.jpg)
Thisisthefinalconfirmationscreen.Ifeverythinglooksasitshould,pressOK
![Page 18: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/18.jpg)
Step5
SetupthediagnosticswindowstotesttheModbustoVFDconnection.
FromthediagnosticsmenuselectModbusandRegfile.
![Page 19: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/19.jpg)
Thiswillopentwowindows.TheModbuswindow,onceexpanded,willshowyouthethreefunctionsyoujustcreatedandtheircurrentstatusalongwithsometiminginformation.TheRegfilewindow,onceexpanded,willshowyouthecurrentModbusregistercontentsforthecommand,status,andspeedregistersfortheVFD.ThestatusregisterisreadingtheVFDstatusregisterbasedonthepollratesetintheModbussetup.ThewriteregisterscontainthevaluessetbyMach4tobesenttotheVFD.Onceavalueisputintoeitherwriteregister,itwillbesenttotheVFDbasedonthePollrate.
![Page 20: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/20.jpg)
DoubleclickontheModbusspeedregisterandenterthevalue10000.Thisrepresents100.00%ofthemaximumspeedsetintheVFDpreviously(maxspeedis400HZ).400Hz*60sec=24,000RPM.
![Page 21: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/21.jpg)
Doubleclickonthecommandregisterandenterthevalue1.Thespindleshouldrunclockwiseatfullspeed.
![Page 22: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/22.jpg)
Enterthevalue5tostopthespindle.
Enterthevalue2toreversethespindle.
Atthispointyoushouldbeabletosetthespeedtoanyvaluebetween0and10000andrunthespindleineitherdirection.
![Page 23: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/23.jpg)
Step6
DownloadtheLUAscriptfromthefollowinglocation:
https://code.porkrind.org/david/mach4-vfd/blob/master/Huanyang_GT_VFD.lua
ThiscodewasoriginallywrittenwiththePMCeditor,butwasmodifiedbymyson,DavidtoaddthenecessarylogicandvaluesthatIcouldn’tgetthePMCeditortodo.
PlacethedownloadedcodeinthePMCfolderinsidetheMach4mainfolderasshownbelow.
NotethefiletypeandmakesureitisaLUAfileandnotatextfile.Sometimesthingsgetalteredwhendownloadingtodifferentmachines.
ThiscodewillneedtobeslightlymodifiedifthecommandbitsinyourVFDaredifferentthantheHuanyangGT.
![Page 24: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/24.jpg)
RestartMach4andselectthescreeneditorintheoperatormenu.
Selectthetop-levelscreeninthelefthandcolumn.GotothebottomleftandlocatethePMCline.Clickonthe3dotsontheright.SelecttheHuanyang_GT_VFD.Besuretochecktheboxnexttothename.Exitthescreeneditorbyclickingitsbuttonintheoperatormenu.
![Page 25: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/25.jpg)
YoucannowcontrolthespindlefromeitherthebuttonsorwiththeMcommandsthroughtheMDIinterface.TheMDIinterfacenowrequiresthatthestartbuttonbepressedtoenterthecommands.ThespeedcanonlybeenteredthroughtheScommandthroughtheMDIinterface.
AllsupportedcommandsexecutefromGcode.
Questions,Comments,andimprovementsarewelcome.([email protected])
HaveFunwithyournewspindlecontroller!
![Page 26: Connecting a VFD to Mach4 through the Modbus-v5...Connecting a VFD to Mach4 through Modbus (RS485) V2 June 2019 Bill Caldwell bill@caldwellfam.net Connecting a spindle controller (VFD)](https://reader033.fdocuments.in/reader033/viewer/2022052409/60b14c27028f3f528f296f88/html5/thumbnails/26.jpg)