gShield / Uno limit switch connecting

Scouring infos to find how / where to connect limit switches with gShield / Uno. Also finding various incompatibility issues mentioned that I had not thought to anticipate.

I bought these switches: smw3d.com

Any help, thanks.

I guess you need to check with multimeter the connections to the switch and you need jumper leads to connect as they connect slightly different sequence to the gshield. if the connections are wrong then the hardware homing does not work and may crush the switch if the switch not protected. I had no problems with limit switches but I am using easel and do not use hardware homing but place the bit on the surface at x axis end of the material and accept current position as home.

Have a look at: Connecting Grbl Ā· grbl/grbl Wiki Ā· GitHub

Make sure you follow the connections for version 0.9.

1 Like

Iā€™ve confirmed the switches are okay for 5-volt usage.

Did anyone use their machine without limit switches ?

Or the consensus more that it is not a good idea at all ?

Itā€™s not that I donā€™t understand, but just seems worth covering the subject a little more while I get the rest figured out.

Well, Iā€™m probably going to proceed carefully without them for now.

Iā€™ve got the connection locations somewhat down, aside from the #11 and #12 switch thing in grbl v 0.9.

There seems to be some pretty clear diagram here: Shapeoko CNC Router, Rigid, Accurate, Reliable, and Affordable

But, Iā€™m still a little unsure why it is or can not be a bit more like a normal switch. Iā€™m sure, if that is the case, there is something more electronically elegant about it. But, by the diagram, there is 5v and switch input (to Uno) on the same line, then GND (ground) on the other line to the switch. And, when the switches I have are activated/actuated the ā€˜NOā€™ and ā€˜COMā€™ terminals are connected. So, it looks like it would send 5v to the GND on the gShield/Unoā€¦ which I just donā€™t think I would want to do without knowing why or that it is correct.

Normally, with a simple switch, you might have power out to a switch and another line going back to send switch input (as an endstop sensor in this case). So the switch could either connect the power while open, then cut it when closed, or vice versa. But, Iā€™m just not seeing how that fits any of these diagrams at all.

Can anyone give some more laymenā€™s terms of what the gShield/Uno will operate on to trigger the limit / home switch function ?

I would have thought it just sends power out and then back to input when the switch triggers, or out and back-then off when the switch is triggered, but cannot make that out of anything I have found. I could just be confused or missing something, but any help will be appreciated, and I kind of think might help someone else in the future.

Thanks

The normal limit switch scheme for grbl is that the inputs are connected to 5V through a high value resistor inside the chip on the Arduino, this is know as ā€œpull upā€. The switches are connected such that they are normally open and the logic in the Arduino will see a value of 1 as the pins are ā€œpulled upā€. When the switch is closed, it connects the pin to ground. Your are right that this is connecting 5V to ground; however, it is through a resistor with a high value, so only a very small current flows to ground, this is normal. The Arduino logic sees a 0 when the pin is connected to ground.

If you install the limit switches as advised by Inventables, they will only operate as homing switches, not true limit switches, but thatā€™s a story for another day. Before you initiate any job, if you have homing switches, the machine is always able to go back to a known ā€œhomeā€ position. This is useful if you also tell the software how big your machine is so it knows not to run the X and Y axes to a point where they would crash. All of this configuration is done for you if you follow the setup in Easel.

Okay, just to double check, I would be running 5v off a pin on the ā€˜top leftā€™ of gShield/Uno, connected to the ā€˜COMā€™ of all my switches, and each in to the X, Y, Z limit inputs. Then GND to ā€˜NOā€™ of all switches, and have no additional resistors that I added, or other circuitry, and that is supposed to not blow the Uno or gShieldā€¦ correct ?

Iā€™m more interested in the limit aspect, and have even left the belts off my machine to try to see that everything seems to work okay without going ā€˜awolā€™ into one of the frame rails, etc.

I was thinking I could set a value to jog, then hand actuate the appropriate switch and see if it stopped the motor jogging in one of the gui/senders.

That is how I tested mineā€¦moved the axis and hit the switch myself to make sure it stopped moving.

I actually wired mine to Normally Closed and had to switch the GRBL settings $5=1 so it recognized them properly.

