Controlling my Huanyang inverter using the X-Controller

This one works for me. My relay
JV

Thank you Thank you Thank you!!!

I now have full control of my new spindle and VFD via GRBL.

M8 turns on the spindle, M9 off
M3 S###### changes the speed between 7250 and 24000 RPM.

I’ll upload pics when I get a chance.

Jer

2 Likes

I forgot to mention I included G4 P4 in my modified PP to alow the spindle to get up to speed before .nc file runs.
JV

Thanks @JohnVann I’ll add that to my notes

Why do you need to have mist turn on/off your spindle? I only have speed from Xcontroller to my vfd and do not need any second signal to start/stop it

I do not use the VFD control panel at all. I use ‘mist’ activates a relay to switch the spindle to run in ‘Forward’ then the 0-10volts controls the spindle speed.
JV

What was the final result to control the vfd? Do you still need to manually hit run?

No. The relay switches ‘run on’ and in my case ‘forward’ as well. If you look at my first post it may explain it better which gives the Pd settings as well.

I’m seeing a lot of conflicting info. Do you have a summary? Wiring and settings?

What part do you need help with?

What tells what to do what.
On. Forward. Speed. Etc.

Have you set: Pd001 set to 1 (this allows external control for starting/run, forward in my case) on your HuanyangVFD.

Have you one wire going to ‘DCM’ and one to ‘FOR’ on your VFD (to try if this works just connect these wire to an external switch. When switch on this the same as pressing run on the VFD panel.

I assume you’ve got the spindle speed already working using the 0-10v connection on the back of the X-Controller.

If all is well then:

Replace the external switch with a small relay (on the switch side).
Connect the relay to the M8 and Ground in the back of the X-Controller.

I use UGS to connect to the X-Controller.
Make sure the VFD is on.
Issue in the command line M8 (this should switch the relay on which will then connect the DCM and FOR together.

Issue in the command line M3 S10000 (in my case the spindle will go to 10,00 rpm).

To stop the spindle I issue S0 M5 M9.

I hope this helps.

3 Likes

The only thing I’ll add to John’s post above is that my VFD (Huanyang) had a jumper on the board that needed to be moved in order for the VFD to be controlled with the M3 commands.

Other than that everything works exactly the same way on mine. I can post pics if you need.

jer

I don’t have a VFD (yet) but reading through this I was too wondering why waste M7 or M8 to switch the VFD on. Isn’t pin D13 supposed to do this?

By default this is assigned to spindle direction, but I believe by uncommenting this

// #define USE_SPINDLE_DIR_AS_ENABLE_PIN

(which btw, comes with a warning about this toggling at boot time) it should theoretically work.

It looks like D13 on the X-Controller (what comes after Z_LIM, marked as pin 17 below) breaks out to pin 3 of J3. Here’s the relevant snippet.

EDIT:

As a simplified alternative, couldn’t the controller only deal with sending the 0-10V signal and have the FOR and DCM on the VFD physically wired (through a SPST switch for peace of mind) ?

It also toggles during firmware updates, but the rest of your scenario is correct.

Yes, but then you don’t have computer control of spindle on/off with M3/M5, just S0.

Hm, I thought that for the particular VFD mentioned here two conditions are required: (1) a FOR to DCM short and (2) 0-10V to AVI ACM.

So, in the second scenario I just thought why not simplify (1) by replacing the relay (which occupies an extra controller output) with a manual switch and keep (2) for speed control.

Yes, you can do that, but you would have to manually turn the switch on/off each time you want the spindle to start/stop. G-code commands M3 and M5 would let grbl know the state of your spindle, but you would have to enter them by hand, or just have one M3 S0 at the beginning (turn spindle on with 0 rpm) and one M5 (turn spindle off) at the end of you G-code. Then you could use the S command to set the spindle rpm.

Some CAM programs would set grbl up correctly for his and some might not.

This G-code would work:

bring up grbl
manually turn on the spindle switch
G21
G90
M3 S0
.
.
S500
.
.
M5
---- end of file —
Manually turn the spindle off

This G-code would not work

bring up grbl
manually turn on the spindle switch
G21
G90
.
.
S500
.
.
---- end of file —
Manually turn the spindle off

Yes, that’s the idea. Thanks for having a look.

Since by default GRBL will not output any PWM duty cycle before running a program (and the X-Controller’s analog output will start at 0V) , the control passes over to M3 Sx and M5 inside the gcode. The manual switch would be an extra safety measure. I’ve seen people running their VFDs with the FOR-DCM permanently shorted.

If someone can tweak their post processor to issue M7 and M9, it’s not harder to do the same with M3 and M5 (if, as you mentioned, their CAM doesn’t do this already).

That’s true when you first turn your machine on, but subsequent accesses to grbl may or may not have the spindle at 0 RPM.

Yes, when you power it on. Then it’s your responsibility to M5 at the end of each operation.