Make Your Desktop CNC 3018 Milling Machine More Reliable

by michaeljtbrooks in Workshop > CNC

11723 Views, 116 Favorites, 0 Comments

Make Your Desktop CNC 3018 Milling Machine More Reliable

IMG_20220415_153542.jpg
IMG_20220501_084433.jpg
IMG_20220501_091443.jpg
RF EMI suppression of CNC motor.png

Are you frustrated by your CNC milling machine cutting out part way through a job?


Desktop CNC milling machines have dramatically fallen in cost, and at the cheap end of the market assemble-it-yourself kits can now be picked up for under £150 ($190). However, they are dogged by one common problem: jobs cutting out part way through.

Annoyingly this is a common symptom with several different causes.


I bought a dirt cheap CNC 3018 kit mainly with the intention of prototyping PCBs. I soon experienced the curse of jobs cutting out midway through. I scoured the web widely and tried all sorts of things. Some measures seemed to reduce the frequency of jobs getting stuck, while others made no difference. Eventually I realised that I had been suffering from three separate causes of jobs getting stuck.


Buried among forum threads and Youtube videos are the solutions to CNC jobs getting stuck. However it's hard to know where to look and which things to try first. So I've written this Instructable to help you home in on the cause and fix the culprit, starting with most likely to least likely.


I will assume that you are running your CNC machine directly from your computer in real-time. If you are instead running your CNC machine in "offline mode" (saving Gcode files and then transferring them to your CNC controller), then you can ignore any of the USB related causes.


TL;DR:

Try each of the steps in order and see if it cures your problem before moving onto the next step.

  • Determine if the cutting out only happens when the motor is running or not
  • If jobs cut out whether or not the spindle is running:
  • Disable USB Auto-suspend on your computer
  • Move to an externally powered USB hub
  • If jobs cut out only when the spindle is running:
  • Twist the spindle wires
  • Earth the spindle motor case
  • Add an RF/EMI filtering circuit (see below for diagram and parts)
  • Replace spindle and power cables with shielded cables
  • If jobs only cut out when milling something particularly tough:
  • Switch the 12V/24V power supply to a proper benchtop power supply

Supplies


Optional items depending on which upgrade you perform:

  • Adding an earth:
  • Mains plug + earth cable
  • Equipment wire
  • Upgrading the power supply:
  • 12V or 24V bench power supply
  • Reducing spindle motor EMI noise:
  • 36V zener diodes (or 36V transient suppression diodes)
  • 3 x 10-100nF non-polar capacitors
  • PCB matrix board
  • Solder
  • Soldering iron
  • PVC insulating tape
  • Reducing noise induced in power supply cable and motor spindle cable:
  • Balanced shielded signal cable
  • Reducing computer noise on USB lines:
  • Double-shielded USB cable
  • Externally powered USB hub
  • (USB isolator)

Determine If Your Problem Involves Your Motor

It is a good idea to find out whether your spindle motor is causing jobs to cut out or not because this will inform which of the fixes you can apply.


How to test:

You do this by "dry running" the job first without the spindle motor running.

  1. Zero your CNC machine so that the work bit is well above the thing you will be cutting so it never actually touches the material when you run the job.
  2. Disconnect the spindle motor
  3. Start the job
  4. If the job dry-run has finished, zero the machine again with the work bit up in the air away from the work
  5. Reconnect the spindle motor
  6. Run the job again


How to interpret the results:

  • If the job cuts out whether or not the spindle motor is connected: you have a problem with your USB feed to the CNC controller
  • If the job cuts out only when the spindle motor is running: you have a problem with the motor generating noise that crashes the controller
  • If the job does not cut out in either test, but still cuts out when actually cutting something: you may still have a problem with the motor generating noise that crashes the controller, but also may have a problem with the power supply being too weak.

USB Connection Is the Problem: Disable USB Auto-suspend

By far, the most common cause of jobs stopping part way through is your computer's USB port going on to standby mode.

Most computers will put any USB ports that have not sent data for a while into standby. For most CNC controllers this breaks the connection and causes the job to get stuck.

You can easily fix this by disabling USB autosuspend:


Disable USB autosuspend on Linux:

As a sudo-capable user, in the terminal enter:

