---
title: 4. Connecting home sensors
slug: cnc720/4-connecting-home-sensors
docTags: N0e76O9diopH-9vAptHkL,QGNQ2zMzYAw-u_7kHwxS7
createdAt: 2024-12-17T14:22:31.128Z
---

:::hint{type="info"}
This information is intended for the &#x7B;&#x7B;controll}} and may not be accurate when used with another controller. Please refer to the documentation for your specific controller.
:::

Home sensors provide the machine with a reference for its position. After shutdowns, step loss, and manual movements, the machine will be able to find its original position.

:::hint{type="warning"}
**Home sensors** and **limit sensors** are **not&#x20;**&#x74;he same. The difference may seem semantic, but in reality, this means that during homing, a machine must be able to move slightly beyond the switch's trigger point. This is to ensure the machine decelerates after the switch is triggered. This distance is determined by the *homing speed* and the machine's *acceleration&#x20;*(*deceleration*) settings. Additionally, the home switch position may not be at the axis's limit. A limit sensor is essentially the end of an axis. So there is no room left. The image below illustrates the difference. Please note that the sensor position is relevant in this context, not the sensor type.

::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/TvST-oZLumJeICNpWPKZX_.blob" size="50" width="1356" height="756" position="center" caption="Home vs. limit sensor" darkWidth="1356" darkHeight="756" showCaption="true"}
:::

The home sensor types supported by the CNC720 are **NPN&#x20;**&#x61;n&#x64;**&#x20;PNP,&#x20;**&#x62;oth in normally open (NO)  and normally closed (NC) configurations. The detection method is irrelevant to the controller and can be selected based on its specifics, such as physical, inductive, or capacitive switches. ~~The~~ CNC720 ~~is designed to sink around 10mA into the sensor when it is active/closed. The threshold voltage for a low or closed signal is typically \<**1.4V for revision 13 and up**~~ ~~and \<**0.7V for revision 12**~~ ~~**and lower**.~~ All home sensors must have the same polarity, so all NO or NC.

# Hardware configuration

## NPN or PNP sensor?

Before connecting the sensor, make sure the controller is powered down. Next, verify that the jumpers for selecting the sensor type are set correctly. The relevant jumpers are shown in the list below:

| Jumper | Function              |
| ------ | --------------------- |
| JP6    | HOME1 mode NPN or PNP |
| JP7    | HOME2 mode NPN or PNP |
| JP8    | HOME3 mode NPN or PNP |
| JP9    | HOME4 mode NPN or PNP |

Below is shown where these jumpers are on the controller:

::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/l6mMxZ_jzjR1dueYFwQhM_image.png" size="70" width="680" height="717" darkWidth="680" darkHeight="717" position="center" caption="Position of homing jumpers" showCaption="true"}

If the jumper is in position '**N**', the sensor is NPN; in position '**P**', the sensor PNP.

:::hint{type="info"}
Please note that sensors ***cannot be m*****ixed**; they must be either NPN or PNP.
:::

## Home inputs

The CNC720 has 4 inputs for homing signals, one for each axis. On the breakout board, behind the home inputs, are a row of connections that can be configured to either +24V ***or*** GND. Depending on how you wire the sensors, you can select this using jumper **JP1.**

::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/S9vxpkhGZYLrWzT4nLjBE_image.png" size="50" width="434" height="432" position="center" darkWidth="434" darkHeight="432" showCaption="false"}

## Wiring an inductive sensor

The advantage of using an inductive sensor is that detection is contactless. Avoiding the wear-and-tear of the sensor. However, they are activated by detecting a metal surface near the sensor. Please check the manual for the detection distances.

In general, most sensors will have the following color codes:

- Blue is the ground wire
- Black is the signal wire
- Brown is the +24V wire

:::hint{type="info"}
**Always&#x20;**&#x63;heck the manual of the sensors to validate the color code
:::



::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/_xUaO4E93BCZIJ3qW3FHU_.blob" size="50" width="1960" height="728" position="center" darkWidth="1960" darkHeight="728" showCaption="false"}

## Wiring a microswitch

When using a simple switch, eg. microswitch. You only need two wires.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/kCILzqVqiMGLVMay4G6Vu_.blob" size="50" width="1960" height="728" position="center" darkWidth="1960" darkHeight="728" showCaption="false"}

::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/_dE-Yo-JJC3EELs9QKAOQ_.blob" size="50" width="1960" height="724" position="center" darkWidth="1960" darkHeight="724" showCaption="false"}

## Testing the sensor

Ensure that none of the sensors are currently triggered.

Open the IO tab and find the home inputs. Their state is indicated by the circle's color next to the input.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/T-Evvp4y3-zwnJLg0M5qG_image.png" size="50" width="613" height="593" position="center" darkWidth="613" darkHeight="593" showCaption="false"}

Verify that the color of the switches in the non-triggered state is the same and matches the software settings.

:::hint{type="warning"}
Please note, these indicators show the **logical&#x20;**&#x73;tate of the input, so either high or low. It does <u>not </u>show the **functional** state. Detection is purely based on change of level compared to the level when the sensor is not active.
:::

Manually activate the home sensor for each axis and verify whether the input state changes. If the switch does not trigger, verify the wiring steps. If the wiring is correct, check that the sensor actually triggered; some sensors have a built-in LED indicator to also shows the activation.

::::VerticalSplit{layout="middle"}
:::VerticalSplitItem
::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/ByxWMBauhouUqrkOBWcH9_home1-in-on.png" size="50" width="107" height="33" position="center" caption="Home input is high" darkWidth="107" darkHeight="33" showCaption="true"}
:::

:::VerticalSplitItem
::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/RwrdfiZYlmFFYo0bcgME5_home1-in-off.png" size="50" width="107" height="33" position="center" caption="Home input is low" darkWidth="107" darkHeight="33" showCaption="true"}
:::
::::

## Home sensor active range

When the controller needs to perform a homing sequence, it must know the direction to travel. This is done by detecting whether the homing sensor is active at the start of the homing sequence; based on this, the controller knows which direction to travel. The machine must be designed to detect this correctly. Failing to do this can result in damage.

::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/bQvrRlmfd9VKFso1MeqOI_.blob" size="50" width="1648" height="928" position="center" darkWidth="1648" darkHeight="928" showCaption="false"}

The homing algorithm is designed to prevent the sensor from activating at the end of the homing process. As a result, the machine coordinate will not be exactly zero because it accounts for the offset from the actual homing position and the sensor's non-activated positions. The so-called 'pull-off' position. If you prefer to have the machine position to be exactly 0, you can add at the end of the homing macro this:

:::BlockQuote
Sub home\_x
&#x20;  home x
***&#x20;  G53 G0 X0***
Eendsub
:::

This is, of course, an example for the X axis, but it can also be applied to other axes by using the correct axis designation.

# Software configuration

Homing an axis works the same for most axis types except for master-slave setups. '**Master-slave**' is sometimes also called '**Gantry Squaring**' or '**Tandem-axis**'. Using master-slave axes with auto-gantry squaring <u>requires </u>additional setup steps as outlined in [Tandem axes](docId\:gHHNiyu_vg6m3AGV5Azjq) which <u>*cannot&#x20;*</u>be skipped.

With all sensors wired, start the software with the machine connected. Open the setup tab, navigate to '**Machine General**', and scroll to the '**Homing**' section.

![](https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/niIhqQCbI6CgqZk_kvHed_image.png)

If the switch typ&#x65;**&#x20;is known**, the setting must be set to "Falling edge" for NO sensors and "Rising edge" for NC sensors.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/Mt6x3hBrDZdr8c6RmGk1V_image.png" size="70" width="350" height="134" position="flex-start" darkWidth="350" darkHeight="134" showCaption="false"}

If the switch type is unknow&#x6E;**,** the switch polarity can be determined automatically. Jog the machine to a position where none of the switches are triggered. Press "Auto detect polarity" and "Ok" to use the current values of the home inputs as inactive.

::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/uynbahbMACs3OOyyb17bF_image.png" size="70" width="1060" height="250" position="flex-start" darkWidth="1060" darkHeight="250" showCaption="false"}

If the state of all home inputs is **not equal**, an error will be displayed. This can happen because the sensor types are not identical or mixed, or because some inputs are triggered while others are not. Perhaps some switches are accidentally activated.

::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/s7ebrXr08vRXLRAdonMbp_image.png" size="54" width="516" height="155" position="center" darkWidth="516" darkHeight="155" showCaption="false"}

If all home inputs are wired to the first home input, the "**Use home input for X axis as home input for all axes**" option must be checked.

::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/Q-iAQIN90x4EI0WJDxE0e_image.png" size="70" width="1063" height="266" position="center" caption="Use one home input." darkWidth="1063" darkHeight="266" showCaption="true"}

:::hint{type="info"}
This option is **not supported** with tandem axes because, with both motors running simultaneously, it is impossible to know which sensor was triggered.
:::

Next, scroll to the Motors section.

![](https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/hZBwtDEd-noMABb55MSBh_image.png)

All homing options here can be configured on a per-axis basis.

:::hint{type="warning"}
These configuration steps assume that the Maximum velocity and Maximum acceleration have already correctly been set. Both these settings may influence the homing procedure and changing them later may induce changes to the homing sequence.
:::

By default, the **Homing velocit**y is set to 0, in this case, **Manual&#x20;**&#x61;ppears in the setup for that axis. Executing a home command for this axis results in the <u>**current position**</u> being set as 0.&#x20;

Entering a **non-zero positive value** ensures a proper home movement will be executed.

A high homing velocity results in a faster homing sequence **but&#x20;**&#x61;lso increases the distance the axis moves past the sensor trigger point. When the sensor triggers during homing, the axis will decelerate according to the value entered in Maximum acceleration. The distance covered results from the acceleration, Homing velocity, and [fifoTime](docId\:TuN7rde84cwJM3npTdibT). Typical values are around 10mm/s.

The precise/safe homing velocity is the velocity at which the machine is moved out of the sensor's triggered area. Typical values are roughly 10% of the homing velocity; the sensor **untriggers&#x20;**&#x61;t that point, which is used as the home position.&#x20;

*Any inaccuracies caused by the first faster movement are therefore not translated into an inaccurate home position.*

The homing sequence needs to know whether to home in a positive or negative direction. If the home position is at the machine's negative limit, invert the direction. If it is at the positive limit, it should not be inverted.&#x20;


This is set by checking ***Inverted homing direction***.

Lastly, the **'home position'** need not be at the sensor trigger point. An offset can be applied to decouple the sensor position from the home position. The value entered here represents the trigger point's position relative to the home position.

## Tandem axes / master slave / gantry squaring

In many cases, it is helpful to use two separate motors on a gantry, perhaps due to weight and size, or to avoid the gantry being no longer square during the operation of the machine. &#x20;

There are three modes to do this:

- **Connecting two motor drivers to one output**

Advantages: cheap and simple

Disadvantage: once the gantry is misaligned for any reason, this needs to be fixed manually.&#x20;

- **Using two axes output in master-slave or tandem setup (slave follows master)**

Advantages: complete control of master and slave axis position.

Disadvantage: needs an extra axis output

- **Master-slave setup, but with so-called 'gantry squaring'**

Advantages: The gantry can automatically square itself after homing, improving the machine's results.

Disadvantage: it needs an additional homing sensor, and setup is a little more complicated.

The rest of the document will only discuss the second and third options as the first option required no additional setup compared to a regular axis.

## Step 1.  Axes setup

The first step in setting up this is to set up the axes. Depending on the controller, any of the up to 3 extra axes can be configured as a slave axis, as shown in the image below. Please note that typically, only one of these dropdown boxes will be displayed.

![](https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/IjXVz1V_PGx9GxlO4ivww_abc-axes-slave-mode.png)

The options relevant to setting this up are selecting one of three options:

- Slave to X axis
- Slave to Y axis
- Slave to Z axis

For this example, we will use the A axis as a slave to the Y axes. In the setup, this will look like this:

![](https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/ZVx1jAsXS3cebGTYFn0VK_image.png)

## Step 2. Macro modifications

Changes to the macro must be made to home axes used in a tandem configuration. A tandem configuration contains two axes, one master and one slave axis. The master axis is the axis that can be actively controlled, and the slave follows the position programmed to the master.

In this example, the Y axis forms a tandem pair with the A axis. The Y is the master, and the A axis follows as the slave. In the macro, both of the homing macros need to be changed.

On the Operate tab of the software, click "**Macro**", and subsequently "**Edit file**".

![](https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/scDdL9ObCtHW7K6r6AVd3_image.png)

There are two options:

1. Tandem axes with one homing sensor
2. Use gantry squaring with two homing sensors

### Option 1 - Only tandem axes with <u>one </u>homing sensor

Since there is only **one&#x20;**&#x68;oming sensor, there must be no separate homing of the slave axis. We can modify this in the macro called `home_a`. In this case, we can either remove the line `Home a` or comment this out:&#x20;

:::::VerticalSplit{layout="middle"}
::::VerticalSplitItem
***Original***

:::BlockQuote
Sub home\_a
&#x20;   **Home a**
Endsub
:::
::::

::::VerticalSplitItem
***Modified***

:::BlockQuote
Sub home\_a
&#x20;   ;**Home a**
Endsub
:::
::::
:::::

### Option 2 - Use gantry squaring with <u>two </u>homing sensors

When actual gantry squaring is to be performed, two macros need to be modified, '**home\_y**' and '**home\_a**'

First, modify  '**home\_y**':

:::::VerticalSplit{layout="middle"}
::::VerticalSplitItem
***Original***

:::BlockQuote
Sub home\_y
&#x20;   **Home y**
Endsub
:::
::::

::::VerticalSplitItem
***Modified***

:::BlockQuote
Sub home\_y
&#x20;   **HomeTandem y**
Endsub
:::
::::
:::::

Next, as before, modify '**home\_a**'

:::::VerticalSplit{layout="middle"}
::::VerticalSplitItem
***Original***

:::BlockQuote
Sub home\_a
&#x20;   **Home a**
Endsub
:::
::::

::::VerticalSplitItem
***Modified***

:::BlockQuote
Sub home\_a
&#x20;   ;**Home a**
Endsub
:::
::::
:::::

This starts tandem homing when the Y axis is homed and does not re-home the A axis separately.&#x20;

Please note, the macro `home_all` is used to indicate the homing sequence:

:::BlockQuote
sub home\_all
&#x20;   gosub home\_z
&#x20;   gosub home\_y
&#x20;   gosub home\_x
&#x20;   gosub home\_a
&#x20;   gosub home\_b
&#x20;   gosub home\_c
&#x20;   msg "Home complete"
endsub
:::

When pressing 'Home all', each axis is homed sequentially, the default sequence is Z, Y, X, A, B, C. If the machine needs a different order, this can be changed in the macro as well by changing the order of the lines in home\_all

Save the file and close the editor. Press "Reload file" to load the changes into the software.

![](https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/AIkDpIfV1k_SuyI8Q0Y6R_image.png)

### Gantry squaring

When using two homing sensors for homing, it's likely that there is a small difference in the position in reference to the gantry. As part of gantry squaring this can be addressed in the setup of each axes.

In the **Setup tab** navigate to '**Machine general**' and scroll to the Motors section. When using Gantry Squaring, the **home position** settings for both the master and slave are used for both homing sensor compensation and squaring.&#x20;

### Maximum distance slave and master axis

Setting the maximum distance between the master and slave after homing to a low enough value is crucial. Both axes move simultaneously during every step of the homing procedure except the last movement. This last movement moves the slave axis to the position of the master. This is the actual squaring movement.

![](https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/8tk2yDOUAyHCDVmKo0DYe_image.png)

If the difference between these axes is too high, the machine may be too rigid to perform this movement. Most machines may only be able to independently move between 1 mm and 20 mm before binding or damage occurs. The more rigid the machine, the smaller this distance should be. If a large difference is found after homing, this likely indicates that the homing procedure failed.

## Testing

### Things to observe during testing

The first thing to watch out for is the direction the machine homes. If this is incorrect, stop the machine using either the E-stop or by pressing **Reset**. If the homing direction is incorrect, see if the messages show "**Home sensor active, starting with second move**". This means that the *Homing inputs trigger edge* setting was set wrong. If this message does not occur, the homing direction should be inverted in the setup, as described in the [Configuration](docId\:TJyqQ9LPP5zo84wyWQHGm) chapter.

Once the machine moves in the correct direction when homing, let the machine go home completely. Keep near the E-stop switch. If the machine moves past the homing sensor without stopping, abort using the E-stop switch or the reset button.

If the machine homes correctly, the axis will have moved to the direction of the home sensor, upon triggering it will decelerate and move back out of the sensor. After the sensor un-triggers, the machine will again delecerate and come to a standstill.&#x20;

### Step 1 - Testing homing sensors

Ensure that none of the sensors are currently triggered.

Open the IO tab and find the home inputs. Their state is indicated by the circle's color next to the input. Check that the color of the switches in the non-triggered state is the same and matches the setting for *Home inputs trigger edge*. If the setting was set to Falling edge, all indicators must be on, if Rising edge was set, the indicators must be off.

:::hint{type="warning"}
Please note, this indicators show the **logical&#x20;**&#x73;tate of the input, so either high or low. It does <u>not </u>show the **functional** state. Detection is purely based on change of level compared to the level when the sensor is not active.
:::



::::VerticalSplit{layout="middle"}
:::VerticalSplitItem
![](https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/ByxWMBauhouUqrkOBWcH9_home1-in-on.png)
:::

:::VerticalSplitItem
![](https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/RwrdfiZYlmFFYo0bcgME5_home1-in-off.png)
:::
::::

Manually activate the home sensor for each axis and check if the state of the input changes. If the switch does not trigger, check the [Wiring](docId\:TJyqQ9LPP5zo84wyWQHGm) steps. If the wiring is correct, check that the sensor actually triggered, some sensors have a built-in LED indicator to show the activation.

### Step 2 - Manually testing gantry squaring

