<ol>
<li>Use a servo. This way you can use the digital pins to control it; or in your specific case <code>PWM_PC9</code></li>
<li>Connect it to the expansion port and configure one of the digital pins in the marlin configuration file. A servo will go to the minimum position when the pin goes low, and the max position when the pin goes high. I take it you don't need any stops in between since you're doing a tool changer.</li>
</ol>
<hr />
<p><em>If you figure out how to modify the code to support tool changing, I'd be interested to know as well.</em></p>

CC BY-SA 4.0
2020-09-01T07:46:03.140Z
Thanks for your answer. Can you please tell me what `SWITCHING_TOOLHEAD_SERVO_NR` is and how can I use it, if you know?
Mahan Lamee
CC BY-SA 4.0
2020-09-01T13:40:53.493Z
PWM_PC9 (pin 4 on extension 1) seems to be the only pwm pin available for use. I believe SERVR_NR is the index of the servo for the M280 command. I don't know enough about this part of marlin to be of much use.
user77232
CC BY-SA 4.0
2020-09-02T16:36:34.577Z
After so much research, finally, I found the way to do this. For the first question, Servo is the best choice.
Mahan Lamee
CC BY-SA 4.0
2020-09-02T16:36:42.797Z
First, we need to configure tool change x and y position and servo rotation angle in `configuration.h` file and leave `SWITCHING_TOOLHEAD_SERVO_NR` as it is. Also, uncomment `#define NUM_SERVOS` and set it to 2.Then we need to open `Marlin\src\pins\stm32f4\pins_BTT_SKR_PRO_common.h` file and in the `Servos` section, add the following line:
`#define SERVO1_PIN                          PC9`

In the end, connect the servo signal pin to the `PC9` pin on extension 1 and the `VCC` and `GND` pin to the pins next to the PC9 pin that are `GND` and `5V`.
Mahan Lamee
CC BY-SA 4.0
2020-09-02T16:40:39.743Z
I haven't tested this because I don't have this board. If this way doesn't work, please tell me.
Mahan Lamee
CC BY-SA 4.0
2020-09-02T17:00:49.213Z
@MahanLameie, you don't have the SKR_PRO board? So you want me to see if this works? Just that a servo will rotate if the firmware is modified thusly?
Since this is becoming a chat: https://chat.stackexchange.com/rooms/112575/marlin-servo-control
user77232
CC BY-SA 4.0
2020-09-03T07:10:45.377Z
No, I haven't bought it yet. Just I want to know if I can do it so when I was sure what I should do, I will buy it. This is not a cheap board, so buying it without knowing if it works or not is not true.
Mahan Lamee
CC BY-SA 4.0
2020-09-03T07:22:04.760Z
Also, I am comparing other boards to this to see which of them is better but because they are all similar, there is no difference for me to mention which of them, and since SKR PRO is the most popular, I mentioned this in my question. I just want to know the instructions and when I knew that, I can do it with any board. The only thing that I should do is find a PWM pin in the boards' datasheet and configure the pin number in Marlin.
Mahan Lamee
CC BY-SA 4.0
2020-09-03T07:22:28.603Z
Let's continue it in the chat room.
Mahan Lamee
CC BY-SA 4.0
2020-09-01T07:36:42.913Z
2020-09-01T19:03:32.007Z
2020-09-01T19:03:32.007Z
user77232
<p>I am planning to build a CoreXY machine with a tool changing system. I am using Marlin firmware and <code>BigTreeTech SKR PRO</code> as the controller board. There are 3 options in Marlin for tool changing systems:</p>
<ul>
<li>Switching tool head</li>
<li>Magnetic switching tool head</li>
<li>Electromagnetic switching tool head</li>
</ul>
<p>I want to use the switching tool head in my project using a servo/stepper motor. So I have 2 questions:</p>
<ol>
<li>Should I use a servo or stepper motor? Which one does the board and firmware support?</li>
<li>Where should I connect the servo/stepper on the SKR PRO and what should the value of <code>SWITCHING_TOOLHEAD_SERVO_NR</code> be?</li>
</ol>
<p>Note: I am also using a BLTouch leveling sensor So I can't connect the servo to the BLTouch servo port.</p>
<p><strong>Edit: After so much research, finally, I found the way to do this.</strong> For the first question, Servo is the best choice.
First, we need to configure tool change x and y position and servo rotation angle in <code>configuration.h</code> file and leave <code>SWITCHING_TOOLHEAD_SERVO_NR</code> as it is. Also, uncomment <code>#define NUM_SERVOS</code> and set it to 2.Then we need to open <code>Marlin\src\pins\stm32f4\pins_BTT_SKR_PRO_common.h</code> file and in the <code>Servos</code> section, add the following line:</p>
<pre><code>#define SERVO1_PIN                          PC9
</code></pre>
<p>In the end, connect the servo signal pin to the <code>PC9</code> pin on extension 1 and the <code>VCC</code> and <code>GND</code> pin to the pins next to the PC9 pin that are <code>GND</code> and <code>5V</code>.</p>
<p><strong>Note:</strong> I haven't tested this because I don't have this board. If this way doesn't work, please tell me in comments.</p>

