<p><strong><em>Note</strong>: The question has changed after posting this answer. This answer answered the previous question, but is now out-of-date with respect to how the question has changed; I'll update it later, as it is possible what is asked now.</em></p>

<hr>

<p>You can change the Z-min and the Z-max pin assignment in Marlin Firmware in the <code>pins_&lt;boardname&gt;.h</code> file, you basically exchange the Z-min and the Z-max. Note that the switch connected to the old Z-min port now becomes a Z-max sensor if you enable that in the firmware; you should therefore remove it (the actual switch) from the minimum Z position.</p>

<hr>

<p>To enable a BLTouch sensor you require 2 pins free on the microprocessor. One registers the signal of the trigger, the other triggers the servo to stow/deploy the sensor.</p>

<p>You can connect the white/black to the Z-min signal (Z-min pin) and ground of the Z-min connector (or if pins are swapped in the firmware to the Z-max). The other wires need to be connected to +5&nbsp;V (red), ground (brown) and orange/yellow to a free analog pin (PWM pin):</p>

<blockquote>
  <p><a href="https://www.indiegogo.com/projects/bltouch-auto-bed-leveling-sensor-for-3d-printers#/" rel="nofollow noreferrer">BLTouch can be operated in the following condition.</a><br>
  - One I/O for control (PWM or Software PWM)<br>
  - One I/O for Zmin (Z Probe)<br>
  - GND and +5&nbsp;V power</p>
</blockquote>

<p>The PWM pin should be defined in your <code>pins_&lt;boardname&gt;.h</code> file, e.g.:</p>

<pre><code>#define SERVO0_PIN         5 // RUMBA board
</code></pre>

<p>or</p>

<pre><code>#define SERVO0_PIN         27 // ANET board
</code></pre>

<p>The Z-max signal pin is no PWM pin for the servo.</p>

CC BY-SA 4.0
2019-05-06T18:17:12.653Z
2019-05-12T06:15:15.210Z
2019-05-12T06:15:15.210Z
0scar
<p>After studying the Marlin code, I found the answer I was looking for.</p>
<p>If I have a spare PWM pin, I can assign it to anything I want. So the best solution is to define the pin as a <code>Z_MIN_PROBE</code> and then in <code>Configuration.h</code> in the Bltouch settings</p>
<pre><code>#define Z_MIN_PROBE_ENDSTOP
</code></pre>
<p>rather than</p>
<pre><code>#define Z_MIN_ENDSTOP_USES
</code></pre>

CC BY-SA 4.0
2019-05-13T23:11:37.293Z
2022-06-17T11:05:52.947Z
2022-06-17T11:05:52.947Z
Glen Hoffman
<p>I’m in the process of installing a BLTouch on a Velleman Vertex K8400. The board doesn’t have a dedicated servo pin, so I’ll assign one. No problem there.</p>
<p>The board only has a Z-min pin, so it’s my understanding that I’m supposed to unplug my Z-min cable and plug the BLTouch into the Z-min port.</p>
<p>My question is: &quot;Can't I assign another unused pin as a Z-max, plug the BLTouch into that, adjust the firmware, and leave the existing Z-min sensor plugged in?&quot;</p>
<p>Upon further review, I probably shouldn't have said Z-max, and will be more specific.</p>
<p>This is a Mega 2560 board with 2 available PWM pins. Anything wrong with this setup?</p>
<p>Pins.h:</p>
<pre>
  #define SERVO_0_PIN 15 //PH3 (PWM)
  
  #define Z_MIN_PROBE_PIN 16 //PH4 (PWM)
</pre>
<p>Configuration.h:</p>
<pre>
=======Z Probe Option=======

  #define Z_MIN_PROBE_ENDSTOP

  #define BLTOUCH
</pre>
<p>I want be able to keep my Z-min sensor plugged in as a backup to prevent a bed crash just in case the BL touch doesn't trigger. From what I see this should work as long as I make sure the BLTouch triggers before the Z-min. Any issues that anyone can see?</p>

