<p>Too bad you broke the acrylic plate (nice temporary fix though), but you can easily print a replacement part once your machine is up and running.</p>

<p>Probe positioning is defined in the Marlin configuration as:</p>

<pre>
 *      +-- BACK ---+
 *      |           |
 *    L |    (+) P  | R -- probe (20,20)
 *    E |           | I
 *    F | (-) N (+) | G -- nozzle (10,10)
 *    T |           | H
 *      |    (-)    | T
 *      |           |
 *      O-- FRONT --+
 *    (0,0)
</pre>

<p>This implies that your sensor is located on the back-right when facing the machine and need to have the following constants set:</p>

<pre>
#define X_PROBE_OFFSET_FROM_EXTRUDER 16   // X offset: <strike>-left</strike>  +right  [of the nozzle]
#define Y_PROBE_OFFSET_FROM_EXTRUDER 58   // Y offset: <strike>-front</strike> +behind [the nozzle]
#define Z_PROBE_OFFSET_FROM_EXTRUDER 0    // Z offset: -below +above  [the nozzle]
</pre>

<p>In order to calculate the correct limits of travel for the sensor, you need to subtract the offset values from the bed size at the max limits.</p>

<p>An additional offset may be required for some sensors, so please add an additional offset in the configuration by defining:</p>

<pre><code>#define MIN_PROBE_EDGE 10
</code></pre>

<p>As the sensor is off-center with respect to your nozzle, one can only assume that you have no extra space to move the whole printhead and therefore need to confine the head within the limits of the max/min bed size (there should be some extra space, this can be seen from the offsets for the origin as in values for <code>X_MIN_POS</code> and <code>Y_MIN_POS</code>, but for the sake of simplicity these will not be taken into account).</p>

<p>Basically, your positive Y and positive X offset result in the following schematic.
<a href="https://i.sstatic.net/ftdPk.png" rel="noreferrer"><img src="https://i.sstatic.net/ftdPk.png" alt="Schematic of the bed and the sensor limits"></a></p>

<p>Or, if you include the <code>#define MIN_PROBE_EDGE [value]</code>
<a href="https://i.sstatic.net/v2AGi.png" rel="noreferrer"><img src="https://i.sstatic.net/v2AGi.png" alt="Schematic of the bed and the sensor limits including MIN_PROBE_EDGE"></a></p>

<p>Bed limits for the sensor then will need to be calculated based on the values of your offset of the sensor. E.g. when your nozzle is at (X=0, Y-0), or (0, 0), your sensor is at (16, 58). If you don't want to move the head further left and forward (to respect to origin as limit!), this is the minimum position of the sensor. When the sensor is at the back-right position of (220, 220), the actual head is at (220-16=204, 220-58=162).</p>

<p>This means that the limits for the sensor without a minimum offset are (16, 58) and (220, 220):</p>

<pre>
#define LEFT_PROBE_BED_POSITION (X_PROBE_OFFSET_FROM_EXTRUDER + MIN_PROBE_EDGE)
#define RIGHT_PROBE_BED_POSITION (X_BED_SIZE - MIN_PROBE_EDGE)
#define FRONT_PROBE_BED_POSITION (Y_PROBE_OFFSET_FROM_EXTRUDER + MIN_PROBE_EDGE)
#define BACK_PROBE_BED_POSITION (Y_BED_SIZE - MIN_PROBE_EDGE)
</pre>

<p>would translate with a <code>MIN_PROBE_EDGE = 0</code> to:</p>

<pre>
#define LEFT_PROBE_BED_POSITION 16
#define RIGHT_PROBE_BED_POSITION 220 
#define FRONT_PROBE_BED_POSITION 58
#define BACK_PROBE_BED_POSITION 220
</pre>

<p>and would translate with a <code>MIN_PROBE_EDGE = 10</code> to:</p>

<pre>
#define LEFT_PROBE_BED_POSITION 26
#define RIGHT_PROBE_BED_POSITION 210 
#define FRONT_PROBE_BED_POSITION 68
#define BACK_PROBE_BED_POSITION 210
</pre>

<p>The assertion in code: <code>FRONT_PROBE_BED_POSITION &gt;= MIN_PROBE_Y</code> would now translate to (58 >= 58) (or 68 >= 58), in your case it was (47 >= 58) which clearly is not true.</p>

