586,239 active members*
3,483 visitors online*
Register for free
Login
Results 1 to 18 of 18
  1. #1
    Join Date
    Mar 2009
    Posts
    45

    Mach 3 and encoders?

    I have my cnc router set up and running fine. However, I came across 3 rotary encoders that will fit my stepper drive motors on my machine. Is there a tutorial or set of instructions on how to go about integrating drive motor encoders into Mach 3? There seems to be some options for encoders in the software, so I wonder if it could be done with stepper motors rather than typical servo motors. Anybody doing this or have experience with it?

    Thanks in advance!

  2. #2
    Join Date
    Jan 2006
    Posts
    2985
    Not sure what you wish to do but the most likely response is "Mach3 does not work with encoders".

    Search. Read.

  3. #3
    Join Date
    Mar 2009
    Posts
    45

    ok, any stepper driver boards with closed loop encoder inputs?

    well, it would be nice to use the encoders as error traps for things like lost steps, etc. but apparently since Mach3 is openloop, that can't be done at the software level... So, thanks for the response. My only remaining question is are there stepper drivers that have encoder inputs??

    Thanks again

  4. #4
    Join Date
    Jan 2006
    Posts
    2985
    A stepper is always running at full torque. If you develop some error, you have already exceeded the available torque and have lost steps. If you have lost steps, the part is already scrapped and it is too late to correct for it. Additionally, mach3 does not have any way to know it has lost steps and correct for it, so it is moot to have the encoder data available. In some applications, it might be useful (and you will find encoders on some stepper systems), but for the most part you build the machine properly to suit the expected loads and you will never miss steps, thereby negating the need for encoders or any type of error trap logic.

  5. #5
    Join Date
    Mar 2009
    Posts
    45

    What to do with those nice encoders, then??

    So, if you build it right, there won't be missed steps or slips, etc.. I get it. I hear a lot about missed steps so I assumed being inexperinced that this was fairly common. Must be more of an issue with prototyping new systems and not so much with established working equipment. Thanks for your insights.

    Know anyone who needs 3 nice encoders for 1/4" shafts?

    Regards,

  6. #6
    Join Date
    Jun 2007
    Posts
    3757

    Cool

    The faster the PC, with enough memory the better for Mach3. And NO DMA interrupts.
    Your driver step stream is not coming out smoothly.
    Above a critical speed, missed steps occur if pulse timing forces the motor below the critical speed, even for one missed step.
    I run my machine at half it's maximum speed, so even miss timed pulses can not cause errors, and never do.
    I hear the clunk but never miss steps at my highest speeds.
    I rarely miss the high speed rapids I have sacrificed.
    Might get a better PC one day, with a SCSI drive if I can find one. hahaha
    IDE drives will usually cause intermittent grief.
    Time
    Super X3. 3600rpm. Sheridan 6"x24" Lathe + more. Three ways to fix things: The right way, the other way, and maybe your way, which is possibly a faster wrong way.

  7. #7
    Join Date
    Mar 2009
    Posts
    45

    great help

    Thanks for the quite helpful information neilw20. Adding the link was was appreciated as well.

    I'm running an older Dell PC (circa 2005) on my cnc machine currently, so you may be right on as to one source of missing step issues. I have noticed a few dropped steps so when I can I'm being very cautious with the transit speeds. I asked about the encoders mainly because I'm always up for an extra level of oversight/error trapping as well as another learning opportunity. Plus the encoders were given to me in trade for some cnc work, so they were essentially free. Little to lose here so that's no motiviation.

    I could be out of my tree here, but after thinking about this open loop feature of Mach 3, I believe a simple circuit could be designed that would monitor the input to the step drivers from the brk out board and, through the use of a few ICs and some simple circuitry, look for errors between the stepper driver contol steam and the encoder output. When an anomaly appears, such as a missing or lagging pulse from the encoder, this improvised circuit could simply provide an Estop emulating signal to the BOB to stop the machine. I'm not an expert here, but it sounds like an interesting project (parts needed: a comparator or 2, some ganged divide-by-x counters, and a few other ICs could do it I think. In fact a simple PIC or Arduino circuit would probably work just as well). Since the interrupt would be at digital speeds, machine travel would stop in most cases prior substantial damage to the part. And, I'm thinking chances are good you could change the settings on the machine or your program to make lighter cuts, slower speeds, etc., and then rewind a line or two of the program and continue on--hopefully saving the part from the recycle bin. I sometimes run at the edge of my machine capability limits in an effort to follow the rules for material feeds and speeds with my home made cnc, and truthfully, I experiment a lot with materials and cutters so capturing missed steps could be of use, at least to me.

    And I say all this despite knowing that some will see this "project" as a waste of time (kind of like overstocking a 5L chevy for your boat pwer system instead of buying a real motor like a 5.7 or 6.4L; yes, an off the wall example, but personally relavent). Or, it's a lot of work just to deal with a problem that's easily avoided. These kinds of speculative one-off projects aren't for everyone, granted. And, no doubt, there are lots of folks who've already done this very thing and have disproven or proven its utility. If you have done this successfully on not, I'd appreciate hearing your experiences. Thanks in advance.

    This is a great forum because for the most part so many come to the table as you have with what you can do, not what you can't. I rambled on here so apologies for that. Thanks again for your helpful post, Neil. Best regards.
    Keith

  8. #8
    Join Date
    Jun 2007
    Posts
    3757
    You can do all that error trapping, but it sure is easier just to get a faster PC off the hard rubbish collection.
    I reduced my motor tuning from 2500mm/min to 1500 and not missed a step in over 2000 hours.
    I have not busted one $45 cutter (33 of them), or stuffed up one job.
    The only stuff up is when I set a zero incorrectly, due to brain fade.

    A faster PC is reserved for my bigger machine, with 3 phase steppers.
    6000mm/min 6000RPM 2HP - in development with a PDB and ATC. Ready next year.:cheers:
    Super X3. 3600rpm. Sheridan 6"x24" Lathe + more. Three ways to fix things: The right way, the other way, and maybe your way, which is possibly a faster wrong way.

  9. #9
    Join Date
    Jan 2005
    Posts
    1943
    Quote Originally Posted by keebler303 View Post
    A stepper is always running at full torque. If you develop some error, you have already exceeded the available torque and have lost steps. If you have lost steps, the part is already scrapped and it is too late to correct for it. Additionally, mach3 does not have any way to know it has lost steps and correct for it, so it is moot to have the encoder data available. In some applications, it might be useful (and you will find encoders on some stepper systems), but for the most part you build the machine properly to suit the expected loads and you will never miss steps, thereby negating the need for encoders or any type of error trap logic.
    Not necessarily. Lets just say that you are machining a part and the machine is travelling in the +X direction. Now lets say it loses a few steps on this X axis move. If you were to catch this and stop the machine before a Y axis move was made you could re-zero the machine, slow down the feed rate re-run the program and salvage the part. So, lost steps don't automatically mean a scrapped part.

    Also, lets say the part has a tolerance of + or - 0.010". If you have the system set to shut off if following error gets to 0.002" then you still have 0.008" to play with.

    LinuxCNC actually has the ability to do exactly what the original poster is seeking. Add an encoder to the stepper to monitor and if lost steps are detected then stop the program (following error). The tolerance for lost steps can be adjusted. I actually plan to do this on my machine. Here is some info from linuxcnc.org:

    LinuxCNC Documentation Wiki: Steppers With Encoders

  10. #10
    Join Date
    Mar 2003
    Posts
    35538
    LinuxCNC actually has the ability to do exactly what the original poster is seeking
    You can actually do the same thing with Mach3. There's a commercial product that comes with a Mach3 plugin that monitors the encoders. Originally it used a macro, which would not be terribly difficult to write.

    I also believe that if you use a KFLOP motion controller with Mach3, it's capable of running the steppers closed loop. I know it is when used with Dynamotion's software.
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  11. #11
    Quote Originally Posted by ger21 View Post
    You can actually do the same thing with Mach3. There's a commercial product that comes with a Mach3 plugin that monitors the encoders. Originally it used a macro, which would not be terribly difficult to write.

    I also believe that if you use a KFLOP motion controller with Mach3, it's capable of running the steppers closed loop. I know it is when used with Dynamotion's software.
    Agreed! Honestly, why not run a closed loop with encoders? It only benefits you. Don't let the fact that it might be "a little hard to integrate" stop you from you and your machines full potential.
    www.socalpe.com offers CNC retrofit kits, CNC repair services, CNC motion controls, and a variety of CNC Components and accessories.

  12. #12
    Join Date
    Mar 2009
    Posts
    45

    So glad I asked... now

    Thanks to SoCalPE, ger21, 109jb for your very constructive posts and links. Hotdamn, I've got another project. Folks like you are the reason this zone is priceless. The exchange of valuable yet free information here is a model for our commercially stoned society.

    I think with the help I've gotten so far, I'm on my way to a start. I'm sure I'll have more questions as I go. Been looking into quadrature and types of encoding and my learning curve is at the toe of the slope, unfortunately.. That's where it always starts through.

    Thanks again all.
    Keith

  13. #13
    Join Date
    Jan 2005
    Posts
    1943
    Just wanted to point out that with LinuxCNC you can do the "encoder on stepper to monitor following error thing" right through the parallel port without buying an expensive add-on board. If you need more pins for inputs then you can just buy another parallel port board on e-bay for about $5.

    I'm not sure if this is capable of being done this cheaply on any other system. Myabe, maybe not, I just don't know the other systems.

    This of course assumes that you are using a computer with a parallel port and have an expansion slot for another parallel card.

  14. #14
    Join Date
    Mar 2003
    Posts
    35538
    Just wanted to point out that with LinuxCNC you can do the "encoder on stepper to monitor following error thing" right through the parallel port without buying an expensive add-on board. If you need more pins for inputs then you can just buy another parallel port board on e-bay for about $5.
    You can do the same thing with Mach3. There's no need for any add on board.

    The difference is that with Mach3, you need to write your own code to do the monitoring, either as a VB macro, or a plugin. If you buy the expensive add on board, it comes with the plugin.
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  15. #15
    Join Date
    Jul 2003
    Posts
    1754
    The onlything I would add - If you are doing it with a macro/vb within mach - it isn't realtime. The only realtime part of mach is the printer port driver. So - there is a chance that the error is not detected for a bit. (how ever lon the 'bit' is as it is unknown with windows)

    With linuxcnc - it is reading the encoders in realtime. it will know the position and error atleast a 1000 times a second. (you can run it faster but probably 10khz may be pushing it. (but 1khz works great).

    there are also atleast 2 ways to setup steppers with encoders.

    - One is to just use the encoders for checking following error - the machine would estop when the error is greater than what you have set.

    - The second is to setup a PID loop so if there are a few steps lost here and there (no stall) Linuxcnc will correct. A stall or deviation from actual path that is higher than your set following error will still trip an estop..

    - there is a third that has been thrown around that involves using adaptive feed control - This would work by lowering the feed rate as the following error increases. Again - this has never been experiemented with that I know of.

    In my opinion - if your going to use encoders - might as well go servos.

    sam

    Quote Originally Posted by ger21 View Post
    You can do the same thing with Mach3. There's no need for any add on board.

    The difference is that with Mach3, you need to write your own code to do the monitoring, either as a VB macro, or a plugin. If you buy the expensive add on board, it comes with the plugin.

  16. #16
    Join Date
    Mar 2009
    Posts
    45

    more steppers than servos

    Unfortunately, I've more steppers than servos and the 2 servos I have are both Animatics. I've searched Animatics servos on CNCZ and using them appears to be a can of worms and beginner level explanations and "how to's" are not plentiful. Not to mention, I haven't heard of anyone mixing motor designs; servos and steppers on the same machine. Running a 3 axis machine with only 2 servo motors would require some serious, serious creativity. I imagine it can be done given the depth and knowledge that this crowd has. (I would think very hard before saying anything couldn't be done anywhere in this forum.) However, I'm not sure I could pull it off. And, I'm trying very hard to create the best machine I possibly can using the lifetime worth of parts I've already acquired. It's difficult to justify buying another expensive part when I can barely make room for all the parts I have. And if every time I need something to make it easier I just buy it, what fun would that be? In a perfect world I would use servos probably over steppers, but there's a number of threads that address this issue and I don't want to stir up this issue here.

    So, I'm trying to evaluate all the suggestions and figure out what would fit my situation best. Using Mach 3 on a windows machine currently. Been toying with the idea of using Linux CNC but know next to nothing about Linux. It appears that the encoders can be integrated fairly easily with a change of CNC programs. Lot's to figure out here. Thanks again for all the input.

    Keith

  17. #17
    Join Date
    Jan 2005
    Posts
    1943
    Quote Originally Posted by samco View Post
    The onlything I would add - If you are doing it with a macro/vb within mach - it isn't realtime. The only realtime part of mach is the printer port driver. So - there is a chance that the error is not detected for a bit. (how ever lon the 'bit' is as it is unknown with windows)

    With linuxcnc - it is reading the encoders in realtime. it will know the position and error atleast a 1000 times a second. (you can run it faster but probably 10khz may be pushing it. (but 1khz works great).

    there are also atleast 2 ways to setup steppers with encoders.

    - One is to just use the encoders for checking following error - the machine would estop when the error is greater than what you have set.

    - The second is to setup a PID loop so if there are a few steps lost here and there (no stall) Linuxcnc will correct. A stall or deviation from actual path that is higher than your set following error will still trip an estop..
    I have seen where this has been talked about, but I have not read anywhere that this has actually been done successfully. If the stepper is losing steps then the torque capability has been exceeded and there is nothing you can do to increase torque on a stepper other than slow it down like in the third option you mentioned. It seems to me that this option wouldn't have much chance of success, but if someone has already done this and it does work then that is some news.

    Quote Originally Posted by samco View Post
    - there is a third that has been thrown around that involves using adaptive feed control - This would work by lowering the feed rate as the following error increases. Again - this has never been experiemented with that I know of.

    In my opinion - if your going to use encoders - might as well go servos.

    sam

  18. #18
    Join Date
    Mar 2009
    Posts
    45

    Understand your point

    I agree that for seasoned users, there may be less than a strong justification. Granted. However, for those of us testing the waters and learning the discipline of cnc operation, If I see that I'm losing steps it's probably because I've set, rpms, F, or depth step wrong, which can be corrected, the program restarted, and continued.

    I'm sure there's a lot of things discussed in threads here that most expert cnc operators and builders roll their eyes at. But, hey, no one starts out an expert.

    I like the adaptive feed control idea. Smart CNC.

    k

Similar Threads

  1. Mach 3 and encoders
    By nelZ in forum Mach Mill
    Replies: 3
    Last Post: 11-20-2012, 07:02 PM
  2. Mach 3 Encoders ??
    By Biggermens in forum Machines running Mach Software
    Replies: 3
    Last Post: 12-15-2011, 09:18 PM
  3. cheap absolute encoders? Oxymoron? Decent Incremental encoders?
    By mattbesquare in forum Benchtop Machines
    Replies: 15
    Last Post: 09-09-2010, 12:56 AM
  4. Confused: Mach Turn, Mach Mill, Mach 2/3 ?
    By CanSir in forum Mach Software (ArtSoft software)
    Replies: 5
    Last Post: 02-16-2007, 11:41 AM
  5. mach and steppers with encoders
    By dertsap in forum Machines running Mach Software
    Replies: 3
    Last Post: 09-03-2006, 10:25 PM

Tags for this Thread

Posting Permissions

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