Adventures with silent stepper drivers (and 4th axis and other Nomad electronics fun)

I realised it might be more helpful if I explained my views on steppers, servos, open and closed loop control. These are just my views, I’m sure lots of people won’t agree or will point out key things I’ve missed :wink:

The dark ages

Back in the dark ages before cheap power electronics we used three phase or commutated motors to drive stuff that needed to move. They all have advantages & disadvantages but are very very bad at controlling position or accurately modulating speed. Some of these motor types exhibit basic feedback properties, for example the three phase spindle motors we run automatically adjust their current draw and torque based on how much load we put on the shaft (this happens as we slow the shaft down relative to the drive frequency). None of them has useful positional control though.

Stepper motors

Stepper motors came along and were initially very expensive and not very strong, but we used them in machines, progressively more generally until they started to dominate in things like dot-matrix printers. Stepper motors were great in that we could achieve some basic positional control without needing expensive position sensors to feed-back the actual position. Steppers were bad in that we just have to believe they are where we asked them to be. Also they have a torque / speed curve that means they don’t go fast very well and making them accellerate things quickly without losing steps is tricky. Steppers also mostly sit there at full power to do nothing and stay still, if you turn off the power they flop around so you spend power to do nothing.

Standard stepper controls are “open loop” in that there is no sensing of the position of the motor or the thing being driven to feed back to the controller. So no adjustment of the commands to the motor based on what really happens. You ask, the controller asks, the stepper driver asks, the motor tries, you hope it all worked.

Then power electronics got a lot cheaper and volume manufacturing of stepper motors increased to the point where they became so cheap that their compromises and issues were outweighed by their price advantage, a perfectly usable stepper driver is $0.50 now and the motors are also cheap. This is arguably what enabled things like the Shapeoko for people without a Haas budget.

We have cheap motors with basic positional control (once homed after power up, our one bit of positional feedback control) and reasonable ability to hold position. With even cheaper driver electronics for commodity sizes and we’ve sort of got stuck in a rut because they were so ubiquitous and cheap. We sticky-tape over the issues by either selecting much bigger motors than we really need, which further limits the speed, or by limiting the rates of accelleration and max speed in our control software, it takes quite a bit of tuning to get this right.

Cheap position encoders - closed loop steppers

With the advent of relatively cheap rotary and linear position encoders (see the DRO) stepper motor controllers can now check whether the motor actually did what it was asked to do or not. This means they can, at least, stop and throw an alarm if they have missed steps, instead of continuing to trash your workpiece. More advanced closed loop stepper drivers can modify the drive current on the fly using the feedback, achieve better top speeds and accellerations etc. These are still quite limited in terms of their real control abilities though. There’s no reason they can’t do the magic stuff of servos, but economics may rule against them.

Servo motors

In the other corner we have the servo motor, commonly found in radio control toys doing things like steering. We send this a signal to say “23 degrees left of center” and the electronics inside the box check the position and then drive the cheap DC motor until it approaches that requested position. If you turn them away from position they’ll fight you to get back to it. This is “closed loop” control where the controller can sense the output condition and use that to modify the instructions to the motor. These little RC servos are cheap and not very powerful, but pretty reliable and if you knock them out of position they’ll try to get back.

Maths

The problem with closed loop control systems is math(s). There is some pretty well understood maths about how to build and tune a closed loop system so that it behaves reasonably well, for a given combination of controller, motor, drive system and load condition. In RC servos this exists as a “PID” controller, this uses a tunable combination of the accelleration, speed and absolute position to choose how to accellerate and decellerate the motor to effectively reach the target without overshoot, oscillation and other problems. RC nerds get quite excited about PID tuning.

Magic sauce

In the modern servo motor world, where people like ClearPath have come along and made it consumer priced, what we have are big, powerful, cheap motors coupled up with high precision, relatively cheap position sensors, some smart drive electronics and the magic sauce. The magic is the controls tuning to make the whole thing usable instead of just a way to shake your machine apart.

