How to Control a Taig Mill with a Duet3 Controller
After years of not being able to machine aluminum, I decided I wanted a small mill. I bought a Taig 5019CR mill — a small milling machine with ballscrews that is ready to have 3 motors put on it and run as a CNC.
This story shows how to spend under $400 and fully CNC this mill with a web-browser-based control.
Why a Duet3 Printer Controller?
The Taig forums are full of people who run Grbl or Mach3. It’s also full of statements like “maybe Mach3 hiccupped, it does that”. Both applications have serious problems (in my opinion) and I wanted something easier to use, more reliable and open source. Since my 3D Printer and my CNC Router both use Duet3d controller boards that run RRF (RepRap Firmware) I thought I’d do the same for my mill.
RepRap
I really really like RepRap. It is open source and I’ve written support for backlash compensation and leadscrew compensation for it. All of the configuration is done via G-codes (or M-codes) so it’s all dynamic. You can change configuration on the fly and test the setup without ever changing a header and rebuilding. All of the control is via a web browser so you can connect to the mill from anywhere. Finally, the code base is one of the best I’ve seen for an open source ‘hobbyist’ application.
The Duet3 6HC
The Duet3 from Duet3d is a ~5" square board with a 300MHz CPU, 6 powerful and smart motor drivers (32VDC and 4A) as well as electronics to control fans (variable speed), a VFD for a spindle, half a dozen endstops, an E-Stop, a touch-display, and other controls. It also support servos and closed-loop steppers.
My CNC uses an Xbox controller as a pendant. It would be easy to support a ‘real’ pendant.
Most important, the Duet3 has an ethernet port and all user control of the board is via a web browser. I can control the mill from any computer (or phone) in the house.
Setup
Start by mounting three Nema23 1/4" shaft motors. I used $30 270oz-in motors from StepperOnline. I have a 425oz-in motor for the Z shaft in waiting if necessary.
Once the motors are mounted, all it takes is a Duet3, a power supply and some wire to have a fully working milling machine.
Here’s a photo of my Taig Mill ready to be controlled.
Step 1 — connect to network
The first step is to connect the controller to the network. Plug the provided SD card into a PC and edit the sys/config.g startup script file to be a nearly-blank configuration that just enables the network.
M550 P"DuetMill" ; set printer name
M552 P0.0.0.0 S1 ; enable networking w/dhcp
Insert the SD card and apply power to the board. Then, find the IP address assigned by the network router and browse to the controller interface. From here on the config.g startup script can be edited in the System tab.
Step 2 — connect to 1 motor
I started off by using my 3d printer motor configuration with only the first motor enabled for testing. The only important configuration entry here is how much current to drive the motor with. I used 2.4Amps. Duet3d generally recommends 80% of the motor rating (3A here).
The other settings are straight from my 3D printer, other than steps per mm which should be accurate (200 steps per revolution and 2.5mm per turn of the ballscrew).
; motor definition
M569 P0.0 S0 ; enable drive 0 forward
M584 X0.0 ; set drive mapping X to 0
M350 X16 ; configure microstepping with interpolation
M92 X80.00 ; set full steps per mmM566 X500 ; set maximum instantaneous speed changes (mm/min)
M203 X24000.00 ; set maximum speeds (mm/min)
M201 X1200 ; set accelerations (mm/s^2); use about 80% of power rating for heat
M906 X2400 I30 ; set motor currents (mA) and motor idle per cent
Then I wired up from motor 0 on the Duet3 to the X axis and tested movement. It can’t home yet (no limit switches) so I enabled movement despite no home.
M564 H0
In the Dashboard I clicked the +50mm and -50mm X movements and the axis moved back and forth!
Step 3 — connect the remaining motors
This was trivial, just more wiring.
Step 4 — install limit switches
Mills often have no homing ability but having at least one limit switch on each axis means the mill can read a known (0,0,0) and then obey software X,Y,Z limits and you’ll never whack the ballscrew by going out of bounds. So, I have them.
Step 5 — add optional 5V supply
I use an optional 5V supply to keep the processor always on, so the GUI is available even when there is no motor power. It’s nice to have motor voltage off when not driving motors.
Step 6 — fine tune the kinematics
Now that everything is working, it’s time to set speeds and accelerations and … other stuff for best motion control.