VFD Wiring Instructions

Andy,

I appreciate your help. I’m still having issues with the board pushing out any voltage greater that 2.5V. I’ve ensured the EEPROM settings are set to something greater that 24,000 just to test the voltage and I’m not able to reach 5V.

Below are my EEPROM settings:

This is with the M05 command or M03 S0 (Good to Go, no issues):

This is with the M03 command running the spindle at 12,000 RPM (should be close to 2.5V which it is):

This is with the M03 command running the spindle at 24,000 RPM (Anything over 12,000 RPM shows a decreasing voltage):

Also, when I run the M04 command I only receive a maximum voltage of 1.8V. Not a huge deal, but it doesn’t trigger a 5V current.

I’ve flashed the latest firmware and get the same output for both. I’m probably doing something really stupid. Any ideas?

Your multimeter is set to measure in AC voltage not DC voltage

Hi Rob, how’s your progress been on getting the VFD set up?

Chris,

I was able to figure out the wiring. I’m sure it’s not setup exactly like it should be, but so far it’s been working great. I’ll post the wiring diagram and VFD setup codes shortly. The RPM issue I was having before was an improper VFD code that I finally figured out.

I’m also using VCarve so I’ll share my post processor here as well. The one thing I haven’t figured out just yet is how to program a tool change into the post processor that works with UGS. Ultimately, I want to pause the program, shut the spindle down, move to a position to change the tool, zero the Z axis with the probe and then continue the program when I press the play/run button.

I’ll try to build a tutorial on the forum that can help with the VFD setup.

-Rob

1 Like

Rob, I’ve been checking out cncjs. One of its capabilities you might find useful is tool changes. Unlike UGS it accepts M06 commands and stops to allow the tool to be changed. The cncjs github site lists macros that allow initial tool height setting using the probe block, and a way to probe the block after a tool change to reset Z zero with the new tool, similar to the way Carbide Motion uses the BitSetter. cncjs now has a desktop version so you don’t have to go through the node.js installation.

1 Like

Bill,

This is great info. I’ll definitely need to try it. Thanks for reaching out.

Rob

@BillKorn Bill: Where can I find the desktop version? The only link that I can see on the page is over a year old, so I’m assuming that I am in the wrong place.

/github.com/cncjs/cncjs/releases

Scroll down about half way. You probably want this one:

https://github.com/cncjs/cncjs/releases/download/v1.9.22/cncjs-app-1.9.22-win-x64.exe

1 Like

Rob, can you share the details of your spindle - brand, model, source, etc. Although I think the Makita is an acceptable general use router, it doesn’t go slow enough to safely drill with regular HSS drills, and I’d like to reduce the noise without going to an enclosure.

Thanks.

Bill.

1 Like

Bill,

I bought a water-cooled 220 volt 1.5kw spindle/VFD combo from Amazon a couple years ago that was used on my old home-built and very imprecise CNC machine. The VFD and motor kit is model number HY01D523B, but from what I can tell most models are similar in setup. It’s an inexpensive Chinese product, but other than having a little guilt for not buying a US product, I’ve been very happy with the way it works on the LongMill. I think the max collet size is 3/8", so no 1/2" bits.

Link to the product (no longer available - but plenty of other options are): https://www.amazon.com/gp/product/B01M4I7YHQ/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

The most difficult part of the setup was figuring out the wiring from the LongMill board to the VFD and the VFD programming codes.

For the wiring you’ll need to run the Spindle PWM to the “VI” (Voltage Input for the potentiometer) input on the VFD and the GND to the “ACM” (analog ground) on the VFD. I would think this is the only thing you need to do from the LongMill board to the VFD, but I could not get the VFD to go to a 0 RPM when the M5 code was applied. It would go to ~100 RPM, and obviously that’s not acceptable. So after a lot (i mean a lot) of tinkering, I was ran another wire from the LongBoard Coolant output to the “FOR” (forward rotation) input on the VFD and the Coolant GND to the “DCM” (digital ground - which i believe makes it a simple on/off switch for the spindle commands).

VFD program codes are below. I’ve added the Code number and the function just in case it doesn’t necessarily match up with other models:

