Endstop configuration

I tried using endstops in my previous CNC build but I really did not get there and disconnected them.
Now I am building my second CNC and I am considering the topic again. I am not sure what I want to achieve with the endstops anyway.

I guess the first point would be autohome or so, but even here I do not know what the benefit is, because
I anyway have to zero the machine and if I am turning my piece, I am not at all confident that I will get it precisely attached to the same position.

The way I understand autohome goes to 0 0 0 position whereas I am usually putting my workpiece somewhere in the middle of the axes, is there a configuration option of touching the endstops and then going to some central position?X 300 Y 300 for example? Do I need to home all three axes? I believe for Z-axis the touchplate is the only meaningful option? Only here the z-axis scan can be done only after being in the central position of the X and Y axes?

Should I use two endstops per axis? In my first trial I believe I used hardstop option in GRBL and then I always needed to reset the machine before being able to continue. Can I combine it with autohome or is it exclusive?

The biggest advantage to endstops for a Primo or a LowRider is the ability to automate squaring the machine.

With a Primo, bringing both X and Y motors to a known point makes repeating an exact square configuration easier, and once itā€™s been calibrated, it makes for a simple procedure that can be repeated as often as necessary.

With a LowRider, itā€™s the Y and Z axes that you can repeat to squareness.

Secondary, is a known set point. If you have a repeatable 0 point, you can run different jobs to work on the same piece with a repeatable offset. Say you want to use a 1/4" endmill, a 1/8" endmill, and a 45Ā° V bit, you can do each one as a separate gcode file, and be able to find the same 0 point for each job. (This probably isnā€™t the machine 0 point), but if you know youā€™re starting at X=25, Y=30, you can easily jog the machine there and then reset your 0 point from there, and not have to worry about changing the tool without moving the gantry.

2 Likes

Iā€™ve had good luck with sensorless homing. Itā€™s not super popular here but I find it works great and no endstops to have to worry about.

Yep, what Dan saidā€¦ autosquare (huge benefit everyone can use) and semi-auto tool changes (few folks get to that level, but it is and advantage of homing, not just X and Y, but also Z). To get autosquare, you at least need dual xy endstops (you can do ā€œsensorlessā€ for your endstops, but thatā€™s not really sensorless, instead itā€™s using stall torque as the sensor, and all the unwanted side effects that come with pulling stall torque on flexible belts). Z is helpful if you do tool changesā€¦ it allows you rapid to zmax, clearing clamps etc, without fear of overrunning the z screwā€¦ because the machine always knows where that z screw ends (regardless of where your stock happens to start, or what position you define as z0ā€¦ it will not allow overrunning the screw).

FWIW, I have never had endstops and I donā€™t miss them. I donā€™t have auto squaring, just the old school technique of starting the machine as square as I can with hard stops. The machine keeps itself square once it powers on.

A lot of people like them. So I donā€™t argue.

But they are definitely not as required as they are on a 3D printer.

1 Like

Well, I am trying to build them in. I now wanted to test the X-Axis and set the hard limit to 1. Well it really stops on the stop, then I need to reset and give $X, but now when I move the axis away from the stop and once the microswitch opens again it stops again (and I need to reset and so on). Am I missing some configuration option here?

Are you using grbl? I am not sure. I know you can adjust the periodic status message to add in endstop info.

Itā€™s grblā€™s default behavior I believe. On limit input change it asks for an unlock command from the user like a confirmation(are U sure U want to do this? ).
Because you just activated Hard limits it Will only do thatā€¦ Check that you donā€™t crash the machine axis.
If you want homing you must also e able homing setting with Hard limits.

EDIT: I Donā€™t know the original idea behind that constraint but maybe itā€™s to avoid acidental alarm resets. Imagine the machine hits limit and stops. You unlock it. You start moving the axis but move it in the wrong direction making the button break and fall. It would make the alarm go away but you would be pushing the machine beyond itā€™s physical limits. So before that it stops and askā€™sā€¦ Are you sure itā€™s ok?

@Juge to be sure, that is the proper default behavior for grbl, and some explanation is given in the github:

