More Homing Issues

Discussion about the arduino based g-code interpreter, grbl
Post Reply
oldrayj
Posts: 93
Joined: Wed Sep 26, 2012 8:00 pm
Location: Bellbrook, Ohio
Contact:

More Homing Issues

Post by oldrayj » Wed Jul 17, 2013 2:21 pm

After finally installing my limit switches I ran into some problems getting the homing function to work properly. All 6 switches work properly as hard limits. They are wired in accordance with the final configuration noted in post http://www.shapeoko.com/forum/viewtopic.php?f=4&t=1290.

My issues are as follows. When configuring grbl for homing, I followed the guidance in post http://www.shapeoko.com/forum/viewtopic ... ing#p11509 (“To home to X+, Y-, Z+, set $18=64”). With $18 set to 64, my set-up homed exactly the opposite (X-, Y+ and Z-). I tinkered with $18 and found that when setting $18 to 128 it, homed to X-, Y- and Z+ which what I desired. I guess that’s OK because it works the way I want it to, even though I don’t understand why.

My main issue is that the pull-off does not work properly. With $22 = 2, the reported position after completing the homing is -2 for all axes (should be 0 for all axes). Since, attempts to jog off the homed position sets off the alarm, I have to manually clear the limit switches in order reset.. If I set $22 = 5, the unit starts pounding against the switches at the end of the cycle, apparently moving at least one of the carriages in the wrong direction. I tinkered with the debounce but lowering it to 25 didn’t help.

Help will be appreciated. Thanks

jasonharper
Posts: 11
Joined: Mon Jun 17, 2013 2:06 am
Location: Oklahoma

Re: More Homing Issues

Post by jasonharper » Wed Jul 17, 2013 3:05 pm

Sounds like you've got your switches wired as normally closed, rather than normally open. That's actually desirable from a safety standpoint (a broken connection causes the system to fail immediately, rather than giving the illusion of protection), but grbl as of 0.8 doesn't support that. I expect that we'll get configurable switch polarity in an upcoming version.
ShapeOko #1743F, double X axis, 5mm Y drive shaft, DW660 spindle

oldrayj
Posts: 93
Joined: Wed Sep 26, 2012 8:00 pm
Location: Bellbrook, Ohio
Contact:

Re: More Homing Issues

Post by oldrayj » Wed Jul 17, 2013 5:42 pm

The switches are wired as normally open.

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: More Homing Issues

Post by cvoinescu » Wed Jul 17, 2013 5:57 pm

