So, as promised the following is what I've done to get my SuperPID working flawlessly with my Duet Wifi 2.
The wiring schematic is as follows (please don't mind the inaccuracy of standard symbols):
SUPER-PiD.png
The ON/OFF is accomplished using the FAN0 (-) pin to ground the RUN port on the SuperPID.
The router RPM of the router is controlled by the (-) pin of the FAN1.
On the config.g file on the Duet a file named customconfig.g is called in which customizations are done without modifying the main config.g file. On this file I added the following lines, which configure the FAN1 as the "Tool 0" pin and set the RPM for a max PWM signal (255). It also inverts the PWM signal, so that the more PWM the more RPM:
M106 P1 I-1 H-1 A21 ; disable FAN2 & allocate Tool 0 to pin 21
M563 P0 S"Spindle" ;
M453 S"Spindle" P21 I1 T0 R30000; , Tool 0 = Spindle, invert PWM, 30000 RPM at max PWM
To turn ON the router:
M106 P0 S255
To turn OFF the router:
M107 P0
To set the RPMs:
M3 S15000 ; Set the router speed at 15000 RPM (PWM aprox 128)
References:
https://forum.duet3d.com/topic/13355/cannot-turn-spindle-on-using-m3
https://duet3d.dozuki.com/Wiki/Using_servos_and_controlling_unused_IO_pins