Assigning multiple Pins for CNC M3 command use?
-
Hiya - I'm wiring up a frequency drive to the Duet 2 via a PWM to 0-10v converter for spindle control. I've successfully done this using the P2 heater terminals and the M453 command. But I also need to trigger the forward spindle enable terminal on the VFD, which I'd like to do via a spare relay module and a separate heater terminal. I don't want to bridge the terminal on the frequency drive as this keep the on-board fan constantly running and a holding torque on the spindle with an annoying high pitch noise.
I'd like to be able to send an M3 S# command and for heater 2 to control the spindle speed and for example, heater 1 to control the spindle enable.
I've already disabled heater 1 and 2 with M307 H# A-1 C-1 D-1, and used M453 P2 R24000 F300 T1 for the PWM control, but I'm stuck on how to assign the M3 CNC function onto another pin on the duet.
If someone could point me in the right direction I'd appreciate that. Cheers.
-
You can assign two pins to M453 to use forward and reverse
Pfff:rrr Logical pin numbers used to drive the spindle motor in clockwise and counterclockwise directions. Omit the ":rrr" part if the spindle turns clockwise only.
https://duet3d.dozuki.com/Wiki/Gcode#Section_M453_Select_CNC_Printer_Mode
-
@bearer said in Assigning multiple Pins for CNC M3 command use?:
M453
But if I want to assign two pins just for forward - where one uses PWM up to 24v, and the other is simply 0-5v without PWM?
-
Do you need to explicitly disable forward and not just set speed to 0?
If you you probably need to use M42 before/after M3 to set the forward enable pin. Pretty much the same as this post https://forum.duet3d.com/post/105330
-
@bearer said in Assigning multiple Pins for CNC M3 command use?:
M42
Yes I think so. The VFD works by shorting the forward terminal to ground. I want to place the wire for that to the N/O terminals of a relay module and to switch that with a signal from the Duet.
Does that mean I have to write a post processor to put M42 into Gcode directly?
-
if you can't assign the heater 2 pin to the reverse function and then use your relay to ensure the forward enable is pulled low whenever the duet is not in reverse then i think you need to do something custom yeah
-
@bearer Hmm I think I might move back to GRBL for CNC stuff - this is starting to feel like it's more work than it's worth.
-
I can certainly understand where you're coming from with that statement, I think when version 3 of the reprap firmware is ready for stable release things will be better.
But others may have more insight. I think I'd go with M118 to telnet or paneldue port and send modbus to the vfd instead of using analog interface. modifying the fusion post isn't a big deal
-
@bearer Thanks for the input anyway. I'm reading about MODBUS and RS485, but it may be a little beyond my ability. I guess I'll wait for the version 3 firmware update.
-
Can you explain why your VFD needs 2 pins? Isn't setting the PWM to 0 on the 24V PWM pin sufficient to turn the spindle off?
-
@dc42 Hiya. I'm using an NfLixin frequency drive - so a little different from the more common Huanyang ones. The frequency drive has an analogue 0-10v input to control the PWM speed, and separate programmable inputs for running the spindle forward, reverse, and other things including estop with a faster spindle breaking speed, and toggling between gcode to potentiometer for speed control.
The PWM or analogue 0-10v signal only controls the RPM of the spindle. The forward movement only occurs when the forward terminal on the frequency drive is connected to digital ground. A lot of people are simply jumping the connection on their VFD's which isn't really how they are designed to be used. On my frequency drive, the on-board fan remains on instead of only turning on when reciving the spindle enable signal, and the spindle maintains a holding torque which builds up heat and makes an annoying noise.
Another problem is if I want to toggle between gcode to a potentiometer for control speed - using a jumper cable on the forward input and dcom, will result in the spindle turning on when toggling to potentiometer mode.
Having a seperate PWM or 0-10v terminals and spindle enable are common on GRBL boards - such as the Phoenix CNC controller, and Gradus M1 Pro.
I've attached two manuals for VFD's which might help illustrate how they can be used.
0_1566416225877_L510s-ManualEnglishV02.pdf
0_1566416415298_NfLixin 9000 VFD SKU1618411 - small.pdf -
@EducatingSavvas, thanks for the info.
Currently, in the M453 command, RRF3 allows you to specify e.g. C"out3" if you have just one spindle control output (which is assumed to be for forward motion and PWM capable), or C"out3+out4" if you have two (which are assumed to be separate pins for forwards and reverse, both PWM-capable). I could extend it to allow C"out3+out4+out5" where the first 2 pins are assumed to be on/off pins for forward and reverse, and the third pin is assumed to be the PWM control pin for both directions. Do you think that would cover all eventualities? if the controller had separate on/off and PWM pins but no reverse function, you could use C"out3+nil+out5".
-
@dc42 That sounds great. Glad this will be implemented in the next firmware update.
-
Hi - I just wanted to write an update on this issue. I'm still the older firmware and in the end I used the post processor in Vectric to send the signal to a PWM to analogue converter - which in turn triggers a relay module which connected the spindle enabled terminals on the VFD. I used a M307 H1 A-1 C-1 D-1 I0 command in my config file to disable the E0 heater and a M42 P1 S1 command in the post processor to enable the spindle. It all seems to be working providing I use the custom post processor. That said I have noticed that the previous spindle speed is not saved during a job pause, so after resuming it doesn't turn until the next segment in the code. I can add an arbitrary M3S## command but this will not reflect original speed - which may be material specific. Such as slower for plastics and faster for MDF.
-
Hi there, I came across this article when looking for a solution to trigger FWD from the Duet2. When I bought the VFD I could not find the Huanyang and ordered a combo VFD/Spindle, the VFD not the best quality and terminal are different. It has Vin and GND for analogue as expected but no DCM marked. I am a newb but following your posts (which I am grateful for) to setup I eventually got to the same stage of controlling speed from the duet controller. I shorted the FWD to the same GND as the analogue and it all worked in test. Switch off and come back to do a cut then it seems nothing on earth will bet the FWD to trigger. I managed to trigger it with a high resistor shorting the analogue Vin to FWD but of course that is just creating a voltage divider which throws the spindle speed off.
I set about finding a solution to trigger the FWD and ended up here, the question is have you found a way to trigger FWD? I thought it might be possible from the Duet2 using the Fan PWM headers but as a newb I need advice.
Many thanks for considering.
-
Hello, Savvas and I have similar setups. I have a different VFD, but maybe this will help. My VFD needs a 0-10V PWM signal for spindle speed and a 10V trigger to turn on FWD. I'm running my Duet 2 at 24V, so I need a voltage converter. I am using 2x of these:
Which drops the voltage down to 10V and can translate a 0-24V PWM into a 0-10V PWM signal. They are wired to e0Heat and e1Heat with this config setup in RRF3.3 and use M3 for Spindle On and M5 for spindle off.
;Tools ; No tool is selected at startup M453 ; Set to CNC mode, M950 R1 C"e1heat+e0heat" L0:24000 Q300 ; Select Spindle On/Off,RPM & Direction (not selected). M563 P0 S"Laser" ; Create tool 0 Laser M563 P1 S"Spindle" R1 ; Create tool 1 with Spindle
In previous firmware versions, I used
;CNC M950 P0 C"e0heat" Q300 ; Allocate GPOP Port 0 to Heater 0 M453 C"e1heat" Q300 R24000 T1 ; Set to CNC mode, using Tool 1, 24000 Max RPM
Which meant assigning the FWD to e0heat by turning the spindle on with M42 P0 S1 and off with M42 P0 S0. e1heat would control the spindle speed.
I have tried other voltage regulators that did not work. These work for sure. Also, make sure to switch them from 5V to 24V using the jumper. Hope that helps.