jasonharper wrote:normally closed [is] actually desirable from a safety standpoint [...], but grbl as of 0.8 doesn't support that.
Does too. Wire them NC to +5 V with pull-down resistors (say 1 kohm) to GND. If you have both a min and a max switch on a given axis, wire them in series (not parallel as you'd have wired NO switches to GND).
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

oldrayj
Posts: 93
Joined: Wed Sep 26, 2012 8:00 pm
Location: Bellbrook, Ohio
Contact:

Re: More Homing Issues

Post by oldrayj » Wed Jul 17, 2013 9:06 pm

I’m a little more than confused. This is the wiring that finally came out of my post http://www.shapeoko.com/forum/viewtopic.php?f=4&t=1290 which was based on the guidance “you should use the C and NO terminals of the switches, not C and NC”
Limit Switch Wiring Forum.png
Limit Switch Wiring Forum.png (141.01 KiB) Viewed 2001 times
Now I have one input that implies the switches should be wired Normally Open and one says Normally Closed. Since they don’t work correctly as wired (NO), I suspect Normally Closed is correct.

I guess the diagram should be modified (move the black wires to the left contacts) so that the switches will work both for homing and hard limits? Otherwise is the diagram correct?

Thanks.

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: More Homing Issues

Post by cvoinescu » Wed Jul 17, 2013 10:26 pm

Ignore my comment about GRBL supporting NC switches. That was just nitpicking at jasonharper's assertion.

You have them wired correctly, especially if they do work as limit switches.

The $18 setting depends on the $6. “To home to X+, Y-, Z+, set $18=64” is true only if $6 is 0. If $6 is not 0, then you need to invert the respective bits to home in the - direction. If $18=128 makes it home X-, Y-, Z+, I think your $6 is 252 (all axes inverted, step pulse positive).

Maybe you found a bug in GRBL. My advice is to flip motor wires (swap, for example, red and blue) to get GRBL to work with $6=28 (no axes inverted, step pulse positive). Then, it's more likely that $18 will work as intended. You'll need $18=96.

If that still doesn't work, check whether homing all axes positive ($18=0) works properly. Again, that's more likely to be tested and deubgged.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

jasonharper
Posts: 11
Joined: Mon Jun 17, 2013 2:06 am
Location: Oklahoma

Re: More Homing Issues

Post by jasonharper » Wed Jul 17, 2013 11:27 pm

cvoinescu wrote:
jasonharper wrote:normally closed [is] actually desirable from a safety standpoint [...], but grbl as of 0.8 doesn't support that.
Does too. Wire them NC to +5 V with pull-down resistors (say 1 kohm) to GND. If you have both a min and a max switch on a given axis, wire them in series (not parallel as you'd have wired NO switches to GND).
That would work if your driver hardware is using only the AVR's built-in weak pull-ups on the limit inputs, and doesn't have external pull-up resistors that are in the neighborhood of 1Kohm themselves - that would result in the inputs being pulled to around 2.5V, which is an indeterminate state for a digital input. I'm pretty sure that at least some of the available driver boards have such resistors installed.
ShapeOko #1743F, double X axis, 5mm Y drive shaft, DW660 spindle

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: More Homing Issues

Post by cvoinescu » Thu Jul 18, 2013 9:37 am

jasonharper wrote:That would work if your driver hardware is using only the AVR's built-in weak pull-ups on the limit inputs, and doesn't have external pull-up resistors that are in the neighborhood of 1Kohm themselves - that would result in the inputs being pulled to around 2.5V, which is an indeterminate state for a digital input. I'm pretty sure that at least some of the available driver boards have such resistors installed.
Of course, but grblShield and the buildlog.net stepper shield don't have external pull-up resistors. Are there any other boards?
cvoinescu wrote:The $18 setting depends on the $6. “To home to X+, Y-, Z+, set $18=64” is true only if $6 is 0. If $6 is not 0, then you need to invert the respective bits to home in the - direction. If $18=128 makes it home X-, Y-, Z+, I think your $6 is 252 (all axes inverted, step pulse positive).
After a little more research, I take this back. The $18 setting should be independent of the $6, although it may still interfere accidentally due to a bug, so my suggestion to wire the motors so that they don't need to be inverted in GRBL settings still stands.

Also, just so we are on the same page: Z+ is up, X+ is right, and Y+ is toward the rear of the machine. The two rails connected to the end plates are the Y axis, and the rail(s) on the gantry the X axis.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

oldrayj
Posts: 93
Joined: Wed Sep 26, 2012 8:00 pm
Location: Bellbrook, Ohio
Contact:

Re: More Homing Issues

Post by oldrayj » Thu Jul 18, 2013 12:55 pm

Thanks for your follow-up. We’re on the same page with respect definition of the direction of the axes. My $6 is currently set to zero.

Interestingly, I assigned a negative value (-4) to $22 and ran a homing cycle. The limit switches for all axes were triggered and it backed off 4 units. The reported position after homing was X = -4, Y =- 4, and Z = 4. To get it to accept G commands again (i.e. jogging), I had to do a $X and a soft reset.

I’m going to tinker around with the motor wiring as suggested and see what happens. Thanks again for your help.

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: More Homing Issues

Post by cvoinescu » Thu Jul 18, 2013 1:44 pm

If your $6 is zero, you're already good for motor wires.

Over the weekend I can try this on my machine too -- it's a bit difficult to give useful advice without playing a bit with the actual machine. :) But it does seem to count position exactly backwards from what I'd expect.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

Post Reply