I have successfully configured a custom VFD and spindle to work with my Onefinity. Here are my notes to hopefully help others get their VFD working.
I started with the Buildbotics How to use a VFD spindle driver documentation.
My VFD is the TECO Westinghouse E510.
You will need to wire the controller to the VFD using RS485.
On the VFD side, you may have screw terminals, an RJ45, or some other type of connector. My VFD has an RJ45, so I wired up an ethernet jack in a single gang box using a 110 punchdown connector. This allows me to use a standard ethernet cable to plug into the VFD.
On the controller side, you can either use the breakout board adapter, or get a 25 pin RS232 connector and solder the wires. I went with the breakout board adapter.
RS485 uses two wires. On the E510, they connect to pins 1 and 2 on the RJ45. On the controller, they connect to pins 13 and 14. The Buildbotics docs say that it doesn’t matter which wire is connected to the A or B terminal and it will just “figure it out”. That was not the case for the E510. For the E510, pin 1 from the VFD must be connected to pin 14 on the controller and pin 2 from the VFD must be connected to pin 13 on the controller.
There are several settings you must program on your VFD to enable RS485 control. The primary configuration is in the communication section. For the E510, that is section 09. The values here must match those in the controller Modbus Configuration. Here is the programming for the E510:
- 09-00 (StationAddress): 1
- 09-01 (Communication Mode Selection): 0 (MODBUS)
- 09-02 (Baud Rate Setting): 3 (9600)
- 09-03 (Stop Bit Selection): 1 (2 Stop Bit)
- 09-04 (Parity Selection): 0 (No Parity)
- 09-05 (Communication Data Bit Selection): 0 (8 Bit Data)
The protocol requires 11 bits: 1 start bit, 8 data bits, and either parity and 1 stop bit, or no parity and 2 stop bits. The protocol has a CRC so the parity is redundant and typically set to none with 2 stop bits.
After you set the communication programming, you may have to cycle power on your VFD as I did for the E510.
You must also tell your VFD to accept the run and frequency commands from RS485. For the E510, this is programmed as:
- 00-02 (Main Run Command Source Selection): 2 (Communication Control RS485)
- 00-05 (Main Frequency Command Source Selection): 5 (Communication Setting Frequency)
Open the fly-out menu and select Tool. Depending on the version of firmware you have, you may need to first select PWM Spindle for the tool-type, then uncheck rapid-auto-off (see the Troubleshooting section for why). Now, select Custom Modbus VFD for the tool-type. Set the other tool configuration parameters as appropriate.
In my case, I’m using the 800w Huanyang spindle, so I have those options set as:
- tool-reversed: unchecked
- max-spin: 24000
- min-spin: 0
- tool-enable-mode: disabled
- tool-direction-mode: disabled
The modbus configuration section is where you set the communication parameters of the RS485 and they must match the configuration on the VFD. I’m using the following settings:
- bus-id: 1
- baud: 9600
- parity: none
- multi-write: unchecked
The modbus program is 100% dependent on your VFD. When you select a code on the front panel of your VFD to read or change a value, that is a register. The modbus program is a way for the controller to read and write those registers in your VFD. When you create the modbus program in the UI, you are mapping a function that the controller understands to a register, and value in the case of a write, that the VFD understands. The controller commands you need to map to your VFD is completely dependent on your VFD. You have to read the Buildbotics description of each command and your VFD manual to figure out the mapping. Your VFD may have an additional manual (this is the case for the E510) for the RS485 protocol.
You will most likely not need to map all of the controller commands to your VFD. At an absolute minimum, the controller needs to know the max frequency for your spindle so it can calculate the frequency to set based on the RPM you set for a given tool, how to set the frequency, how to read the frequency, and how to start/stop the spindle.
For the E510 VFD, here is the modbus program I’m using:
- max-freq-read → Address 258
- freq-set → Address 9474
- stop-write → Address 9473, Value: 0
- forward-write → Address 9473, Value: 1
- freq-read → Address 3089
To set the max frequency on the E510, you enter the maximum frequency by programming location 01-02 to 400 (my spindle) on the front panel. The communication manual tells you that the register address of 01-02 as entered on the display is 0x0102 (hex) which is 258 decimal. To set the frequency, you write location 25-02 which is 0x2502 or 9474 decimal. The other commands follow a similar pattern.
Don’t email Buildbotics - they will refer you to Onefinity. Don’t email Onefinity - they will refer you to the forums.
When you create your modbus program, the Failures column should contain all zeros. If any command has a failure greater than zero, it means the command is not working. In my case, I had to reverse the wires on the breakout board. I figured this out by using an oscilloscope to look at the bus. You have to use two probes and subtract the two signals since RS485 is differential. I then had the scope decode the signal as RS232 and I was able to see the proper command being sent from the controller and no reply from the VFD.
If you are using the Buildbotics post for Fusion 360, the spindle will automatically start and the CNC will immediately begin milling before the spindle is at full speed. This is because the Buildbotics firmware does not wait for the spindle to reach the speed that it just set before continuing to execute your gcode. The workaround for this is to put a delay in your gcode right after the speed set. For example:
s18000 m3 g4 p10
I’m going to try to hack the Buildbotics post to do this automatically. I have also asked Onefinity to make this an option in their official Fusion 360 post.
If you are using an older version of the firmware, you may have a problem where the spindle slows down during a rapid then speeds back up. This is because there is an option in the controller called rapid-auto-off (mainly for lasers) that will set the speed of your spindle to 0 during a rapid. The option for setting rapid-auto-off is only available on the PWM Spindle. The workaround for this problem is to select the PWM Spindle, uncheck rapid-auto-off, then select Custom Modbus VFD. This problem is being fixed in the next release of the Buildbotics firmware.
If the controller does not display the RPM correctly, you may need to change your VFD display. In my case, I had the VFD displaying RPM instead of frequency. When the controller was reading the frequency, it got back the RPM value so I had to change the display back to frequency.
I hope this helps!