Limit switches

Discussion about the arduino based g-code interpreter, grbl
wz9v
Posts: 130
Joined: Wed Jan 29, 2014 10:08 pm

Limit switches

Post by wz9v » Wed Mar 26, 2014 7:35 pm

Best I can tell from the reading I've done, GRBL expects Normally Open switches for the limit switches. I've seen some other stuff in the 3D printing and TinyG areas that recommend Normally Closed in order to improve noise response.

Is it possible to configure GRBL for Normally Closed switches?
Shapeoko 2 - Mechanical kit 4731
Z-Axis Acme Screw Upgrade / Makita RT0701C / Re-enforced Y and X-Axis / External Belts on Y / Extrusion work top

twforeman
Posts: 1351
Joined: Tue Jan 29, 2013 4:51 pm
Location: Minneapolis, MN
Contact:

Re: Limit switches

Post by twforeman » Wed Mar 26, 2014 8:03 pm

Yes, but I think you have to pull down the source code and edit config.h and re-compile.
Ender 3 3D Printer
ShapeOko v3 serial #0004 - upgrade thread
All of my ShapeOko related blog posts

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Limit switches

Post by cvoinescu » Wed Mar 26, 2014 8:29 pm

Yes. There are several ways.

You can always use both poles of the switch to change over from VCC (switch not pressed) to GND (switch pressed). You need three wires to each switch, and the connections get a little more complicated when you have two switches on one axis, but it's not really that hard. This gives you the best noise immunity, and does not require any changes in GRBL.

Another way is to use NC switches to VCC, with a pull-down resistor to GND (I suggest 1 kohm). As always with NC switches, wire the two switches on one axis in series. This does not require any changes in GRBL either.

Yet another way is to use NC switches to GND (with pull-up resistors to VCC, or even just the internal pull-ups), and modify GRBL to invert the logic that reads the limit switch inputs.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

wz9v
Posts: 130
Joined: Wed Jan 29, 2014 10:08 pm

Re: Limit switches

Post by wz9v » Wed Mar 26, 2014 8:43 pm

Thanks for the ideas, that gives me some clues to chase down.
Shapeoko 2 - Mechanical kit 4731
Z-Axis Acme Screw Upgrade / Makita RT0701C / Re-enforced Y and X-Axis / External Belts on Y / Extrusion work top

chomdh
Posts: 179
Joined: Sun Jan 19, 2014 3:43 pm
Location: Bettendorf, IA

Re: Limit switches

Post by chomdh » Thu Mar 27, 2014 2:54 am

I could also use some help wiring up the limit switches for homing. I have some hall effect sensors and magnets I can use, and can find a way to rig them up to the motor plates and/or makerslide, but I'm a bit lost when it comes to the electronics side. Do I need to make a special circuit board to make 5 or 6 sensors work off one 5V supply? I could handle wiring up a simple board if someone has a schematic and some helpful pictures.

I currently have wired up the sensors and tested them, I'm getting 5V until I put the magnet close enough and then I get 0V, and I know I need to wire the 3 axes' sensors to pin 9, 10, and 11 on the Gshield, now I need a bit of help to finish out this upgrade!
Shapeoko2 #3702:
DW611, arduino uno, gshield v5, NEMA23's on X & dual Y, NEMA17 on Z with ACME rod, 9mm belts, Mean Well NES-350-24V power supply, re-inforced gantry rails.
Soon to have inventables spindle mount and 1M X axis.

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Limit switches

Post by cvoinescu » Thu Mar 27, 2014 9:59 am

If you ask me, you don't need a PCB for that. Depending on the makeup of your Hall-effect switches, you can get away with simply wiring the two sensors on one axis in parallel, or you may have to use diodes. If you know the part number of your switch, I can look it up and check the datasheet.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

RobCee
Posts: 587
Joined: Wed Jan 08, 2014 11:33 am
Location: Birmingham, UK

Re: Limit switches

Post by RobCee » Thu Mar 27, 2014 1:16 pm

Does this sort of thing help? The actual connections on your sensors may be slightly different, but you should get the concept form this diagram.

This diagram is ONLY correct for sensors with open-drain outputs. Check your sensor's manufacturer for the correct way to connect your sensors.
Hall Sensor.jpg
Hall Sensors
Hall Sensor.jpg (65.85 KiB) Viewed 3651 times
Here is the image as a bigger PDF
Hall Sensors 2.pdf
Hall Sensor wiring PDF
(178.58 KiB) Downloaded 343 times
Last edited by RobCee on Fri Mar 28, 2014 10:16 am, edited 1 time in total.
ShapeOko2 #3400 - Chinese 800W AC Spindle - Stiffened X-Axis - TR10 Z-Axis - Inverted Z Motor - Hall Effect Limits - Drag Chains & Custom Brackets

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Limit switches

Post by cvoinescu » Thu Mar 27, 2014 3:13 pm

That'll work only for some Hall sensors. For others, that way at best does not work, and at worst destroys the sensors. The only way to tell is to know what type of output the sensor has, and the best place to find that out is the datasheet.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

chomdh
Posts: 179
Joined: Sun Jan 19, 2014 3:43 pm
Location: Bettendorf, IA

Re: Limit switches

Post by chomdh » Thu Mar 27, 2014 5:27 pm

I have Allegro A1101ELHLT-T Hall sensors. I really appreciate the limit switch for dummies level explanation. I'm more of a mechanical type of guy, and this project is helping me learn quite a bit.

Datasheet link:
http://www.google.com/url?sa=t&rct=j&q= ... 8443,d.b2I
Shapeoko2 #3702:
DW611, arduino uno, gshield v5, NEMA23's on X & dual Y, NEMA17 on Z with ACME rod, 9mm belts, Mean Well NES-350-24V power supply, re-inforced gantry rails.
Soon to have inventables spindle mount and 1M X axis.

wz9v
Posts: 130
Joined: Wed Jan 29, 2014 10:08 pm

Re: Limit switches

Post by wz9v » Thu Mar 27, 2014 6:06 pm

I was planning to just use plain old subminature switches (two wire, passive) for my limits.

Do people prefer the circuit board ones that use a three wire (active circuit I assume) connection?
Shapeoko 2 - Mechanical kit 4731
Z-Axis Acme Screw Upgrade / Makita RT0701C / Re-enforced Y and X-Axis / External Belts on Y / Extrusion work top

Post Reply