PD013 (Reset) - 8 (do this first if you are using a previously programmed VFD and need to factory reset the codes)

PD001 (Source of Run Commands) - 1 (External commands, i.e. Longmill Board)
PD002 (Source of Operating Frequency) - 1 (External Terminal)
PD003 (Main Frequency) - 400 (Motor dependent)
PD004 (Base Frequency) - 400 (Motor dependent)
PD005 (Max Operating Frequency) - 400 (Motor dependent)
PD006 (Intermediate Frequency) - 2.5
PD007 (Min Frequency) - .2
PD008 (Max Voltage) - 220 (Motor dependent)
PD009 (Intermediate Voltage) - 15 (Motor dependent)
PD010 (Min Voltage) - 8 (Motor dependent)
PD011 (Frequency Lower Limit) - 120
PD014 (Motor Acceleration Time) - 10 seconds (this becomes important when setting your GCode delay after M3 command
PD015 (Motor Deceleration Time) - 10 seconds
PD041 (Carrier Frequency) - 8 (Motor Dependent)
PD044 (Forward Function tied to the FOR digital input discussed above) - 2 (Forward rotation when VI received Spindle PWM input > 0 volts)
PD70 (Analog Input - VI Input) - 1 (5VDC which is what the Longboard Spindle PWM outputs)
PD141 (Rated Motor Voltage) - 220
PD142 (Rated Motor Current) - 5
PD143 (Number of Poles) - 2
PD144 (Rated Motor Revolution)- 3000 (this equated a 5V input from the Spindle PWM to 24,000 RPM)

I’m not sure what CAD/CAM software you’re using, but with VCarve I had to go into the GBRL mm post-processor and add the following to the Spindle On command:

±--------------------------------------------------

  • Command output after the header to switch spindle on
    ±--------------------------------------------------

begin SPINDLE_ON

“[S]”
“M3”
“G4 P12”

…and the following to the end of file command:
±--------------------------------------------------

  • Commands output at the end of the file
    ±--------------------------------------------------

begin FOOTER

“M5”
“G0 [ZH]”
“G0 [XH] [YH]”
“M2”

After that I could trigger the spindle on and off with the M3/M5 commands and set spindle speed using SXXXX. I’ll give the M6 command a try with CNCJS when I get back to hobby time.

Hope that helps. I’ll try to make a better tutorial with pictures in a couple weeks.

3 Likes

This is awesome info. Thanks for taking the time to explain in detail.

Bill

Bill,

Long time since the last post. I’m finally getting around to using my machine again and I’m ready to try CNCjs. Do you mind sharing some of your settings such as the probe command? I’m using the sienci probe if that matches with your setup.

Thanks for your time.

Rob

I’ve gotten away from using the probe in CNCjs or UGS in favor of the cigarette paper test because I oftern cut from the interior of a piece of stock and don’t have any corners to do an X or Y, and the paper is faster and easier if I’m only doing Z. I think Heyward has been using the probe - maybe he can provide some more detail.

Hi Rob and everyone,

I’m new here and in CNCing as well )))
I’ve got a long mill recently and also got a spindle from Amazon almost like yours.
I saw your instructions for how to setup a spindle but you were saying that you would do more detail instruction with pics! :wink: if I may ask, by any chance have you done that?
Thanks a lot

Hi Rob,

Can you (or anyone) please take a pic. how are you attached your spindle to LM?
Thanks

BTW, Merry Christmas everyone!!!

All,

Apologize for the really late reply on the requests. I’ll get some pictures and better instructions typed up by the end of the week.

I’ve received a couple requests on how I was able to wire up a VFD with the LongBoard. There’s really three parts to this. 1. Settng up the VFD software, 2. Wiring the VFD to the LongBoard and spindle and 3. Controlling the VFD/spindle using gCode with your gCode software/CAM software of choice (in my case Vectric Vcarve)

1. Setting up the VFD

This is very dependent on the spindle and VFD you own, but for this tutorial I used a 220v water cooled Chinese spindle and I’ve posted my VFD settings above. Big thing to note is the LongBoard outputs 5vDC for Spindle PWM so you’ll need to do the math for settings PD70 and PD144 based on that. The settings I used above should work for most 220V 24,000RPM spindles.