CC BY-SA 4.0
2022-06-17T08:48:40.950Z
Did you install bltouch on k8400? I have the same printer and want to install auto bed leveling but I dont know how
Ofitecno
CC BY-SA 4.0
2022-06-17T09:12:48.370Z
@Ofitecno - Hi and welcome to Stack Exchange. Please ask a new question - questions posted as an answer aren't permitted. Please take the [tour] to get a better understanding of how SE works. Thanks.
Greenonline
<marlin><firmware><bltouch>
BLTouch wiring and pin assignments
Glen Hoffman
# BLTouch wiring and pin assignments

(Asked by: username_0 on 2019-05-06)

I’m in the process of installing a BLTouch on a Velleman Vertex K8400. The board doesn’t have a dedicated servo pin, so I’ll assign one. No problem there.

The board only has a Z-min pin, so it’s my understanding that I’m supposed to unplug my Z-min cable and plug the BLTouch into the Z-min port.

My question is: "Can't I assign another unused pin as a Z-max, plug the BLTouch into that, adjust the firmware, and leave the existing Z-min sensor plugged in?"

Upon further review, I probably shouldn't have said Z-max, and will be more specific.

This is a Mega 2560 board with 2 available PWM pins. Anything wrong with this setup?

Pins.h:

```

  #define SERVO_0_PIN 15 //PH3 (PWM)
  
  #define Z_MIN_PROBE_PIN 16 //PH4 (PWM)

```

Configuration.h:

```

=======Z Probe Option=======

  #define Z_MIN_PROBE_ENDSTOP

  #define BLTOUCH

```

I want be able to keep my Z-min sensor plugged in as a backup to prevent a bed crash just in case the BL touch doesn't trigger. From what I see this should work as long as I make sure the BLTouch triggers before the Z-min. Any issues that anyone can see?

**Tags:** marlin, firmware, bltouch

> **Comments:**
> **username_1**: Did you install bltouch on k8400? I have the same printer and want to install auto bed leveling but I dont know how  
> **username_2**: @username_1 - Hi and welcome to Stack Exchange. Please ask a new question - questions posted as an answer aren't permitted. Please take the [tour] to get a better understanding of how SE works. Thanks.  

---

## 2 answers

### Answer by username_3 on 2019-05-06. Score: 4

***Note***: The question has changed after posting this answer. This answer answered the previous question, but is now out-of-date with respect to how the question has changed; I'll update it later, as it is possible what is asked now.

---

You can change the Z-min and the Z-max pin assignment in Marlin Firmware in the `pins_<boardname>.h` file, you basically exchange the Z-min and the Z-max. Note that the switch connected to the old Z-min port now becomes a Z-max sensor if you enable that in the firmware; you should therefore remove it (the actual switch) from the minimum Z position.

---

To enable a BLTouch sensor you require 2 pins free on the microprocessor. One registers the signal of the trigger, the other triggers the servo to stow/deploy the sensor.

You can connect the white/black to the Z-min signal (Z-min pin) and ground of the Z-min connector (or if pins are swapped in the firmware to the Z-max). The other wires need to be connected to +5 V (red), ground (brown) and orange/yellow to a free analog pin (PWM pin):

> [BLTouch can be operated in the following condition.](https://www.indiegogo.com/projects/bltouch-auto-bed-leveling-sensor-for-3d-printers#/)  
> - One I/O for control (PWM or Software PWM)  
> - One I/O for Zmin (Z Probe)  
> - GND and +5 V power

The PWM pin should be defined in your `pins_<boardname>.h` file, e.g.:

```
#define SERVO0_PIN         5 // RUMBA board

```

or

```
#define SERVO0_PIN         27 // ANET board

```

The Z-max signal pin is no PWM pin for the servo.


---

### Answer by username_0 on 2019-05-13. Score: 2

After studying the Marlin code, I found the answer I was looking for.

If I have a spare PWM pin, I can assign it to anything I want. So the best solution is to define the pin as a `Z_MIN_PROBE` and then in `Configuration.h` in the Bltouch settings

```
#define Z_MIN_PROBE_ENDSTOP

```

rather than

```
#define Z_MIN_ENDSTOP_USES

```


---

