Home switches get your CNC retrofit ready sooner after a applying power. Home switches define reference points along each axis, from which, axes can be moved to a convenient starting position or origin. LinuxCNC saves it position, but the machine has moved while not powered, for instance the head drifted down, the restored positions will be wrong.

Convenient origins are probably a personal choice that helps with ones workflow. A convenient Z origin could be at the top of the column travel ready for a tool to be loaded. The XY origin could be centered under the spindle or with the table all the way forward to make loading a part easier.

Home switches also increase machining safety. With an accurate origin position, the distance to the ends of each axes is known. This can be used to define a safe machining work envelope. This may be further enhanced with a database of tool lengths.

Home vs. limit switches

Limit switches are related, and an a limit switch could be used as a home switch, but the two are slightly different. Home switches influence the controller only while homing and are used to find a precise starting location. Limit switches are used to avoid a collision and prioritize the emergency response over accuracy. The approach to a home switch is likely slow while a limit switch could be approach at full speed. The need to decelerate before colliding with the end of travel requires the limit switch to be placed in advance of the hard limit so the motor has time to slow the axis down. While home switches are likely to be wired independently into a controller, limit switches may be wired in series and to a single limit input or be part of the estop loop.

Instead of adding hardware limit switches, I rely on LinuxCNC to provide software based limits and with closed loop motors this seems reasonable. I’ve never had a motor run away but I have collided with an axis end point because I didn’t have a proper origin and programmed axis limits.

Installation details

I used 24v PNP normally closed inductive switches (Automation Direct AHS-CP-1A with OPT2107 bracket and shielded cable). Wiring PNP sensors into the Mesa 7i76e card is simpler than NPN sensors because no resistors are needed with PNP sensors. I previously used these on my CNC lathe conversion, and the specs promise they are pretty accurate.

The sensors are installed in places where they should see minimal coolant and chips: at the top of the column and under the table. The X-Y cables are further protected by passing through a hose. The X-Y sensor and target placements are shown in the picture at the top of this article. Both the X and Y sensors are installed on the saddle. The Y-target is installed on the base. And the X-target is installed on a precision surface on the underside of the table taking care during installation to avoid places where the target could collide with the saddle.

A block of steel is used as a sensor target. The inductive sensors can detect steel targets at a greater distance than a non-ferrous target. The sensor-target combination must be installed in such a way that some over travel is allowed but the sensor must never get behind the target. LinuxCNC will search along an axis in one direction, and if the target is behind the searching sensor, the home switch will never be tripped. If there are no limit switches, then the machine will collide with an end of travel. Starting the search while the sensor is already detecting the target is fine. LinuxCNC will skip the initial search, reverse the search direction, and more slowly probe for the start of the target. This more precise final search is performed everytime.


I waited a number of years to add home switches to my LinuxCNC retrofitted mill. Adding them took a few days, but I’m glad they are now installed because they will save time each time I use the mill. With a consistent origin point, I can also add features to the table and reference those by distances from the origin. For instance, I’ve added a tool length sensor with an exact known position once homing is complete. I can also crank the MPG wheel fast, and quickly move up to an end of an axis without worrying about colliding with the end of travel. Also, when a program is loaded, I know if it’ll fit in the work envelope.

If starting a new CNC retrofit, consider where you might install the home switches early. Alternatively, consider absolute encoders that retain position after power is lost. These could be used to know the position of the machine on startup without the need to home. Absolute encoders are options on some motors, like the DMM servos, and could allow positioning from a one-time-ever homing operation.

More information

I made a video about the process of installing small inductive sensors as home switches, that are tucked away, protected from chips and coolant. The home switches are attached a Mesa 7i76e board and the mill is a PM25 CNC retrofit. I hope you’ll find the ideas useful for your retrofit.

Full notes for this project are available on Notion.