When gantry squaring is used it's possible to manually test each of the 4 sequences of gantry squaring. Please note, this is **ONLY&#x20;**&#x66;or testing each step **NOT&#x20;**&#x66;or normal homing. These steps are normally automatically executed when `TandemHome `function is called in `home_` macro.

Use them in **MDI** for testing and understanding.&#x20;

1. **`PrepareTandemHome y`**, Both slave and master are moved towards the home sensor. The axes stop when both axes are on the sensor. When one axis reaches the home sensor first, this one is stopped, and the other moves further. This movement is done when both axes have reached the sensor.
2. **`Home Y`**, home the Y, the slave will just follow. The Y home sensor is used. Because the Y is already on the sensor, the move will be toward the machining area **away from** the sensor. The position is latched at the moment the sensor de-activates. Then the movement stops and then the correct position is calculated end set for the Y.
3. **`Home A`**, exactly the same, but now the A Home sensor is used and the A position is set. When done, A is no longer a slave because the position is different from Y. This is indicated by the message: "Slave decoupled from master". The following command will restore the master slave-coupling.
4. At this point, both master and slave have a correct known position but are probably different. It can be equalized by moving the slave axis to the position of the A axis. This is done using the command **`MoveSlaveToMaster A`**. The slave will move to the same position as the master. The gantry is squared and the homing procedure is done. (If the gantry is not square, adjust the home positions in the setup).

### Step 3 - Home each axis

Keep near an E-stop switch and start the homing procedure for each axis separately by going to the home menu and pressing the home button for the accompanying axis. Remember that the order of homing operations is usually important to avoid collisions.

The image below shows the homing menu at the bottom of the operate tab:

![](https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/3Gk9NldDrRPezRJpqyw7R_image.png "Home functions")

The **Homing menu&#x20;**&#x68;as separate buttons for manually homing each axis:

![](https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/CJp6poMUKRH7D599F2Jno_image.png)

Repeat this manual homing each axis. After all axes are tested separately, press **Home All** to verify the order of the homing operations.

::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/DxumMDsfLWiB-XX7s6BxS_image.png" size="38" width="344" height="397" position="center" caption="Home All button" showCaption="true"}

## Optionally correcting the homing position after homing

After the machine has been homed, the actual machine coordinate position will be slightly away from the home position point, this difference is the result of the machine needing to decelerate after the home sensor triggers. This does not mean that the home position is inaccurate.&#x20;

A side effect of this behavior is that the sensor is always un-triggered after the home operation for that axis is completed. This is <u>**especially important**</u> in setups that use all homing switches to be connected to one input.

If, for any reason, it is preferred that the machine is positioned at position 0 of that axis, it is possible to add a command to the homing functions. There are two ways of doing this:

**Move to position 0 of the axis after homing it**

For example, for the X axis, the standard macro function can be modified so that after homing the axes move back to their actual 0 position:

:::::VerticalSplit{layout="middle"}
::::VerticalSplitItem
***Original***

:::BlockQuote
Sub home\_x
&#x20;   home x
Endsub

:::
::::

::::VerticalSplitItem
***Modified***

:::BlockQuote
Sub home\_x
&#x20;   home x&#xA;**&#x20;   G0 G53 X0** &#x20;
Endsub
:::
::::
:::::

Keep in mind that for other axes the 'X0' needs to be changed to its respective axis. Depending on the machine, you can optionally also add the feed rate by replacing the G0 with G1 and adding an F-word:

:::BlockQuote
**G1** G53 X0 **F50**
:::

**Move to position 0 for all axes after homing**

The second option is to execute the move when all separate axes have been homed. This is also preferred when all homing inputs are connected **to one input**.

In that case, an extra line is added for all axes. Below is an example of the `home_all` function:

:::::VerticalSplit{layout="middle"}
::::VerticalSplitItem
***Original***

:::BlockQuote
sub home\_all
&#x20;   gosub home\_z
&#x20;   gosub home\_y
&#x20;   gosub home\_x
&#x20;   gosub home\_a
&#x20;   gosub home\_b
&#x20;   gosub home\_&#x63;**&#x20; &#x20;**&#xA;&#x20;   msg "Home complete"
endsub

:::
::::

::::VerticalSplitItem
***Modified***

:::BlockQuote
sub home\_all
&#x20;   gosub home\_z
&#x20;   gosub home\_y
&#x20;   gosub home\_x
&#x20;   gosub home\_a
&#x20;   gosub home\_b
&#x20;   gosub home\_c&#xA;**&#x20;   G0 G53 X0 Y0 Z0**
&#x20;   msg "Home complete"
endsub
:::
::::
:::::

