Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Viperx85 on February 07, 2019, 04:08:25 AM

Title: Setting up Spindle/VFD control Issues
Post by: Viperx85 on February 07, 2019, 04:08:25 AM
Hey all.
Mach4 4.2.0.3804
ESS Build 232
Gecko G540
Nowforever VFD

Ive been using the setup for awhile with just the Potentiometer on the VFD for spindle control, I want to setup software control with the ESS/Gecko/Mach4

Ive set it all up as I believe it should be (following manuals etc) but as soon as I connect the wiring from the GeckoG540 to the VFD it activates the spindle and sets it at 232hz no matter what I change?

My wiring is as follows:
Gecko G540 Pin 7 (VFD Ground) --> Comm Terminal on VFD
Gecko G540 Pin 8 (VFD Out) --> X1 Terminal on VFD (Spindle FWD Input)
Gecko G540 Pin 9 (VFD 10V) --> AIN1 (Analog Input 1)

Software setup:

Mach 4 ESS plugin config:

Spindle: Type = PWM
Frequency Hz = 400z (im not actually sure about this one? how do you know the base hz, I just choose the max hz

Pins Config:
Port 1 - Pin8 - Out - Active High - Spindle PWM
Port 1 - Pin9 - Out - Active High - Spindle FWD
Output Signals:
Spindle Motor PWM - Enabled - Mach Mapping ESS Only - Pin1 Mapping "Spindle PWM"
Spindle FWD - Enabled - Mach Mapping ESS - Pin1 Mapping "Spindle FWD"

Mach 4 Config:
Output Signals:
Spindle FWD - Enabled - Device = ESS - Output Name Spindle FWD

Ive tried setting different pins, setting active low, changing spindle FWD to Spindle ON, even swapped the wires on the VFD (x1 and AIN1)

Oh I should mentioned Ive changed all the setup parameters on the VFD to suit analog control through AIN1.

But yea no matter what I try it just turns the spindle on straight away at 200odd hz

Im out of ideas.
Title: Re: Setting up Spindle/VFD control Issues
Post by: joeaverage on February 07, 2019, 04:56:01 AM
Hi,

Quote
Gecko G540 Pin 7 (VFD Ground) --> Comm Terminal on VFD
Correct

Quote
Gecko G540 Pin 8 (VFD Out) --> X1 Terminal on VFD (Spindle FWD Input)
Incorrect. Pin8 of the G540
is a variable output voltage between 0 and 10V. It needs to be hooked to the AIN input of your VFD

Quote
Gecko G540 Pin 9 (VFD 10V) --> AIN1 (Analog Input 1)
Incorrect. The G540 is expecting a constant 10V input supply, from the VFD if it has one or an external 10V supply
if it doesn't. The G540 will take this 10V supply and 'modulate' it to the required (variable) output. Does you VFD have
a 10-12V supply for this purpose?.

Quote
Spindle: Type = PWM
Frequency Hz = 400z (im not actually sure about this one? how do you know the base hz, I just choose the max hz
Correct although the G540 is expecting a base frequency of 50Hz, probably good idea to provide the signal
that the G540 is designed for, ie 50Hz

Quote
Pins Config:
Port 1 - Pin8 - Out - Active High - Spindle PWM
Port 1 - Pin9 - Out - Active High - Spindle FWD
Incorrect. The ESS pins will hook to the DB25 input of the G540.

Thus Port1 -Pin14 Active High Spindle PWM

You have a problem now. It is common to have a signal to turn the spindle ON/OFF.
If you want to be able to go both directions you'll want a FWD/REV signal as well.

There are two uncommitted outputs on the G540, OUTPUT1 and OUTPUT2. They are driven by two G540 DB25
input pins.

Port1 -Pin1 OUTPUT2
Port1 -Pin17 OUTPUT1

You need to decide whether you want ON/OFF AND direction control OR just plain ON/OFF control.

Quote
Mach 4 Config:
Output Signals:
Spindle FWD - Enabled - Device = ESS - Output Name Spindle FWD
You shouldn't touch this setting. You make the output settings in the ESS plugin and that AUTOMATICALLY populates
the Mach4 Config.

Until you decide the direction/ON/OFF question the ESS outputs are undecided.

Craig
Title: Re: Setting up Spindle/VFD control Issues
Post by: thosj on February 07, 2019, 08:49:33 AM
Wow, Craig, most excellent post!!

Only thing I'd even consider adding, for the OP's understanding, is the PWM frequency is unrelated to the VFD's frequency!!
Title: Re: Setting up Spindle/VFD control Issues
Post by: Viperx85 on February 07, 2019, 06:09:57 PM
Wow thanks JoeAwesome for the indepth reply!

I only require a spindle on and the vfd is set to turn clockwise.

The VFD does have a ā€œ12vā€ out but while I was checking things I happened to probe between this post and the comm post and it was showing 13.2volts. I do remember reading somewhere in the gecko manual not to let this be over 12v. Is this a problem?
Title: Re: Setting up Spindle/VFD control Issues
Post by: joeaverage on February 08, 2019, 12:48:20 AM
Hi,

Quote
The VFD does have a ā€œ12vā€ out but while I was checking things I happened to probe between this post and the comm post and it was showing 13.2volts. I do remember reading somewhere in the gecko manual not to let this be over 12v. Is this a problem?

Yes, it may be. Its quite common for a 'nominal 12V' supply to be somewhat more, as in your case 13.2V.
As you know 12V is the common output voltage of an automotive 6 cell flooded lead acid battery. In fact when absolutely
fully charged you might expect 2.2V per cell for a total output voltage of 12.6V. When in automotive service when the engine runs
the generator (old school)/altenator will elevate the voltage to charge the battery. A modest charge rate could be secured by
charging at 13.2V. A more aggressive charge rate as is the norm for modern cars is 14.2V to 14.5V.

With the long history of 12V use in automotive service then '12V' can be a bit flexible.

I don't recall seeing anything in the G540 manual, but I take your word that it is there, the recommendation not to exceed 12V.
If that is the recommendation I would stick to it. It is worth an email to Gecko to get a little more info.
The simplest solution I can think of would be to drop the voltage slightly with a 9.1V Zener diode and a resistor. That would
mean that the variable output voltage of the G540 would be  0 to 9.1V, slightly less than spec but close enough. 9.1V is a
standard Zener voltage. You might enquire from Gecko about the expected G540 current draw from the nominal 10V supply,
it maybe that a Zener will get a bit hot and bothered.

Another alternative is to use a low dropout voltage regulator. You might get away with a very common and dirt cheap LM317.
It would require two resistors to set the voltage but you can set it very accurately.

Let me know if you need some help to regulate the 13.2V output of your VFD. Electronics is 'my thing'.

Craig
Title: Re: Setting up Spindle/VFD control Issues
Post by: Viperx85 on February 08, 2019, 04:39:05 AM
Ok so progress! I wired and configured the way you said and now have control of the Frequency on the VFD except for one problem. The GeckoG540 is outputting 0 to 13volts. Maybe thats why they say not to connect it to over 12v as it cant reduce anything over 12v down to 10volts?

So yeh looks like I might have to drop the voltage.

Next problem is I setup Output 2 as Spindle On And the output is working (testing with multimeter) but the VFD only activates the X1 terminal when X1 and Comm terminal (on the vfd) are connected. and Output 2 on the g540 doesnt seem to have continuity to Comm on vfd so im not sure what to do there. Maybe run a wire from the Comm terminal on the VFD to the pin12 on the GeckoG540 (power supply ground)
Title: Re: Setting up Spindle/VFD control Issues
Post by: joeaverage on February 08, 2019, 05:12:05 AM
Hi,

Quote
Maybe thats why they say not to connect it to over 12v as it cant reduce anything over 12v down to 10volts?

Not quite. The G540 can reduce the input voltage in a range of 0% to 100%. If you call for the spindle to go to maximum
speed it will output 100% of the supply voltage it is given. If it is given 13V then at 100% the output voltage will be 13V.

The problem I'm guessing is that Gecko believe that an input voltage of more than 12V will stress the internals of the G540.

Quote
Next problem is I setup Output 2 as Spindle On And the output is working (testing with multimeter) but the VFD only activates the X1 terminal when X1 and Comm terminal (on the vfd) are connected. and Output 2 on the g540 doesnt seem to have continuity to Comm on vfd so im not sure what to do there. Maybe run a wire from the Comm terminal on the VFD to the pin12 on the GeckoG540 (power supply ground)


Sounds like the VFD Enable is active low. If you reverse the sense of the Gecko output, when it goes low it should turn the
VFD on. It may be as you say that the Com terminal is isolated from pin12, the power supply ground. Try in the first instance
the reversal of the signal, done in the ESS plugin Pins Config page. It may be necessary to hook pin 12 of the G540 to the Com
of the VFD.

Craig
Title: Re: Setting up Spindle/VFD control Issues
Post by: Viperx85 on February 08, 2019, 06:35:10 PM
Ok So I need to drop the voltage from 13.2 to 10volts.

Can this be done with a simple Resistor voltage divider circuit? http://www.learningaboutelectronics.com/Articles/How-to-reduce-voltage-with-resistors.php

If So am I better to use say a 1k resistor as R1 or a 10K for example.

Also where would I connect the earth from this circuit to? The comm of the VFD I would guess but doesn't this create a short circuit?

Or is the other method you mentioned better using a LM317? how is that done?


Lastly why does the VFD have a 12V (13V) output when its analog inputs only work with 0-10v :S
Title: Re: Setting up Spindle/VFD control Issues
Post by: Viperx85 on February 08, 2019, 06:47:12 PM
Actually should I just get one of these?
https://www.ebay.com.au/itm/LM317-DC-DC-step-down-converter-4-2V-40V-to-1-2V-37V-linear-voltage-regulator-JO/264175708605?hash=item3d821969bd:g:Mt0AAOSwIAJb~-Xp:rk:2:pf:0

https://www.ebay.com.au/itm/LM317-DC-Linear-Converter-Down-Voltage-Regulator-Board-Speed-Control-Module/272850619516?epid=608069985&hash=item3f872a0c7c:g:jOsAAOSwuLRZvgXX:rk:1:pf:0


The first one says minimum amps is 1.5 output Id imagine the Gecko/vfd would have very small amp output? does this mean it wont work? The second link says 5-1500ma so would this be better? not sure why it has 7 pins tho?
Title: Re: Setting up Spindle/VFD control Issues
Post by: Viperx85 on February 08, 2019, 07:14:44 PM
Doh, don't worry... I was thinking its weird it has a 12V output when its Analog input wants a 0-10V signal so reading the VFD manual some more it also has a Analog output which you can configure to output between 0-10v!
Title: Re: Setting up Spindle/VFD control Issues
Post by: joeaverage on February 08, 2019, 07:16:46 PM
Hi,
yes you could use a simple voltage divider but you can't be sure how much current the G540 will draw and whether it will
be constant. The output voltage of the voltage divider will vary with the current drawn.

The attached is a simple Zener diode regulator with just a diode and a resistor. I'm going to guess that the G540 will draw
10 mA or so. Zener diodes come in a variety of sizes, 500mW being the common small size. You can get 1W and 3W Zeners
as well. I would recommend 1W or 3W if you can find one locally. The resistor should be 1/2W or thereabouts.

You can use an adjustable regulator, the LM317 is very common, its like an asshole....everyones got one!
It would require a 317 reg, a 100mA TO92 size would be plenty big enough. Two resistors, or better one
resistor and an adjustable resistor would allow you to adjust it perfectly. The only draw back is the dropout voltage.
A linear regulator like this lets say has an output voltage of 10V. The device requires, according to the LM317 spec,
an input voltage of at least 2.5V MORE than the output voltage. So our reg will require 12.5V minimum. If the input
voltage drops below 12.5V then the output voltage may no longer get to the required 10V output, in fact it might stop
altogether. That is called the 'dropout voltage'. With 13.2V from the VFD you are awfully close to the minimum required
input voltage.

There are regulators which have lower than normal dropout voltages, called LDO regulators. They tend to be a little more
specialized and you are less likely to fin one in your local electronics shop.

I would try the Zener reg to start with, I'm 99% confident it will work for you. If not Then we start looking at slightly more
sophisticated designs.

Quote
Lastly why does the VFD have a 12V (13V) output when its analog inputs only work with 0-10v :S

I suspect that the VFD manufacturer sees the 12V nominal output as a purely auxillary supply and did not waste any resources
on its design, a standard off the shelf IC and that is that. The manufacturer might reasonably assume that the PWM
can handle the extra.

Geckos have an excellent reputation for robustness and it surprises me that they have specified such a close tolerance between
the expected max output (10V) and an input supply (12V). Without being privy to the circuit diagram I can't say for sure
why that is or if indeed 13.2V would cause damage. For the sake of a Zener and a resistor why risk it?

Craig
Title: Re: Setting up Spindle/VFD control Issues
Post by: joeaverage on February 08, 2019, 07:21:33 PM
Hi,

Quote
also has a Analog output which you can configure to output between 0-10v!

that output is NOT A SUPPLY for the PWM circuit!

Its meant to be a signal output, probably less than 10mA. Depending on how you program the drive the output
might be an analogue representation of the VFD ouptut power, or output current, or output frequency, or temperature of
the IGBT's, or whatever.....It meant so you can monitor the VFD or motor it drives.
Title: Re: Setting up Spindle/VFD control Issues
Post by: Viperx85 on February 08, 2019, 07:59:34 PM
Oh oops ok, lucky... I had configured it and wired it up and it was working  but yes the voltage output was changing depending on what frequency i was commanding.

Ill grab a zener and resister as you specified tho.

p.s. connecting the Gecko's -ve to the VFD comm fixed the X1 issue. it now turns on the spindle as expected :) I guess this was due to the VFD not being connected to the same power source (its connected directly to AC mains and the Gecko off a 48V DC supply) they are both earthed to the same earth star but i guess the Comm and Earth terminal on the VFD are isolated
Title: Re: Setting up Spindle/VFD control Issues
Post by: Viperx85 on February 08, 2019, 09:02:51 PM
Ok I can get these locally:

220 Ohm 5 Watt Wire Wound Resistor or 220 Ohm 0.5 Watt Metal Film Resistor Either is cheap so I guess 5watt is overkill but better?

Also have the choice between a 9.1V zener or 10.0V zener both 1watt. Would the 10v Zener be better?
Title: Re: Setting up Spindle/VFD control Issues
Post by: joeaverage on February 08, 2019, 09:12:20 PM
Hi,

Quote
Would the 10v Zener be better?

Yes, I don't ever recall seeing a 10V zener.

Craig
Title: Re: Setting up Spindle/VFD control Issues
Post by: Viperx85 on February 08, 2019, 09:17:15 PM
Do you have Jaycar in NZ?

https://www.jaycar.com.au/10v-1n4740-1-watt-zener-diode/p/ZR1410 (https://www.jaycar.com.au/10v-1n4740-1-watt-zener-diode/p/ZR1410)
Title: Re: Setting up Spindle/VFD control Issues
Post by: joeaverage on February 08, 2019, 09:25:33 PM
Hi,
yes we do but 10V is not an E12 value.

Craig
Title: Re: Setting up Spindle/VFD control Issues
Post by: Viperx85 on February 08, 2019, 09:39:20 PM
Whats a E12 Value? does that mean it wont work?
Title: Re: Setting up Spindle/VFD control Issues
Post by: joeaverage on February 08, 2019, 10:17:44 PM
Hi,
no, everything will be fine.

Often component values are broken into standard steps. In the case of E12 it means '12 values per decade', the E signals
exponential increments. 

Thus E12 resistors are in values:
1       eg 1k        10k      100k     1M
1.2         1k2      12k      120k
1.5         1k5      15k
1.8         1k8
2.2
2.7
3.3
3.9
4.7
5.6
6.8
8.2
9.1

So you can routinely buy 4.7kOhm resistors but not 5kOhm. There are other 'series' like E24 and E96 but E12 is the
common one.

Craig
Title: Re: Setting up Spindle/VFD control Issues
Post by: Viperx85 on February 15, 2019, 06:42:19 PM
So picked up the parts during the week and wired as per your diagram and is working perfectly Thanks! https://www.machsupport.com/forum/Smileys/default/grin.gif

Just for my understanding and curiosity is it working by the zener diode "bleeding" off any voltage it "see's" above its set value to ground (in this case 10v)

What I don't understand is how this does not create a short circuit and overload the amp capacity of the VFD 12v output?

Also can you explain what the resistor does for this setup please.

I did have a small issue where the commanded hz was not matching the output. say I commanded M3 S12000 the Gecko output (reading with a multimeter) is spot on 5.00V but the VFD is outputting 210-220hz  (should be 200hz) similar at M3 S24000 Gecko output = 9.98v VFD 385hz (should be 400hz)

Im guessing this is just due to the cheap chinese VFD, I adjusted the settings in the VFD to Max expected voltage to be 9.8V and now it puts out 400hz at 24000rpm commanded but 12000rpm is still the same or slightly higher from memory... which is fine for what Im doing, no need to be exactly spot on
Title: Re: Setting up Spindle/VFD control Issues
Post by: joeaverage on February 15, 2019, 07:11:32 PM
Hi,

Quote
Just for my understanding and curiosity is it working by the zener diode "bleeding" off any voltage it "see's" above its set value to ground (in this case 10v)
Yes, in fact that is a very good description as to what exactly a Zener diode does.

Quote
What I don't understand is how this does not create a short circuit and overload the amp capacity of the VFD 12v output?

Also can you explain what the resistor does for this setup please.
The resistor is between the VFD 12V output and the Zener. In absence of the resistor the Zener would 'short out'
the output and the VFD might not like it.

You are correct, but the 'short' is not quite the normal sense of it. Normally you would short a circuit and force the output
voltage to zero. In this instance you would 'short' it to not 0V but 9.1V (or whatever value Zener you used).
In engineering parlance that is called a 'differential short circuit'.

The resistor is to limit the current in the differential short and drop some voltage, in this case 13.2V-9.1V=4.1V.
It is entirely likely that the manufacturer of the VFD put some current limit resistor or other circuit within the VFD
to protect the output in case of a short circuit. Quality designed and built US, Japanese and European brands
will almost certainly have protection built in. Who knows with Chinese brands? Some are actually very good indeed,
anything made by Delta for instance I rate as good or better than any US, Japanese, European stuff but other Chinese
stuff I wouldn't 'cross the road to piss on'.

Craig
Title: Re: Setting up Spindle/VFD control Issues
Post by: Viperx85 on February 15, 2019, 08:32:08 PM
Thanks Craig, all makes sense.

My next problem is setting up Mach4 control of the mist coolant sprayer. I plan to use the spare gecko output which is rated at 1amp 50vdc max

I have a pneumatic valve which has a 12V 4.12W Solenoid on it which I believe equates to 0.343Amps / 343milliamps

Problem is I do not have a suitable 12v power supply.

Current voltage sources are
-48V 7.3amp switching power supply (main supply running geckog540)
-5v 3amp switch mode supply (running Ethernet smooth stepper)
-Gecko chiller has a 12V 200milliamp output (currently running a box fan)
-VFD has the 12-14v output but says limited to 20ma

Could I use the same trick with the Zener Diode's and the 48v supply or is it too much of a drop from 48-12v? if its ok what value resistor would you use (and out of curiosity how do you calculate that value)

Or since its likely going to be a constant load? could I just use a Voltage divider circuit with resistors or is this once again too much of a differential between 48-12volt and resistors would get very hot?

Other possible option is I think I can get a 24v solenoid for this valve which might help? but I know there is no 48v one. 

Title: Re: Setting up Spindle/VFD control Issues
Post by: joeaverage on February 15, 2019, 08:47:31 PM
Hi,

Quote
Could I use the same trick with the Zener Diode's and the 48v supply or is it too much of a drop from 48-12v? if its ok what value resistor would you use (and out of curiosity how do you calculate that value)

NO! the Zener and resistor will fry up BIGTIME.

A 12V 1W zener will get to limiting heat at 1/12=83mA. If at 83mA you had to drop (48-12)=36V then the resistor
would be 36/0.083=432 Ohm. The dropper resistor would dissipate 36 x 0.083=2.988W.

Either way such a setup wont deliver anything like your required 450mA to a load.

I will give it some thought and make a few suggestions.

Craig
Title: Re: Setting up Spindle/VFD control Issues
Post by: Viperx85 on February 15, 2019, 09:36:05 PM
Should I just use a 12v wall wart?
https://www.ebay.com.au/itm/AU-Power-Supply-Adapter-Transformer-AC240V-To-DC12V-1-2-3-5-6-8-10A-fr-LED-Strip/182610398988?hash=item2a846d8f0c:m:mjCOZaPW5RZJjJfPQdpCuUg:rk:1:pf:0

Actually might just add another power supply to the box.
https://www.ebay.com.au/itm/LED-5050-3528-Switch-Transformer-Power-Supply-Adapter-AC100-240V-to-DC-12V-AU/142920446582?hash=item2146b8f276:m:meSq8OvGzmE0_4h74ReHHOA:rk:17:pf:0
Title: Re: Setting up Spindle/VFD control Issues
Post by: MN300 on February 15, 2019, 09:48:32 PM
Viperx85,  Your last post came in whilst I was writing this.

A 100 ohm in series with the valve you describe would let you use 48V. However it would be dissipating 12 watts, not very practical.
A 24V valve with the same wattage could use a 33 ohm resistor and waste 4.1 watts. It would draw half the current but that's still not ideal.
There are 48V valves but they are less common, probably more expensive.

12V 1.0A power supplies are cheap on eBay or other sources. The extra current is good in case you want to add something later. I think this is your best option.
Example:
https://www.ebay.com.au/itm/Switching-Power-Adapter-Charger-ADS-12FB-12-12012GPSA-12V-1-0A/263731008662?hash=item3d6797d496:g:U~4AAOSwW8RbEgct:rk:2:pf:0

Another option would be to use a solid state relay and a mains powered valve. Common SSRs are 32VDC input max so a small resistor would be needed in series. This method can control small motors too like a coolant pump.
Title: Re: Setting up Spindle/VFD control Issues
Post by: joeaverage on February 15, 2019, 09:59:30 PM
Hi,
yes that would be simplest and probably cheapest.

48V to 12V is a bit outside the normal realm of linear regulators so you would have to augment the pass transitior
with an external transistor, doable but depending on your electronic skills fiddly.

Another possibility is a switching buck regulator but would require an IC, a Mosfet and an inductor with maybe a few
other smaller components to 'glue' it all together on a circuit board. Again doable but fiddly.

Yet another alternative is a DC-DC converter. This a typical example:

https://nz.element14.com/recom-power/r-78hb12-0-5-w/dc-dc-converter-12v-0-5a/dp/2774032 (https://nz.element14.com/recom-power/r-78hb12-0-5-w/dc-dc-converter-12v-0-5a/dp/2774032)

Useful, elegant and tidy solution for $27NZD plus GST and freight.

Craig
Title: Re: Setting up Spindle/VFD control Issues
Post by: MN300 on February 15, 2019, 10:26:07 PM
When a relay is switched off the falling current generates a voltage spike, often several times the supply voltage. The traditional way to protect the driving circuit is by placing a diode across the relay coil. A 1N4001 or other higher voltage rated diode in the 1N400x series would do. The cathode would be connected to the end of the coil going to the +12V supply.

The 50V output may not need protection but for a few pennies better safe than sorry.