What we get is a motor that can go fast, have huge holding torque, apply very large peak power when required, because it only needs to do that for peak, not continuously, maintain very precise speeds and positions and frequently integrates the driver and motor packages.

The bit that I’m impressed with is the advent of the “self tuning” servo motor, this is, to my view, the clever innovation for ClearPath and others. Instead of finding an engineer who studied enough control theory to build up a model of your system and calculate tuning parameters for your control loop they’ve managed to write smart software that uses the motor / encoder to test move the equipment as assembled, measure the results and come up with an “auto tune” for the installed system. This makes it possible for normal people like us to use closed-loop servo control on big heavy bits of equipment.

I also think that ClearPath’s hosting of their tuning smarts in the cloud is a very smart move for a long list of reasons.

5 Likes

DC is actually a good point, maybe ODrive would be a decent alternative to servos.

I’ve said it plenty in this thread but I can say it again: I really recommend EdingCNC or a CNC-focused controller. Duet’s RepRap firmware is fantastic for 3D printers but CNC mills can’t be called their main target. Some examples of some differences I could quickly find between RepRap and a mill controller (e.g. EdingCNC, LinuxCNC, I suppose probably Mach3/4):

  • RepRap doesn’t have backlash or cross compensation
  • (As far as I can tell) RepRap doesn’t support tool length measurement, just Z-offsets
  • RepRap doesn’t have G-code subroutines
  • RepRap’s step rate is relatively limited

I think a Duet is a definite step up over GRBL but if you’re going to upgrade the controller, why not go all the way into a “real” controller?

As someone who knows next to nothing about tuning servos, what does this tuning usually look like? Am I likely to be biting off more than I can chew if I decide to buy some?

I wont argue with most of your points accept this one. The Duet WiFi which was their 2nd generation board with a 120MHz uC and has a single stepper step rate of 360kHz. The controller you went with has a 400kHz single stepper step rate. The 3rd generation Duet board is running a 300MHz uC so I would assume that it is faster.

While the RepRapFirmware version 2 was designed for 3D printers, version 3 has been redesigned and has had quite a bit of focus put on things like CNCs. The Duet 6HC system has been designed for far more complex systems and they are putting a ton of focus on things like CNC in their firmware. It can support something like 30 independent stepper motors through its CAN-FD bus.

On top of this I am not looking to build some huge CNC mill able to machine steel like it was butter. As long as I can keep the current basic functionality offered by GRBL and gain the numerous benefits the Duet offers I am good. Things like G-Code Subroutines and backlash compensation will not prevent me from milling aluminum. The benefits of the 6HC are its direct SPI interface with a Raspberry PI which can communicate with the ODrive directly, its fantastic web interface that WorkBee CNC has customized for CNC work, silent stepper drives that have things like 256x microstepping stallguard 2 and stealthchop2.

Honestly if I was worried about building a high end CNC mill I would go with LinuxCNC + Mesa FPGA cards. You can get the Mesa FPGA card for like $160 and you get perfectly timed step pulses.

It usually looks like either a lot of fiddling with the Proportional Integral Derivative parameters on your servo controller to try to make things stable, or, if you want a good result, a whole load of weighing and maths.

That’s where ClearPath and a couple of others (there are other self tuning servos out there) seem to have made the real breakthrough. I haven’t had the chance to use them myself yet but from those who have;

The process with the clearpath is to install them and then run their self-tuning mode where the motor makes a bunch of test movements which allows it to measure the system it is now part of. That data gets uploaded over the Internet to the ClearPath platform where it does some maths and sends back the tuning parameters to your motor. There’s quite a few folks out there who’ve installed them and say it works well.

On the downside, servos have no static braking like steppers so you might end up having to run a regular stepper or putting an electromagnetic brake on the Z axis;

