# Homing machine in Universal GCode Sender

**URL:** <https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835>\
**Category:** Motors, Mechanics, Power and CNC\
**Created:** [May 14, 2024, 11:40am UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835 "2024-05-14T11:40:54Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![naseemaa](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@naseemaa](https://forum.arduino.cc/u/naseemaa)\
**Post date:** [May 14, 2024, 11:40am UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/1 "2024-05-14T11:40:54Z")

</div>

Hello all,  
I have made my own desktop CNC machine, with grbl controller, and using the universal gcode sender.

while setting it up using the setup wizard, I was confused to configure the limit switches, I have 2 for X-axis (X+ and X-), 2 for Y-axis(Y+ and Y-), and 1 for Z-axis (Z+), I dont know how to configure them to home my machine.

this is my firmware setting:

| $0 | 10 | Step pulse time |
| --- | --- | --- |
| $1 | 25 | Step idle delay |
| $2 | 0 | Step pulse invert |
| $3 | 3 | Step direction invert |
| $4 | 0 | Invert step enable pin |
| $5 | 0 | Invert limit pins |
| $6 | 0 | Invert probe pin |
| $10 | 1 | Status report options |
| $11 | 0.010 | Junction deviation |
| $12 | 0.002 | Arc tolerance |
| $13 | 0 | Report in inches |
| $20 | 0 | Soft limits enable |
| $21 | 0 | Hard limits enable |
| $22 | 1 | Homing cycle enable |
| $23 | 3 | Homing direction invert |
| $24 | 25.000 | Homing locate feed rate |
| $25 | 100.000 | Homing search seek rate |
| $26 | 25 | Homing switch debounce delay |
| $27 | 1.000 | Homing switch pull-off distance |
| $30 | 1000 | Maximum spindle speed |
| $31 | 0 | Minimum spindle speed |
| $32 | 0 | Laser-mode enable |
| $100 | 100.000 | X-axis travel resolution |
| $101 | 100.000 | Y-axis travel resolution |
| $102 | 100.000 | Z-axis travel resolution |
| $110 | 100.000 | X-axis maximum rate |
| $111 | 100.000 | Y-axis maximum rate |
| $112 | 100.000 | Z-axis maximum rate |
| $120 | 10.000 | X-axis acceleration |
| $121 | 10.000 | Y-axis acceleration |
| $122 | 10.000 | Z-axis acceleration |
| $130 | 200.000 | X-axis maximum travel |
| $131 | 10.000 | Y-axis maximum travel |
| $132 | 10.000 | Z-axis maximum travel |

I dont know what to change, or either by changing the settings or from the hardware

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [May 14, 2024, 12:00pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/2 "2024-05-14T12:00:41Z")

</div>

Are you wiring the +/-axis limit switches in Series? grbl assumes that if it's moving +X and Xlimit trips, it's hit Xmax, and if moving -X and Xlimit trips, it's hit Xmin, so it's expected to double up the the X+ and X- switches on the Xlimit pin.

![image](https://europe1.discourse-cdn.com/arduino/original/4X/d/6/5/d6540944f4faa8f87494851af23b15bacadf3e06.jpeg)  
(ht Protoneer: [https://blog.protoneer.co.nz/arduino-cnc-shield/#BoardLayout](https://blog.protoneer.co.nz/arduino-cnc-shield/#BoardLayout))

---

<div class="post-metadata">

**Author:** ![naseemaa](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@naseemaa](https://forum.arduino.cc/u/naseemaa)\
**Post date:** [May 14, 2024, 12:02pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/3 "2024-05-14T12:02:51Z")

</div>

I connected the NC terminals of the limit switches to the CNC shield.  
for example for x-axis:  
1 NC to the positive pin on the shield and the other to the negative

---

<div class="post-metadata">

**Author:** ![naseemaa](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@naseemaa](https://forum.arduino.cc/u/naseemaa)\
**Post date:** [May 14, 2024, 12:12pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/4 "2024-05-14T12:12:14Z")

</div>

what is happening is when I press "home machine", it is going up through the z-axis, for a specific distance and an alarm is triggered

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [May 14, 2024, 12:13pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/5 "2024-05-14T12:13:18Z")

</div>

The default grbl+shield setup is for normally open switches in parallel. It is better to use NC in series, so it fails-safe, but then you need to invert the limit pins ($5) and wire the switches in series.

If you invert the limit pins and leave the NC switches connected in parallel, one or the other of the limit switches will be closed and always will inhibit detection of the other limit by shorting `Limit ?-Axis`.

---

<div class="post-metadata">

**Author:** ![naseemaa](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@naseemaa](https://forum.arduino.cc/u/naseemaa)\
**Post date:** [May 14, 2024, 12:14pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/6 "2024-05-14T12:14:47Z")

</div>

do u recommend changing the limit switch pin connections from NC to NO? May this be the issue?

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [May 14, 2024, 12:17pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/7 "2024-05-14T12:17:33Z")

</div>

You can do it either way:

> **[Wiring Limit Switches](https://github.com/gnea/grbl/wiki/Wiring-Limit-Switches)**
>
> An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino - gnea/grbl

...but the wiring and $5 settings depend on the type of switch.

I prefer the NC in series form so that if a wire or switch breaks or becomes unplugged, it acts as if it hit a limit switch.

---

<div class="post-metadata">

**Author:** ![naseemaa](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@naseemaa](https://forum.arduino.cc/u/naseemaa)\
**Post date:** [May 14, 2024, 12:22pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/8 "2024-05-14T12:22:18Z")

</div>

I am using the ME-8111 limit switch, how i find the com?  
It has 4 terminals as follows:

3 NO | 4 NO

1 NC | 2 NC

In my project i took a wire from terminal 1 to the positive side of the X+, and the terminal 2 to the negative side of the X+ limit switch.

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [May 14, 2024, 12:32pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/9 "2024-05-14T12:32:31Z")

</div>

If you wired 1&3 together, they would act like COM on a 3-terminal switch. In an NC context, is as if (1NC) is (COM).

But you could just do:

`(X-)----(SW1 1NC)----(SW1 2NC)----(SW2 1NC)----(SW2 2NC)---(X+)`  
`(X+)----(SW1 1NC)----(SW1 2NC)----(SW2 1NC)----(SW2 2NC)---(GND)`  
or  
`(X-)----(SW1 1NC)----(SW1 2NC)----(SW2 1NC)----(SW2 2NC)---(GND)`  
or  
`(GND)----(SW1 1NC)----(SW1 2NC)----(SW2 1NC)----(SW2 2NC)---(X+)`  
or  
`(GND)----(SW1 1NC)----(SW1 2NC)----(SW2 1NC)----(SW2 2NC)---(X)`

as in

 ![](https://europe1.discourse-cdn.com/arduino/original/4X/d/e/0/de081cee2034b766dc3bd3d67b967cb42a9bf5b8.jpeg)  
(ht [Wiring Limit Switches · gnea/grbl Wiki · GitHub](https://github.com/gnea/grbl/wiki/Wiring-Limit-Switches))

---

<div class="post-metadata">

**Author:** ![naseemaa](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@naseemaa](https://forum.arduino.cc/u/naseemaa)\
**Post date:** [May 14, 2024, 12:33pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/10 "2024-05-14T12:33:40Z")

</div>

okay i will try, probably its wiring issue.

---

<div class="post-metadata">

**Author:** ![naseemaa](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@naseemaa](https://forum.arduino.cc/u/naseemaa)\
**Post date:** [May 14, 2024, 12:49pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/11 "2024-05-14T12:49:36Z")

</div>

> [@DaveX](#):
>
> `(X-)----(SW1 1NC)----(SW1 2NC)----(SW2 1NC)----(SW2 2NC)---(X+)`

on the cnc shield, I have:  
For X+ 2 pins white and black  
For X- 2 pins white and black

I should use 1 of them and doesnt matter which one to use or how?

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [May 14, 2024, 2:10pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/12 "2024-05-14T14:10:27Z")

</div>

It does not matter which of the +/- pairs you use. For each axis, the pins on the endstop headers are connected together on the CNC shield before they hook into the 3 Uno pins:

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/6/9/a/69ab55515149b1c3bf9f47f0e2fbd1eb97473ef1.jpeg)  
per [Arduino CNC Shield – 100% GRBL Compatable | Protoneer.co.nz](https://blog.protoneer.co.nz/arduino-cnc-shield/)

One column is grounds, and the other column is signals:

That is:  
 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/e/4/c/e4c23c7e2db16814ea9173625f778dd5af6e5832.jpeg)

Z+ is connected internally to Z- in its silkscreened box. As is Y+ to Y-. And X+ to X-. So you need Z+ and its ground. I'll edit my wrong line above to:

```
(X+)---(SW1 1NC)---(SW1 2NC)---(SW2 1NC)---(SW2 2NC)---(GND)

```

---

<div class="post-metadata">

**Author:** ![naseemaa](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@naseemaa](https://forum.arduino.cc/u/naseemaa)\
**Post date:** [May 14, 2024, 2:39pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/13 "2024-05-14T14:39:47Z")

</div>

the x and y axis are working properly, disconnected one i press the limit and connected when released.  
however, the z axis still not working, the limit switch is normal and functional.  
i connected directly the Z to the ground and the Z still didnt seem to be connected.  
i tested the Z pins, the positive and negative pins of the Z are working as ground.  
Is the CNC shield damaged? Or any recommended solution??

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [May 14, 2024, 2:48pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/14 "2024-05-14T14:48:29Z")

</div>

Do Z+ and Z- on the shield both connect to Pin 9 pin 11 on the Arduino?

Does your Arduino work with the Button example sketch configured for pin 9 pin 11 or pin 12?

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [May 14, 2024, 3:05pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/15 "2024-05-14T15:05:38Z")

</div>

Oh, depending the shield version/clone version/grbl version/grbl configuration, the Z-stop might be on a different pin, like SpindleEnable/pin 11/pin12:

> **[Connecting Grbl](https://github.com/gnea/grbl/wiki/Connecting-Grbl)**
>
> An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino - gnea/grbl

---

<div class="post-metadata">

**Author:** ![naseemaa](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@naseemaa](https://forum.arduino.cc/u/naseemaa)\
**Post date:** [May 14, 2024, 8:00pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/16 "2024-05-14T20:00:45Z")

</div>

Yes, this was the problem. I connected Z to the spindle pin it worked.

Thanks a lot​:raising\_hand\_man:🙋‍♂️🙋‍♂️

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [November 10, 2024, 8:00pm UTC](https://forum.arduino.cc/t/homing-machine-in-universal-gcode-sender/1259835/17 "2024-11-10T20:00:52Z")

</div>

Closed on November 10, 2024, 8:00pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
