Inventables Community Forum

Homing/Limit Switches

Looking at things from the grbl perspective, the term "limit switch" only applies for the X-carve if you use hard limits ($21=1) .

Looking at things from the grbl perspective, all other cases for the X-carve the switches are "homing switches".

Homing switches allow soft limits ($20=1) to work. For this case the "limits" depend on having done the homing cycle and on the low end the limits are 0,0,0 and the limits on the high end are set by $130, $131, and $132. After the homing sequence the switches are ignored. Cannot get a false trigger after homing sequence is complete.

For soft limits the destination of your G-code commands are checked to see if they are out of bounds - if they are out of bounds, grbl alarms without moving the machine.

For hard limits the error is only detected if the machine actually does a move that trips a "limit switch".

You can have both soft limits and hard limits turned on at the same time. This configuration is susceptible to false triggers without either, shielded switch wiring or a low pass filter on the switch input to the gShield.

Both soft limits and hard limits with the Arduino/gShield electronics depend on the integrity of the electronics. In other words if your electronics don't function properly then neither will your soft or hard limits.

4 Likes

Just moved these to the Wiki category, good posts!

Always the best information from you. Thank you. Just wondering, do you ever have time to carve. ☺️

Hello LarryM,
I am busy setting up my 3D router but am encountering difficulties in programming the GRBL 0.9 to accept the limit switch signals. The $21=1 is the first information I have seen in many hours of searching for answers. This I would understand as being a good start.
I was given some sketch lines for an NC configuration " #define LIMIT_ACTIVE HIGH " and " #define LIMIT_INACTIVE LOW " but I actually have little idea how to ensure that I have put them in the correct place in the program. When I do input them, I get the error message :- " error: Expected command letter ". When I make small changes to these lines thinking I need to put in some reference to a UNO pin, I also get the error message:- “error: Bad number format”.
What do I need to do to avoid the error message and to make sure that the command/setting will work? What indeed would be the correct command to ‘activate’ my limit switches.

Best regards,

John Attwell

@JohnCAttwell Do you have homing enabled ($22=1)? Most users here don’t use hard limits ($21=0) unless they have really good reason to.
Can you give more details? What’s not working?
If you send a ?, what response do you get (paste here)?

Hello Neil, thank you for your reponse. I will first set up the $21=1 to see if I am on the right track as far as my hardware is concerned. It would appear that I am getting confused between GRBL codes and Uno codes. When I uploaded the *Define Limit…" sketch into the Uno it cleared the Hex GRBL codes. Then the penny dropped and I realised that the two codes are different and apparently can’t be combined. Well, at least not at my level.
I will message you again with the results of the $21=1 setting. But from an strong interest point of view, what is the reason for the ‘hard limits’ not being popular? My GRBL configuring guide even suggests that the same switches can be used for ‘homing’ but not clear if this is concurrent.

Best regards,

John Attwell

Most of these hobby level machines only have switches at one end of each axis, so crashes can still occur on the other end. The main reason, though, is that the electronics are prone to interference which can cause a false switch detection. A well operated machine won’t crash.
Homing switches are only “homing” switches when homing. With $21 set, they act as true limit switches (when not in a homing sequence).
It’s unlikely that a belt driven machine will damage itself. A false switch detection during a carve could ruin your workpiece.

You’re correct. You cannot upload multiple sketches to the Uno. They just overwrite the previous.

Hello Neil, Thanks for your support. I will update you tomorrow.

John

Hello Neil,
I can confirm that my switches are now working. The only hassle is that I have to reboot the GRBL programme to move any of the axes after a stop. However I am going to follow your advice use the same switches and set up the homing function. I have some info on how to do it, but if I come unstuck I would like to avail myself of your support. Thanks for your guidance thus far.

Best regards,

John Attwell

That’s normal. Position is potentially lost when a hard limit is hit.

Should be as simple as $22 = 1, and then send $H to home.