GRBL directly wiring 5v pin to limit pin (end stop)

Hello everyone,

I am working on a project using stepper motors meant for a CNC machine. I will control my device with GRBL G code, and have a question regarding end stops.

For my x-axis and y-axis, i am using an optical end stop to mark my "home" position (x=0 when it is triggered).

Important : my device does not have a z-axis.

In order to set home coordinates, I enabled Limit Switches in the software that I am using (universal Gcode sender). However, when I invert my switches (open light switch = good, closed light switch = alarm), then my z-axis is always in "alarm" mode, preventing me from using the machine.

I was wondering if I could connect a 5v source pin directly to the pin representing my z-axis, without damaging the Arduino. I would think that this just gives a constant signal, emulating an open light switch.

If you have any knowledge regarding this topic, please let me know!

I would connect it to 5V through a 10K resistor. This would limit the current should anything happen.

Hello again poenwl!

Unfortunately fixing your z-axis limit switch to either a high or low input won't work - the homing cycle requires a change of state to operate.

The right way to do this for a two axis machine is to disable z-axis homing in software, to do this you need to change a couple of lines of code in the config.h file of grbl, then recompile your custom version of grbl and flash it to your Arduino.

In config.h, comment out the following two lines:

#define HOMING_CYCLE_0 (1<<Z_AXIS)
#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS))

then add in:

#define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS))

Instructions for compiling Grbl can be found here.

Hope this helps!

2 Likes