<p>It is easy. Leave the driver in. Connect to the first two wires usually used by the motor output. I.e. this is usually where the nema 17 motor goes. The first two wires are your output to the valve.</p>

<p>Use M42 to control the ENABLE pin. Bringing the pin high creates a 0V output. Bringing the pin low creates a 12V output.</p>

CC BY-SA 4.0
2020-04-25T20:32:32.807Z
2020-04-25T20:32:32.807Z
K Mmmm
<p>I'm building a device that requires five 12&nbsp;V valves to be programmatically controlled as a switch. So far, I have been able to get outputs from the heated bed, extruder, and fan to be controllable through Marlin, by defining "SENSITIVE_PINS" to be an empty array. I can now use <code>M42</code> to switch these pins on and off, allowing for programmatic control of 3 of the 5 valves. </p>

<p>For the other two valves, I'd like to control these directly from the 3D printer board somehow. I noticed the A4988 driver will rapidly flick a 12&nbsp;V output on and off according to the microstep setting (<a href="https://lastminuteengineers.com/a4988-stepper-motor-driver-arduino-tutorial/" rel="nofollow noreferrer">https://lastminuteengineers.com/a4988-stepper-motor-driver-arduino-tutorial/</a>). But this type of flicking is not really good for controlling a valve, because I want the valve to remain open until I say  "stop". </p>

<p>What I would like is to be able to use the <code>M42</code> to command to administer a 12&nbsp;V output on or off from the motor section of the usual boards. The A4988 driver takes in inputs like <code>Enable</code>, <code>Step</code>, and <code>Dir</code> from Arduino pins. Is there any way I can "hack" the A4988 driver to provide a constant voltage, similar to a relay switch? Alternatively, can I remove the driver and do something with the female pins that are normally used to connect to the A4988 driver?</p>

<p>In researching this I have noticed that when removing the driver, you expose some more 12&nbsp;V female and GND pins on your board, which can provide an easy connection to a third-party relay or h-bridge. But ideally, I would be able to do this without adding any new hardware to the board.</p>

<p>This question is on-topic because it has to do with 3D printer boards that are currently on the market and because it is ultimately a device that is used to 3D print something. </p>

CC BY-SA 4.0
2020-04-24T20:07:21.573Z
Use the enable pin, you can solder a wire directly to it. You control it by giving any movement command and by disabling that stepper output. The same applies to the direction pin: give a movement in a direction to turn it on, send a movement in the opposite one to turn it off
FarO
CC BY-SA 4.0
2020-04-24T20:57:17.683Z
@FarO The enable pin doesn't give out 12V so that doesn't address the problem. You can also just use M42 to address the pins directly.
Tom van der Zanden
<marlin><stepper-driver>
Getting a programatically-controlled, constant 12 V from one of the motor outputs
K Mmmm
# Getting a programatically-controlled, constant 12 V from one of the motor outputs

(Asked by: username_0 on 2020-04-24)

I'm building a device that requires five 12 V valves to be programmatically controlled as a switch. So far, I have been able to get outputs from the heated bed, extruder, and fan to be controllable through Marlin, by defining "SENSITIVE\_PINS" to be an empty array. I can now use `M42` to switch these pins on and off, allowing for programmatic control of 3 of the 5 valves.

For the other two valves, I'd like to control these directly from the 3D printer board somehow. I noticed the A4988 driver will rapidly flick a 12 V output on and off according to the microstep setting (<https://lastminuteengineers.com/a4988-stepper-motor-driver-arduino-tutorial/>). But this type of flicking is not really good for controlling a valve, because I want the valve to remain open until I say "stop".

What I would like is to be able to use the `M42` to command to administer a 12 V output on or off from the motor section of the usual boards. The A4988 driver takes in inputs like `Enable`, `Step`, and `Dir` from Arduino pins. Is there any way I can "hack" the A4988 driver to provide a constant voltage, similar to a relay switch? Alternatively, can I remove the driver and do something with the female pins that are normally used to connect to the A4988 driver?

In researching this I have noticed that when removing the driver, you expose some more 12 V female and GND pins on your board, which can provide an easy connection to a third-party relay or h-bridge. But ideally, I would be able to do this without adding any new hardware to the board.

This question is on-topic because it has to do with 3D printer boards that are currently on the market and because it is ultimately a device that is used to 3D print something.

**Tags:** marlin, stepper-driver

> **Comments:**
> **username_1**: Use the enable pin, you can solder a wire directly to it. You control it by giving any movement command and by disabling that stepper output. The same applies to the direction pin: give a movement in a direction to turn it on, send a movement in the opposite one to turn it off  
> **username_2**: @username_1 The enable pin doesn't give out 12V so that doesn't address the problem. You can also just use M42 to address the pins directly.  

---

## 1 answers

### Answer by username_0 on 2020-04-25. Score: 0 | Accepted answer

It is easy. Leave the driver in. Connect to the first two wires usually used by the motor output. I.e. this is usually where the nema 17 motor goes. The first two wires are your output to the valve.

Use M42 to control the ENABLE pin. Bringing the pin high creates a 0V output. Bringing the pin low creates a 12V output.


---

