Adding End-Stop Switches

End-Stop Switch

After a number of positioning errors and the machine making some nasty noises trying to move beyond limits it was obvious the addition of limit switches would be a good investment.

These Limit Switches from Amazon are compatible with the Cronos Controller Board. The cables provided fit without alteration.

I may yet add a Z axis end-stop but for now I’ve added switches only to the X & Y axis. In order to get the controller board to properly home the X & Y axis the firmware on the controller will need to be re-flashed to allow it to only home X & Y. I took this as an opportunity to update to GRBL 1.1h.

The configuration changes to the firmware are as below and are located about 100 lines into the config.h file:


// Define the homing cycle patterns with bitmasks. The homing cycle first performs a search mode
// to quickly engage the limit switches, followed by a slower locate mode, and finished by a short
// pull-off motion to disengage the limit switches. The following HOMING_CYCLE_x defines are executed
// in order starting with suffix 0 and completes the homing routine for the specified-axes only. If
// an axis is omitted from the defines, it will not home, nor will the system update its position.
// Meaning that this allows for users with non-standard cartesian machines, such as a lathe (x then z,
// with no y), to configure the homing cycle behavior to their needs.
// NOTE: The homing cycle is designed to allow sharing of limit pins, if the axes are not in the same
// cycle, but this requires some pin settings changes in cpu_map.h file. For example, the default homing
// cycle can share the Z limit pin with either X or Y limit pins, since they are on different cycles.
// By sharing a pin, this frees up a precious IO pin for other purposes. In theory, all axes limit pins
// may be reduced to one pin, if all axes are homed with seperate cycles, or vice versa, all three axes
// on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits
// will not be affected by pin sharing.
// NOTE: Defaults are set for a traditional 3-axis CNC machine. Z-axis first to clear, followed by X & Y.
//#define HOMING_CYCLE_0 (1<<Z_AXIS)                // REQUIRED: First move Z to clear workspace.
//#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS))  // OPTIONAL: Then move X,Y at the same time.
// #define HOMING_CYCLE_2                         // OPTIONAL: Uncomment and add axes mask to enable

// NOTE: The following are two examples to setup homing for 2-axis machines.
// #define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS))  // NOT COMPATIBLE WITH COREXY: Homes both X-Y in one cycle. 

#define HOMING_CYCLE_0 (1<<X_AXIS)  // COREXY COMPATIBLE: First home X
#define HOMING_CYCLE_1 (1<<Y_AXIS)  // COREXY COMPATIBLE: Then home Y

// Number of homing cycles performed after when the machine initially jogs to limit switches.
// This help in preventing overshoot and should improve repeatability. This value should be one or
// greater.
#define N_HOMING_LOCATE_CYCLE 1 // Integer (1-128)

// Enables single axis homing commands. $HX, $HY, and $HZ for X, Y, and Z-axis homing. The full homing 
// cycle is still invoked by the $H command. This is disabled by default. It's here only to address
// users that need to switch between a two-axis and three-axis machine. This is actually very rare.
// If you have a two-axis machine, DON'T USE THIS. Instead, just alter the homing cycle for two-axes.
// #define HOMING_SINGLE_AXIS_COMMANDS // Default disabled. Uncomment to enable.

// After homing, Grbl will set by default the entire machine space into negative space, as is typical
// for professional CNC machines, regardless of where the limit switches are located. Uncomment this
// define to force Grbl to always set the machine origin at the homed location despite switch orientation.
#define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.

It may be possible to zero both X & Y simultaneously but I chose to zero each in turn. For my own preference I also enabled the HOMING_FORCE_SET_ORIGIN so that the machine coordinates are positive.

Limit switches were placed on the left of the X axis and back of the machine for Y axis. This allows the home position (0,0) to align with the bottom left of the work piece. There are limit switches available that have the switch mounted 90 degrees but, if careful, you can bend them round which is what I did for the Y axis. I used a bit of hot melt glue to mount them, not pretty but works perfectly.

GRBL settings will need adjusting to reverse direction of the switch sensors.

$5=1         Reverses the limit switch inputs
$22=1 Enables the homing function
$23=3 Reverses the homing direction of X & Y allowing (0,0) to correspond to bottom left of the CNC bed

Once zero is established you can then determine the maximum X & Y travel and configure that too.

$130=280.000       Maximum X travel
$131=170.000 Maximum Y travel
$132=40.000 Not important as Z axis does not home (40-45 is about right)

$20 can be used to set soft limits so the machine never exceeds your new found limits but I found this interfered with the Z axis so just turned it off. There is bound to be a solution but Candle shows the size of the cut anyway as a final check and during the generation of G-Code I now know the bed size. So far no axis crashes.

Leave a Reply

Your email address will not be published. Required fields are marked *