Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After homing machine, G28 triggers limit switch #585

Closed
David-Hari opened this issue Dec 24, 2018 · 16 comments
Closed

After homing machine, G28 triggers limit switch #585

David-Hari opened this issue Dec 24, 2018 · 16 comments

Comments

@David-Hari
Copy link

I have an XYZ-Carve, which is similar to the XCarve. I use the UGS Platform software to send G-code to the machine.
When using the G28 command to go back to zero, the tool travels all the way along the Z axis and hits the limit switch.

I have set the firmware settings to the following:

Max travel (mm):
  X: 1000
  Y: 1000
  Z: 200
Homing pull-off: 1 mm

The X & Y limit switches are at the bottom left of the machine, and Z is at the top.

After homing, UGS displays the following position (mm, first number is work pos, second number is absolute machine pos):

  X:  0.00      -999.00
  Y:  0.00      -999.00
  Z:  199.00    -1.00

I read somewhere that the negative co-ordinates are normal for CNCs, so although it seems odd to me, I am not concerned about that.

Issuing the following command,

  G90 G0 X0 Y0
  G90 G0 Z0

takes the machine to

  X:  0.00     -999.00
  Y:  0.00     -999.00
  Z:  0.00     -200.00

which is bottom left of X/Y axis and Z all the way down.

And the following,

G91 G28 X0 Y0

takes it out to

  X:  999.00     0.00
  Y:  999.00     0.00

However, when moving the Z axis to zero,

  G91 G28 Z0

it hits the limit switch and triggers an alarm and immediately stops.
This is because it thinks that Z 0 is right on the limit, instead of being just shy of hitting it.

I imagine the correct thing for the machine to do after homing is to set machine Z to 0 instead of -1. Hence, the zero position is where the tool stops after homing (which is 1 mm away from the limit switch).

Please tell me if this is a bug in the grbl code, a problem with the XYZ-Carve, or have I just done something wrong?

@chamnit
Copy link
Contributor

chamnit commented Dec 24, 2018

Read this FAQ. Also please review how work coordinate systems work. LinuxCNC has excellent help pages.

@chamnit chamnit closed this as completed Dec 24, 2018
@David-Hari
Copy link
Author

David-Hari commented Dec 25, 2018

Thanks, that was useful information, but it doesn't really answer my question.

I do have my limit switches wired normally-open. The homing works just fine. It's just where it defined Z 0 to be that is the problem.

@neilferreri
Copy link

@David-Hari What are you expecting that command to do? Do you know your G28 offsets? My guess is you have not set any, so they default to 0,0,0 (away from your homing switches). Without more details, I'm not sure why x and y aren't on their switches as well.
If you enable HOMING_FORCE_SET_ORIGIN, you can set your machine zero at a pull off distance from the switches.
Again, though, what are you trying to accomplish with the G91 G28 Z0 (move Z to its G28 offset)?

@David-Hari
Copy link
Author

David-Hari commented Dec 25, 2018

Do you know your G28 offsets?

What do you mean by that? I thought G28 was supposed to go the machine’s reference (or zero) position. That's what I read here and here.

My problem is essentially that Z 0 triggers the limit switch, which I don't believe it should do. Moving to 0,0,0 should be a safe operation. The limit should only be triggered if it moves slightly past 0. Does that make sense?

My guess is you have not set any, so they default to 0,0,0 (away from your homing switches).

Ok, so how do I set these offsets? Keep in mind that I am only really familiar with UGS.

Also, X 0 and Y 0 are away from my limit switches, but the limit on the Z axis is at 0 (i.e. the top of Z axis, as I described earlier). Not sure if this is the usual set-up, but it's how XYZ-Carve has it.

@neilferreri
Copy link

Through the console in UGS, send
$#
That will show your offsets.
You can define your G28 position by sending a G28.1 command when the machine is in the location you like.
Grbl uses G28 as a user defined position. I use it for a tool change/probe location and I use G30 (works the same) for a get out of the way position.
As Sonny mentioned, linuxCnc is the place to get your info.
Here's a pertinent link: http://linuxcnc.org/docs/html/gcode/g-code.html#gcode:g28-g28.1

@David-Hari
Copy link
Author

Thanks, that makes a bit more sense now.

I'm not sure the XYZ-Carve's firmware supports decimal g-codes (I think it complained once when I tried it), but I'll give it a go.

Do you think UGS should be using G28.1 immediately after homing, so that G28 will return to that point? I can always make a macro, but I would have thought it would be part of the homing process.
Perhaps I should report it on their Github page.

@neilferreri
Copy link

No. You don't want your UI changing those offsets. Everything is working. You set your G28 where you want it. I'm assuming since you posted here that the machine is using GRBL. It should accept G28.1
If you want to go back to machine zero, just home the machine.

@David-Hari
Copy link
Author

If you want to go back to machine zero, just home the machine.

That's the problem - machine zero is beyond the limit. Well, at the limit, which causes it to trip the switch. Are you saying this is ok? That it is normal for it to do that, and that I need to manually change it using G28.1? I don't understand.

@neilferreri
Copy link

Machine zero is the limit switch by default. You won't be using machine coordinates for your work.
Were you able to see your current offsets? $#

@David-Hari
Copy link
Author

No, I don't use machine coordinates for my work. But the G28 command does. Since you say I can change where G28 goes to then I guess my problem is solved.

@chamnit
Copy link
Contributor

chamnit commented Dec 25, 2018

Please look into learning proper work coordinate systems. Grbl has six and they are set by the G10 command. These are saved in memory so you will always be able to reference them from machine zero if you suffer a power cycle or need to restart a job.

@chamnit
Copy link
Contributor

chamnit commented Dec 25, 2018

G28 and g30 kind of do the same thing in terms of a reference point but they don’t set work coordinate frame, or part zero. G10 will set the work origin anywhere you want.

@David-Hari
Copy link
Author

I should have mentioned that the g-code is generated by Fusion 360, which by default does a G28 at the beginning and end of a job. I can disable that functionality, but the purpose of asking here was to determine how I can use it successfully. As neilferreri said I can set the position that G28 goes to, then I will try that.

@neilferreri
Copy link

@David-Hari I use Fusion 360 as well, but I use a custom post. Like I said, I like using G28 for a tool change location. That command (G28 G91 Z0) in the default Grbl post is the reason for several threads on the Inventables forums. I'd recommend joining there.

@ramimehyar
Copy link

Hello David,

Did you find a solution to your issue, ever since I updated my FW, the Grbl homes to the limits, pulls of 1mm and then sets all home coordinates at -1.000, -1.000, -1.000

@langwadt
Copy link

rebuild with HOMING_FORCE_SET_ORIGIN defined, that will set the machine coordinates to 0,0,0 after pull off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants