[Guide] Using Grbl to debug your homing switches

If you are having difficulties with your homing switches you can do a quick test with Grbl to see what the state of the homing switches is from Grbl’s point of view. NOTE: In order to use this procedure you need to have grbl Version 0.9j or later installed on your Arduino.

To do so, you use the Grbl status immediate command ? (question mark). This command asks Grbl for its current value of some of its state information. For the purpose of this article we are interested in the homing switch state.

Not all Grbl access programs will pass Grbl immediate commands to the Arduino. UGCS is one of the programs that does not send the immediate commands when you enter them in the “Command Tab”. You can use a terminal program like HyperTerminal or Putty to perform this function. Also, the Serial Monitor in the Arduino IDE will send the immediate commands.

Before we can get the information we want we have to tell Grbl that we want to see the state of the homing switches. In order to get this report you have to change the “status report mask” in Grbl. The default setting for the status report mask is 3. This causes Grbl to report the Machine Position and the Work Position. If you have not homed your machine or otherwise initialized your machine these values will be meaningless until your machine is initialized.

To request the homing switch state you turn on the bit associated with the switches in the status report mask. The bit to turn on is bit 4 which is equivalent to decimal 16. So, you would add 16 to the 3 that is the default setting to get 19. Set $10=19 to turn on the reporting function for homing switches.

Now when you issue the status immediate command (?) the return message will include the state of the homing switches (LIM=000). This value represents the normal case with no homing switch tripped. The order of the report is ZYX. So, a report of LIM=010 would indicate that the Y axis homing switch is tripped. Similarly, LIM=111 would indicate that all of the homing switches are tripped.

To test your switches you would issue a status command and note the return value. If you are using normally open switches the return should be LIM=000 if none of the switches are tripped. If it is not zero then you need to determine why before you proceed. Then you would press and hold one of the switches while you execute the status command again. This time you should see the switch you pressed as tripped. Repeat this for each switch.

6 Likes

Hi Larry, I’m trying to troubleshoot my just installed limit switches.

I have issued $10=19 and I can see that the setting took by doing $$.

$10=19 (status report mask:00010011)

However when I enter ? I get in response:

>>>?
ok

Do I need to restart GRBL for the setting to take place? Or what else can I try.

Thank you.

…Peter

@Peter_Jakab
Which program are you using to access Grbl?

I’m using UGS 2.0 nighty build.

Also running GRBL 0.9J, the Inventables branch.

@Peter_Jakab
Ok, that’s the problem. UGCS does not pass grbl immediate commands to grbl from the Command Tab.

Take a look here and see if that helps:

@LarryM
OK, I have the Arduino IDE installed. No idea of how to send a direct command to the arduino, I guess I could look it up, or if you could tell that would be awesome.

I’m running on a Mac, if that makes any difference. I do have a terminal program, but not sure how to connect to the arduino using it, do I telnet to it?

Thanks again.

@LarryM
OK, figured it out, thanks I can see the status now.

So, am I safe to assume that if I hold a limit switch and press ? while the switch is closed I should see the bit on the status change? It always shows 000 for me. Would this indicate a bad connection?

Thanks.

Bring up the Arduino IDE, follow the setup instructions in the above post for the IDE. In the upper right corner of the IDE window there is a magnifying glass. Click on that and it will bring up the Serial monitor. If you have done the setup correctly you should see grbl announce itself with the version number. Then you can issue grbl commands such as $$ etc.

@LarryM
OK, I have a ground cable connection that is bad at the header pins, the female connector is not in far enough into the pin.

Thanks a lot, I learned a lot.

…Peter

Glad it worked out. Now on to the fun stuff!

I cant seem to get it to show the LIM status.

Using the Arduino Serial console, I did my $10 = 19, and it then gave the same message after “?”.

<Idle,MPos:0.000,0.000,0.000,WPos:0.000,-15.240,0.000>

Regardless of if the machine was on or not, I couldn’t get it to show LIM.

@JamiePhillips

Do you have your Arduino Serial Monitor configured as requested in this thread?
(and also what is the response that you get from the ? command?)

Idle,MPos:0.000,0.000,0.000,WPos:0.000,-15.240,0.000

correct baud rate and com port, also correct arduino type :slight_smile:

Can you post your Grbl settings here ($$ output from Grbl)?

Also, which version of Grbl are you running?

Inventables version. Nothing has been changed at all except $10 = 19 and the Steps/mm on X and Y. Also homing enabled.

Well, there has to be something wrong in there or you are running a version of Grbl that doesn’t support homing switch status reports.

I’m not at the machine so can’t post $$ until tomorrow. However it’s just 0.9 with steps/mm and $10 changed

Has this gotten any attention recently? I’m facing the same issues and flashed the controller twice already with the Inventables fork of grbl with no luck. Is there a setting I have to enable to read the LIM value? I have tried $10=19 and that also hasn’t worked for me. Do note that I am trying this through the Arduino IDE while I can enter commands, there isn’t always text recognition.

Check this thread:

Post your $$ output.

What is the failure scenario?