I will try that and can then wire everything up if it works. So, GND to ā€˜COMā€™, and 5v to ā€˜NOā€™ with $5=1 in GRBL for no power until the switch is flicked (?). Does that reduce the chance of false limit triggering due to em emissions from motors, etc. ?

I also found where I read the modified pin designation on the page Andrew linked, which is X limit-pin -9, Y limit-pin -10, then Z limit-pin -12 ( for v 0.9), or D9, D10, D12 on the gShield.

Either way, thank you guys for the help and so on.

Mine are on 9, 10 and 12 all three work. The shielded wiring is what helps with the false triggering. Normally open or close I donā€™t believe makes a difference.

This is the wire I usedā€¦no false triggering of the switches yet.

http://www.amazon.com/gp/product/B0009GUOP6?psc=1&redirect=true&ref_=oh_aui_detailpage_o03_s00

Okay. Iā€™ll have to try my luck and just go with having all my wires twisted to reduce noise/emission in the personal V1 of my machine, with things like that on the list of revisions.

X-Carve looks really nice in hindsight, as the Shapeoko 3 which I was first on a later part of the waiting list for, but am so new and with a lot of ā€˜spare timeā€™, so decided to go with something comparable, a bit more immediate, and worth starting out with. Butā€¦ Iā€™m learning, hopefully just not too late.

No donā€™t wire the way that you said. You need to connect GND to the common (COM) on all of the switches and then connect the normally open (NO) of the switch to the relevant pin on the Arduino shield. The pullup resistor to 5V is all handled internally in the Arduino you donā€™t have to worry about that. I this scenario, leave $5=0.

If you want to do it the same way as Erik, then connect to the normally closed (NC) connection rather than the normally open (NO) and set $5=1.

I went with default to start and check, but not seem to be working at this point. I have one switch with COM to pin -9 and NO to GND. Iā€™ve confirmed the switch pin outs more than once, and also get just under 5v on the circuit when powered, then just over 1v when the switch is actuated.

Iā€™ll try the other way, but does that mean my switch isnā€™t cutting the power properly or enough ?

These are my current grbl settings:

**** Connected to /dev/tty.usbmodem1421 @ 115200 baud ****

Grbl 0.9i [ā€™$ā€™ for help]
$$
$0=30 (step pulse, usec)
$1=25 (step idle delay, msec)
$2=0 (step port invert mask:00000000)
$3=0 (dir port invert mask:00000000)
$4=0 (step enable invert, bool)
$5=0 (limit pins invert, bool)
$6=0 (probe pin invert, bool)
$10=3 (status report mask:00000011)
$11=0.010 (junction deviation, mm)
$12=0.100 (arc tolerance, mm)
$13=0 (report inches, bool)
$20=0 (soft limits, bool)
$21=0 (hard limits, bool)
$22=0 (homing cycle, bool)
$23=0 (homing dir invert mask:00000000)
$24=25.000 (homing feed, mm/min)
$25=500.000 (homing seek, mm/min)
$26=250 (homing debounce, msec)
$27=1.000 (homing pull-off, mm)
$100=26.670 (x, step/mm)
$101=26.670 (y, step/mm)
$102=177.780 (z, step/mm)
$110=500.000 (x max rate, mm/min)
$111=500.000 (y max rate, mm/min)
$112=500.000 (z max rate, mm/min)
$120=10.000 (x accel, mm/sec^2)
$121=10.000 (y accel, mm/sec^2)
$122=10.000 (z accel, mm/sec^2)
$130=290.000 (x max travel, mm)
$131=290.000 (y max travel, mm)
$132=200.000 (z max travel, mm)
ok

Your GRBL settings do not have the switches turned onā€¦

$21

Doing this from memoryā€¦at workā€¦lol

Thank you for catching that. :bulb: I had not gotten that far down on the Configuring Grbl v0.9 Ā· grbl/grbl Wiki Ā· GitHub page, but will have to pay more attention since I did not make the connection to the description in the parentheses.

If you go through the Easel set up process with NO switches that connect the pins to ground, then the machine will be set up properly for homing, but not for true limit switches. Using the switches as true limit switches is problematic at this stage sue to noise introduced by the spindle, others may have solutions for that.

The shielded wire I am using seems to have done the trick. I ordered more switches to add to the other ends of the X and Y axis to make true limit switches.

Good to hear, thanks Erik