2. Wiring the LongBoard to the VFD

I’ve got to be honest, this was a lot of trial and error. I’m still not 100% sure why my wiring works, but I’ll give you some pictures and hopefully a smarter electrical engineer can fill in the gaps.

First a picture:

LongBoard Wiring
SpinPWM: Red Wire
SpinPWM Ground: White Wire
Coolant: Blue Wire
Coolant Ground: Green Wire

You’ll notice I have an additional Red Wire and Black wire for SpinPWM. That’s used to control my Laser TTL. Another tutorial, for another day. :wink:

VFD Wiring:
LongBoard SpinPWM (red wire) :arrow_right: VFD VI (longboard sends 0-5vDC to the VFD input)
LongBoard SpinPWM Ground (white wire) :arrow_right: VFD ACM (Analog variable input ground)
LongBoard Coolant (blue wire) :arrow_right: VFD FOR (digital input to turn on the spindle in only one direction, for me forward, set in the VFD settings) 5vDC triggers spindle always on, but SpinPWM is what sets RPM.
LongBoard Coolant Ground (green wire) :arrow_right: VFD DCM (on or off digital signal circuit. For my setup it’s always triggered on)

Now the tricky part. Without the below wiring I could not get the spindle to zero out the spindle RPM. This is where an electrical engineer or subject matter expert would explain the circuits…I just tinkered until it did what I wanted.

Short (red) wire from VFD 5vDC to AI
Short (white) wire from VFD ACM to DCM

I’m probably way off here, but my thought is that the Analog input needed a 5vDC signal to measure the 5vDC input from the LongBoard. The tied grounds nulled out extraneous voltage. Without the ACM to DCM tie, I could not get the Spindle to zero out with a S0 gCode line. Hopefully someone can chime in and tell me why that works. I’ve been running my machine for over a year like this and nothing has blown up yet.

3. GCode Post Processor / Software

At this point, you should be able to use gSender or UGS to turn the spindle on and off using the M3 command for On and M5 command for Off. You should also be able to use the S command with S0 being the off setting and s24000 being max RPM (spindle and VFD dependent). If you haven’t invested in a good multimeter I’d recommend it. Especially if you’re trouble shooting the circuits at this point.

Once that is working and verified you need to work on your post-processor. In Vectric Vcarve I edited the GBRL gCode Post Processor to include a header to each toolpath that will turn the spindle on with the associated spindle speed and then turn it off post completion and prior to the movement of the spindle to home:

±--------------------------------------------------

  • Command output after the header to switch spindle on
    ±--------------------------------------------------

begin SPINDLE_ON

“[S]”
“M3”
“G4 P12”

[S] sends the projected Spindle speed to the LongBoard and out to the VFD as a fraction of the 5vDC signal. For example my 24,000 RPM = 5vDC, for 12,000 RPM the Longboard sends a 2.5vDC signal.
M3 starts the spindle. The P12 code pauses movement of the spindle for 12 seconds before initiating movement for the first cut. This allows the spindle to spin up to max speed prior to making a cut.

At the end of the program I have the following code:

“M5”
“G0 [ZH]”
“G0 [XH] [YH]”
“M2”

M5 shuts down the spindle before moving to home.

So hopefully that helps. If you have questions please feel free to post here or send me a private message.

1 Like

For those that are looking to run a 110V 1.5K water cooled 65mm spindle I have posted the installation instruction here. https://www.facebook.com/groups/mill.one/permalink/1149912342146762

1 Like

Hi, I have a problem where the spindle won’t run unless I do PD001 = 0 and press “Run”. The speed can be controlled from the LongBoard with SpinPWM > VI and SpinPWMGrnd > ACM, but SpindDIR > FOR and SpinDIRGrnd > DCM does not work. I want to be able to start/stop this from the LongBoard as well. Is there something I am doing wrong?

Blunderpunk,

The way my machine works through the long board is speed only. To turn the machine “off” the post processor adds a “S0” code to the M5 code, so the VFD stays on, but with no voltage applied to the spindle.

I had to set PD001 to “1” to accept the voltage change.

Hope that helps.