586,926 active members*
2,828 visitors online*
Register for free
Login
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Mar 2013
    Posts
    81

    Adding Encoders?

    How difficult and expensive would it be to add encoders to each Axis? I have steppers with 1/2 5 start screws. Mach3 controlling.

    Does Mach3 do encoders? What kind of encoder resolution is needed? I've seen them for as low $16 and up to several hundred $ on eBay but don't know if it is worth the trouble and expense.

    Thanks.

  2. #2
    Join Date
    Apr 2009
    Posts
    5516
    Mach3 does not read any encoer feedback. You need a "hybrid" stepper drive that accepts encoder feedback such as Leadshine. If your steppers are sized correctly you don't need encoder feedback.

  3. #3
    Join Date
    Sep 2012
    Posts
    1195
    Or you could go to analog servos and get an ethernet connected controller that works with them. There are 3 controllers like that available for Mach 3 (kflop, Vital and CS Labs), and they all take encoder feedback to the controller instead of the drives (Leadshine takes the feedback to the drive, but is not used for position correction as it is in the analog servo controllers). So to the question of how difficult, I'd say it's not very difficult at all. They wire up just as easy as any dir/step based drive, just using a different kind of signal. The tuning of the servos is the main difference, but that is done through a Mach 3 plugin where you can monitor the positioning error as you make the needed adjustments until you have them reduced to a minimum.

    As to how expensive, well that's another story and really the main reason you don't hear about these controllers much. I'd estimate that you'd be looking at around $2500 minimum to get all the hardware needed for a true closed loop system. The controller would be between $600-$1100 depending on the brand/model, but keep in mind that these are probably the most robust and industrial Mach 3 controllers available, so not really something you can compare to a basic hobby controller. In addition to the controller cost, if you need smaller analog servos, you're looking at another $350 (minimum) per axis for the motor, drive and encoder. For a mid-sized analog servo/drive combo, you'd be closer to $750-1000 per axis. I'm looking to replace my older servos which I'm driving with an analog Mach 3 controller and it will cost me around $1200-1500 per axis (2.2kw servos) for pretty basic/inexpensive AC servo motors/drives. This basically puts the range from $2500 all the way up to $15,000 (or more) depending on motor size/quality and how many axis you need.

    Other than these analog servo systems, there really isn't a way to get encoder feedback to Mach 3. Even if there were, I don't think that a step/dir system is normally capable of on the fly adjustments to the trajectory like we are used to with analog systems. I'm sure it's possible, and I think that LinuxCNC provides it as an option, but it would take some serious knowledge to implement it to the point where I've never heard of anyone bothering. If time is worth anything, it just makes more sense to buy a controller that supports it and goes together in a matter of hours, not months.

  4. #4
    Join Date
    Jan 2006
    Posts
    2985
    Open loop stepper driven machines make thousands of parts every day. If you need encoders to catch lost steps you are doing something wrong. A properly designed, maintained and operated stepper machine will NEVER miss steps.

  5. #5
    Join Date
    Mar 2013
    Posts
    81
    Quote Originally Posted by keebler303 View Post
    Open loop stepper driven machines make thousands of parts every day. If you need encoders to catch lost steps you are doing something wrong. A properly designed, maintained and operated stepper machine will NEVER miss steps.
    Yes. I just finished rewiring mine with shielded and grounded cable. Then I saw "encoders" on ebay for $16 and thought to myself "Self, did you just screw yourself?" But based on the feedback I'd say I made the right move. Thanks everybody.

  6. #6
    Join Date
    Sep 2012
    Posts
    1195
    Quote Originally Posted by keebler303 View Post
    Open loop stepper driven machines make thousands of parts every day. If you need encoders to catch lost steps you are doing something wrong. A properly designed, maintained and operated stepper machine will NEVER miss steps.
    True, but I think you are only considering one aspect of what encoder feedback can provide, and probably the least important aspect IMHO. The point of encoder feedback to the controller is less about missed steps and more about compensating trajectory during coordinated multiaxis motion. You'll have a hard time finding a high end machine running with steppers for that very reason. If you are cutting straight lines all day, then no problem with using steppers because it will never get off trajectory unless steps are lost (which can be nearly eliminated if properly configured). If you cut any multiaxis motions, that's where you start to see a difference in motion quality between open and closed loop systems. That's not to say that steppers (or open loop step based servos) can't provide acceptable motions, but there is a difference. With a closed loop system, the placement of two axis along a trajectory is monitored by the controller so that at any given time, both axis are timing their motions to match the planned trajectory. With open loop systems, the controller sends pulses to move the motors, but it does not know WHEN the motor achieves those anticipated positions relative to each other between the start and end position other than some expected tolerance within when the pulses are sent. Variations in true acceleration vs. theoretical acceleration of the motors will result in positions that may be out of sync, even if just by a very small amount. Just because a motion starts and ends at the correct position does not mean that it was correctly positioned at a given time in between those points in relation to another axis.

    You can see this effect and how the controller compensates for those errors in trajectory between the start and end points within the software provided with the controller. In the tuning plug-in, you can see the number of encoder counts that the actual position is off from the expected position, and in most cases you see the greatest deviation at the start and end of the motion where acceleration and deceleration forces are present. Once tuned to their maximum ability, servos are then able to very quickly respond to controller compensation and keep the position within a couple encoder counts at the maximum deviation. On a well tuned machine, that's an encoder tolerance of .001mm or less depending on the encoders. On an open loop system, I'd expect that you would see the position error does not get compensated for, so if the initial position is off by 10 encoder counts (as an example) due to acceleration, the trajectory will remain off by those 10 encoder counts for the rest of the move until eventually the deceleration would likely counteract them. The start and end position may be exactly correct, but the entire move in between may be off. Granted, it would be a very small amount, but it is an advantage that closed loop offers beyond just watching for lost steps.

    Another nice feature of closed loop is that it doesn't affect the position of the machine in an E-stop condition. The encoders are still being read, so the position is still known just as well as if the servos/steppers were still active. All you do is reset the machine and keep going. No need to realign the tooling to a fixture or a part that is only partially finished. If you were to push the table with the servos off, the encoder count updates the position in the DRO the same as it would if the machine were on and moved by the servos. Also, homing is done off of the index mark of the encoder without any additional hardware. This can also be done with steppers, but you would need a drive that has a home out signal terminal and a controller that can use it. With closed loop, it's pretty much automatic because the index mark can be found without any special drive hardware. Homing on the index allows you to home the machine to a precise home position every time. In practice, I find that I can home the machine after it's been disconnected from power and it will align with the work that was being performed the previous day without any extra effort. If you use a fixture on your machine, and plan to run the same parts for days, this allows you to turn your machine off every night, turn it on in the morning and just start cutting.

    There are many advantages to closed loop systems beyond watching for missed steps.

  7. #7
    Join Date
    Aug 2011
    Posts
    999
    I would agree with the advantage in an e-stop event. If a stepper is spinning at medium to high rate and is stopped hard you will obviously lose a bunch of steps.

    But I am not sure if I buy the trajectory theory. Assuming the controller is capable of spitting out the pulses when they are due according to the path geometry, IMO the worst that can happen due to acceleration is that the stepper is lagging by a half step. If it was any more, then the torque maximum is exceeded and you will indeed lose a full or more steps. But then the drive is already under-designed. In a well designed open loop system with reasonable margin, the angular error of the stepper should be well less than a half step. In most routers that would be less than the other mechanical uncertainties of the drive (backlash, linearity, flex etc.).

    As for the position memory when turned off, at least the Planet-CNC USB stepper controller that I am using, has that too. When I turn on the machine it will show the last position it had when I turned it off. I can jog the axes without the PC running. This is assuming that nothing moved the axes while turned off (e.g. drooping z-axis).
    Box Joint and Dovetail CAM software here: WWW.TAILMAKER.NET

  8. #8
    Join Date
    Sep 2012
    Posts
    1195
    Quote Originally Posted by JerryBurks View Post
    I would agree with the advantage in an e-stop event. If a stepper is spinning at medium to high rate and is stopped hard you will obviously lose a bunch of steps.

    But I am not sure if I buy the trajectory theory. Assuming the controller is capable of spitting out the pulses when they are due according to the path geometry, IMO the worst that can happen due to acceleration is that the stepper is lagging by a half step. If it was any more, then the torque maximum is exceeded and you will indeed lose a full or more steps. But then the drive is already under-designed. In a well designed open loop system with reasonable margin, the angular error of the stepper should be well less than a half step. In most routers that would be less than the other mechanical uncertainties of the drive (backlash, linearity, flex etc.).

    As for the position memory when turned off, at least the Planet-CNC USB stepper controller that I am using, has that too. When I turn on the machine it will show the last position it had when I turned it off. I can jog the axes without the PC running. This is assuming that nothing moved the axes while turned off (e.g. drooping z-axis).
    Your software looks really cool! Does it require the boards be mounted vertically to do the tails or does it do both the pins and tails on the same angular ramp fixture? I've never been able to do dovetails on my machine since the table moves and there is no space beneath the table to mount a piece of wood vertically. I'm definitely interested.

    With the home on index system of a true closed loop system, it doesn't remember the location because it was left there, it re-homes it's location to .01mm tolerance based solely on the actual location of the index pulse on the encoder (or higher if you have hardware with enough resolution). I could turn power off to my machine, move the table by pushing it by hand, let the Z axis drop (it has a brake, so that would actually be hard to do), or move the z axis across the gantry by hand, but still find the exact same position without any effort beyond hitting Ref All after turning the machine on again. The machine moves to the home switch for each axis, then backs off the switch until it finds the index mark on the encoder. At that point, it sets machine zero for that axis based on the index mark the first time it encounters it after backing off the home switch. Since the index mark is mechanically coupled to the drive system (direct drive in my case), the home position is exactly the same every single time you turn it on. You can set up Mach to call that home position something other than zero, so if you want it to move the table back toward the home switch by 20mm, you could call that index mark +20 in the homing menu of Mach and it would automatically move the table back to machine zero after locating the index in the Ref All, which would be 20mm to the minus side of the index mark. As I said earlier, this can be done with steppers as well, but you just have to be very selective about what stepper drives you choose since they would have to be hybrid "closed loop" drives (I don't like that term for encoder feedback to drives) and they would also need to have a Home output signal. The controller would then need to be able to understand the Home signal and set the home position based on that signal, which originates from the index pulse the same as it does for my machine's servo system. The CS Labs CSMIO IP-M and IP-S both accept home signals and will home on index with them, but I've found there are very, very few stepper drives that have this output.

    As for trajectory errors (following errors), I guess that I have based my thoughts about how steppers are affected by them from the existence of these hybrid "closed loop" stepper drives. These drives have adjustable following error tolerances and will go into fault if they are exceeded. If there were no following errors, there would be no reason for these drives to exist. Perhaps they interpret a missed step as a following error, but that doesn't really seem to fit the concept of following errors. I am not that familiar with how they work to be able to distinguish between whether it is measuring following errors based on trajectory as the term would suggest or based on missing steps. Since they have a tolerance setting, I have always guessed that it would be trajectory based errors, but I would readily admit that I could definitely be wrong. If so, they should not term them following errors as they do since it's not a missed trajectory, but missed steps. It would be more accurate to call them stepping errors if that's the case. At any rate, these following errors are only there to check the encoder data against the steps/dir that were provided by the controller and be sure they are within tolerance. The driver does not know what the real trajectory was supposed to be, only what the trajectory that the controller pulses would have generated.

    The other place where following errors can occur is the controller. Since the controller doesn't really know how the signals it sends out are translating to real world motion, it can't really know if it's on trajectory as it's sending the signals or not. It very well could be that it thinks the acceleration will produces a certain trajectory, but the real world result is different. When the controller sends signals to an analog servo, it does so based on calculations and tuning, but those following errors still result based on the very, very slight miscalculation the controller makes since it can't take every aspect of the machine kinematics into account. It sends the step/dir signals based on theory, just as it sends +/- 10v signals to servos based on theory, so while the motors themselves may not be the direct cause of the missed trajectory, the trajectory may still be off because the step/dir signals are not quite right directly out of the controller. It only has to be off by the tiniest amount to affect the trajectory on a multiaxis move enough to be measurable. It gets off with analog servos, but the encoder feedback allows the controller to adjust in milliseconds (probably faster, I have no idea how quickly it recovers). If a stepper system had encoder feedback, I would bet that corrections to the pulse would be made based on that data.

  9. #9
    Join Date
    Aug 2011
    Posts
    999
    Quote Originally Posted by mmoe View Post
    Your software looks really cool! Does it require the boards be mounted vertically to do the tails or does it do both the pins and tails on the same angular ramp fixture? I've never been able to do dovetails on my machine since the table moves and there is no space beneath the table to mount a piece of wood vertically. I'm definitely interested. .....
    Hey thanks! I don't want to highjack this thread but just as a quick reply: Both boards are clamped to the same 15-degree wedge jig. However....the bad news for moving table machines, since most boards longer than 6-10" would hang down from the jig over the edge of the table they are likely to collide with the stationary machine base (depending on the machine configuration and size). That said, I am not aware that anybody tried it. Maybe it is possible. You can download the software and play with it. The trial version allows for the most common things like drawers etc. The download also contains the drawings and Vcarve files for the wedge jig. For more info just send me a PM or email "info at tailmaker.net"
    Box Joint and Dovetail CAM software here: WWW.TAILMAKER.NET

  10. #10
    Join Date
    Sep 2012
    Posts
    1195
    Double post.

  11. #11
    Join Date
    Jan 2006
    Posts
    2985
    Some quick comments:

    E-stops: They should be used only in rare cases where a feedhold won't do the job. In that case, if it is worth hitting the big red button, it is worth having to re-home your machine.

    Homing: You can "ref all" just the same with steppers or servos. Once you hit your switches and do your sequence, you know where you are. This is the same for everybody unless you have absolute encoders, which know where they are without homing.

    Trajectory: There is no following error in a stepper, if there were, it would stall. Regardless of any delays between a step pulse coming out of mach and hitting your motor, that delay should be the same for all axes so there would be no error in the trajectory. Hybrid "closed loop steppers" treat the stepper motor as a high pole count brushless AC motor and therefore can have some following error just as a normal servo motor would.

    Following Error: Neglecting fancy things like feedforward, a servo loop must ALWAYS have some error. A conventional PID loop will have zero output with zero error. It requires some error to generate an output. That error should be only a few encoder counts, but there must always be error.

    Obviously servos are better, that is why they are used by ALL industrial machine tool builders. This is not meant to be a debate between steppers and servos but rather a reality check to understand the possible benefits of adding encoders to a stepper system and how much hell you will have to go through to make it work as you want. I would NEVER, NEVER recommend adding encoders to any homebuilt, hobby or DIY machine no matter the reason. Mach is a joke when it comes to machine controls anyway and mach cannot even think about using TRUE closed loop control. Any "closed loop" system with mach is not truly closed. It may be closed loop between the motor and drive, like with a servo drive accepting step/dir, but mach cannot read the encoder fast enough to know what is going on let alone alter its output to try to change it. If you need real closed loop control, use a real controller. If you just need steppers, let mach do what it's good at and don't try to bog it down with clunky addons.

    My $.02
    Matt

  12. #12
    Join Date
    Sep 2012
    Posts
    1195
    Quote Originally Posted by keebler303 View Post
    Some quick comments:

    E-stops: They should be used only in rare cases where a feedhold won't do the job. In that case, if it is worth hitting the big red button, it is worth having to re-home your machine.

    Homing: You can "ref all" just the same with steppers or servos. Once you hit your switches and do your sequence, you know where you are. This is the same for everybody unless you have absolute encoders, which know where they are without homing.

    Trajectory: There is no following error in a stepper, if there were, it would stall. Regardless of any delays between a step pulse coming out of mach and hitting your motor, that delay should be the same for all axes so there would be no error in the trajectory. Hybrid "closed loop steppers" treat the stepper motor as a high pole count brushless AC motor and therefore can have some following error just as a normal servo motor would.

    Following Error: Neglecting fancy things like feedforward, a servo loop must ALWAYS have some error. A conventional PID loop will have zero output with zero error. It requires some error to generate an output. That error should be only a few encoder counts, but there must always be error.

    Obviously servos are better, that is why they are used by ALL industrial machine tool builders. This is not meant to be a debate between steppers and servos but rather a reality check to understand the possible benefits of adding encoders to a stepper system and how much hell you will have to go through to make it work as you want. I would NEVER, NEVER recommend adding encoders to any homebuilt, hobby or DIY machine no matter the reason. Mach is a joke when it comes to machine controls anyway and mach cannot even think about using TRUE closed loop control. Any "closed loop" system with mach is not truly closed. It may be closed loop between the motor and drive, like with a servo drive accepting step/dir, but mach cannot read the encoder fast enough to know what is going on let alone alter its output to try to change it. If you need real closed loop control, use a real controller. If you just need steppers, let mach do what it's good at and don't try to bog it down with clunky addons.

    My $.02
    Matt
    You are behind the times when it comes to Mach controllers. I used to think Mach is a joke as well, but found there are some industrial grade options starting to crop up when I was researching controllers to retrofit my router, which is a 4 head industrial stationary gantry machine (weighs in at around 8000lbs). If you compared the operation of my machine to any currently manufactured industrial machine, it would compare very favorably both in how you use it and how fast/accurately it will position. There are three options that offer true closed loop control for analog servo systems and do so via plugins to Mach 3. Kflop does so via USB, but does not have quite the bandwidth needed to provide really high speed motion and high encoder count feedback that would be expected of an industrial controller. It's still a very good controller and can function without Mach as well, which is a nice option. Vital and CS Labs both produce ethernet connected controllers that take encoder feedback directly at a frequency of up to 3-4mhz, which means you can have both high resolving encoders and reasonably high motor speeds. In all three cases, Mach does not do the heavy lifting, but simply supplies an interface and forwards data to the controller while also receiving positioning information for the DROs. Mach does not make the following error correction calculations, that is done at the controller itself. They are, in fact, excellent controllers, even for industrial applications. While they are already suitable for high tolerance machines and I know they have been retrofitted into machining centers, I suspect they will be even more capable when Mach 4 is finally released which will add a lot of software speed at the Mach end of things, making jog motions more instantaneous among other likely improvements to the overall experience. One of the cool things about these ethernet based controllers is that they are programmable, so new features can be added by simply flashing a new version of the controller onto them. All the features you are used to in an industrial control that Mach normally does not have are already present by essentially having the controller do it like a canned cycle (rigid tapping for one), so these controllers have added features that Mach itself cannot perform including the true closed loop system. In a way, the controller is in charge more so than Mach 3. This also allows Mach 3 to run on just about any computer since it really is not doing any of the significant computing, but deferring that task to the controller instead (I use a 6 year old laptop to run mine and it's never had so much as a hiccup). A 3-4mhz encoder sampling is more than fast enough to make adjustments to the output. In theory, you could run a 3000rpm motor at full speed with up to a 50k-80k encoder count on the Vital or CS Labs controllers, or a lower encoder count at faster RPMs. I'm only running mine (CS Labs CSMIO IP-A) with the machine's original 1990/91 motors/encoders at 1000rpms and a 2000ppr count (both motors and encoders are old and will be replaced in the new year) and it is starving for data to make the needed trajectory corrections.

    There are more conditions than hitting E-Stop that would put the controller into an E-stop condition. Limit switches, spindle errors (overdrawing current causing a shut down of the spindle), servo stepper drive errors, vacuum system drops below minimum, air supply pressure drops below minimum, etc. can all put the machine into an E-stop condition as they should. Even if you re-home your machine without a closed loop or home out signal, you will not necessarily be in exactly the same home position. Home is a relative concept when you are homing off of switches. You don't need absolute encoders for home on index to work, and I speak from experience as mine does exactly what I've described and is a Mach 3 system. The axis moves to the home switch until it is engaged, then it backs off of the home switch until it encounters the first instance the index mark is found. If the encoder is mechanically linked to the drive system, this position will be the exact same spot every single time. If you are using belts, it is possible for this to change if the belt slips, but I have not seen that happen unless there is a mechanical problem, so even a belt driven system will have the index mark align to the axis near the limit switch the same way every time. Obviously, any slop in the system will hurt this function, but even with backlash it should still position very accurately so long as there's say 3/4 of a turn after changing directions before the index mark is found. This can also be done with a hybrid stepper system that has a home output combined with a controller that has a home input. I'm not familiar with every Mach 3 controller, but the CS Labs step/dir controllers are capable of homing on index. Finding a stepper driver with home output is not so easy though since there aren't many controllers that could even use it. I think you'll start to see this feature crop up in various Mach controllers as it becomes more known, which will also create a need for drivers that offer it.

Similar Threads

  1. SEM encoders
    By vidio1 in forum Servo Motors / Drives
    Replies: 2
    Last Post: 05-01-2011, 02:28 AM
  2. cheap absolute encoders? Oxymoron? Decent Incremental encoders?
    By mattbesquare in forum Benchtop Machines
    Replies: 15
    Last Post: 09-09-2010, 12:56 AM
  3. Replies: 0
    Last Post: 05-28-2008, 04:37 PM
  4. Encoders
    By ramasule in forum DIY CNC Router Table Machines
    Replies: 3
    Last Post: 12-24-2007, 07:27 PM
  5. Encoders-to be-or not to be
    By Georgie in forum Stepper Motors / Drives
    Replies: 2
    Last Post: 02-16-2005, 09:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •