Homing your CNC Machine

Homing allows your CNC Controller to learn about the boundaries of your CNC machine. In this article, I'll explain why it helps and how to set it up with a Buildbotics CNC Controller.

Why bother?

Honestly, homing with a Buildbotics Controller is not absolutely necessary. But it does provide two important advantages.

First, it lets the controller know the boundaries of the physical machine. This prevents running into an endstop, which can be pretty hard on your machine.

Second, once a machine is homed, you can tell it to move to some specific absolute position and that absolute position will always be at the same place on the machine. For instance, you may have a jig on your table where you like to lay down a workpiece. If the machine is homed, that location will always be at the same absolute position. Check out my article on 'Macro Buttons' to see how to make things even easier.

You may have noticed that I am using the phrase 'absolute position'. The absolute position is the position relative to the machine boundaries. The cutting position or just 'position' can be different from the absolute position if the position offsets have been adjusted. Check out my article titled 'CNC Offsets (absolute position vs cutting position)' to learn more about position offsets.

What hardware is needed for homing?

Homing relies on the ability to trigger an event when an axis reaches a known position. On the Buildbotics Controller, that event is either opening or closing a switch. These switches are known as limit switches. There are several kinds of limit switches including magnetic reed switches, optical switches, proximity switches, and mechanical lever switches. The one thing that they have in common is that they provide a state change on a pair of wires that can be detected by the controller.

I usually use magnetic reed switches like the ones shown below because:

  • They are easy to install.
  • They have no mechanical parts that can fail.
  • They're cheap.
  • They do not require power.
  • The activation position seems to be very consistent.
  • They never make physical contact. I can install them in a way that the magnet slides past the reed rather than running into it.

The one drawback is that they don't work very well when cutting ferrous materials.

The reed switches change state when the magnet comes into close proximity with the reed relay.

Magnetic Reed Switch

How do you connect the switch to the Buildbotics Controller?

Each limit switch gets connected to one of the digital inputs on the DB25 Breakout box. Simply pick any unused digital input pin. We'll configure the controller later.

If the limit switch is passive (non-powered), simply connect one of the wires to digital input pin and the other wire to a ground pin.

If limit switch is powered, connect the positive wire to a digital input and the ground wire to one of the ground pins.

Then plug the DB25 breakout box into the back of the Buldbotics Controller.

DB25 Breakout Box that comes with the Buildbotics CNC Controller

How to configure limit switches in the Buildbotics Controller

Limit switches are configured on the SETTINGS->I/O page on the Buildbotics Controller.

SETTINGS->I/O page on the Buildbotics Controller

Do the following things for the digital input pin that you selected:

  • Select the function from the pull-down menu in the Function column. For instance, if the switch is positioned at the maximum end of the axis served by motor port 0, then the function would be 'input-motor-0-max'
  • Select the mode from the pull-down menu in the Mode column. This will be 'normally-open' if the switch is open or presents a high signal when it is not active. It will be 'normally-closed' if the switch presents a low signal or is closed when it is not active.

The icons in the State column report the current state of the switch and are really handy for troubleshooting your switch and connection.

  • If the icon is green, the switch is active.
  • If the icon is red, the switch is not active.
  • If there is a '+' in the icon, the input is high or open.
  • If there is a '-' in the icon, the input is low or closed.

You can operate the switch manually while watching the icon to make sure it's doing what you expect.

How to configure homing

Homing is configured on the SETTINGS->Motor pages.

Homing and Limit Switch configuration on the Buildbotics Controller

Here's how to configure an axis for homing on the Buildbotics Controller:

  1. Go to the SETTINGS->Motor page for the motor port serving the axis and login.
  2. Set the absolute position of the minimum and maximum soft limits for the axis. The image above is the configuration for my X axis. It has 830 mm of available travel and I like to set the absolute position right in the middle. As a result, I have set the lower soft limit to -415mm and the upper soft limit to +415mm.
  3. If you mounted your limit switch at the maximum end of the axis, set the homing-mode to 'switch-max'. Or, if you mounted the limit switch at the minimum end of your axis, set it to 'switch-min'. My switch is at the maximum end, so it is set to 'switch-max'.
  4. Set the 'search-velocity' to the speed at which the machine will search for the switch. If it's too fast, it may may not be able to stop in time and damage your machine. If it's too slow, it will take a long time to find the switch. I have my X-axis set to search at 2 meters per minute.
  5. Once the switch changes state, the machine will back off by the distance assigned in the 'latch-backoff' field. My X-axis is set to back off my 15mm once the switch is found. This allows the switch to change back to it's inactive state before approaching again.
  6. The 'latch-velocity' sets the speed at which the axis will approach the switch again. This slower speed will provide a more repeatable position where the switch activates. My X-axis is set to .5 meters per minute.
  7. Set 'zero-backoff' to the distance that the axis backs away from the switch after the homing sequence is complete.

When the homing sequence is complete, it will set the absolute position to the position defined in the soft limit. If the 'homing-mode' is 'switch-max', the absolute position will be set to the 'max-soft-limit' value. If the 'homing-mode' is 'switch-min', the absolute position will be set to the 'min-soft-limit' value. My X-axis is set to 'switch-max', so it comes to rest at the right end of my axis at an absolute position of +415mm.

How to home the machine

The homing buttons are located on the CONTROL page at the right side of the 'axis table'. Each axis can be homed individually by clicking the 'Home' button for that axis. Clicking the 'Home All' button initiates the homing sequence on all axes.

Summary

Homing teaches the Controller where the boundaries of the physical machine are located. This provides the following advantages:

  • Since the controller knows where the boundaries are located, it can prevent crashing into the endstops.
  • Commonly used locations on your machine will always be located in the same absolute position. This allows you to return to that exact position from any location after homing, even if the contoller is rebooted. Check out my article on 'Macro Buttons' to see how to make things even easier.