In case they're useful for people, here are notes regarding integration of a Duet 2 with a low cost 1.5KW air cooled spindle from Ebay, controlled by an “AskPower A131” variable frequency drive (VFD) inverter.
Wiring up a VFD involves high, potentially lethal, voltages and shouldn't be undertaken without appropriate knowledge and experience.
1 VFD Mains Wiring
The VFD was connected to 240V mains power via a switch and fuse (13A) using the L and N terminals in accordance with this diagram:
2 Duet to VFD Interface
To enable the speed and direction of the spindle to be controlled by the Duet, a simple interface was built on matrix-board using parts to hand. The schematic is as follows:
Opto-isolators U1 to U4 electrically isolated the VFD controller from the Duet to avoid ground loops and reduce the risk of damage to the Duet board in the event of a fault/breakdown in the VFD. In addition, they provide the necessary level shifting from the 3.3V logic levels provided by the Duet.
Emergency Stop is provided by a normally closed button on the control pendant. In normal operation, this switch holds the Duet Emergency Stop Input low and LED in U1 is held off via D1.
When the Emergency Stop button is pressed, the switch contacts open, applying current to the LED in U1 via R3. This asserts the VFD_RESET line to rapidly stop the spindle. In addition, D1 allows R2 to pull an Emergency_Stop input to the Duet high, so it can pull the spindle up in the Z axis and halt the CNC X-Y stepper motors.
The Spindle_Run and Spindle_Dir signals control the spindle ON/OFF state and direction of rotation and drive the VFD's VFD_RUN and VFD_DIR inputs via U2 and U3 respectively.
Light emitting diodes DS1 through DS3 indicate the status of the VFD_RESET, VFD_RUN and VFD_DIR inputs and provided useful for test purposes.
The Spindle_PWM signal from the Duet is passed through U4. R10 and R11 act to limit the PWM signal generated by U4 to an amplitude of 10V, as required by the VFD. The PWM signal is passed through a second order low pass filter formed by R12, R13, C3 and C4 and a unity gain buffer (U5) to drive the VFD_Speed input. A linearity error of around 4% at 5.0V output was measured. This gives a spindle speed of around 12,480 rpm for a 12,000 rpm setting, which was felt to be OK for now. Ideally, the VFD’s frequency output signal would be used to reduce this error.
It may be noted that this circuit is generic and could be used with other VFD such as the HuanYang units.
Duet 2 Connections
The interface board was connected to the Duet 2 expansion connector using the following pins:
The interface board was wired to the VFD as shown in the photo below. Note that the brown and red wires are both wired to the 12V OUT terminal and the blue and black wires are both wired to the GND terminal.
To enable external control, the VFD must be configured using its control panel.
The basic method is as follows:
a) Ensure the VFD is powered and the Spindle is stopped.
b) Press SET to put the VFD into the “Parameter Set” mode.
c) Press the up/down buttons to choose the parameter to be adjusted.
d) Press the SET button again to select the chosen parameter.
e) Press the up/down and left/right buttons to adjust the parameter value to the desired setting. The left/right buttons are used to select which digit of the numeric value is to be changed and the up/down buttons enable the value of the digit to be incremented or decremented. Holding down Up or Down will cause the selected digit to scroll through the values 0 to 9.
f) Once the value has been set correctly, press SET to store the new value. Alternatively, press STOP to cancel the operation.
Using this approach the following parameter values were configured, with all others left at their default values:
Duet Firmware Configuration
The following settings were used for the latest Firmware Version 3.2 Beta to take advantage of the new CNC spindle control options. However, the settings used for previous versions are included for reference, but commented out.
M563 S"Spindle" P0 D0 H ; Define Tool 0 (our Spindle)
G10 P0 X0 Y0 Z0 ; Set tool 0 axis offsets
G10 P0 R0 S0 ; Set initial tool 0 active and standby temperatures to 0C
; CNC Emergency Stop
M950 J0 C"exp.e2stop" ; Define exp.e2stop as P0 to use as an emergency stop input
M581 P0 T0 S1 R0 ; emergency stop (T0) when P0 (E0 end stop) edge occurs
; CNC Mode (Updated for Firmware 3.2)
M453 C"exp.13+exp.8+exp.14" Q1000 R24000 T0 ; CNC Mode, PWM frequency 1KHz, max rpm = 24K
; spindle speed PWM pin : exp.13
; spindle run pin : exp.8
; spindle direction pin : exp.14
; CNC Mode (Pre Firmware 3.2)
; M950 P1 C"exp.8" ; use pin 8 on the expansion connector as the VFD enable pin
; M42 P1 S1.0 ; to turn the spindle on
; M42 P1 S0.0 ; to turn the spindle off
; M453 C"exp.13" F1000 R24000 ; spindle speed PWM control using exp.13 pin,
; PWM frequency 1KHz, max rpm = 24K
Hope this helps someone!