You are on page 1of 1

 Circuits Works

End Stop hop Switch


/ Limit Craft Problems
Cooking by
Living Outs ide Teachers
BenHarper Follow Download Favorite w I Made It Following

instructables workshop Projects Contests PUBLISH Let's Make... 

End Stop / Limit Switch Problems


By BenHarper in Workshop > CNC 116.120 108 54

Published Oct 9th, 2014 Download Favorite

By BenHarper
More by
Follow
the author:

UPDATE: There are now several easier alternatives than the G-shield and CNC shield which have
built in lters amongst other features.

a) GRBL AIO (Arduino + Drivers + Filters + more on one board)

b) GRBL Breakout (Needs Carrier Boards + Arduino)

c) CNC Shield (Needs Carrier Boards + Arduino, + Make sure your buying latest version or no
lters)

Limits switches or 'end stops' as they are known to the 3D printing community can be
troublesome for Hobby CNC and 3D print setups. Many forums have discussion on how to stop
the false triggers and most of it doesn't seem to work 100%.

You need 100% accurate limit sensing, 1 false limit trigger can ruin your whole print or CNC job.

Much discussion, on the Shapeoko & Shapeoko2 side, falls around using low value pull up
resistors or special shielded cables and cable routing paths.. but its all di cult, sometimes
expensive and unsightly and usually not a perfect solution.

This problem seems to plague everyone who tries to put limit switches on. There are many
recommendations about adding resistors and shielding cables and re running limit switch wires
away from power wires etc but I feel its all quite unnecessary.

When ever you have interference, you have options -

1) Chase the interference and x / shield from it

2) Stick a lter in place to negate the noise.

Read on to see how easy option 2 is to get perfect end stop awareness for your Arduino based
CNC machines & Printers

 Add Tip V Ask Question | Comment Download

Step 1: Behind the Issue


Wether you are using a reprap style printer or a cnc router or other cnc tool like the open source
shapeoko(2)

and ox, there is allot of interference in the device due to all the equipment and power sources
in the mix.

Its too hard to stop 4 steppers, a spindle, a speed controller, and a power supply + any other
equipment near by from interfering with delicate 5V ttl logic, even with low value pull up
resistors and expensive shielded cables. Not to mention the pain of rewiring the device!

Im not sure about the constant advice to add low value pull up resistors...

Adding lower val pull up resistors just creates heat and wastes power. When ever your limit
switch remains depressed, like after a home command, your resistor will be ghting to bring the
pin voltage back up to 5 while the limit switch holds it down at 0v. waste & heat.

All you need to do for 100% perfect limit switch operation with Zero false triggers is: 3 small
capacitors.

For each capacitor, connect the negative leg to the ground rail, and the positive to one of the
limit sense pins on the controller. On an arduino running GRBL these are pins 9,10, &11.

For Shapeokos I have found that a .47uf is perfect in all instances.

One capacitor for each pin. Then as usual your limit switch wires, one wire from each switch to
ground and the other to one of the pins 9,10, or 11 (grbl v.08). Same as all the diagrams
everywhere, don't need add any of the resistors or other components from these diagrams.
These .47uf value caps will ensure that the interference form your power supplies, steppers,
spindle and spindle controllers cant a ect the 9,10,11 pin voltages quickly or enough to bring
the pins voltage down to the logic low threshold which is where your false positive limit error
comes from.

The arduinos internal pull up resistors will constantly be charging the cap and holding the pins
high which is why you don't need to add more. (this is not a waste of power / creator of heat,
capacitors average consumption not add) The internal pull ups will ensure that the cap cant
draw to much current on initial charge from the atmega pins so there is no safety issue for the
arduino.

The cap works as it should to lter the line noise, not to (big) much so that the limit switch
cannot pull the pin to ground quickly, and not to little that there can be any confusion as to if
the shapeoko/printer has hit a limit or not.

Its pretty much foolproof, Ive tested it on 5 seperate shapeoko2's, including with bigger nema
23's, quiet cuts spindles, variable speed drives... There is not need to concern how to route the
cabling, no need to worry about shielded cabling, no need to add any resistors anywhere. No
need to muck with the grbl debounce timing constant. Just put in 3 caps and forget.

