Shop OBEX P1 Docs P2 Docs Learn Events
CNC Homing And Over-Travel Discussion — Parallax Forums

CNC Homing And Over-Travel Discussion

idbruceidbruce Posts: 6,197
edited 2014-04-25 20:32 in General Discussion
Hello Everyone

I am currently considering homing and over-travel issues, so I am wondering what others are doing and what kind of successes or failures they have encountered. As usual, there are several ways to do this, hall effect sensors, proximity switches, slotted optical switches, limit switches, etc... or no switches at all, with simple hard stops.

I came across a PDF which discusses three common methods and it is woirth reading just for the basics, but I want to get a little more in depth. This PDF can be located here: http://www.galilmc.com/support/appnotes/optima/note2448.pdf

I personally like the idea of hard stops for a 3D printer, but I am unaware of a method to measure the torque of a stepper motor.

Anyway, let's hear what you have to say.
«13

Comments

  • Ken GraceyKen Gracey Posts: 7,392
    edited 2014-04-22 12:29
    I'll give one piece of advice - take it or leave it. If you're cutting aluminum you absolutely need flood coolant. While mist systems are a good start, they are not nearly as effective as flood coolant systems. And once you have coolant, you'll be damaging whatever over-travel switch system you install. Limit switches and optical sensors must be fully shielded and enclosed from coolant, else it's just a matter of time before they fail. Large, professional machines have carefully designed these into their systems with force-feedback sensors of several types, but this issue often plagues the home shop machinist.

    Ken Gracey
  • idbruceidbruce Posts: 6,197
    edited 2014-04-22 14:10
    Ken

    Thanks for your input, which really got me thinking about the hard stop method. Did you read that PDF?

    As applied to stepper motors, more particularly stepper drivers, I am now wondering whether the current changes as the load is increased or decreased. Taking the Gecko G251X for example, this drive will handle 3.5A per phase with a heat sink. The maximum current delivered through this drive can be adjusted with a single 1/4W resistor. For the sake of discussion, let's assume that the maximum desired current is 2.0A, which is set by the appropriate resistor value. My question now is whether or not that 2.0 Amps is being constanly applied to each phase or does the amperage change according to the load? If the amperage changes, it should be simple enough to monitor the amperage of the drive and apply it to a torque limit, which would indicate that home has been reached or whether an over-travel condition exists. This would eliminate sensors and switches.

    I imagine this could be useful for other types of drives as well, and may be a solution for coolant flooded environments.
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2014-04-22 14:15
    Maybe, but by the time you've hit the limits your motor has already ground a few steps before you sensed the physical limitation. My thoughts are that it's already too late to sense end points in this way. What about digital encoders that provide serial output? Then you never even need to let your machine destroy itself. Look, I'm the wrong guy to say much more because I tend to use what's proven already unless it's something I'm trying to create. CNC can deliver enough challenges in the drawing, tooling, CAD/CAM area without consideration to building machines, so I usually roll with off-the-shelf complete systems as much as possible.

    I've used the Geckos before, but not with current sensing.

    And no, I didn't read the whole PDF. I don't have the time today, unfortunately.

    Carry on - I'll lurk and check in on this interesting thread.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-22 14:15
    Well, it would be nice to use devices that don't require more code... sensors that don't require debouncing or opto-isolated switches that do bounce..

    Ken jumped in with flood coolant messing up nearly everything, but you are thinking 3D printing. I'd go with optical breaks or hall-effect sensors.

    But I wouldn't have these stops represent a calibrated X0 Y0 or Z0. They would be in negative regions (a few steps beyond where home base should be) and act only as fail safes.

    Of course, there would be limit switches at both extremes and that annoys me a bit as they eat up a whole six i/o pins. Full control of 4 steppers( enable, direction, and step) eats up 12 i/o. So you have 18 pins consumed already.

    In the scheme I am thinking the Propeller will have 3 or 4 used for I2C to an ADC chip, likely 3.

    So starting with 28 available, 21 are a committed, 7 remain for heater PWM print heat and bed heat, power on/off, fans, a kill switch, and such.
  • idbruceidbruce Posts: 6,197
    edited 2014-04-22 15:43
    Loopy

    Yeah, one Propeller is cutting it pretty close for a 3D printer.

    However, I did start this discussion for all types of CNC homing and over-travel, not just 3D printing. And yes, Ken threw a very valid point into the subject.

    Theoretically speaking, there should be no need for home or limit switches. In the case of hard stops, when you first start the machine, if the torque (current) limit is obtained within one index point, you know you are already against a stop, and if that is the case and you are going in the direction of a homing stop, simply reverse one index point and mark zero, if not then slowly reverse in the opposite direction until the torque (current) limit is obtained, then reverse one index point and mark zero.

    In my opinion, all axes should have hard stops anyhow, to prevent machine damage, and to me, the other switches and indicators would be a waste of time, energy, and space, providing the machine is indexed correctly to zero and no over-shoots occur. However mistakes will be made, therefore if switches are used, I believe they should only be used as an indicator that the end is near.

    In normal situations, I would say that zero should be nowhere near the beginning of possible linear travel and the workpiece should stop way before the ending of possible linear travel can be reached. So in other words, you obtain the location of the stop near the beginning of linear travel, then pick an arbitrary reversed index point and make it zero, as is the case when zeroing to a fixture or workpiece. At which point, the limit of travel would become the width of the fixture or workpiece, and the stop at the end of linear travel, would only be there to prevent severe damage in case of a coding error.

    EDIT: However, the above arbitrary zero scenario could not be applied to the Z axis.
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2014-04-22 15:52
    idbruce, once you've got micro stepping controls set up you will be able to calculate and measure the number of steps required to travel a certain distance. This can be used to store your X/Y/Z location in memory and you might not even need limit switches just like you suggested. The problem comes when you have to identify 0,0. You need to run into the corner, back off a bit, and set it. I think the limit switches could be used for determining the 0,0 origin and after that you can drive the steppers open-loop and stay within your work envelope, a half-inch from danger on all three axes.

    Backlash will need to be measured with a dial indicator. I'd put the money into ballscrews, too.

    Limit switches have always been a problem on my desktop mill. Once you hit them, whatever part you were making is wrecked since you lost your location. Would've been better if my work envelope was properly defined in whatever CAM program I was using.

    Ken Gracey
  • idbruceidbruce Posts: 6,197
    edited 2014-04-22 16:03
    Ken
    Would've been better if my work envelope was properly defined in whatever CAM program I was using.

    EXACTLY!!!!! The work envelope should be determined before any machining begins, to ensure it fits within machine parameters.

    I am now wondering if you read my last post, since we both posted at about the same time.

    EDIT: EXACTLY!!!!! The work envelope should be determined before any machining begins, to ensure it fits within machine parameters (Between any limit switches that may exist).

    EDIT: Much of this is definitely a software issue.

    EDIT: If limit switches are utilized, I am now beginning to think they should be considered E-Stops, providing current sensing is possible to detct torque limits, and the hard stops are only there to help set zero and to prevent severe damage to the machinery. However, if limit switches are utilized, as Ken suggest, zero and over-travel could be and in my opinion should be established before reaching the switches.
  • jmgjmg Posts: 15,173
    edited 2014-04-22 16:19
    idbruce wrote: »
    My question now is whether or not that 2.0 Amps is being constanly applied to each phase or does the amperage change according to the load? If the amperage changes, it should be simple enough to monitor the amperage of the drive and apply it to a torque limit, which would indicate that home has been reached or whether an over-travel condition exists. This would eliminate sensors and switches.

    Stepper motors are not quite like DC motors, in that Steppers are usually current driven, and the motor speed sets the back EMF, which determines the voltage seen across the motor. ( Current Drive does not care what voltage drop there is ).

    That makes simple current-sense not much use, but you could detect voltage changes that are unexpected for the speed, and so sense a stop.

    Google finds this, covering exactly that topic
    http://www.edn.com/design/analog/4368829/Back-EMF-method-detects-stepper-motor-stall
    For an ST part


    There they mention reading the actual micro-stepping -> Sine.Cosine reference -> local FB PWM drive current regulate and feeding back that local Drive PWM regulation loop (usually simple analog schmitt-comparator) to give info on the Back EMF.
    A Prop can check an external PWM waveform fairly easily.

    OnSemi have parts (NCV70521) saying
    ["The chip provides a so−called “Speed and Load Angle” output. This allows the creation of stall detection algorithms and control loops based on load−angle to adjust torque and speed."]


    Cheap printers seem to simply overdrive at power up, at lower speeds, into a soft-stop, so they then know where one edge is.
    After that, they rely on not missing steps to keep track of XY space.
  • idbruceidbruce Posts: 6,197
    edited 2014-04-22 16:36
    jmg

    Thanks for the info, I will look into that. As for the following comment:
    After that, they rely on not missing steps to keep track of XY space.
    Unless you want to invest in linear or rotary encoders, what other option do you have? I like the idea of linear encoders in a linear drive, but to obtain that, there is a lot of design considerations and additional cost.
    Cheap printers seem to simply overdrive at power up, at lower speeds, into a soft-stop, so they then know where one edge is.

    And just exactly how do they know when the soft stop is reached? Do they run slow for the maximum possible extent of travel?
  • jmgjmg Posts: 15,173
    edited 2014-04-22 16:50
    idbruce wrote: »
    And just exactly how do they know when the soft stop is reached? Do they run slow for the maximum possible extent of travel?

    Good question - I suspect something of a hybrid combination, of both simple stall-sense, and deliberate over-stepping, but I have not tried moving the head to extremes on power-off.

    At lower torques, you can give enough steps to ensure you must reach one end stop. (soft here means some shock absorber action, but it also needs to be not so soft that an accurate physical zero is lost )
  • idbruceidbruce Posts: 6,197
    edited 2014-04-22 17:03
    It is all coming back to me now..... the difficulties of stall detection with stepper motors. I had forgotten all about that.

    As jmg indicates and as the article he linked to outlines, there are chips and drivers available that enable or indicate stalls, but the Gecko G251X is not one of them. :(

    Although this is an open discussion, I believe my best bet for the current task will be to combine jmg comments with Kens advice:

    jmg said:
    Cheap printers seem to simply overdrive at power up, at lower speeds, into a soft-stop, so they then know where one edge is.

    and Ken said:
    You need to run into the corner, back off a bit, and set it.

    I believe by combining these two and ensuring the work envelope is well within machine parameters through software, I believe the home and over-travel switches can be eliminated, at least for a 3D printer.
  • $WMc%$WMc% Posts: 1,884
    edited 2014-04-22 17:26
    I use limit switches as a means of preventing damage to the machine.Simply an E-Stop.
    '
    The only time I have ever hit a limit switch is because of a loss of steps on a stepper motor. When this happens the software thinks a certain axes is at this location, But in fact it's farther one way then it should be. My limit switches are all wired back to inputs as "over travel stop everything" Abort...
    '
    I have found that just a tiny Little knot in a piece of Oak can cause steps to be lost on a stepper from increased tool pressure.
    '
    I'm in the process of adding encoders to my NEMA 23 steppers. I think this is a must to determine where the axis really are.
    '
    I really like the code "JonnyMac" showed in his article in Nuts&Volts magazine (Spin Zone 3/2014). It uses shift Reg. to free up some I/O pins on the Prop. He has a PASM version that's really fast.
  • kwinnkwinn Posts: 8,697
    edited 2014-04-22 17:26
    Well designed hard stops provide the most accurate and repeatable positioning, with the possible exception of a laser measurement system. A ball screw turned by stepper motors with optical encoders on the motor shaft would provide excellent precision and a method of sensing when the stop is reached.
  • idbruceidbruce Posts: 6,197
    edited 2014-04-22 17:43
    I get the sense that nobody has any faith in the accuracy of GT2 timing belts :)
    A ball screw turned by stepper motors with optical encoders on the motor shaft would provide excellent precision and a method of sensing when the stop is reached.

    Okay Kwinn.... Thank you very much for your input... I am going belt drives for X and Y, but I really like the idea of optical encoders on the motor shaft to detect stalls or the reach of a hard stop. And considering my motors are dual shaft, that is a perfect solution. One of those cases.... Why didn't I think of that? Anyhow, it gives me a chance to plug US Digital encoders, I now wish I had three of them:
    Walt - And thank you for all of the valuable information provided in your post.

    EDIT: However with the use of screws, you also gain a mechanical advantage, but with belts, you gain the advantage of speed. I can't drive 55 :)
  • kwinnkwinn Posts: 8,697
    edited 2014-04-22 17:56
    BTW, the encoders could also go on the ball screw shaft. It would be lower resolution but would compensate for any lash up to that point. Also keep in mind that it is possible for one of the encoder signals to be toggling when the carriage is at the stop position. The stepper tries to step, the carriage hits the stop, and on the next step the motor moves back.
  • $WMc%$WMc% Posts: 1,884
    edited 2014-04-22 18:08
    The drive is not the problem...It's real motor slip.
    '
    I have set my CNC machine up and have it carving away....Then I hear that distinct sound a stepper makes when it's missing steps. It goes from a hum to a buzz.
    '
    I got to aggressive with the feed rates and usually junked out the material I was carving when this happens.
  • idbruceidbruce Posts: 6,197
    edited 2014-04-22 18:08
    Kwinn

    That is another very good point:
    The stepper tries to step, the carriage hits the stop, and on the next step the motor moves back.
    So this must be written into the control software that if the maximum amount of steps has been taken, then this condition exists.
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2014-04-22 18:32
    Bruce, I understand mostly why people build things they can buy - learning experience, satisfaction, etc.

    But 3D printers are everywhere right now and they're almost in a race to the bottom price-wise. They keep getting cheaper and cheaper, and sometimes even better.

    How come you want to build a 3D printer? What are you going to do differently in your design?

    I'm interested in what you're doing here, not accusing you of making silly choices.

    Ken Gracey
  • idbruceidbruce Posts: 6,197
    edited 2014-04-22 18:38
    Walt
    The drive is not the problem...It's real motor slip. I have set my CNC machine up and have it carving away....Then I here that distinct sound a stepper makes when it's missing steps.

    Believe me, I understand. Of course, we are talking about all types of application and not just mine. In your type of application, the load can be very unpredictable, such as hitting a knot like you described, but in the instance of a common printer or a 3D printer, I believe the load is much more predictable, with the possible exception of the extruder, where a jam might occur.

    Many of you have probably heard me say the phrase "wirery mess", but I never really got into talking about it. In the 3D printer thead, I was talking to Peter about clearance issues, and the problems with clearance pertaining to the spring bender CNC.
    0.020" clearance anywhere in the wires path would bring that machine to a grinding halt and perhaps a wirery mess.

    I was not joking, and I had many wirery messes due to clearance issues :)

    You have to remember that it was all built from scratch, both mechanical and software. If there was a mechanical issue, and the software did not compensate for that issue, steps would be missed, the machine would keep feeding wire, etc... Then the whole machine would need to be recalibrated, just because of a few steps. The wire cutter needed extreme accuracy, one single missed step in a production run, and there was a wirery mess and a lot of down time. A later fixed that issue by putting a proximity sensor in the bending table to detect if a completed spring had exited the table at the appropriate time, through the software, if not, the machine was shut down. Until I did that, missed steps were an absolute headache and there were many wirery messes. And of course there were other areas where missed steps would create serious havoc, but the cutter was the worst. In all cases, with the proximity sensor, a completed spring must leave the table before more wire would be fed. It took a lot of time to remedy missed steps in all the various stepper motors.

    I am truly thankful for that proximity sensor :)
  • T ChapT Chap Posts: 4,223
    edited 2014-04-22 18:41
    A $5 switch only on one end of travel suffices on tens of thousands of cnc's on the market for homing. Stall sensing seems way overkill for a 3d printer. It is a simple matter to count the step output from the Prop simultaneously with counting a quad encoder on the shaft. If the difference is > X, shut down. But on a printer? Why bother. The feed rate before "stepper squeal" is quite easy to find, just stay some margin below and there is no need for any closed loop efforts. A good practice is safe/software limits in all directions that do a graceful decel if exceeded to maintain sync from controller to stepper.
  • $WMc%$WMc% Posts: 1,884
    edited 2014-04-22 18:48
    Thanks T Chap
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2014-04-22 18:53
    $WMc% wrote: »
    Thanks T Chap

    Yep, also agree with T Chap. And Walt, where the heck you been? In a Florida swamp? Either you haven't been here for a long time or I've not run across you as much as in the past.
  • idbruceidbruce Posts: 6,197
    edited 2014-04-22 19:00
    Ken
    How come you want to build a 3D printer? What are you going to do differently in your design?

    I'm interested in what you're doing here, not accusing you of making silly choices.

    My main objective is to test my new design of linear actuators. I have eliminated many costly components in this design and they should be easy to reproduce. I am not saying they will work, but I must build them and test them. For the most part, 3D printers are supposed to be the next big thing, so I want to test my actuators in something that has a foreseeable future. If my design works and it is durable, then I believe there might be a situation where I can compete against parts and labor. In addition to being low cost, they will also be pretty rugged, but only acceptable for light loads, such as a 3D printer.

    As mentioned elsewhere, I have another similar prototype that I built, and it worked well as long as the temperture was stable. In this design, I have tried to compensate for variances in temperture. However, by altering the design, I believe I also heavily reduced the load capacity of the actuator. I could be wrong about the load and I won't know until I test, but this version will be limited to NEMA 17 at the moment.

    I also want to get back into the Propeller as a CNC controller and I figure controlling 3D printers would be a nice thing for the Propeller. I will be trying some new things in combination with some old things. I figure on resurrecting that serial terminal I was working on several years ago and using a PC to send G-codes to a Propeller, which in turn will control the various stepper drives and other items associated with 3D printers. Additionally, I also want to see if I can use my old stepper drivers, that use the Propeller's counters to accurately control 3D printing. If I can get it working, the 3D printer serial terminal, the control software, as well as all electical hook-up will all be open to the public.

    More or less I am just experimenting :)
  • kwinnkwinn Posts: 8,697
    edited 2014-04-22 19:09
    This is where having an encoder on the motor shaft really shines. When the stepper and encoder position can be compared you can detect motor slip and take appropriate steps. In most cases since the step did not occur the work piece is not damaged, and the encoder position information can be used to re-start the work at a known position and at lower speed.
    $WMc% wrote: »
    The drive is not the problem...It's real motor slip.
    '
    I have set my CNC machine up and have it carving away....Then I hear that distinct sound a stepper makes when it's missing steps. It goes from a hum to a buzz.
    '
    I got to aggressive with the feed rates and usually junked out the material I was carving when this happens.
  • kwinnkwinn Posts: 8,697
    edited 2014-04-22 19:23
    Not exactly. With a gray or quadrature encoder if only one of the two inputs is changing multiple times then you know the carriage is at the stop position or there is something else stopping it from moving. If it is at the stop then everything is fine. If not then there is a problem that requires human intervention. One way of automating that decision is to use an opto-interrupter to tell the software it is close to the stop position. An advantage of the opto-interrupter is that it allows the use of high speed moves until the carriage is close to the stop.
    idbruce wrote: »
    Kwinn

    That is another very good point:
    So this must be written into the control software that if the maximum amount of steps has been taken, then this condition exists.
  • ellipserellipser Posts: 43
    edited 2014-04-22 19:28
    Of course, there would be limit switches at both extremes and that annoys me a bit as they eat up a whole six i/o pins. Full control of 4 steppers( enable, direction, and step) eats up 12 i/o. So you have 18 pins consumed already.

    You wire all 6 in series and then feed the end into just one pin. Just buy the normally closed variety. You have over 6,000 of these to choose from on Mouser. I'm at the stage of my build where I need to be concerned about this. If your motors are weak, you just don't worry about it like on a desktop 2D printer. The motor will stall, and then when you need to home it, it starts up again. On a more powerful machine, you don't rely on the motor stalling and you don't want to have the machine self-destruct and so over-travel limit switches are needed. A guy got killed on a big machine when it jammed up due to failure/missing/jumpering-out of the over-travel limit switch. When he was taking apart the machine to un-jam it, the lead screw broke or flew like a spring under tension and somehow went through his skull.

    IDBruce, you have over 6700 to choose from on Mouser:
    http://www.mouser.com/Sensors/Proximity-Sensors/_/N-7h7mq?Keyword=proximity+sensor&FS=True
  • kwinnkwinn Posts: 8,697
    edited 2014-04-22 19:58
    The two limit switches for each axis could share a pin so you only need 3 pins for them, so two switches, one pin, one pullup resistor per axis. If you are travelling in direction +X you only need to be concerned with the limit at the +X end. If the pin is already pulled low then you step in the +X direction for a preset number of steps. If it stays low then you are at the limit. If it goes high you continue until it goes low. Then you are at the limit.
    .........................................................

    Of course, there would be limit switches at both extremes and that annoys me a bit as they eat up a whole six i/o pins. Full control of 4 steppers( enable, direction, and step) eats up 12 i/o. So you have 18 pins consumed already.

    In the scheme I am thinking the Propeller will have 3 or 4 used for I2C to an ADC chip, likely 3.

    So starting with 28 available, 21 are a committed, 7 remain for heater PWM print heat and bed heat, power on/off, fans, a kill switch, and such.
  • kwinnkwinn Posts: 8,697
    edited 2014-04-22 20:08
    PS, as ellipser says you could wire the pins in series and use 1 pin but that means you can only move one axis at a time which is very slow and kind of a shame if you are using a propeller. With a propeller you could have one cog per axis and do all the moves in parallel as long as each axis has it's own end of travel pin.
  • idbruceidbruce Posts: 6,197
    edited 2014-04-22 20:14
    Kwinn

    You sure are providing a lot of nice input here. Thanks. This will be a good reference for years to come.
  • idbruceidbruce Posts: 6,197
    edited 2014-04-22 20:28
    Actually... Thank you to everyone for your participation.
Sign In or Register to comment.