Welcome to Our Community

Some features disabled for guests. Register Today.

GRBL Auto Square

Discussion in 'CNC Mills/Routers' started by cncguy, Feb 6, 2019.

  1. cncguy

    cncguy New
    Builder

    Joined:
    Sep 20, 2016
    Messages:
    6
    Likes Received:
    0
    Hi,

    I would like to verify my understanding of using auto square with GRBL.

    Background: I have rebuilt my CNC machine and I am now using dual Y motors. I would like to have the machine auto square. I am using a CNC Shield.

    EDIT: I have the second y motor running from the A driver that is paired to the y motor with reversed STEP/dir jumper on for driver A.

    To verify;

    I will need 2 end stops on the same end of the CNC machine. One for each motor. I am using NO switches. I will need to wire them in parallel.

    The only change I would need to do in GRBL is $5=1 if I decide to go with NC instead, correct?

    This will auto square the machine when homing, correct?

    Thank you.
     
    #1 cncguy, Feb 6, 2019
    Last edited: Feb 6, 2019
  2. Alex Chambers

    Alex Chambers Openbuilds Team
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    545
    Likes Received:
    343
    I can't help you with autosquare in GRBL, but if two NO switches are wired in parallel one of them is redundant - either switch will complete the circuit. For two NC switches wired in parallel BOTH switches need to be operated to BREAK the circuit.
    Alex.
     
  3. cncguy

    cncguy New
    Builder

    Joined:
    Sep 20, 2016
    Messages:
    6
    Likes Received:
    0
    @Alex Chambers, I am going by the attached image. I understand what you are saying. I am confused about that also.
     

    Attached Files:

  4. Alex Chambers

    Alex Chambers Openbuilds Team
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    545
    Likes Received:
    343
    I think that image shows how to set up hard limits - one switch at each end of the same axis. For auto squaring I assume you would have two switches at the same end of the Y axis, but connected to different inputs on the controller. Anything after that is completely beyond me, but hopefully someone else on here can help.
    Good luck.
    Alex.
     
    cncguy likes this.
  5. Alex Chambers

    Alex Chambers Openbuilds Team
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    545
    Likes Received:
    343
    The only reference on here to auto squaring was a post by Hytech2k who mentioned that Mach3 has that capability - he didn't say how to do it though. It might be worth messaging him and asking.
    Alex.
     
  6. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    417
    Likes Received:
    157
    I'm confused as to the utility of auto-squaring anyway. Unlike auto-levelling, it doesn't seem to serve a meaningful purpose.

    If you set your switches to the machine and the machine is out of square, it can't calibrate square anyway. If you can square your switches, just square the machine. If your steppers both move the same amount per step, it can't really get out of square very easily. If they don't, you have to separately calibrate them anyway to the point where a sequence of "square" XZ planes can be at any arbitrary angle to each other. If you try to drive the gantry with a single motor at a time, the gantry will rack and you won't get a valid result anyway.

    The only meaningful use for this is the same as for out-of-square stock, where you define arbitrary planes as XYZ based on your probing routine and don't need to worry about your workholding. And if you don't need to worry about your workholding, you don't need to worry about your machine either. The only things that meaningfully exist are the linear axes with their limits and the work itself.

    But I could be missing something really obvious. :D
     
    David the swarfer likes this.
  7. cncguy

    cncguy New
    Builder

    Joined:
    Sep 20, 2016
    Messages:
    6
    Likes Received:
    0
    Hi,

    The auto square feature helps with the racking of the gantry. I use belts, and if I accidentally hit one side of the gantry, it throws it out of wack. I have been checking it manually, however, students will be using this and would like an automatic solution that is performed with ever homing sequence.

    Take care,
     
  8. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    417
    Likes Received:
    157
    Ah, gotcha. So have a switch exactly in line with one of the existing limit switches, so that both motors drive until the first one triggers, then the remaining side pushes into the second switch, whereupon you know (assuming the switches are close enough to the outsides of the gantry width, or you'll obviously get some degree (heh) of cosine error) that the gantry is square. It's more of a phase difference correction than a real squaring. I actually like it, since the ease of belt-racking has come up on my current/most recent build.

    There's no obvious way of doing that in grbl that I can think of off-hand, especially since you'd really need to initially calibrate it by having both switches actuate simultaneously (within some predefined limit) with a pre-squared gantry, I suppose by having the non-limit switch on a micrometer mount. Grbl definitely has some I/O limitations, so you'd probably need to figure out a set of subsystem hardware that could accomplish it using the probing pin. It would need to differentiate the two switches, prevent grbl from alarming out after hitting the limit switch outside of initial homing, drive the two y-axis motors independently, and have some simple internal logic that would allow it to operate under either motor hitting first, or getting a simultaneous reading.

    At that point, you almost may as well take grbl out of the picture and write an Arduino sketch from scratch. The only other solution would be some kind of software add-on (maybe for bCNC since it's Python, or something else that plays nice) that could read and override limit/probe inputs and optionally differentiate between Y1 and Y2 stepper drivers, perhaps using the coolant/air blast pins if you're not already using them. A dedicated hardware approach would probably be more effective and reliable (no need to worry about software/firmware updates...) though.

    However, many of my original points still apply. You have to know the machine is square to begin with.

    Optionally, a more KISS approach; have a pair of square metal blocks that are screwed tight to the machine (perhaps within the range of the overtravel of one of the limits) that are perfectly square to each other, and simply push the gantry into them while the motors are disabled/unpowered. That's likely what I would/will do.
     
  9. cncguy

    cncguy New
    Builder

    Joined:
    Sep 20, 2016
    Messages:
    6
    Likes Received:
    0
    Thanks for the reply, Rob.

    I was curious about this feature with the CNC Shield and GRBL. I read that the MPCNC, which uses Marlin, has this feature. I was hoping to be able to do this with my current hardware and GRBL. I was thinking that I could use the Y+ end stop pin some how. I suppose the CNC Shield would need to have a pin assigned to the A driver for that to work. It looks like I will probably use some sort of block method as we mentioned.

    Take care,
     
  10. cncguy

    cncguy New
    Builder

    Joined:
    Sep 20, 2016
    Messages:
    6
    Likes Received:
    0
    I keep looking at the pinout of the CNC Shield. Are the x-, x+ / y-, y+ / z-,z+ using the same pins respectively? As far as I can tell only pins 9,10,11 are assigned for end stops off of the Arduino.
     
  11. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    417
    Likes Received:
    157
    If you can go simple, go simple! I have some 74HC00 quad NAND gates on their way so that I can do single-wire active-switch active-low limits, because I'm a fool who doesn't listen to my own advice and likes blinking LEDs (sound familiar, @Batcrave?).

    Yes, only three axis pins. You wire the switches such that either end of the axis activating will flip the logic state of the line, whether active high (parallel) or active low (series). The CNC breakout board (which I originally was using, but got rid of for overcomplicating things as well as StepSticks being terrible) makes things sound more useful than they are. Realistically, you're plugging one switch into each of those limit terminals, and it's doing the series/paralleling/whatever internally.
     
    joe williams likes this.
  12. cncguy

    cncguy New
    Builder

    Joined:
    Sep 20, 2016
    Messages:
    6
    Likes Received:
    0
    Thanks again. Sadly, like you, I like to over complicate things sometimes. At this point it is a principal of "can I figure this out". :)
     
  13. joe williams

    joe williams Veteran
    Builder

    Joined:
    Nov 9, 2015
    Messages:
    99
    Likes Received:
    59
    Excellent advice! As I am on this CNC journey I find myself often over complicating things!

    Saw a cncrouterparts.com build video that seemed to show some kind of auto square feature...interesting.
     
  14. Rick 2.0

    Rick 2.0 OpenBuilds Team
    Staff Member Moderator Resident Builder Builder

    Joined:
    Dec 20, 2013
    Messages:
    2,043
    Likes Received:
    945
    The problem you face here is the A stepper is hardwire cloned to the Y. What you have to figure out is how to unclone A so they can operate independently of each other in order to square the system.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice