This post will be about a basic Duet CNC controller design, which I initially implemented for my Moot_Three CNC Machine, and later adapted for a couple DIY Ooznest Workbee machines. It is the seventh controller I have made following on from those documented within the CNC Control Box Timeline. The premise was to create a controller with several features including a physical pause button and E-stop safety controls, to minimise wiring by utilising sensorless-homing and an external router spindle, and to provide a teaching tool which could demystify CNC and automation processes. The controller doesn’t include a tool probe or enclosure interlock although I have added illustrated diagrams for these further below. The illustrated diagrams are shared alongside the Duet system configuration files, macro files, Vcarve post processor and job setup. I’ve have tried to include as much information as possible, including wire length but these are approximations. I am also not a qualified electrician so take my guidance with a pinch of salt. These diagrams, notes and files are provided freely for your own research and development. I declines all liability for injury to persons and damage to components due to incorrect use. Refer to safety data sheets for all components when installing and only use reputable suppliers.
This is a prototype of the first basic Duet CNC controller I made down the studio with sensorless homing only utalised once for the z axis. The later version which is documented in this post doesn’t use proximity sensors – instead utilising the sensorless homing available with the Duet 2 Wifi controller on all axes. I’ve found sensorless homing to be very reliable once setup correctly.
I’m now going to write about the wiring of the controller starting with the AC elements. AC power goes from the main switch into the controller via a 10A fuse and RCD, and to a lower wattage 24v DC PSU. The PSU supplies the On/Off latching circuitry and provides the main safety circuitry. The first cluster of distribution blocks (on the right side) power the first 24V DC PSU, connect to the L1 and L2 side of the un-magnetised open contactor and provide the main point for earthing including stepper motor wiring shielding and to the enclosure galvanised backing plate. I use insulated crimp connectors at all wire terminal ends.
On/Off & Emergency Stop
When the On button is pressed, a latching circuit is created by energising a magnet within the contactor unit, closing the contacts and allowing AC power to the 350w 24v PSU and Wago relay module. The second PSU powers the Duet Wifi 2 Controller which can switch the relay module – allowing power to the spindle router. The off and Estop buttons break the magnetised circuit, cutting power to all components. If power fails but is later restored, the contactor would have to be manually magnetised to supply power to the Duet controller and relay module. I use a combination of insulated crimp connectors and bootlace ferrules at all wire terminal ends.
Duet 2 Wifi Wiring
The Duet controller requires wiring to several parts including DC power in , spindle relay module, external triggers inputs, intake and exhaust fans, LED ring light and stepper motor wiring. I’ve clustered these into a gallery below. I have also included wiring illustrations for a stationary tool probe using a large button switch and the panel due7i touch screen which were not implemented and will need additional setup including editing the system files to complete. Again, I use a combination of insulated crimp connectors and bootlace ferrules at all wire terminal ends.
Bill Of Material – BOM
Duet – System Files
These are basic system files for the Duet 2 controller with the above wiring. You will need to refer to the Reprap Gcode library to edit or update these, but before that also set up the controllers network connection using this guide. I used an access point which has to be setup via YAT and a USB connection to the controller. Make sure you use a data USB cable and not a charging one. Once setup you can log into the Duet and access the web controls via the controller IP address, then navigate to the system tab and editing the content there.
Duet – Macros
Here are a few very basic macros for a simple job setup and workflow. The first macro sets the datum position which is normally on the bottom left corner of the wasteboard – I work in the G55 work coordinate system. I also have a macro for setting the tool Z zero which is normally done on the wasteboard. A rapid move to a tool change location, at the front of the machine which can also be used to fit or remove the dust shoe, and a macro to move the spindle / gantry to the rear of the machine for material fixing and removing of jobs.
Duet Firmware Version
I’m using RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.0rc2 which is Beta version, along with Duet WiFi Server Version: 1.26, but I’m haven’t progressed from Duet Web Control 3.4.0-b1 as the later version seems to have massive buttons for CNC and Laser Modes which looks a bit childish.
Vectric VCarve Pro Post Processor / Job Setup
Above is the post processor for the Vectrics CAM software. The Duet can processes G Code Arcs, but the current Duet firmware version has problems with resuming after a pause so I had to adapt this. The result is the gcode files contain a lot more lines. I also included lines “[N]M98 Pcondition1.g” in the HEADER and “[N]M98 Pcondition2.g” in the FOOTER so g-code messages could pop up with relevant information for the users. The web interface has a Upload & Start option which I wanted to slow down with a confirmation click before beginning.
To the left are the Job Setup details which corresponds with the macro workflow. Z Zero Position is set to Machine Bed and and X Y Datum Position is set to the bottom let of the wasteboard with no offset used. This seemed like the safest and most user-friendly way to design the workflow.
Basic Controller Images
Basic Duet Controller Diagram & Modified Ooznest Workbee
- Power Pilot Light.
- Main On/Off Buttons.
- USB connector – for debugging only.
- Wifi antenna.
- CNC controller name / number.
- Exhaust fan – helps to keep enclosure cool.
- Enclosure locking points – do not open controller while powered.
- Emergency stop button.
- Main power in socket.
- Job Pause / Cancel – press once during job to pause and again to cancel.
- Spindle on pilot light – when power is enabled to spindle light will display red.
- Power socket to spindle router.
- Job resume.
- Wires to CNC Machine.
- PVC enclosure flaps – should be lowered during machine cutting.
- Cable stop.
- Spindle router – Makita hand router.
- Main dust extraction hose.
- Drag chain for cabling.
- X axis gantry.
- Y Axis – right hand side.
- Hard stop Y axis barrier – machine uses sensorless homing where axes are driven into a physical stop and motor load detected.
- CNC perimeter – do not cross while machine is operational.
- Sacrificial wasteboard.
- Spanner for tightening spindle collet.
- Dust show with removable bristles.
- Datum position.
- Cabling to CNC controller.
- Hard stop X Axis.
- Z Axis.
- Enclosure fine dust removal – anything missed by the main dust shoe will be collected by the secondary inlet.
- Speed toggle – keep between speed 3-4 and no higher.
- Spindle on/off switch.
- Motor brushes.
- LED visibility light.
- Notch for spanner.
- Collet and Nut – set tool shank diameter.
- Cutting tool – generally single flute up-spiral are used.
- Spindle locking button – used when changing cutting bits or collet.
1. Power up the CNC machine controller. You will hear a faint clunk sound as the contactor unit magnetises as well as the fans beginning to spin. You should also notice the spindle LED ring light dimly illuminating.
2. If the red E-stop button has been pressed this will need to be twist-to-reset before powering.
3. If using local access points (Wifi) you will need to log in. Click on the network icon on your task bar and select the controller name. This process may vary depending on how you setup the controller.
4. To access the web controls, open your web browser such as Chrome or Edge and write the IP address into the URL.
5. First home all axes on the machine [Home All]. Movement should be prohibited if the machine has not been homed. Ensure the machine is clear of obstacles before homing all axes.
6. Move the spindle to the tool changing position using Macro 0. This will move the carriage and gantry to the front of the machine. Begin by removing the bristles section from the dust shoe, which are held in place magnetically.
7. Place cutting tool with the correct collet into the spindle router and tighten. Make sure the spindle rocker switch is set to off while doing this. Do not overtighten the collet.
8. Now set the tool Z zero position onto the wasteboard using Macro 2. You will have the option to use the on-screen movement arrows. Soft limits are enabled which should prevent the spindle crashing into the X and Y extremities, but you can drive the tool into the wasteboard. Perform small movements to avoid this. Optional third party hand pendant can be bough and setup separately.
9. Press the ok button on the duet web controls macro. The tool will now automatically lift to the safe Z axis position.
10. Move the carriage and gantry to safe location at rear of machine using Macro 1 – Move To Safe X Y Z Position.g. This will clear the area for you to place and secure your material onto the wasteboard.
11. Secure material to waste-board. You can use screws, or a small amount of double-sided tape between masking tape stuck on the wasteboard and material. If using screws, map the fixing location in Vcarve CAM software to help avoid crashing the cutting tool into them.
12. Move the spindle to the tool changing location using Macro 0 and place the dust shoe into position. Make sure this is securely in place. Also Set the spindle rocker switch to on, and set the speed dial between 3-4.
13. Turn on dust extraction! If you machine is in an enclosure – how is the time to close the door.
14. In the Duet web controls – click on the job tab on the ribbon menu on the left, and find the Upload G-Code Files(s) button. Press, find and open your g-code file. V carve will export this as an *.NC file if using the above post processor.
15. The CNC machine must be supervised while operated. Do not walk away or leave unattended.
16. The Web Controls will have swapped to the status tab where you can see a processing time-bar and have option to pause and cancel the job. There are also options on the controller box.
17. If you notice a build-up of dust or something wrong with the cuts, pause the job before investigating.
18. When the job is completed a message will appear in the duet web controls prompting you to move the gantry and carriage to the rear of the machine. Vacuum any debris before removing work.
While this setup doesn’t utilise a stationary probe you can still use multiple tools over a cutting job, providing you manually zero the new tool each time it is changed on a free part of the wasteboard.
I’ve tried to be as thorough as possible with this guide, and I hope it is useful for anyone trying to build their own CNC controller. Please review and assess your own projects thoroughly. Any thoughts, comments or feedback – let me know in the comments section below.