To make it clean, get a blank arduino uno prototyping board and install the caps and limit
switch inputs to that, then insert that between the arduino and the gshield or what ever
stepper shield you are using. As you rst power up the board, the capacitors will pull down the
limit switch pins for a tiny bit of a second as they charge, so the board will come online in a
'Limit switch error' state, and you have to soft reset and $x to clear it as usual, its actually nice
for the controller to come online disabled though so its a cool side e ect.

If you want to clean the line best for your particular setup, get an oscilloscope and probe your
limit pins while running all the axis and dremel or spindle, and try a bunch of di erent caps,
small as possible going bigger until you get no false limits, then maybe choose the next size up
from there to be safe. If you dont have a scope, just use the .47uf or experiment.

Another handy tip, if your using the omron lever style limit switches, set the pull o constants in
grbl to about 5mm so that when your homing nishes it pulls back o the limits when done so
that its not bending the levers so much, otherwise you constantly have to re bend them back
out. Also, I believe that these are the style of switch to use, they are not as convenient for
mounting as a momentary push switch as shown in the shapeoko wiki but they are more
accurate, they have a threshold from which they literally JUMP from open to closed with a
spring e ect, it means that the actual point of limit should be more repeatable than using an
ordinary momentary push button which bounce more. Also, the momentary switches bottom
out when they connect, meaning that if your axis is moving very quickly, you might be able to
smash the switch or crash the carriage before the limit is triggered - with the levered switches
you get yourself a few extra millimeters before it goes crunch!

Next page some diagrams of the switch lter board

 Add Tip V Ask Question | Comment Download

Step 2: Solve the Issue for GRBL/Shapeoko/Xcarve/Ox...

6 More Images

Options:

1) Get a controller with Limit Switch Filters such as

GRBL AIO (Arduino + Drivers + Filters + more on one board)


GRBL Breakout (Needs Carrier Boards + Arduino)
CNC Shield (Needs Carrier Boards + Arduino, + Make sure your buying latest version or no
lters)

or

2) Make an intermediary lter board

For Grbl systems, you can use a protoshield like the one here or one of many others found
online.

This will slip nicely between your arduino and controller wether its a gshield or my favourite the
CNCshield.

See photos 1-3 for the component layout.

Careful these electrolytic .47uf capacitors are polarised, positive to the limit wire and arduino
pin and negative to ground

Photos 4-6 show the soldering on the back,

note the pins from the 3 orange wires are bent over to meet the pins from the socket two
holes over.

Photos 7-9 show the nished lter board sandwiched between the controller and arduino uno.

If you want the end result instead of making your own, I have a limited number available
already made: here.

Then you are left with 4 wires.

1 is ground, its green in my photos. The other 3 are you XY&Z limits.

These are connected to one side of your normally open limit switch. The other terminal of the
limit switch is connected to ground. So when the limit switch is depressed, it will short the
circuit to ground and the controller will know its at the ...limit.

Please note, grbl v.09 has moved one of the limit switch pins!!
https://github.com/grbl/grbl/wiki/Connecting-Grbl

Also note: I have been pulled up on my resistance to adding resistors:


http://www.shapeoko.com/forum/viewtopic.php?f=4&t=...

 Add Tip V Ask Question | Comment Download

Step 3: Testing Your Switches


Some tips to help test without breaking anything!

Setup Grbl Params:

$20=0 (soft limits, bool)

$21=1 (hard limits, bool)

$22=1 (homing cycle, bool)

$130=XXX (x max travel, mm) Make YYY something larger than the machines travel

$131=790.000 (y max travel, mm)Make XXX something larger than the machines travel

$132=110.000 (z max travel, mm)Make XXX something larger than the machines travel

You Can test the limit switches by setting $10=16 (status report mask:00010000)

Then turning on Verbose logging (checkbox) on UGS.

You will see a stream of numbers like "[verbose]"

When you hit the Z switch (manually with your nger) it should change to "[verbose]"

When you hit the Y switch (manually with your nger) it should change to "[verbose]"

When you hit the X switch (manually with your nger) it should change to "[verbose]"

and o course if you have enough hands to push all switches it will show "[verbose]"

So of these 3 numbers, the rst corresponds to Z, next Y and third X (seems a bit backwards so
be careful) If you nd that any of the switches are showing a di erent di erently on the output
then you need to swap some of the leads around so that it shows correctly.

Once you are done with this you can set the $10 back to 3 (you must do this or things dont work
correctly) and at this point try a homing cycle - its the button labelled $H