I would question whether it’s worth putting a set of servo motors on a Shapeoko at their current cost however, you can buy a closed loop stepper kit for about $80 per unit for NEMA23 with Shapeoko sized torque;

As opposed to about $250 for a ClearPath servo.

There’s little doubt that the ClearPath is more motor, can run faster, can recover from positioning errors rather than just alarming, can rapid faster etc. but I’m not sure the Shapeoko chassis can take advantage of that grunt. As far as positioning and accelleration go, I think the Shapeoko chassis is likely to flex enough to affect accuracy if you drove it as hard as the servos can run. You’d likely end up setting quite small numbers for max speed and accelleration on the servo.

Also, the machine is not rigid enough to stall out one of those closed loop steppers in normal operation, it’s not a mill, it’s a gantry router and not a very heavy one.

I would certainly buy a closed loop system now if I was buying motors and controllers, I think open loop is just out of date and a waste of my money if I care about positional accuracy. Whether I’d pay the extra $500 to go servo, that’s a different matter. They will get cheaper, there will be Chinese clones available in the future, but there’s still a big price difference. The flip-side is that ClearPath has a US distribution and customer support capability and you might decide that makes it worth the extra.

HTH

2 Likes

Hmm, you’ve kinda got me there but I’m not super sure. Per the wiki, the Duet WiFi has 360kHz with one motor and 180kHz with 3. My controller, the EdingCNC CNC720, has “400kHz” but it doesn’t mention whether that’s specified for one motor or all simultaneously. My assumption is that such a specification, without any qualifiers, would mean 400kHz for all axes simultaneously.

Fair enough, seems like you’ve more than done your homework and the Duet is a good choice for you.

If you wanted to go ODrive, expect to learn a lot about how it all works but this guy;

Has had some quite entertaining success in using the ODrive for positional control with cheap BLDC motors and encoders.

1 Like

Without a qualifier in their description I assume companies are listing the best statistic they can for a given requirement. That said it is possible that that is for all axes.

And yes I have been looking at controllers far longer than I have had my Shapeoko.

I don’t have a Shapeoko, I have a Nomad. I’m interested in servos because if I understand right, they can hold their torque at any position and their accuracy is only limited by the resolution of the encoder. With that, my machine’s accuracy would be at the mercy of the ballscrews, which can be very precise, well into micrometer territory.

If I were to go with steppers, I’d pay a lot less but they’re a whole lot less accurate than servos if I understand things right. The only reliably accurate increment a stepper has is a fullstep. Any microstepping and torque drops rapidly, which is important if I’m going to go and throw a heavy 800W spindle on my machine.

So the question is ~$700 to buy servos that will give me micrometer accuracy or ~$100 to buy steppers which can be relied upon for ~20µm.

Really, I could go either way but micrometer resolution is right there for the taking and it’s really tempting.

ODrives can be paired with AS5048 encoders which give a resolution down to 0.00366 of a degree effectively turning them into relatively inexpensive servo motors.

2 Likes

Ah, that’s a bit different then.

In theory vector control drive of a stepper with a sufficient resolution encoder should be able to achieve high torque positioning control in a microstepping mode and achieve a higher positioning precision than the same stepper in open loop;

As the stepper is a motor with more poles the same feedback controls can be used for detailed positioning.

I’m not having much luck finding a decently priced closed loop stepper controller that can get down to that sort of rotary precision though.

Another option, cheaper to start with, would be a geared stepper;

https://www.omc-stepperonline.com/precision-planetary-gearbox/

You’ll lose some top speed but the Nomad isn’t very big so…

Or you could stick something like the Mechaduino on the back of your motors;

https://tropical-labs.com/mechaduino/

Yeah, that’s really nice. The thing that puts me off ODrive is mostly which BLDC motors are appropriate and how to buy them. It might actually be a really good option but I need to research more.

It’s true that it’ll be an improvement over open-loop but fundamentally, the incremental torque is still a sine function, so depending on where precisely you intend to move, trigonometry may or may not crap all over your wishes and there’s not a whole lot an encoder can do to help with it.

