Dealing with Spindle motor noise causing steppers to wander

I just finished rebuilding my 1612 mini CNC, properly repairing a snapped spindle bracket, removing the laser entirely (I have others) and re-doing some of the electrics.

I have a specific job in mind for this machine, and testing was going well, until I tried something new; using a big v-carve bit and, for the first time ever, running the spindle at less than 100% pwm.

End result is higlighted above, the spindle went well off course when asked for a 10x10mm box outline at 50% pwm.

I correlated this to PWM almost immediately; The perfect square cut next to it was done with the same bit, from the same startpoint, with 100% power. As were the other straight cuts there.

Simply running the spindle at 50% unloaded and un-moving let me see that all three axes were gently jittering and wandering (X worst of all), going back to full power stopped it completely.

My first work on this involved redoing some cable re-routing, shielding and twisting pairs for the 36v spindle lines, routing them away from the control lines. This made a noticeable improvement, but was no solution. I also saw an improvement when I bonded the machine chassis to ground, and from changing the PWM frequency.

The real solution came and adding proper supression capacitors to the spindle:


This is a common solution for brushed DC motor noise; 0.1ĀµF caps to the spindle body, and 2.2ĀµF across the terminals. These small ceramics are rated to 50v.

This machine has a totally open chassis and a unshielded control board (a very early esp32 control board, lots of long thin tracks etcā€¦) so I guess my main surprise should be that I have not seen this happen earlierā€¦ :wink:

When reading up on what to do I noticed several people on the electronics forums saying that brushed dc motors are bad for noise, but pwm+brushed dc motors is really, really bad. Too many transients happening at once I guess.

And, eventually, I got what I wanted (text pathing courtesy of LaserWebā€™s vpath feature), this is a test for something Iā€™m working on.

1 Like

Hi Owen,
With a cap parallel to the coil, you make it a tank. The circuit that controls the frequency of an oscillator. Wouldnā€™t it be better to use a common mode transformer in series with both leads of the motor?

The ā€œperfectā€ way to control speed on a brushed DC motor is voltage of pure DC; PWM is merely more efficient to supply. ā€œFilter capacitorsā€ are certainly common for DC motors. This is particularly true for brushed DC motors due to commutation. Transients during commutation show up with PWM more because suddenly the commutation sometimes happens during moments of 0V supply, I believe.

For an oscillator, you need a oscillating element as well as tuning of some sort (RLC, RC, RL). Note that RL can be a tuning element, which already exists in the coil between its complex impedance and inductance. And you even have parasitic capacitance in the power wires and between turns of each coil. Why are you concerned that the tank itself would resonate when adding a capacitor to add explicit as well as the mostly-trivial parasitic capacitance? Am I missing something here?

If there were still an EMI problem after the cheap and normal transient suppression using small capacitors, putting ferrites around both wires is basically making a 1-turn common mode choke (because ā€œturnā€ is defined as number of times through the core) and is common for EMI suppression. (Iā€™m used to that being called a common-mode choke to separate it from galvanic isolation of a transformer. A true transformer with galvanic isolation on a DC signal isnā€™t going to do what you wantā€¦)

Ultimately, ā€œthe proof of the pudding is in the eatingā€ and @easytarget reports that he actually solved his problem with the series of fixes documented. :grin:

3 Likes

As noted above; adding small value ceramic capacitors to DC motors like this is common, they form a high-frequency filter / supressor circuit. Their values are way too small to store a meaningful charge, but they are very close to the brushes and very fast acting, this lets them absorb the high-frequency spikes caused by the brushes in the motor.

I used the triangle config since it is the most effective version of this; values are guesswork + what I have in stock. That stackexchange article is one of the ones I read while working out what to do.

A awkward part of this was making a good connection to the (pressed steel) spindle body. Fortunately I have some silver solder and suitable flux in my ki; once the silver solder had made a bond I used general purpose solder to build up and connect the caps.

Iā€™d love a proper, linear, voltage controlled spindle supply but have to make do with a N-Channel mosfet & classic PWM. This is fine for my use, mostly this machine is used for PCB work with tiny (as low as 0.4mm) mill bits where I could, frankly, do with even more speed.

1 Like

For reference; here is the machine Iā€™m referring to. Itā€™s a 1610 CNC/router kit I got from AliExpress 5 years ago, with, ahem, a few modifications.


I keep meaning to write ā€˜Tulipā€™ up,. Sheā€™s lots of fun, but very much a hobby machine.

1 Like

Oh, to be clear, I wasnā€™t suggesting that you switch to a crazy ridiculously expensive power supply. I donā€™t even use a linear power supply for my HF ham rigā€¦ I was setting up why the capacitor filter approach made sense to me! :smiling_face:

My own choice here for an upgrade was to a three-phase spindle and VFD with actual speed control. That improved matters. But Iā€™ve still run into problems, and have been planning, once I get back to it, to add shielded wire (already purchased for this purpose) and two common-mode chokes at the VFD, one on the spindle wires and one on the power wires. The VFD isnā€™t doing PWM but that doesnā€™t mean the power is cleanā€¦ :smiling_face:

[Edit: I mean, the VFD is assuredly using PWM to produce the three-phase power, but just as assuredly it is at least trying to filter it into a smooth three-phase waveform.]

You obviously donā€™t need this since your problem is solved, but for others with EMI problems who someday read this, note that PWM produces essentially all the odd harmonics of the base frequency, and also at anything other than 50% duty cycle, you have two separate phases of all the odd harmonics of the base frequency, which can combine in interesting ways. This means that filtering at the source can also be helpful for reducing EMI from your spindle power. A ā€œbuckā€ (voltage reducing) DC-DC converter is basically a PWM power supply (typically at much higher frequency, like 500kHz) with filtering capacitors, and often an inductor, on the output stage. So also adding capacitors and/or common mode chokes (a ferrite around both positive and negative leads together) on the output of a PWM spindle power supply can be separately worthwhile in reducing EMI.

Every wire is an antennaā€¦ So if you still have problems, you might have resonance at some frequency that is coupling noise to your control board. Changing the PWM frequency lower will increase the length of the wire that would be needed to resonate, so it would be my first try. But Iā€™d also suggest slowly sweeping up and down across the entire PWM duty cycle range to test any PWM frequency before you count yourself clear, because the products of the two phases might create inconvenient resonances in only one small range of duty cycle.

1 Like

Iā€™ve been doing some more carving; very confident I have fixed this. Iā€™ve already got a proper ferrite choke on order (nothing really suitable at home) and Iā€™ll be adding that too for a bit more peace of mind.

1 Like