Might be a good idea to rst turn down the homing speeds:

$24=25.000 (homing feed, mm/min)

$25=250.000 (homing seek, mm/min)

Once you have validated the homing is all working in the right way you can turn them back up a
bit.

Its nice to have them turned down while testing so you have time to hit the Estop if things are
ging wrong, like for example the machine starts homing in the wrong direction!

You need it to home towards the limit switches. If its not going in the right direction you will
need to mess with the $23=0 (homing dir invert mask:00000000) parameter. More info on that
here: Homing Directions

 Add Tip V Ask Question | Comment Download

1 Person Made This Project!

maxias made it!

Did you make this project? Share it with us!

I Made It!

Recommendations

Cement Light Bulb Planter by Birdz of a Medium Modular Formicarium (Ant Concrete Relief-Cast Botanical
Feather in Molds & Casting Farm) by ValleR1 in Pets Specimens by MadeByBarb in Molds &
Casting

 2 8 122 8 259  12 8 571

 V |
Add Tip Ask Question Post Comment

We have a be nice policy.


Add Images Post
Please be positive and constructive.

54 Comments

6688318 Question 7 months ago  Answer / Upvote


Hi, how about grbl v1.1? I did this noise filter and it works perfectly. Problem I have (I suppose) is
connected with TTL. TTL is also on pin 11. 47uF capacitor could probably mess things up. Shouldn't it be
pins number 9,10,12 in grbl 1.1? Thanks in advance.

markmallett82 2 years ago  Reply / Upvote


Thank you so much for this post. You are 100% correct. This solved my false signal problems. I salvaged
some .47uf caps from an old circuit board and used them on an Arduino proto board to filter my homing /
limit stops, hold, probe, etc. I simply plugged the proto board into my Arduino board and problems solved!
No resisters were used. I'm running simple unshielded wire.

4 replies F

GeertjanB 3 years ago  Reply / Upvote


Hi Ben,
I have build the Workbee CNC machine using the GBRL shield v3.0 as the controller. but i'm struggling
with the limit switch noise problem.
I've quickly put together an image, can you tell me if this is the right way to connect the capacitors?
Thnx GJ

2 replies F

PhilL57 3 years ago  Reply / Upvote


Ben, Thank you so much for this article. In the sea of confusion surrounding limit switches your article
helped me so much. I purchased an x-controller with my x-carve and I have found it difficult to get the
information I need about wiring it up with 5 limit switches (2X 2Y 1Z) - I wish I had known about and
purchased the 3dtek controller as the basic instructions online tell you everything that I have been trying to
find out unsuccessfully about the xcontroller.
I have purchased three .47 uf capacitors and I would like to wire up my limit switches as Normally Closed
but I am still confused as to whether I need to add anything to achieve this or whether I can just wire my
switches directly into the x-controller. I know it has built in filters and I have attached the shematic. If
somebody could please let me know what, if anything, I need to do to achieve this, or whether I would be
better off with normally open and the 3 capacitors (or not) I would be eternally grateful. This is the final step
in getting my CNC up and running at last.

12 replies F

KevinW101 4 years ago  Reply / Upvote


There is another option which I am working on and so far good success record..... That is to put another
Arduino in which also allows 2 end stops for each axis reacting if either end is hit, also working on
Hold/Start buttons (mine are built in to the machine a distance away from the controller).
This then monitors each switch and carries out a Debounce operation passing on the signal only when it is
convinced that it is is not a spike... Works well.

2 replies F

SpirosF 4 years ago  Reply / Upvote


I bought 4 end stop switch with 3pins output, when I realised that V3 cnc shield, has only two pins input. I
can do sth, or buy new one? This one I bought
https://www.cableworks.gr/3d-printers/end-stops/mechanical-end-stop-limit-switch-with-cable-for-cnc-3d-
printer-ramps-1.4/

1 reply F

avinashk 4 years ago  Reply / Upvote


hi ben,
thank you very much for such a helping and nice instructable. i was pulling my hairs for this silly thing of
homing and limit switches for days together, as there are lot of confusion on this topic, over the net and
forums, like NO or NC,and pull down pull up registers, tried everything, but finally your this instructable
helped me, for that million thanks. kindly just help me for setting up my DIY cnc, as i am a totally a layman
with passion to DIY, want to know which is the exact position of home? is it Z all the way up, X at extreme
right and Y towards the Operator?( facing the m/c from front ) and its the same XYZ Zero also?
any way i will upload the pics of my machine .
thanks again
regards

