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.

  • $\begingroup$ 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 $\endgroup$
    – FarO
    Apr 24, 2020 at 20:07
  • 2
    $\begingroup$ @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. $\endgroup$ Apr 24, 2020 at 20:57

1 Answer 1


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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .