VFD speed scaling

More
23 Jun 2020 00:35 #172408 by Bats
VFD speed scaling was created by Bats
As the ever-patient rodw & andypugh are well aware ([thanks|sorry], guys) , I've been stumbling through my first linuxCNC migration for some time now, and I feel like I'm finally getting close to the end of this phase of the project (read: I'm probably about due for a crippling blow to my hardware, software, or ego).

Today's problem, as I creep ever so slowly towards the finish line is the spindle. I got my super classy Huanyang VFD wired for my Gecko G540 with a little help from The Internet , and tested out in Mach3 to be sure it was working... but, as is usually the case, linuxCNC wants a little something more out of me.

I managed to frankenstein up a working HAL with bits stolen from stepconf (I haven't managed to wrap my head around pwmgen.N.scale/offset), but I'm at something of a loss for making the scale & offset behave the way I'd like them to.

The VFD is configured (in firmware params) with a minimum speed of 6000rpm, and a max of 24000.

In stepconf (on my most successful attempt) I used:
Speed 1: 6000.0 PWM 1: 0.0
Speed 2: 24000.0 PWM 2: 1.0

Right now everything's pretty accurate between M3 S6000 and S24000.... but as the M3 speeds decrease below S6000, the spindle speed begins to increase again - so S3000, for instance, gives ~9k rpm, and S1000 gives ~11k.

Now I could just ignore this behavior - I obviously won't be using speeds <6000 anyhow - but it strikes me as messy, and is likely to eventually come back and bite me as soon as I forget about it.

Ideally, I'd like to either have anything <S6000 = S6000, or anything <S6000=0 (it doesn't much matter which).

Is there an easy way to achieve this (whether in HAL, .ini, or gmoccapy), or should I just write it off as "quirky", and get used to it like that one not-quite-sane girlfriend you couldn't help but fall in love with?


-Bats
Attachments:

Please Log in or Create an account to join the conversation.

More
23 Jun 2020 01:53 #172411 by JohnnyCNC
Replied by JohnnyCNC on topic VFD speed scaling
This is how I have mine set in the .ini file. I run mine between 7200 ~24000. I'm using the -10v to +10v interface. Not sure if this will help but hopefully it will. I have a water cooled spindle with a Huanyang VFD

[SPINDLE_0]
P = 0
I = 0
D = 0.0
FF0 = 1.00
FF1 = 0.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
OUTPUT_MIN_LIMIT = 0
OUTPUT_MAX_LIMIT = 16800
OUTPUT_SCALE = 16800

These are my .hal settings


#*******************
# SPINDLE S
#*******************
setp pid.s.Pgain [SPINDLE_0]P
setp pid.s.Igain [SPINDLE_0]I
setp pid.s.Dgain [SPINDLE_0]D
setp pid.s.bias [SPINDLE_0]BIAS
setp pid.s.FF0 [SPINDLE_0]FF0
setp pid.s.FF1 [SPINDLE_0]FF1
setp pid.s.FF2 [SPINDLE_0]FF2
setp pid.s.deadband [SPINDLE_0]DEADBAND
setp pid.s.maxoutput [SPINDLE_0]OUTPUT_MAX_LIMIT
setp pid.s.error-previous-target true

setp offset.0.offset 7200
net spindle-vel-cmd-rpm => offset.0.fb-in
net spindle-output <= offset.0.fb-out

# ---Analog output signals/setup---

setp hm2_5i25.0.7i83.0.1.analogout4-scalemax [SPINDLE_0]OUTPUT_SCALE
setp hm2_5i25.0.7i83.0.1.analogout4-minlim [SPINDLE_0]OUTPUT_MIN_LIMIT
setp hm2_5i25.0.7i83.0.1.analogout4-maxlim [SPINDLE_0]OUTPUT_MAX_LIMIT
net spindle-output => hm2_5i25.0.7i83.0.1.analogout4

# ---setup spindle control signals---

net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-enable <= spindle.0.on and2.ena.in0 estop-latch.1.reset
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-revs => hm2_5i25.0.encoder.00.position spindle.0.revs
net spindle-at-speed => spindle.0.at-speed
net spindle-vel-fb-rps => spindle.0.speed-in
net spindle-index-enable <=> spindle.0.index-enable


net spindle-lockout-db estop-latch.1.ok-out => and2.ena.in1
net spindle-OK and2.ena.out => timedelay.0.in
net HY-enable timedelay.0.out => hm2_5i25.0.7i76.0.0.output-05 hm2_5i25.0.7i83.0.1.analogena4
net spindle-Lockout hm2_5i25.0.7i76.0.0.input-07-not => estop-latch.1.fault-in

# ---Setup spindle at speed signals---
net spindle-at-speed <= hm2_5i25.0.7i76.0.0.input-10

Please Log in or Create an account to join the conversation.

More
23 Jun 2020 09:29 #172454 by rodw
Replied by rodw on topic VFD speed scaling
Bats, I'm glad you got a helper. I don't know the first thing about spindles!

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds
Powered by Kunena Forum