There are 3 known options for setting up RS485 communication to your YL-620A VFD in LinuxCNC.
MB2HAL has successfully been used by the PrintNC community to connect to the VFD over RS485. There has been quite a bit of discussion on the LinuxCNC channel of the discord, but no formal guide has been written yet. Please help our community out by contributing instructions for configuring MB2HAL for the YL-620a. Thanks!
VFDMod is a LinuxCNC add-on with the intent to make communicating with VFDs easier. There appears to be some use of VFDMod in the community, but this documentation is currently untested.
This repository contains files and instructions for configuring VFDMod for the YL-620a. These instructions are currently untested by the PrintNC community, please update this page with your results & tips!
These instructions are based off the instructions found in this repository. but there were a few mistakes so i have uploaded a new repository
https://github.com/handsomebeast20/yl620-a-rs485-modbus-classicladder/tree/main
with the edited information and some new info that should help you get this running in no time, i can confirm this works using linuxcnc 2.8.4 using the axis gui, im also using the breakout board that came with the aliexpress kit. and when setting up stepconf wizard make sure to disable any pins that are linked to spindle as this will cause loading errors from duplicated pins after setting up your hal and ini files from this tutorial (ask me how i know)
(Files can be downloaded by clicking the green “Code” button and downloading the zip).
Classic Ladder is a powerful programming language in LinuxCNC that includes Modbus communication built in. Using it solely for the purpose of communicating with your spindle may be overkill, however Classic Ladder is a standard LCNC component which should be supported in future releases.
Parameter | Value | Description |
P00.01 | 3 | Start/Stop Signal from RS485 |
P03.00 | 4 | 19200 Baud |
P03.01 | 1 | RS485 Slave Address |
P03.02 | 2 | Data Format: 8Bit, 1 Stop bit, No Parity |
P07.08 | 5 | Frequency Source from RS485 |
Do not forget to power off and power on the VFD after changing settings to apply the new settings!
recommended adapters:
loadrt classicladder_rt numS32out=100
addf classicladder.0.refresh servo-thread
loadusr classicladder --modmaster vfd.clp
net spindle-on classicladder.0.in-00 spindle.0.on
net spindle-brake classicladder.0.in-01 spindle.0.brake
net spindle-forward classicladder.0.in-02 spindle.0.forward
net spindle-reverse classicladder.0.in-03 spindle.0.reverse
net spindle-cmd-rpm <= spindle.0.speed-out
net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-cmd-rps <= spindle.0.speed-out-rps
net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs classicladder.0.floatin-00
MODBUS_MASTER_SERIAL_PORT=/dev/ttyUSB0
MODBUS_MASTER_SERIAL_SPEED=19200
MODBUS_MASTER_SERIAL_DATABITS=8
MODBUS_MASTER_SERIAL_STOPBITS=1
MODBUS_MASTER_SERIAL_PARITY=0
MODBUS_ELEMENT_OFFSET=0
MODBUS_MASTER_SERIAL_USE_RTS_TO_SEND=0
MODBUS_MASTER_TIME_INTER_FRAME=100
MODBUS_MASTER_TIME_OUT_RECEIPT=500
MODBUS_MASTER_TIME_AFTER_TRANSMIT=100
MODBUS_DEBUG_LEVEL=0
MODBUS_MAP_COIL_READ=0
MODBUS_MAP_COIL_WRITE=1
MODBUS_MAP_INPUT=0
MODBUS_MAP_HOLDING=0
MODBUS_MAP_REGISTER_READ=1
MODBUS_MAP_REGISTER_WRITE=0 _/FILE-com_params.txt
"MODBUS_MASTER_SERIAL_PORT=/dev/ttyUSB0"
(this is the line that needs editing with /dev/ttyACM0)
edit the text and save the file
now when you open linuxcnc and open up the config window in classicladder you will see it has changed to/dev/ttyACM0 and it will now work ,also i set the vfd to 19200 8 n 1 and kept the same in the the classicladder config tab to get mine working, but we also need to configure the adapter in linux for it to stay this way permanently for the adapter which at default is set to 9600 8n1 and can be changed via terminal but unplugging and restarting linux causes thes changes to be put back to default so the solution for this i have the following permanenty set and forget solution
DO NOT and i repeat DO NOT BY ANY MEANS use a usb extention cable. the adapter came with a cable that has a built in ferrite and is also shielded but if i used it, as soon as i send a command to linuxcnc the connection would drop straight away. so if your trying to get this method working DONT use an extention cable for the usb adapter. also buy the adapter i listed above as people were sayin they had to use resistors to negate noise from the vfd signal to the adapter but this has them on the adapter pcb and is also lighting proof according to the specs. i tried a cheap usb adapter previously but due to a noisy signal couldnt get that working, you may be lucky but the setup is problematic enough without adding caveats yourself.
This configuration was confirmed working on a setup with a parallel breakout board, but should work similarly for Mesa cards as well. When using the Stepconf wizard, all spindle pins were set to unused and the “Include Classic Ladder PLC” on the options screen was left unchecked.
also i have now switched to /en/https://www.waveshare.com/wiki/USB_TO_RS232/485/TTL using the adapter in this link as i am about to put all my electronics into an enclosure, and it works the same as the usb dongle type adapter but is in a metal housing which helps shield the pcb from noise and can be used with the supplied usb cable that it comes with to connect it to the pc, which i have tested and it works flawlessly, there is a switch for 3.3v and 5v on the side of the unit, for me the connection is only stable if using the 5v setting as 3.3v dropped connection after starting the spindle but the 5v setting it keeps connection, i have tested it using a 1m long jst-xh male to female cable to connect it to the vfd, untwisted as it has connectors on both ends and connected that to a 10cm male jst-xh that is connected to the green terminal block on the adapter and this works fine, others who have had problems have bought this adapter and put it in their enclosure next to the vfd with a short twisted pair wire and had no issues, where as they had issues with other adapters connecting and staying connected without errors,