Homing and Limit switches again

Hello fellow X-Carve users.

I have a CNC router working with Mach3 - and in this machine - I have 3 homing switches, each going to it’s own pin on the board (HobbyCNC) with common ground.

My Limit Switches use another pin for all 3 - in series.

Now for my X-carve - I know there are 3 pins for the homing/limit switches. If I want to use also 3 limits switches - where do I hook them ? Is there a special pin you guys are using for the limit switches ?

I would love to hear from guys having 3 extra limit switches - where and how did you connect them.

A wiring diagram would be perfect,

Many thanks

Isaac

@IsaacNeuman

The people that I have seen do this place the limit switches for each axis in series and run them Normally Closed.

This has the added advantage of causing a limit alarm if a wire breaks.

If you do it this way you can still use the stock Arduino/gShield electronics with grbl.

Can you do the same with the home switches i.e. wire them in series N/C to a single pin?

@GeoffSteer

Whether you call a switch a homing switch or a limit switch depends on how you use the switch. There isn’t a physical difference.

If you want to change from Normally Open to Normally Closed you would set $5=1 in grbl.

[Edit] I think I miss read your question. You need to use the three I/O pins on the Arduino/gShield for three axes. You can have as many NC switches on one axis as you want. Then Normally Closed would be wired in series.

Thanks. My existing X-Carve setup uses a Gecko G540 and Linuxcnc with N/C home switches in series to a single pin. I plan to install an Arduino mostly to give Easel a try and the less I have to change, the better. No plans for limit switches at this stage, soft limits work very well.

@GeoffSteer

Yes, I think soft limits are adequate, but some people like to cover as many possibilities as they can.

How does that work? It seems that when any one of the axes opened the switch then the homing sequence would stop leaving the other two axes in the wrong place.

It all depends on having the homing sequence set correctly. Each axis is homed separately ( Z,Y,X) so when the home circuit goes O/C, the software knows which axis is activating it.

@GeoffSteer

So, you got me curious. I checked and grbl can support homing on a single I/O pin. You have to change the configuration of grbl and recompile to get this option to work. This should work with N/O in parallel or N/C in series.

The Inventables fork of grbl does not support single I/O pin homing.

1 Like

Thanks @LarryM

So how does the SW know which is which ? On my other system (Mach3) I press the ref button, each axes goes to the Homing switch - activate it - goes back a bit to release the lever and this sets the machine zero position. The limit switches just stop the machine and triggering a warning.

If you have 2 switches on one pin - how does the sw know if a homing switch was pressed or a limit switch that is on the other side of the machin ?

My GRBL knowledge is close to zero - so this is why I ask all these questions :cold_sweat:

Many thanks again.

@IsaacNeuman

You determine via grbl parameters which way the machine moves in a homing cycle (Inventable fork default is Z up, X left, Y front).

Using the Arduino/gShield electronics with grbl (Inventables fork) each axis has it’s own I/O pin. X axis is on D9, Y axis is on D10 and Z axis is on D12. These pins are hooked to the homing switches. grbl (Inventables fork) will first home the Z axis (move to homing switch contact, back off, approach again more slowly to contact, then pull off a small amount to clear the switch). Once Z is complete, X and Y will home simultaneously (same procedure).

Check out this thread:

Thanks @LarryM

As always - you are most helpful. Very much appreciated.

My head is already spinning . . .

For this setting - can I hook the wires straight to the Arduino/Gshield pins or do I need to add some “pulldown” resistors ? (read something about it on GRBL parameters)

BTW - is "normally high = Normally Open ?

Many thanks again

Isaac

@IsaacNeuman

Not trying to be too picky, but normally high and normally open is an apples and oranges type question.

Just so happens that the design of the Arduino/gShield/grbl system if the homing switch is used in the normally open configuration then the voltage on the I/O pins is high when the switch is not tripped.

If you use the normally closed configuration then the voltage on the I/O pin is low when the switch is not tripped.

Here’s how you would hook up your switches (X axis). Y and Z would be the same to the appropriate pin.

Don’t forget to change $5 to 1 if you hook it up this way.

The only reason you would need to use a pull down resistor is if you where using NC switches and you were not going to hook up one or more of the axes.

This is interesting. My 3d printer uses individual homing switches, but no limits. This series wiring seems promising.

So, to wire in series this way, you would need two digital pins? One for positive travel (limits), and one for negative travel (homing)?

Would it be possible to run the switches in parallel to analog/ADC pins on the Arduino with different resistor values on each to indicate what triggered in a given situation? (e.g. assuming remapped ADC values of 0-500, 0=no fault, 200=x, 300=y, 400=z)

@IsaacNeuman, just to expand on what @LarryM said. Generally speaking High/Low describes the state of the pin while Open/Closed describes the state of the switch. This can be configured in many different combinations.

No. One of the switches above is the standard X-carve homing switch for the X axis and the other switch is for the far end of the X axis. After the homing cycle is complete the homing switch acts as a limit switch if hard limits are turned on. Using NC wiring if either switch opens then the limit is tripped.

Not with grbl. Anything is possible, but why would you want to do this?

@BradT - I also do have a 3D printer, and it’s setting of homing and soft limits works fine. Will have to play with the options to see which will work best.

@LarryM - thanks again for your kind support. I reckon I will start with Homing and soft limits, and after all will work properly I might start playing with the other options. I installed and wired all 6 switches, but will hook them later.

Had an argument with my buddy who helps me in building - he reckons that if we use coax cable to hook the switches then the inner wire will go NC pin on the switch and the mesh will go to ground (as a (-) wire) on the switch.

Forum guys have told me to use a shielded cable - so each wire will go to the switch and the mesh to the ground on the Arduino/Gshield side.

I would like to hear your opinion on this one too.

So much to learn - I very much like it.

Cheers

Better choice for this application is 2 conductor cable with shield. The shield should only be connected at one end of the cable. Since the shield is not connected at one end it cannot serve as a current path and the switch would not do anything in either position. You need the second conductor to form a current path.

The whole idea behind the shield is to protect the signal path from interference from other electro-magnetic sources. If you use the shield as a part current path then the signal path is not protected as the entire return path becomes an antenna exposed to interference.

Thanks @LarryM - yes, this was my argument.

Now I have some serious backup to my argument - will gladly see him twist ha ha

Best

Isaac

Ahhh…gotcha @LarryM. The Marlin firmware for 3d printing handles homing and limit switches differently. It handles each of the 6 switches, and the direction of travel they affect, independently rather than only looking at which axis is triggered. That is what I am used to. Looking at the grbl firmware on github now, I see what you mean.

I don’t know that I would. It’s more a hypothetical idea than anything. I just like to tinker and poke around.

@BradT

Marlin is another beast. It also has different meanings for some of the G-code commands.

In the CNC world the limit switches are an “oh, sh*t” situation where you don’t care which way it’s moving, you just want to shut it down.