echo on | sudo tee /sys/bus/usb/devices/*/power/level >/dev/null

I have this running as part of my CAM software launching script so that it gets executed when I open UGS platform.

If you are using a RaspberryPi as your computer to send messages to the CNC controller, this is what you'll want to do.


Disable USB autosuspend in Windows 10/11:

See this visual guide by WinBuzzer or this other guide from Windows Central.

  1. Open Control Panel. ...
  2. Click “Hardware and Sound”
  3. Press “Power Options”
  4. Click “Change plan settings”
  5. Press “Change advanced power settings”
  6. Find USB settings > USB selective suspend settings
  7. Change the setting to Disabled


USB Connection Is the Problem: Move to an Externally Powered USB Hub

Sometimes, the internal components in a computer spew out a lot of RF noise. This is particularly problematic in high-end desktop computers with powerful graphics cards, and lots of cooling pumps / fans. This RF can find its way down the USB power lines to your CNC controller, causing ripples in the power supply to be interpreted as garbage data.


Move the USB connection to a separately powered USB hub:

A simple but effective way to reduce USB noise is to add an externally powered USB hub then connect your USB line to that. An externally powered USB hub (one that requires its own separate power supply) will provide power to its ports from the separate power supply rather than the USB power lines. So it will effectively isolate the CNC controller USB input from the noisy computer USB port power lines.

Make sure you try Step 2 (Disable USB Auto-Suspend) and repeat the test in Step 1 to confirm that there is a still a USB cause of jobs getting stuck, before splashing out on a new USB hub.


Use a USB galvanic isolator:

An alternative to using a USB hub is trying a USB galvanic isolator. These filter and regenerate the 5V and 0V USB power lines while transmitting the data in an isolated fashion. The downside is that it will limit your data rate in that USB port to ~8Mbps, which will be fine for almost all CNC machines.


Switch to an alternative connection method such as Bluetooth:

nedavison suggests using a Bluetooth HC-05 module configured as a serial passthrough which you attach to your CNC controller. You will need to have a controller which has serial connection pin headers for accepting such a Bluetooth module. You'll need to match the baud speed to what your CNC controller is expecting. You will also need your computer to have a Bluetooth chip/card in it.

Then do a search for Bluetooth devices on your computer, and connect to your Bluetooth module. Now you can send your CNC controller data via Bluetooth with complete isolation from noisy computer internals!

Motor Is the Problem: Twist the Spindle Wires & Earth the Motor Case

earth_only_plug.jpg
earthed_motor.jpg

Motors generate a lot of electromagnetic interference (EMI). When the brushes in the motor make and break contact with the motor commutator, little sparks are generated which emit white noise interference. This can find its way to the CNC controller board and be interpreted as garbage data, causing the controller to crash.


Twist the spindle wires:

You can reduce the amount of EMI reaching the CNC controller board by simply twisting the wires that go between the CNC controller and the motor. This causes any noise induced in the spindle motor wires to be induced equally in both the + and - cables, which causes some level of noise cancellation.


Earth the motor case:

If you have an earth point available such as on a bench power supply, use that earth point.

If you do not have an earth point available, you can make one by using a mains plug with an earth. Simply wire the plug so that ONLY the earth pin is connected, leave the neutral and live unconnected. You must make sure that there is no chance of the wire coming loose in the plug. Obviously you need to reassemble the plug once wired before using it in a mains socket. This is far safer than trying to fudge an earth by jamming wire directly into mains sockets!

Connect the other side of your earth wire to the motor case. The motor probably won't have a tab for connecting to its case, so you can simply strip a few cm of the earth cable, and then using insulating tape, tape the bare stripped end of the earth wire to the metal side of the motor. Bear in mind that the motor will move in the X axis and Z axis directions, so you need to ensure there is enough spare earth cable to move with it.

Alternatively, open the clamp which holds the motor, slide in the bare stripped end of the earth wire between the motor and the clamp, then tighten again.

Earthing the motor case will mean much of the EMI originating from sparks inside the motor will flow to Earth rather than induce a voltage in the spindle wires and the CNC controller board.

You can make use of this earth for some of the other fixes.

Motor Is the Problem: Add an RF/EMI Filtering Circuit

RF EMI suppression of CNC motor.png
IMG_20220501_084421.jpg

If earthing the motor case isn't enough to cure the jobs getting stuck problem, then you'll want to suppress the RF / EMI noise that the motor generates. This can be extremely effective, but requires a few electronic components and soldering skills.

The above circuit should be placed as close to the spindle motor as possible. You will need an earth too, which is why it makes sense to do Step 4 first.

The circuit consists of three capacitors and two zener diodes (or one transient suppression diode). I suggest putting this on a small piece of matrix board PCB rather than have bare component leads snaking everywhere because your motor will be moving along the X and Z axis, and you don't want to risk a short circuit!


Zener diodes / Transient Suppression Diode:

The zeners need to be rated a little bit above your spindle motor's working voltage. Most spindle motors are 24V or 12V (mine is 24V so I've used a 36V transient suppression diode). If using zeners, you should place them back-to-back and connect the other sides across the motor. If using a transient suppression diode, just connect this across the motor.

The point of these is to remove any spikes in voltage. Motors contain coils and thus are an inductive load. When a motor moves from encountering resistance (such as when cutting), to no resistance (such as when it has cut through the edge of some material), the sudden release will generate a voltage spike in the coil. This can be several hundred volts and can find its way back into the CNC controller board where it can interfere with data. The diode(s) will provide a low resistance path for anything that goes outside -36V to +36V, and so will prevent these spikes from reaching the CNC controller. They will also prevent the filtering capacitors from getting damaged by huge inductive load generated voltages


Capacitors:

These should be non-polar because CNC motor spindles are able to turn in both directions so the positive rail and negative rail may swap. The capacitors need to be rated above the spindle motor voltage.

Capacitors block DC but pass AC. The smaller the capacitor, the higher the frequency needs to be before they allow it to pass. In the circuit, I have connected one capacitor across the motor, allowing any differential-mode high frequency RF/EMI generated by the motor to cancel out. I have also connected one capacitor between each of the spindle motor supply rails to ground. This allows any common-mode RF/EMI noise (such as generated by sparks in the motor) to drain to ground.

Spindle motors have their speeds controlled via Pulse Width Modulation (PWM). By adding capacitors we do, to a certain extent, cause the pulses to have a slurred upstroke and downstroke. The larger the capacitance, the worse this becomes. This means that we need smallish values of capacitors so that we can filter RF/EMI, but leave the PWM pulses mostly unaffected.

I have gone for 22nF capacitors. I suggest 1nF-100nF rated at 50V or above. The astute of you will realise that the differential-mode capacitance is actually more than 22nF (it's 33nF) because there is 1 capacitor in parallel with a series of 2 capacitors! If you go much above 100nF, you'll start to affect the PWM pulses more.


I recommend insulating the filter circuit PCB with PVC insulating tape so that it can't accidentally short out against the motor case as the motor spindle moves up and down the X and Z axes.

If you absolutely cannot get hold of three caps and the diodes, then at least put one appropriately rated capacitor across the spindle motor terminals!


Motor Is the Problem: Replace Spindle and Power Cables With Shielded Cables

If despite twisting the motor cables, earthing and filtering you are still seeing noise get into the CNC controller circuit, you can upgrade the motor spindle cables to shielded ones.


I absolutely love this foil screened stranded conductor twin cable "FST" from Canford. I use it for balanced audio runs and some digital signal data lines. You can find similar two core + screen cable on Amazon and AliExpress, though make sure it is capable of carrying 2 amps which is what your spindle motor will happily draw when cutting through something tough.


I tried the FST cable on the CNC spindle motor and found that it greatly reduced the amount of EMI that reached the CNC controller. I connected the earth from Step 4 to the outer foil shield (there's a handy bare core that is in contact with the foil which you can connect to), then one of the motor filter circuit's poles to the red core and another to the black core. Now any RF/EMI noise from the motor can't radiate from the motor's power leads.


Once you've got a supply of screened dual core cable, you might as well upgrade the power cable to the CNC controller to the same shielded cable. That way, EMI won't get induced in the power supply to the CNC controller as much.

Power Supply Is the Problem: Run It Off a Bench Power Supply

IMG_20220501_091443.jpg

Often the power bricks (switched mode power supplies) that come with the CNC machines are rather weak and quite noisy. If you find that your jobs are cutting out only when cutting hard or thicker material this could be due to the power supply not being able to provide enough current to the CNC controller and motor spindle.

The more resistance the motor encounters, the more current it ends up drawing. If the power supply is anaemic and cannot provide that much current, the voltage of the supply will drop and cause the CNC controller to lose power, thus killing the job.

I found that the power supply that came with the CNC machine kit could manage 1.5amps continuously but tended to overheat at 2amps if drawn for more than 5 minutes, and completely fail at 3.5amps.

I now run my CNC controller off a high quality bench power supply because it is capable at pumping out a very stable 24V at up to 5 amps.

If you don't have a bench power supply to abuse, then look for 12V or 24V power supplies from reputable suppliers (there are loads of low quality power supplies with fake amp ratings on Amazon and AliExpress). I've seen people repurpose computer PSUs to provide a stable solid 12V!