@OwenD said in Driving a Relay through extruder stepper output:
What is your usage case?
If you're not FDM printing, but instead trying to control an external device via the relay (like say a welder), you could probably set the machine up in laser mode.
See M542
https://duet3d.dozuki.com/Wiki/Gcode#Section_M452_Select_Laser_Printer_Mode
I think Owens idea might fit the bill. You can configure the heater output to be a laser output which will energize the solenoid when you're moving with laser on. Silimarly with CNC mode and spinde output I guess.
Take care to ensure the output you use have a flyback diode to supress the emf from the solenoid, I think all recent Duets have diodes on the heater outputs but not the fan outputs.