GRBL Issue - drivers keep going after hitting limit switch

Im running the cnc through arduino terminal using the default grbl file to communicate with cnc and passing in the following commands to set it up for running

$$
?
$X
G92 X0 Y0 Z0

After passing the above commands I send in G-Code to see how the machine runs e.g. G0 X10 if the has already hit its X limit it’ll still keep running trying to reach X10

I have tested the limit switches by setting $10=16 and clicking one after the other, they seem to working fine I get value of Lim:0 when not pressed and Lim:10, Lim:1 & Lim:11 when pressed

Max travel was already setup on each axis
$130=200.000 (x max travel, mm)
$131=200.000 (y max travel, mm)
$132=200.000 (z max travel, mm)

Have you enabled hard limits?

You’ll also want shielded wiring to reduce false positives.

no my hard limits is off
current setting:
$21=0 (hard limits, bool)

(that’s why then, with hard limits disabled GRBL will let you happily crash into the switches. The flip side of that coin is that if you do enable hard limits, your immediate problem will be fixed, but you will become susceptible to false-positive detection during a run as Will mentions, which may stop a job for no good reason)

1 Like

I enabled it but now that its enabled it just stops whenever it hits any limit switch the whole thing and outputs

ALARM: Hard limit

[Reset to continue]

Basically acts as an emergency stop button

Yes, that’s the feature. What did you expect/want it to do ?

1 Like

So my way around this is to get shielded wires?

Sorry im new to this, i was expecting that but not in the same way.
Doesn’t the machine have to realize that, right its hit a limit switch move onto the next line/command/co ordinate?

No, the shielded wires that Will mentioned are “only” to avoid false-positive triggering in the case where you enable hard limits, to avoid the situation where the controller would raise that alarm you saw in the middle of a job for no good reason, which would ruin your job.

GRBL cannot “resume” execution normally after it has detected a limit switch, because that probably means that the last move being executed (which triggered the alarm) was interrupted, therefore the move was not complete, so just going to the next line will result in a positional offset that will not be recoverable, and the resulting carve will be incorrect (the rest of the job will be shifted by the missing amount)

GRBL could theoretically be super smart and just “clamp” the job to where the limits are detected, but that would require more memory than it has.

1 Like

okay but doesnt grbl know where exactly the location of the spindle is at? lets say the spindle is 5 mm away from the limit switch and i pass in a command which tries to send it 10 mm over the x limit shouldn’t grbl know that it cant do it since its already 5 mm away from the x limit and output an error?

i want the machine to travel to its limits without shutting down on me

It could, but the current version does not (to the best of my knowledge) implement that function, and the very limited memory resources of the AtMega328 microcontroller are such that it’s almost impossible to add much (but the GRBL developer would have to comment).

You can get that behavior on the other side of each axis by enabling soft limits ($20) and the travel limits you mentioned in the first post, but that won’t work on the side where the switch are (it would be like a “min travel” parameter, but there is no such thing in the current GRBL version)

1 Like

ahh okay thank you I think i confused myself but its all good thanks.

Now for some odd reason my alarm is triggering even though the spindle isnt near any limit switches
I’m assuming that’s because I’m not using shielded wires?

Mmh…false positive detection shouldn’t be that easy to get…do you see those alarms happening randomly/at random places ? If so, this is likely an electrical issue with the limit switches picking up noise (generated by other things when the machine is moving), and then shielded wires may help. I remember adding capacitors in parallel in the limit switches wiring of my first 3D printer to filter out (some of the) noise.

By the way is this on a Shapeoko or some other machine ?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.