<hr>

<p><em>Please look into <a href="/a/7399/">this answer</a>, <a href="/a/7465/">this answer</a> or <a href="/a/6874/">this answer</a> for more information.</em></p>

CC BY-SA 4.0
2019-01-29T09:17:54.323Z
2019-01-29T12:59:25.493Z
2019-01-29T12:59:25.493Z
0scar
<p>I'm trying to get the ROKO (SN04-N) sensor to work with my Anet A8. First of all, while trying to screw it to the extruder, I tightened it too much and sort of broke the acrylic plate... sort of. I had to use a very thin steel plate with two holes to enforce the acrylic plate. It still works.</p>

<p>Now, I followed instructions in this <a href="https://www.youtube.com/watch?v=uY4GlbV4kGU" rel="nofollow noreferrer">video</a>. <em>(Please note that the video is not in English.)</em> After the first "Auto Home" operation, the guy draws on the bed and then measures. My measurements are slightly different.</p>

<p>At the 19-minute mark, the guy is hard-coding the values but I don’t understand how he calculated them? My measured offsets are: <code>X_PROBE_OFFSET_FROM_EXTRUDER 16</code> and <code>Y_PROBE_OFFSET_FROM_EXTRUDER 58</code>. In his video, his calculations were 18&nbsp;mm for the X offset and 57&nbsp;mm for the Y offset. Either way, I’m not able to compile the code as a sanity check fails:</p>

<pre>
`static_assert(FRONT_PROBE_BED_POSITION >= MIN_PROBE_Y, "FRONT_PROBE_BED_POSITION is outside the probe region.");`
</pre>

<p>Here are the sensor limitation values from the configuration file:</p>

<pre><code>// Set the boundaries for probing (where the probe can reach).
#define LEFT_PROBE_BED_POSITION 20 //MIN_PROBE_EDGE
#define RIGHT_PROBE_BED_POSITION 200 //(X_BED_SIZE - MIN_PROBE_EDGE)
#define FRONT_PROBE_BED_POSITION 47 //MIN_PROBE_EDGE
#define BACK_PROBE_BED_POSITION 200 //(Y_BED_SIZE - MIN_PROBE_EDGE)
</code></pre>

<p>What am I doing wrong?</p>

<p>Note that I'm using Marlin Firmware v1.1.9</p>

<marlin><anet-a8><bed-leveling>
ANet A8 running Marlin v1.1.9 Auto Bedlevel with ROKO SN04-N
DoomerDGR8
# ANet A8 running Marlin v1.1.9 Auto Bedlevel with ROKO SN04-N

(Asked by: username_0 on 2019-01-29)

I'm trying to get the ROKO (SN04-N) sensor to work with my Anet A8. First of all, while trying to screw it to the extruder, I tightened it too much and sort of broke the acrylic plate... sort of. I had to use a very thin steel plate with two holes to enforce the acrylic plate. It still works.