I don’t think it’s a stepper controller you want, it’s a motion controller. The TMC4361A is perfect for this and I suspect, like the rest of Trinamic’s stepper products, basically represents the state of the art of what a stepper motor can do.

It can definitely make closed-loop steppers better (as I said earlier in the thread, look at chapter 16) but it’s still fundamentally fighting their foundational concepts, which just doesn’t make much sense to me.

If I want to position a motor at an arbitrary position, a BLDC or servo motor seems to just make more sense.

But then I have to deal with backlash and the inaccuracy introduced by the gearbox itself.

Iunno, it disturbs me that they market a stepper as a servo…

The news I’m sure you’ve all been waiting for! My super exciting polycarbonate windows have arrived!

They don’t work quite as well as the wood but they work well enough. I made a short video with dB levels if anyone cares.

In super-boring uneventful news, V2 of my PCB is being manufactured:

I finally hooked up the E-stop but I also added connections for the 4th axis of my controller. I’m waiting to see if I can get a 4th axis with a harmonic drive reducer that will fit under the Z-axis, otherwise I’ll just get a boring cheap one with belts and pulleys.

2 Likes

I am quite sure we can all agree that it would be the good kind of rediculous!

Pretty impressed by the noise reduction you seem to achieve, do you have a window in both the inner and outer box? Is the dba measurements calibrated?

Yeah, I’m using a box-in-box setup and each box has its own window.

The dB measurement isn’t explicitly calibrated but the app claims to be quite accurate on iPhone due to the consistency of Apple devices.

Subjectively, it seems pretty accurate. I’d say machine’s volume is somewhere around that of a printer, when listening to it while it’s in its enclosure.

@RichCournoyer you asked for 4-axis photos and I can finally oblige!

I just finished all the electronics (soldering the third PCB after killing two previously, adjusting and flashing the firmware, making sure nothing exploded) and haven’t got around to making a proper mounting plate yet but I put the thing in the vice just to be sure I can actually cut stuff :slight_smile:

So here it is:

And here’s a short clip of it running.

I was afraid the motor wouldn’t have the holding power to deal with milling metal (it’s listed as being for “wood working”) but it holds up without any issues.

Not bad for a $120 upgrade :smiley:

I wonder, am I the first to add a 4th axis or did someone beat me to it?

4 Likes

Nice job, and thanks for remembering my request! I looked at that style of rotary but knew it didn’t have enough braking/holding power for a Shapeoko, but never thought about the Nomad’s smaller torque demand. What are you driving it (controller) and what are you using to make the CAM?

First, sorry no…but almost.

1 Like

Yeah, I suppose you’d want one of the fancier reduction mechanisms like a harmonic drive reducer or something, right?

What are you driving it (controller)

EdingCNC CNC720 with Trinamic TMC5160 stepper drivers.

and what are you using to make the CAM?

In this case I just wanted to see if it worked so I just entered G-Code manually (which is why you can see delays in the video). I intend to use Fusion360 mostly but I’m not entirely clear on licensing yet…

First, sorry no…but almost.

Ah, interesting, it looks like he used the same style of 4th axis, even the chuck is the same.

2 Likes

By the way there are plenty of higher-torque options on AliExpress. I even would have bought one, I just wasn’t able to because I needed a smaller option with clearance for the X-axis carriage.

For example this kind came up a bunch.

Thanks!

There isn’t that many rotaries that will fit under the machine…so the choices are…well that one! lol

I use F360 (Hobby/Free License) and the Tormarch 4th axis Post. It works very well on my Shapeoko with minimal editing with one exception (Can Cycles, but I have a work around for that, since I often use Deep Hole Drilling cycles). When you get ready to make some chips and want to know more about it (IF you want to use F360) I’d be more than happy to offer some training via facetime (or sim).

Good luck and enjoy!

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.