VFD integration: M3, M4, M5 Macros and RPM measurement
-
@jay_s_uk I haven't done the wiring yet for the relay, that is trivial. I have the PWM port next to the 12v output on the duet 3 going to my 0-10v analog converter, I have a 5v 4 input relay board, 1 input will turn the spindle on of as appropriate, and the other input will toggle direction. It would be nice to get feedback back into the duet, but having the ability to toggle relays as appropriate is all I was after. Will also add relay toggle in my eStop trigger -- one of my main concerns is the lack of a proper eStop -- which I also added. Now just 2 minor code tweaks and i'm good to go.
-
You maybe able to use a current limit output on the drive as some sort of warning. I am not sure about the Chinese VFD’s, but I know all the big companies ones that I use (Schneider, Danfoss, WEG) have relay outputs to indicate they are in current limit. Provided you are not getting close to current limit while machining, if the spindle was to stall, you could use that to trigger a macro to shut down. This could also be for any other fault, output phase loss, under voltage etc.
Once I have my new house built, I am going to build a CNC router with a 3-4kw 3 phase spindle and will probably use a Schneider VFD, which will be 4-20mA so will need to look for a frequency converter. I absolutely hate 0-10v or 0-20mA for two different reasons.
Sam
-
@samlogan87 if you're going to build a large CNC, with such powerful spindle, duet is not the platform for it. I have a 5'x3' CNC with a 2.2kw 220v water cooled spindle -- super rigid, cuts like a dream, runs mach3, i'd go linux cnc or mach4 route now. Duet web and panel due is not designed for CNC workflow, I am doing a small X2 mill conversion, it has 500w spindle, high torque, but max 2500 rpm, I've made some code changes to RRF3 to make hard limits work, and properly interface with the VFD in this mill, I think I'll get the ooznest web UI for the web interface and will work on the panel due firmware to customize it for CNC better. Duet is great for printers, for CNC, the hardware is great -- though if you go for a nema34 or something bigger you'll need an external driver anyway, the software is lacking.
-
@kazolar yeah I don’t think I will be using Duet either. I am going to be using servos on mine so it won’t integrate nicely. Will likely use linuxcnc.
-
@kazolar said in VFD integration: M3, M4, M5 Macros and RPM measurement:
though if you go for a nema34 or something bigger you'll need an external driver anyway
Duet 3 can drive Nema 34 motors, as long as you are not looking for both high torque and high speed, which would need more than 32V. We're looking at supporting 48v power in future.
-
@kazolar said in VFD integration: M3, M4, M5 Macros and RPM measurement:
@dc42 https://littlemachineshop.com/products/product_view.php?ProductID=4213
This is pretty common config for Mill CNC -- on/off, forward/reverse and analog 10v speed.
Thanks. Unfortunately the datasheet doesn't specify what the inputs do or the signal levels, just how to connect it so some existing machines of aspecify types.
@cjm said in VFD integration: M3, M4, M5 Macros and RPM measurement:
This is a typical manual for an affordable VFD:
http://www.jinlantrade.com/ebay/invertermanual.pdfThanks, that's very informative. Look like you can configure it to use either separate FWD and REV inputs, or RUN and DIR. A board with 3 opto isolators, a comparator and a few passive components would be ideal for driving it.
To both of you (any anyone else with experience in this areas): do you think it is sufficient to support configuring only on/off, fwd/rev and speed outputs, or are there some controllers that require separate run-forward and run-reverse inputs (as well as the speed output)?
Doing all the work in macros isn't really an option until we can pass parameters to macros.
-
@dc42 hardware is sufficient, there are too many software changes that need to be made to make RRF on par with mach3 -- I've made some of them -- like a proper eStop trigger to honor hardware limits, and M3,4,5 macros, the web ui is totally not appropriate for a CNC, ooznest is better, but I want to see and be able to set the spindle speed, adjust it -- that's not in the stock UI. I'm running at 30v now, hardware is not the limiting factor. After I made my tweaks, I have the MUST have features for a CNC, I still need to bring in the webUI and then look at the firmware for the paneldue to show machine coordinates vs work coordinates, and spindle speed,etc.
-
I am not looking to make RRF on a par with Mach3 in one go. It appears that the biggest limitation is the M3/M4/M5 handling, so I am looking to do that first.
There is work planned (some already started) to make DWC and PanelDue more suitable for CNC applications.
-
@dc42 actually macros work perfectly fine for VFD - i have a macro executing right after the spindle speed is set-- also there is an assumption that for going forward or reverse there are 2 pwm pins, there are not, so added a check if the reversePwm isValid, then use it otherwise use the forward for reverse as well -- the macros simply toggle 2 relays -- that works super well -- I issue 2 M42 commands -- it's fine to set the rpm, toggle relays then do a G4 for whatever is reasonable. Which is similar to a dwell.
-
@dc42 CNC mode MUST honor hardware limits. That is a non-negotiable. I added code to support a trigger that trigger my custom eStop if a hardware limit is hit when not homing, that gets me the safety measures -- I also toggle the relay that would normally be closed for spindle on -- and that's perfect for eStop.
-
You already have the option to have the endstop switches trigger emergency stop via triggers, so I see this as less urgent. There is a separate thread about whether emergency stop should require a full reset afterwards.
-
My thinking at present is to change M452 to this:
M452 C"port1+port2+port3" F10000
- F is the PWM frequency, as now
- port1 is the speed control (PWM) port
- port2 if present is the on/off port
- port3 if present is the reverse/not-forward port (if not present then reverse is not supported)
-
@dc42 there needs to be a way to stop movement when a machine hits hardware limits. There isn't in current firmware. Ask any CNC operator who uses a large CNC machine 1 meter and up, they never home it. It takes too long and serves no purpose the only zero that matters is the work coordinate zero. I honestly would not bother homing my mill either since all I care about are work coordinates too. I added limit switches to prevent a crash
-
@dc42 i think M452 like that would work -- add an option for dwell time (how much it should wait after m# command issued before proceeding to the next line -- spindle needs time to get to speed before cutting or stop cutting and be safe to handle), and you got it. reverse forward is handled like -- floating if forward, close means reverse.
-
@kazolar said in VFD integration: M3, M4, M5 Macros and RPM measurement:
@dc42 there needs to be a way to stop movement when a machine hits hardware limits. There isn't in current firmware.
Yes there is. Surely you know about M581, https://duet3d.dozuki.com/Wiki/Gcode?#Section_M581_Configure_external_trigger ? Trigger 0 was specifically provided for this purpose.
-
0 trigger requires you to reset the machine manually it should work the same way as the eStop on the web UI or the panelDue -- there is no option to do that presently -- I added that for me, and it works great - -
-
@dc42 other controllers treat hitting an eStop the same you treat it with panelDue -- auto reset -- you can even reboot in a (end stop triggered condition, but reboot not force me to manually reset the hardware)
-
@kazolar said in VFD integration: M3, M4, M5 Macros and RPM measurement:
0 trigger requires you to reset the machine manually it should work the same way as the eStop on the web UI or the panelDue -- there is no option to do that presently -- I added that for me, and it works great - -
You can reset the machine via DWC - recent versions even invite you to do that via a Reset Machine button when they detect that the machine has been halted by emergency stop.
You can also reset the machine by sending M999 from PanelDue. Put it in a macro if you like.
-
@dc42 I made about 20 minutes worth of code changes, and now I am finishing up the wiring. I will probably need more code changes to the firmware to allow for spindle coolant - I want to add a fogbuster to my mill. I have the key safety stuff addressed with M# macros and hardware limit handling pretty similarly how my other 2 CNCs handle them -- it's such a convenience while using the big CNC to tap an end switch when a cut goes bad and have it stop everything and then have the machine stop immediately and reset the controller.
-
@dc42 M999 waits 1 second before stopping movement -- a lot of bad stuff can happen in 1 second.