Now, I followed instructions in this [video](https://www.youtube.com/watch?v=uY4GlbV4kGU). *(Please note that the video is not in English.)* After the first "Auto Home" operation, the guy draws on the bed and then measures. My measurements are slightly different.

At the 19-minute mark, the guy is hard-coding the values but I don’t understand how he calculated them? My measured offsets are: `X_PROBE_OFFSET_FROM_EXTRUDER 16` and `Y_PROBE_OFFSET_FROM_EXTRUDER 58`. In his video, his calculations were 18 mm for the X offset and 57 mm for the Y offset. Either way, I’m not able to compile the code as a sanity check fails:

```

`static_assert(FRONT_PROBE_BED_POSITION >= MIN_PROBE_Y, "FRONT_PROBE_BED_POSITION is outside the probe region.");`

```

Here are the sensor limitation values from the configuration file:

```
// Set the boundaries for probing (where the probe can reach).
#define LEFT_PROBE_BED_POSITION 20 //MIN_PROBE_EDGE
#define RIGHT_PROBE_BED_POSITION 200 //(X_BED_SIZE - MIN_PROBE_EDGE)
#define FRONT_PROBE_BED_POSITION 47 //MIN_PROBE_EDGE
#define BACK_PROBE_BED_POSITION 200 //(Y_BED_SIZE - MIN_PROBE_EDGE)

```

What am I doing wrong?

Note that I'm using Marlin Firmware v1.1.9

**Tags:** marlin, anet-a8, bed-leveling


---

## 1 answers

### Answer by username_1 on 2019-01-29. Score: 5 | Accepted answer

Too bad you broke the acrylic plate (nice temporary fix though), but you can easily print a replacement part once your machine is up and running.

Probe positioning is defined in the Marlin configuration as:

```

 *      +-- BACK ---+
 *      |           |
 *    L |    (+) P  | R -- probe (20,20)
 *    E |           | I
 *    F | (-) N (+) | G -- nozzle (10,10)
 *    T |           | H
 *      |    (-)    | T
 *      |           |
 *      O-- FRONT --+
 *    (0,0)

```

This implies that your sensor is located on the back-right when facing the machine and need to have the following constants set:

```

#define X_PROBE_OFFSET_FROM_EXTRUDER 16   // X offset: -left  +right  [of the nozzle]
#define Y_PROBE_OFFSET_FROM_EXTRUDER 58   // Y offset: -front +behind [the nozzle]
#define Z_PROBE_OFFSET_FROM_EXTRUDER 0    // Z offset: -below +above  [the nozzle]

```

In order to calculate the correct limits of travel for the sensor, you need to subtract the offset values from the bed size at the max limits.

An additional offset may be required for some sensors, so please add an additional offset in the configuration by defining:

```
#define MIN_PROBE_EDGE 10

```

As the sensor is off-center with respect to your nozzle, one can only assume that you have no extra space to move the whole printhead and therefore need to confine the head within the limits of the max/min bed size (there should be some extra space, this can be seen from the offsets for the origin as in values for `X_MIN_POS` and `Y_MIN_POS`, but for the sake of simplicity these will not be taken into account).

Basically, your positive Y and positive X offset result in the following schematic.
[![Schematic of the bed and the sensor limits](https://i.sstatic.net/ftdPk.png)](https://i.sstatic.net/ftdPk.png)

Or, if you include the `#define MIN_PROBE_EDGE [value]`
[![Schematic of the bed and the sensor limits including MIN_PROBE_EDGE](https://i.sstatic.net/v2AGi.png)](https://i.sstatic.net/v2AGi.png)

Bed limits for the sensor then will need to be calculated based on the values of your offset of the sensor. E.g. when your nozzle is at (X=0, Y-0), or (0, 0), your sensor is at (16, 58). If you don't want to move the head further left and forward (to respect to origin as limit!), this is the minimum position of the sensor. When the sensor is at the back-right position of (220, 220), the actual head is at (220-16=204, 220-58=162).

This means that the limits for the sensor without a minimum offset are (16, 58) and (220, 220):

```

#define LEFT_PROBE_BED_POSITION (X_PROBE_OFFSET_FROM_EXTRUDER + MIN_PROBE_EDGE)
#define RIGHT_PROBE_BED_POSITION (X_BED_SIZE - MIN_PROBE_EDGE)
#define FRONT_PROBE_BED_POSITION (Y_PROBE_OFFSET_FROM_EXTRUDER + MIN_PROBE_EDGE)
#define BACK_PROBE_BED_POSITION (Y_BED_SIZE - MIN_PROBE_EDGE)

```

would translate with a `MIN_PROBE_EDGE = 0` to:

```

#define LEFT_PROBE_BED_POSITION 16
#define RIGHT_PROBE_BED_POSITION 220 
#define FRONT_PROBE_BED_POSITION 58
#define BACK_PROBE_BED_POSITION 220

```

and would translate with a `MIN_PROBE_EDGE = 10` to:

```

#define LEFT_PROBE_BED_POSITION 26
#define RIGHT_PROBE_BED_POSITION 210 
#define FRONT_PROBE_BED_POSITION 68
#define BACK_PROBE_BED_POSITION 210

```

The assertion in code: `FRONT_PROBE_BED_POSITION >= MIN_PROBE_Y` would now translate to (58 >= 58) (or 68 >= 58), in your case it was (47 >= 58) which clearly is not true.

---

*Please look into [this answer](/a/7399/), [this answer](/a/7465/) or [this answer](/a/6874/) for more information.*


---