mrarmyant 5 years ago  Reply / Upvote


Can the homing limit switches share a ground?

1 reply F

GeorgeM280 5 years ago  Reply / Upvote


Hello everybody!
I tried to connect endstop/limit switch to arduino UNO. I connected it in NC mode to 11 pin and GRND pin
So, it works but printer "hangs" after $H command. It finds limit switch and then do not respond.
To enable Limit stop switch I sent that commands to GRBL:
$20=1 (soft limits, bool)
$22=1 (homing cycle, bool)
I tried hundreds of different iterations (NC, NO mode, $23=1, $5=1 and so on) and can not solve this
problem.

2 replies F

odc.jgf 4 years ago  Reply / Upvote


Hi, I'm also having issues with interference on my limit switches when my spindle is turned on. I'd just like to
know what are the specs of the capacitors. You say we should use 47uF but not at what voltage. So should
it be 47uF/5V capacitors or something else?
Thanks!

2 replies F

klauson 4 years ago  Reply / Upvote


Hi, i have two switches per axis in parallel. I use your settings. I
tested every single switch if there are interferences with $10=16 by
pressing with my finger. It works. Homing cycle works too. When i want
to move the x or y axis manually after Homing Cycle the universal
g-coder sender says Alarm: Hard Limit [Reset to ontinue]. I verified
that none of the switches are pressed. What could be the problem?

1 reply F

maxias 4 years ago  Reply / Upvote


does this also work with unpolarised capacitors? and could this guide also help with optical limit
switches? thx community

1 reply F

lathe_makeatio 4 years ago  Reply / Upvote


Very helpful. I also thought about rewiring/shielded cable or inverting to NC.
I am relative new to Grbl-CNC but limit switch issues seems to be the plague. Before i read your
contribution i added non-polar caps to ground. No real success. It only needs to switch the vac to trigger
the limits. I ll try now caps with polarity..

kantivah 5 years ago  Reply / Upvote


Thank you very much. I tried to solve the limit switch issues by using shielded wires but nothing changed.
With the three capacitors you suggest everything works fine.

JohnG138 6 years ago  Reply / Upvote


I'm almost ready for the electronics on my first CNC build, and was contemplating this very limit/homing
switch problem. Your solution was right on time!! I'm not using an Arduino/GRBL controller as your
example. My system will be Mach 3 driving thru a breakout board, then eBay/Amazon drivers (542 style).
I'm thinking your electrolytic caps @ the breakout board where the limit switch signal terminates. Do you
agree?? Thanks for your very thorough analysis of a very aggreviating problem.

Carlosbenitos 6 years ago  Reply / Upvote


I hve just finished my CNC, I had to install the endswitch and saw some issue on the web, but with it I think I
will be good!!

Awersome thank!

soilwork 6 years ago on Introduction  Reply / Upvote


So ,you saying add 3 electrolytic capacitors and 3 resistors ?, or just the 3 caps??
i missed a bit with the last note.

2 replies F

bill.wagstaff.9 6 years ago on Introduction  Reply / Upvote


Great suggestion, Ben! I had a bit of space available on my 24Volt-to-12Volt board powering my cooling
fan, and used that space to put pin headers and the three 0.47 mFd capacitors. Moved my switch
connectors to the new input headers, and jumpered the new output headers to the gshield - bingo! My
false limit switch events are gone. I cut several jobs that have been impossible to finish, and nary a
problem in several hours of running time. Thanks!

deca14 6 years ago on Introduction  Reply / Upvote


Thanks, But Why when I look at your first picture am' I seeing one wire from each of the caps to the ground
connector and the other pin not on the 5v connector but instead on a non 5volt connectors pins ? Even
when I look at you two others pictures of the reverse side I don't see any soldier on the 5 volts connectors ?
The images are a little confusing.

1 reply F

More Comments Post Comment

Categories About Us Resources Find Us

 Circuits  Living Who We Are Sitemap

 Workshop  Outside Why Publish? Help

 Craft  Teachers Contact


 Cooking

© 2021 Autodesk, Inc. Terms of Service | Privacy Statement | Privacy settings | Legal Notices & Trademarks

You might also like