Limit Switch Wiring?

Re: Limit Switch Wiring?

Postby txcas » Fri Aug 15, 2014 12:16 am

eagletree wrote:Those look great. I am curious what you did on the bottom of the Z because I need to replace mine eventually, they are taking up too much space and losing me almost an inch of travel at the bottom. I would be interested in the STLs if you wouldn't mind posting them.

I am wondering the same thing. I will also like to get the STLs.
txcas
 
Posts: 14
Joined: Thu Jul 31, 2014 12:50 pm

Re: Limit Switch Wiring?

Postby skantron » Sat Aug 16, 2014 6:49 pm

HEy Guys, here are the STLs (had to zip them STLs aren't allowed I guess). I actually didn't do anything for the -Z, its not needed for homing and if I am exceeding the travel there, its crashing into the wasteboard anyways. Do most people have a -Z limit then?
Attachments
Endstops.zip
(15.92 KiB) Downloaded 639 times
- Shapeoko2 #4557, NEMA 23
skantron
 
Posts: 23
Joined: Tue Apr 01, 2014 8:59 pm

Re: Limit Switch Wiring?

Postby eagletree » Sat Aug 16, 2014 7:01 pm

skantron wrote:HEy Guys, here are the STLs (had to zip them STLs aren't allowed I guess). I actually didn't do anything for the -Z, its not needed for homing and if I am exceeding the travel there, its crashing into the wasteboard anyways. Do most people have a -Z limit then?


Thank you, I will download, even the Z+ would be better as I'm losing travel there too.

I put a Z- on because depending on the height of the waste board (I dropped mine down 20mm, for what I'm planning to mill, there is no need for the carriage to reach the waste board and that will allow me to use 4 inch stock with 2 sided cuts), I could drop it off the delrin nut and end up with the assembly being crooked. But I agree, with care about one's gcode, it seems superfluous.
eagletree
 
Posts: 96
Joined: Fri Jun 20, 2014 5:15 pm
Location: Western Washington State

Re: Limit Switch Wiring?

Postby end3x » Thu Aug 28, 2014 3:44 pm

Hello,

Image

I wanted to install a homing system, I first started with the x axis, as in the drawing above,but with 330 Ohm resistor each, it worked well, it has stopped the motor, but I realized that the current 5v passed directly on Limit X (D9), without any resistance, (pcb error).

Then I put this resistor like a drawing but now the homing no longer works.

My question is: Have I damaged my card, knowing that everything works?
Can I redo my original configuration without resistance?

My last statement : 4.96 Volts between limit x (D9) and Ground.

Thank you for your help.
end3x
 
Posts: 1
Joined: Thu Aug 28, 2014 2:44 pm

Re: Limit Switch Wiring?

Postby eagletree » Fri Aug 29, 2014 1:58 pm

I just ripped out my switches because they are getting too many false trips and I'm rewiring everything again. But, before I did, I saw your post and measured voltage downstream of the capacitor to the limit switch pins on the arduino. I had 5 volts, so your 4.96 doesn' t sound like a problem. Mine was working that way aside from false alarms.
eagletree
 
Posts: 96
Joined: Fri Jun 20, 2014 5:15 pm
Location: Western Washington State

Filter Out Limit Switch Noise

Postby scott216 » Tue Sep 02, 2014 2:50 pm

This was originally posted by Ben Harper on GitHub in the GRBL repo. I thought it was informative and worth reposting here.

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 fix / shield from it
2) Stick a filter in place to negate the noise.

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

Adding lower val pull up resistors by the way just creates heat and wastes power. When ever your limit switch remains depressed, like after a home command, your resistor will be fighting 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:

Install 3 X 0.47 uf electrolytic capacitors.

For each one, connect the negative to arduinos ground and the positive to one of the 9,10,11pins.
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. 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 affect 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 filter 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 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 g shield or what ever stepper shield you are using.

As you first 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 effect.
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 different 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 off constants in grbl to about 5mm so that when your homing finishes it pulls back off 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 effect, 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!

Ben.
Shapeoko 2 with DW660
grbl v0.9g
PCB Toolchain: Cadsoft Eagle > pcb-gcode > Chilipeppr or GRBL Panel
Other Toolchain: Fusion 360 > Chilipeppr or GRBL Panel
My Build Log
Location: New Jersey
scott216
 
Posts: 226
Joined: Thu Oct 10, 2013 12:35 pm
Location: New Jersey

Re: Limit Switch Wiring?

Postby cvoinescu » Tue Sep 02, 2014 4:31 pm

I agree with some but not all of that.

The energy wasted as heat from a 330 ohm pull-up resistor is minimal -- same as an LED, which you would not think twice about adding to your circuit.

A series resistor helps, because it slows the rate at which unwanted transients (noise) can charge or discharge the capacitor. It's probably not needed in most cases, but even then it allows a lower-value capacitor to suppress all the noise, and protects the contacts of the switch from wear from the high current created by discharging a relatively large capacitor. A long wire with a capacitor at one end can cause destructive pulses through a phenomenon called LC ringing, and the series resistor also prevents that.

As for levers or no levers, I prefer microswitches with no levers, as long as there's a hard stop that prevents the switch or other parts (V-wheels) from being crushed (the eShapeoko motor plates always hit the end plates before V-wheels do, and the limit switches can be adjusted so that only the plunger is pressed). I think that a lever amplifies whatever small error the switch has: for the same type of switch, the lever-less version is more accurate.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk
cvoinescu
 
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK

Re: Limit Switch Wiring?

Postby Kevin Fraser » Tue Sep 09, 2014 10:42 am

:?: Got my shapeoko2 up and running, only stumbling block is the limits. wiring them straight to ground doesn't work, (all wiring has been confirmed with my ohm meter). Now reading the posts (almost daily) 5v is needed, a resistor and now a cap.No problem with components and installation, just wondering after upgrading to v0.9h is there code changes to be made to enable this ? Also do we use the same approach for pins A0,A1 and A2 ?
Kevin Fraser
 
Posts: 1
Joined: Sun Sep 07, 2014 2:29 pm
Location: Canada

Re: Limit Switch Wiring?

Postby BenHarper » Thu Oct 09, 2014 9:21 am

Kevin Fraser wrote::?: Got my shapeoko2 up and running, only stumbling block is the limits. wiring them straight to ground doesn't work, (all wiring has been confirmed with my ohm meter). Now reading the posts (almost daily) 5v is needed, a resistor and now a cap.No problem with components and installation, just wondering after upgrading to v0.9h is there code changes to be made to enable this ? Also do we use the same approach for pins A0,A1 and A2 ?



Kevin,
I saw a note that the pinout may change a little in Grbl V.09 - mentioned here: https://github.com/grbl/grbl/wiki/Connecting-Grbl

"For Grbl v0.9 with variable spindle PWM ENABLED: (NOTE: The Z-limit and the spindle enable pin swapped, because we had to access the hardware PWM on D11 for variable spindle PWM output to work.) We are still updating this pin configuration at the moment by weighing future options. We'd like to change the only pins once. Stay tuned!"

Im not sure if they have enacted this or other change but may be worth looking at.
Also, are you aware that you need to set a few parameters down the bottom end of the list to turn on the limit functionality?
$16=1 (hard limits, bool)
$17=1 (homing cycle, bool)
$22=2.000 (homing pull-off, mm)

What exactly are the limit switches doing or not doing Kevin?
Last edited by BenHarper on Thu Oct 09, 2014 10:00 am, edited 1 time in total.
BenHarper
 
Posts: 3
Joined: Wed Aug 13, 2014 7:06 am

Re: Limit Switch Wiring?

Postby BenHarper » Thu Oct 09, 2014 9:59 am

cvoinescu wrote:I agree with some but not all of that.
The energy wasted as heat from a 330 ohm pull-up resistor is minimal -- same as an LED, which you would not think twice about adding to your circuit.
A series resistor helps, because it slows the rate at which unwanted transients (noise) can charge or discharge the capacitor. It's probably not needed in most cases, but even then it allows a lower-value capacitor to suppress all the noise, and protects the contacts of the switch from wear from the high current created by discharging a relatively large capacitor. A long wire with a capacitor at one end can cause destructive pulses through a phenomenon called LC ringing, and the series resistor also prevents that.


Yup - I agree with this, resistor should be added, hence the name RC filter;) For simplicity I left it out, but to be correct it should be there.
The contactors in those omron switches are 15amps so they will survive but true - ok add a few resistors;)