CC BY-SA 4.0
2020-09-01T07:53:14.207Z
To my knowledge a single PWM pin in exposed on extension port 1, but  recalling Arduino tinkering you can use any digital or analog pin for a servo. For a stepper you require more pins to control the movement, how many tools are you focussing on? Each tool requires a feeder stepper... E3D uses Duet boards, they have many options for additional steppers (either through extension boards).
0scar
CC BY-SA 4.0
2020-09-01T08:40:07.500Z
@0scar SKR PRO has 3 extruder outputs and because I use 2 of them, 1 of them (e2) will be unused. Also, my preference is to use a servo motor. But I don't know how to connect it to the board and configure marlin for it (pins.h, configuration.h,configuration_adv.h)
Mahan Lamee
<marlin><bigtreetech><corexy>
Configure Marlin for tool changing system
Mahan Lamee
# Configure Marlin for tool changing system

(Asked by: username_0 on 2020-09-01)

I am planning to build a CoreXY machine with a tool changing system. I am using Marlin firmware and BigTreeTech SKR PRO as the controller board. There are 3 options in Marlin for tool changing systems:

Switching tool head
Magnetic switching tool head
Electromagnetic switching tool head

I want to use the switching tool head in my project using a servo/stepper motor. So I have 2 questions:

Should I use a servo or stepper motor? Which one does the board and firmware support?
Where should I connect the servo/stepper on the SKR PRO and what should the value of SWITCHING_TOOLHEAD_SERVO_NR be?

Note: I am also using a BLTouch leveling sensor So I can't connect the servo to the BLTouch servo port.
Edit: After so much research, finally, I found the way to do this. For the first question, Servo is the best choice.
First, we need to configure tool change x and y position and servo rotation angle in configuration.h file and leave SWITCHING_TOOLHEAD_SERVO_NR as it is. Also, uncomment #define NUM_SERVOS and set it to 2.Then we need to open Marlin\src\pins\stm32f4\pins_BTT_SKR_PRO_common.h file and in the Servos section, add the following line:
#define SERVO1_PIN                          PC9

In the end, connect the servo signal pin to the PC9 pin on extension 1 and the VCC and GND pin to the pins next to the PC9 pin that are GND and 5V.
Note: I haven't tested this because I don't have this board. If this way doesn't work, please tell me in comments.

**Tags:** marlin, bigtreetech, corexy
> **Comments:**
> **username_1**: To my knowledge a single PWM pin in exposed on extension port 1, but  recalling Arduino tinkering you can use any digital or analog pin for a servo. For a stepper you require more pins to control the movement, how many tools are you focussing on? Each tool requires a feeder stepper... E3D uses Duet boards, they have many options for additional steppers (either through extension boards).  
> **username_0**: @0scar SKR PRO has 3 extruder outputs and because I use 2 of them, 1 of them (e2) will be unused. Also, my preference is to use a servo motor. But I don't know how to connect it to the board and configure marlin for it (pins.h, configuration.h,configuration_adv.h)  

---

## 1 answers

### Answer by username_2 on 2020-09-01. Score: 2

1. Use a servo. This way you can use the digital pins to control it; or in your specific case `PWM_PC9`
2. Connect it to the expansion port and configure one of the digital pins in the marlin configuration file. A servo will go to the minimum position when the pin goes low, and the max position when the pin goes high. I take it you don't need any stops in between since you're doing a tool changer.

---

*If you figure out how to modify the code to support tool changing, I'd be interested to know as well.*

> **Comments:**
> **username_0**: Thanks for your answer. Can you please tell me what `SWITCHING_TOOLHEAD_SERVO_NR` is and how can I use it, if you know?  
> **username_2**: PWM_PC9 (pin 4 on extension 1) seems to be the only pwm pin available for use. I believe SERVR_NR is the index of the servo for the M280 command. I don't know enough about this part of marlin to be of much use.  
> **username_0**: After so much research, finally, I found the way to do this. For the first question, Servo is the best choice.  
> **username_0**: First, we need to configure tool change x and y position and servo rotation angle in `configuration.h` file and leave `SWITCHING_TOOLHEAD_SERVO_NR` as it is. Also, uncomment `#define NUM_SERVOS` and set it to 2.Then we need to open `Marlin\src\pins\stm32f4\pins_BTT_SKR_PRO_common.h` file and in the `Servos` section, add the following line: `#define SERVO1_PIN                          PC9`  In the end, connect the servo signal pin to the `PC9` pin on extension 1 and the `VCC` and `GND` pin to the pins next to the PC9 pin that are `GND` and `5V`.  
> **username_0**: I haven't tested this because I don't have this board. If this way doesn't work, please tell me.  
> **username_2**: @MahanLameie, you don't have the SKR_PRO board? So you want me to see if this works? Just that a servo will rotate if the firmware is modified thusly? Since this is becoming a chat: https://chat.stackexchange.com/rooms/112575/marlin-servo-control  
> **username_0**: No, I haven't bought it yet. Just I want to know if I can do it so when I was sure what I should do, I will buy it. This is not a cheap board, so buying it without knowing if it works or not is not true.  
> **username_0**: Also, I am comparing other boards to this to see which of them is better but because they are all similar, there is no difference for me to mention which of them, and since SKR PRO is the most popular, I mentioned this in my question. I just want to know the instructions and when I knew that, I can do it with any board. The only thing that I should do is find a PWM pin in the boards' datasheet and configure the pin number in Marlin.  
> **username_0**: Let's continue it in the chat room.  

---