So the assumption is there may be skipped steps to deal with after the hardstop (no deceleration, so makes sense to me theoretically), but as Paciente8159 motioned there could be other reasons it may save the day. I dug through marlin a few minutes, and canā€™t find much about hardstops there, other than for homing. With GRBL, you could also add max limit switches too, in case thereā€™s a fixture you want to ensure you wonā€™t crash into you can just slide the max switch to that spot.

1 Like

Is there a way to get information which stop got triggered? I am now testing the axis and homing and sometimes for example, middle of the Y-Axis movement I all the sudden get the stop?
I also find it peculiar that I have stops with NO. If I unplug the cables to the microswitch I also trigger the alarm. I mean if the switch is open disconnecting cables should not trigger anything, right? Am I overseeing something here?

Thatā€™s normal for NC switches, and one of the reasons that we use them. If the cable comes unplugged, the machine stops when homing instead of crashing into the end.

Typically the switches are set up with a resistor between the +5V rail and the signal pin. This raises the voltage at the signal pin to logic HIGH, which is the flag for triggered. We use a NC switch to short the signal to ground which brings it to logic LOW. This way if the circuit is opened either by the switch getting triggered, or the wire coming unplugged, the machine will stop in its homing sequence.

EDIT: if you send a ? to GRBL it will report the machine state, including triggered pins. (If your version of GRBL is new enough, apparently.)

I have plugged then with NO.

Try issuing a ? command from the terminal with one of the end stops triggered/jumpered. You should see evidence in the status report. If not, check grbl documentation for your specific version to set the $10 mask.

Also, double-check your $5 setting as it might be inverting the end stop state behavior.

(sorry for all the edits) Finally, I had to add capacitors to my end stop connections at the CNC Shield end to filter out noise on the switch lines that was causing false-positives. My switches are also NO.

1 Like

Thanks, I am not sure about the $5 the manual talks about hi and low. Should I then use $5=1 for NO switch?

I guess I could also consider putting a capacitor, did you just connect it between the pins? What kind of capacitance should it have?

Looks like they all invert together with $5.

From what I found I think one should use $5=1 for NC and $5=0 for NO configuration. I could not
get my x- to cooperate at all when I connected it with NC. I switched to other arduino, other shield everything, it just would not do anything.

With NO (but I think the interference would be similar problem with NC) I seem to get some disturbances and therefore the hard limit kicks in randomly. I ordered some capacitors and I will try them, parallel between the pins.

On the CNC Shield v3.00 that Iā€™ve got, the board connections are parallel, so if you wanted 2 NC switches on one axis, you needed to put them in series, otherwise opening one didnā€™t register since the other was still making the circuit.

If you are getting interference in your switches there are a couple of tricks you can doā€¦

Check if there are not any loose wires.

As an interface circuit for the limit switch I use some opto couplers. (donā€™t judge my wiring work :sweat_smile:)


This does 2 things. isolates the arduino and PC from the cnc machine and allows me to run the limit switches at a higher voltage (for example 12V.) making it less suceptible to EMI noise.

I also prefer using the NC in series with the Arduinoā€™s internal pull up. Itā€™s just safer since any forgotten or bad connection is detected.

Then there is the problem of false positive when the tool is working. I have a 1.5kw spindle and vfd and I simply shielded it with thinfoil and ductape. On the side of the vfd I connected the thinfoil with a copper wire to ground and that made wonders. 0 issues after that.

Does a capacitor work at all on a circuit with NO switch? I seem to be getting an interference and thatā€™s why the stop is triggered but how does a capacitor add any filtering to a false-positive? I think this is the simpler solution, so I will try this one first.

At the second option I guess octocoupler or a relay would indeed allow to drive the switch circuit with higher voltage, I have 24V going for my CNC shield so I guess I would need something in that control circuit, for instance a led?

The capacitor will take a fraction of a second to charge up. So if there is a tiny blip, it will sink into the capacitor and the signal pin wonā€™t see a voltage change. If the actual switch triggers it, the current flow will be strong and charge the capacitor quickly, and the voltage will reflect that.

The cap needs to be wired between signal and ground.