I don't agree with simply adding resistors as a solution though.
Its not effective on its own and the basis behind the idea that the pullups in the Arduino being too high I don't feel is correct.
Resistors should only be added as part of an RC filter - in my opinion.

cvoinescu wrote:As for levers or no levers, I prefer microswitches with no levers, as long as there's a hard stop that prevents the switch or other parts (V-wheels) from being crushed (the eShapeoko motor plates always hit the end plates before V-wheels do, and the limit switches can be adjusted so that only the plunger is pressed). I think that a lever amplifies whatever small error the switch has: for the same type of switch, the lever-less version is more accurate.


Yes - I agree with that too.
The levers I suppose will fatigue over time or with abuse, its the authority with which the contact's themselves move between open and close which makes them repeatable & reduces bouncing. These switches allow you to remove the debounce time to almost nothing which may make a difference as debounce time could change the trigger point depending on how quickly the carriage was moving when it hits the limit.
So yes, maybe the lever less version of this switch is better than the levered version, either is better than the button that shows up in allot of setups.
I suppose that any limit is better than none, but the momentary switches were designed to push with your finger, and the levers for being actuated in situations like this.
I have opened up allot of industrial equipment, the cheap stuff uses these levers and the expensive stuff has limit switches worth over $100 a piece, none of them use buttons.

Thanks cvoinescu, Im going to play with the non lever version and report back.
Now I have to get my scope back out and work on this subject I had mentally closed:(
Ben Harper
BenHarper
 
Posts: 3
Joined: Wed Aug 13, 2014 7:06 am

PreviousNext

Return to Electronics

Who is online

Users browsing this forum: No registered users and 1 guest