CNC machines cut, carve, and mill material at speeds that change constantly during a job. A manual drill press relies on belt changes and pulley adjustments to set speed, but a CNC spindle has to respond to the toolpath on its own. The controller sends live speed commands to the motor drive while the program runs, which gives cleaner cuts, longer tool life, and fewer broken bits. This article explains the hardware and wiring needed to connect a CNC controller to a variable frequency drive (VFD) so the spindle speed follows the program automatically.
The setup described here suits the common hobby and small-shop combination of a parallel-port or USB controller, a breakout board, a digital potentiometer IC, and a VFD driving a three-phase spindle motor. Each connection point, the pin labels on the digital pot, and the checks to run before switching the machine on are covered in order.
Why Automatic Spindle Speed Control Matters
A VFD changes motor speed by varying the frequency of the power it delivers. A three-phase spindle motor rated for 400 Hz can turn far faster than the 50 or 60 Hz mains supply, which is why water-cooled spindles commonly run at 24,000 rpm. Feeding the VFD an analog voltage signal, usually 0 to 10 V, tells it which frequency to output. When the CNC controller adjusts that voltage from G-code, the spindle accelerates and slows down without anyone touching a knob. A spindle that runs only as fast as the job requires also uses less energy and makes less noise than one that runs flat out between cuts.
What a VFD Does for a Spindle Motor
The VFD also soft-starts the motor, ramping it up over a set time instead of slamming it to full speed. That reduces inrush current, limits mechanical shock on the bearings, and allows reverse under program control. Most VFDs used in CNC work accept three control methods: the front panel keypad, external switches, or an analog input wired to the controller.
- Constant torque across the usable speed range for heavier cuts at low rpm
- Regenerative or resistor-based braking for quick stops
- Overload and over-temperature protection built into the drive
- Remote start, stop, and direction control from the controller
Low-Speed Torque and Ramping
At low frequencies a VFD can lose torque unless it boosts voltage, a function usually called V/f boost or torque boost. Set the ramp time to a few seconds so the spindle does not overshoot the commanded speed. These settings live in the VFD parameter menu and should be checked before wiring the analog input.
The same variable-speed spindle logic shows up across the shop. Machines such as oscillating belt and spindle sanders use similar motor and drive combinations, and understanding the control side of one spindle makes the next one easier to set up.
Hardware Needed for the Connection
The classic setup uses four main components. The CNC controller runs the motion software and generates the speed signal. The breakout or interface board converts that signal into a form the rest of the circuit can use. The digital potentiometer IC sits between the board and the VFD, and the VFD drives the spindle motor.
- CNC controller running Mach3 or similar software, with a parallel port or USB motion card
- Interface board with a PWM output and a regulated 5 V supply
- Digital potentiometer IC rated for 10 kOhm with an SPI interface, such as the 4131 family
- VFD with an analog input terminal set, usually labelled VI and GND or AVI and ACM
- Shielded cable for the analog signal and a separate low-voltage supply for the IC
Choosing a Digital Potentiometer IC
A manual potentiometer gives you a knob to turn by hand, but G-code cannot turn a knob. A digital pot replaces the resistive track with a wiper position controlled over a serial interface, so the controller can set the speed value electrically. The 10 kOhm rating matters because most VFDs expect a 10 kOhm potentiometer on their speed input. The 4131 family runs on 1.8 to 5.5 V, which lets it share the 5 V rail on the interface board. A USB motion card and a parallel port breakout board both produce the PWM signal needed, and the wiring is identical from that point on.
Reading the Pin Labels
The chip labels its pins with short names. CS is the chip select, SCK is the serial clock, VDD is the positive supply, VSS is the ground or negative supply, and A, W, and B are the three terminals of the internal resistor. W is the wiper, the moving contact that the chip positions along the resistance track.
Control input to CNC software is flexible. Operators use keyboards, pendants, and even repurposed game controllers; one popular hobbyist trick is using an Xbox controller for navigating 3D models in design software, which shows how many different ways a machine can be driven.
Wiring the Digital Potentiometer to the VFD
The VFD side of the circuit is simple because the drive already expects a potentiometer. Its speed input terminal set accepts the two ends of the resistor and the wiper. Connect the IC A and B outputs to the two fixed ends and the W output to the wiper input, and the VFD sees exactly what it would see with a manual 10 kOhm pot on the front panel.
Terminal-by-Terminal Connections
| IC Pin | Label | Function | Destination |
|---|---|---|---|
| 1 | CS | Chip select, SPI enable | Controller output |
| 3 | SCK | Serial clock, SPI data line | Controller PWM output |
| 4 | VSS | Negative supply | Interface board GND |
| 5 | PAO | Resistance terminal A | VFD A or VI input |
| 6 | PWO | Wiper output | VFD W or wiper input |
| 7 | PBO | Resistance terminal B | VFD B or GND side |
| 8 | VDD | Positive supply, 1.8 to 5.5 V | +5 V from the board |
Check the VFD manual for the exact terminal names. Some drives call the wiper input VI, others call it AVI, and the reference terminal may be labelled ACM, GND, or COM. The electrical rule stays the same: the wiper signal is the speed reference, and the two outer terminals set the span of the control range. Some VFDs include a jumper or switch that selects the analog input source, so check the factory default before testing.
The control circuit only sets the speed; the finish still depends on tooling. Choosing the right sanding sleeves for an oscillating spindle sander, for example, matters as much as the motor speed, and the same is true on any machine that removes material.
Step-by-Step Connection Procedure
The sequence below follows the pin labels on a 4131-style digital pot. Work with the machine powered off and the VFD capacitors discharged before touching any terminal.
Controller to IC Connections
- Connect the Mach3 board PWM output to IC SCK pin 3. This line carries the speed command as a pulse-width signal.
- Connect IC pin 1 to the interface board GND point to establish a common reference.
- Connect the IC VSS pin 4 to the negative 5 V supply from the interface board.
- Connect the IC VDD pin 8 to the positive 5 V supply from the interface board.
IC to VFD Connections
- Connect the IC PBO pin 7 to the VFD B terminal, one fixed end of the potentiometer circuit.
- Connect the IC PWO pin 6 to the VFD W terminal, the wiper input that sets the speed.
- Connect the IC PAO pin 5 to the VFD A terminal, the other fixed end.
The A and B points are the two ends of the resistive element, and W is the wiper. Reversing A and B only flips the direction of the control range, so the spindle runs at full speed when the wiper voltage sits at the bottom of the range instead of the top. Number the wires or use colour-coded heat shrink so the seven connections can be traced later.
A common upgrade after the speed control works is adding a spindle to a router table for light sanding and finishing passes. The same VFD and control wiring applies, and the table already provides a rigid platform for the motor.
Testing, Safety, and Maintenance
Before the first powered test, check every connection against the pin table. Confirm the 5 V supply polarity, the SPI wiring, and the VFD terminal names.
Commissioning Checks
- Power the interface board only and measure 5 V between VDD and VSS on the IC.
- Jog the spindle from the VFD keypad at 10 percent speed and verify the motor rotates in the right direction.
- Command a speed change from the CNC software and watch the VFD display follow the setpoint.
- Run a test cut with the spindle at low, medium, and full speed and check the surface finish.
- Watch the VFD for error codes such as overcurrent or overvoltage during ramps.
If the speed does not follow the commanded value, check the PWM line with an oscilloscope or logic probe, then measure the wiper voltage at the VFD input with a multimeter while the controller changes speed. Log the parameter changes you make in the VFD menu, because a factory reset will wipe them all.
Keeping the Wiring Reliable
- Use shielded twisted pair for the analog signal and ground the shield at one end only
- Keep the SPI cable short and away from the spindle power cable
- Add a ferrite bead or small capacitor if the speed jumps at random
- Clean and re-tighten screw terminals at least once a year
- Keep the VFD parameter sheet with the machine so settings can be restored
The word spindle covers a lot of ground in a workshop. A CNC cutting spindle, the spindle on a sander, and the balusters on a staircase, which builders call staircase balusters, share the name even though they do very different jobs. In every case the setup decides the result, and that applies to stair work as much as to a router or mill. Homeowners who repaint stair spindles white follow the same rule: the preparation and finish schedule determine how the job looks.
