Limit Switches

i replaced the switch i destroyed above with one i bought off amazon and now when i run a homing sequence the z axis goes up and clicks the switch, comes down about 1/8" then goes back up and clicks the switch again and comes down, then does thattwo more times and then goes back up one more time and finally moves on to the X and Y axis

any idea why it does that now?

Did you update your version of grbl? There’s a setting in the config.h that specifies how many times it engages and backs off from the homing switch.

i didnt make any changes to grbl. worked fine before the new switch went on

Don’t suppose anyone knows what spec the limit switches are? Managed to destroy one today and I suspect it won’t be my last



Are the limit switches worth the trouble? I did not order them with the upgrade and now I am thinking I should just keep manually homing the machine.

I am not sure I could stand the suspense of watching the spindle approach a hard limit just hoping everything works correctly.

For some they are others not so much. I played around with them and ultimately decided not to implement them. But to each his own.

I find that they are essential if you want to use multiple bits for a cut and want to recover your position after changing the bit. Also, if you home your machine when you turn it on, you can set “soft” limits that will keep it from crashing into the ends.

1 Like

@AllenMassey - I think it depends on how you use the switches. Wired and configured as homing switches they are useful for exactly that - HOMING, but will not stop you from destroying them if you tell the machine to go somewhere it should not go. Wired and configured as limit switches, which would require 6, they can tell your machine to stop moving when it hits them and maybe save the belt or some other part if you tell the machine to go somewhere impossible. All-in-all, the whole homing/limit switch debacle is something that requires a lot of reading and understanding before you will get the most out of it. I have seen some really great write-ups about how to wire them, and how to filter the circuit to avoid or eliminate noise, and whether to wire as NC or NO.

One of the forum posts I have bookmarked for later use
and another
and yes, another


Joined the smashed homing switch club the other day! Yay?


I really do think there should be a forum badge for it :smile: Along with your first deep plunge into the wasteboard, and your first snapped bit.


Breaking stuff is how we gain experience, I am just not sure I can afford much more experience.


Agreed, also had a plunge through my project into my wasteboard yesterday! No broken bit though, luckily!

1 Like

snapped my 1/32" bit over the weekend, finished a cut in some acrylic, (a 3/4" pink flamingo) and had jogged the spindle up and the gantry back to look at the work, hit return to zero and before I knew it the spindle came down and the gantry rapided forward dragging that little bugger across one of the clamps.

They make a real nice pinging sound when they snap! :cry:

It can be really exciting when one fragments at 10,000+ RPM. Not that I’ve done that…a few times… :smiley:

Not sure if this info will help others or not - I’m gradually getting the limit switch thing closer to a resolution. Much of the info below is from another thread on the same subject.

On my machine (1000x1000 X Carve) I’ve installed additional limit switches, so I now have a switch on each end of both the X and Y axis and a single switch on the top of the Z axis. These are all Normally Open switches, wired in parallel pairs (the two X switches in parallel and ditto for the two Y switches)

Using Easel (through the Inventables site) I ran the Machine setup program which (for me) was the easiest way to “enable” the homing switches in GRBL. I’ve no doubt there’s probably a simple command for doing this via Universal Gcode Sender (UGS), however I’m all for taking the simple path wherever possible.

The advantages of using Easel to set up Homing is that it has a series of test sequences which allows you to

  • Enable homing
  • Test each switch
  • reset the homing direction if it’s wrong etc
    Having enabled homing, I can now use the “$H” homing command to home the machine (ignore the “”)

I then set up “Soft Limits” by

  • Homing the machine to find X0, Y0, Z0
  • Using the “jog” feature in UGS (arrow keys on my keyboard) to move each axis to what I considered as its safe maximum travel and then recording the X, Y and Z position for each.
  • Entering each soft limit via the UGS command line ("$130=790" for the X axis, “$131=790” for the Y axis and “$132=80” for the Z Axis - without the inverted comma’s of course). GRBL should respond with “ok” after entering each command. Note these limits are all unique to my machine - yours WILL be different.
  • These settings are confirmed by sending the $$ command - GRBL will respond with a list of all current settings where you’ll be able to check your entries have been added.

I then enabled “Hard Limits” in GRBL by sending the “$21=1” command (GRBL should again respond with “ok”)

  • Now when I manually “jog” the machine along an axis to the point where one of the limit switches is closed, the machine will stop and generate an alarm.
  • To reset this alarm, I have to manually move the machine away from the offending limit switch, reset the alarm ("$X") and re-set the machine (“Soft Reset” in UGS)
    Note I’ve only played with this briefly - there may be a better way to reset the alarm.

So to summarise, I’ve now got:

  • Homing enabled - the command $H will send the machine to 0, 0, 0,
  • Soft Limits are enabled - This means the controller will not accept commands the exceed the maximum limits set for each axis, in theory, avoiding crashing into the end axis for X, Y and (sometimes) Z
  • Hard Limits are now enabled - If I manually move an axis too far, the machine will stop & generate an alarm
  • Important note - the Z axis “soft limit” will be pretty much useless unless you use the same tool and tool length every time. Anytime you put a longer tool into the machine, you’ll either need to reset the limit, or just make sure you’re not likely to cut into your table/waste-board

Is this the final setup - certainly not. I’ve already had problems with false alarms due to noise issues with the switch wiring (I did use shielded cable for the new switches, but I’ve not yet connected to the controller - I assume this would go to ground, but that’s TBA). I’ll shortly be adding a DeWalt unit to replace the current tiny spindle, so I’m kinda hoping that running the power cable for this separately will reduce the noise a little also. Finally, I’m exploring the option of waiting in a capacitor & some additional resistors to reduce noise even further.

For reference, see here for a list & description of some of the GRBL commands and what they do

For interest, below are a couple of images on how I fitted the additional switches - not the neatest or best option, however it suited some of the restrictions I have with the way I’ve configured my machine.

Please also excuse the somewhat crude table set-up I’m using at the moment which is an odd combination of T Slot channels, threaded holes and multi-piece wasteboard. I’ll get around to something better when I stop tinkering…


I have limit switches on my shapeOko2, I use NEMA17 motors and the limit switch wiring runs through the same cable duct as the stepper wires. This creates noise on the limit switch inputs. This was solved by installing a RC filter with a .47uf capacitor.

From Github:
Grbl v0.9j Atmega328p 16mhz 115200baud with generic defaults (2015-12-18) ◦IMPORTANT INFO WHEN UPGRADING TO GRBL v0.9 :
◦Baudrate is now 115200 (Up from 9600).
◦Homing cycle updated. Located based on switch trigger, rather than release point.
◦Variable spindle is now enabled by default. Z-limit(D12) and spindle enable(D11) have switched to access the hardware PWM on D11. Homing will not work if you do not re-wire your Z-limit switch to D12.

This means that you have to verify your wiring if you upgrade Grbl.