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
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.