Machsupport Forum

Third party software and hardware support forums. => SmoothStepper USB => Topic started by: maddios on October 20, 2010, 05:37:12 PM

Title: How to use closed loop spindle rpm with SS
Post by: maddios on October 20, 2010, 05:37:12 PM
Hi guys,

I've got my spindle operating in PWM output mode from mach3 with SS, and I have an opto-interrupter reading from a single gap wheel for rpm feedback to mach3. I can control rpm from within mach3 and I see a readout show up. Currently I'm trying to setup closed loop operation but I'm unable to make it do anything (it's just ingoring any settings in the section). Any suggestions where I can try to look? or does the SS not support closed loop right now?

Thanks
Title: Re: How to use closed loop spindle rpm with SS
Post by: Jeff_Birt on October 21, 2010, 10:47:19 AM
I suspect you really don't want closed loop operation. What you are likely after is Mach syncing with the spindle speed. Look at the Spindle tab in Ports&Pins.
Title: Re: How to use closed loop spindle rpm with SS
Post by: maddios on October 21, 2010, 11:58:00 AM
Yeah, I've tried every combination of those checkboxes under spindle setup and mach just ignores them, or at least I see zero effect.
spindle rpm will show 2500 in the DRO for example but mach has been asked to do 2000 and I see zero adjustment in pwm to get it to match.

Eugene
Title: Re: How to use closed loop spindle rpm with SS
Post by: Jeff_Birt on October 21, 2010, 12:05:46 PM
OK, that is not closed loop either :) It is just PWM output.

There was a post a few weeks ago here about getting PWM running properly. I'll see if I can find it later and link to it here.

Here is the link: http://www.cjh.com.au/PWM%20Spindle%20Control%20using%20Mach3.pdf (http://www.cjh.com.au/PWM%20Spindle%20Control%20using%20Mach3.pdf)

Title: Re: How to use closed loop spindle rpm with SS
Post by: thosj on October 21, 2010, 12:23:44 PM
So what this boils down to is there is no way in Mach to control spindle speed with the index signal? Or am I missing it?

The doc linked by Jeff talks about tuning spindle speed and stuff, but I don't think it mentions if we can actually adjust the spindle speed to the index signal. I guess that is "closed loop" and it simply doesn't work. It seems that if one has an index signal to Mach, Mach should adjust the spindle PWM to achieve the commanded S RPM.

My problem is if I have a pulley setup, say Pulley 7, to 300-3000 RPM, at 2000 I'm pretty close, but at 1000 I'm low and at 3000 I'm high. If we can't have index feedback for spindle speed, what's the correct way to adjust linearity? I've read to delete linearity.dat and not use Calibrate Spindle. Is there a way to get the linearity better?

All PWM control with SS is done in SS settings, right? Mach settings ignored?
Title: Re: How to use closed loop spindle rpm with SS
Post by: maddios on October 21, 2010, 12:30:11 PM
That's precisely my problem, DC motors are by nature not linear. So there needs to be some way of adjusting pwm linearity not just max/min like the doc you linked to suggests. I tried to use the caibration screen but as soon as I click AutoCal my spindle turns off and mach goes into an EStop condition and calibration stops, not sure if that's because AutoCal thinks it's done and just powers off the spindle (having not done anything) or if something is screwy because i'm using an SS.

My original question was same as one from thosj, the index signal doesn't seem to "correct" mach 3's pwm output based on the actual rpm being reported vs rpm requested.

btw, thanks jeff, I've actually read that doc you've linked, and there was a lot of info in there that I needed to get this far. :)
Title: Re: How to use closed loop spindle rpm with SS
Post by: Jeff_Birt on October 21, 2010, 12:46:46 PM
Actaully, DC motors ARE quite linear in speed w.r.t. input voltage. Speed controllers and/or PWM to voltage circuits are not linear many times though. If you set it up open circuit does mach's PWM output change in response to your commanded speed?
Title: Re: How to use closed loop spindle rpm with SS
Post by: maddios on October 21, 2010, 01:01:54 PM
Yeah, well, they're pretty linear, but not perfectly, and that's true, my error could be anywhere in the system, as i'm using an SS -> G540 -> KBMM-125 (motor speed control)  -> motor.

I can control motor rpm within mach 3 with the S word, but the motor rpm is never what I actually want, it's correct at around 1800 rpm, but then at s3000 actual rpm is like 6k and at s1000 actual is like 340 so there seems to be a pretty epic curve. I'm using an ac/dc motor with a max rpm of 30k, i believe it was removed from a vacuum cleaner it doesn't have permanent magnets, but rather a coil.
Title: Re: How to use closed loop spindle rpm with SS
Post by: maddios on October 21, 2010, 01:06:20 PM
Guess I should give a little more background here, I know for a fact that my G540 outputs its 0-10v vfd signal non linearly, as in when I request s2000 I get 2.4v and when I do s1000 i get 1.6 which is WAY off, and then when I do s3000 I get 3.8v.

I'm going to put a scope on my setup and try to determine if my PWM is possibly incorrect coming out of the SS, or maybe I have excessive noise feeding back from the KBMM-125.

My question was really a more theoretical, in a situation like this, true closed loop control would be able to adjust out all of this error and dial in the correct speed via the PID algorithm, but I've till now been unable to get the adjustment to happen at all.
Title: Re: How to use closed loop spindle rpm with SS
Post by: Jeff_Birt on October 21, 2010, 08:39:36 PM
I think maybe you have configuration problems. I have had the G540 VFD out hooked up to a KBIC and I seem to recall it was not more than 100 RPM off all along the scale. Do you have the tach sensor on the motor or spindle?
Title: Re: How to use closed loop spindle rpm with SS
Post by: maddios on October 21, 2010, 10:05:16 PM
haha, yeah, i'm like 99% sure i can have configuration issues:) There are so many variables to account for in setting up mach 3 that it's almost a guarantee that some issue will come up. I'm going to work on trying to resolve the issue this weekend, test out the output PWM from SS, compare it to the scaling out of G540, check noise on the control lines to the KBMM, etc.

The tach sensor is on the spindle itself, motor is connected to the spindle via a toothed belt via a 0.4 reduction. I also verified the index rpm was correct with a laser tach, it was within a few %.

I'm going to go through my configuration this weekend too, to make sure i didn't miss anything, and i can try to post some screenshots of the config screens.

Just as a side note, the closed loop spindle control does or doesn't work with SS? In your setup, if it does work, if you put a load on the motor, how long does it take Mach 3 to respond and bring the speed back up?
Title: Re: How to use closed loop spindle rpm with SS
Post by: Jeff_Birt on October 21, 2010, 10:51:06 PM
If you have the sensor on the spindle make sure you do not have anything but a '1' in for any of the pulley ratio boxes.
Title: Re: How to use closed loop spindle rpm with SS
Post by: thosj on October 21, 2010, 11:00:05 PM
Just as a side note, the closed loop spindle control does or doesn't work with SS? In your setup, if it does work, if you put a load on the motor, how long does it take Mach 3 to respond and bring the speed back up?

This is the question and I'll be following this thread closely.

maddios, your curve is WAY worse than mine, but a solution to yours would seemingly help me. I don't know what to change or where, to change the linearity of this PWM spindle with SS. I also don't know if I can fix this somehow in my VFD settings or in the PMDX-125/107 combo.

I've never sat down and tried to figure it out. I know my index sensor is feeding Mach the absolute right RPM, but the commanded RPM is not what the index sensor is reporting except at one spot in the curve.
Title: Re: How to use closed loop spindle rpm with SS
Post by: maddios on October 22, 2010, 02:04:16 AM
If you have the sensor on the spindle make sure you do not have anything but a '1' in for any of the pulley ratio boxes.

Hmm, a 1? I put a .4, what does this number mean? I'll try that tomorrow night.
Title: Re: How to use closed loop spindle rpm with SS
Post by: Jeff_Birt on October 22, 2010, 09:05:34 AM
In your case you have the tach sensor mounted on the spindle, so there is a 1:1 correspondence between the tach signal and the spindle speed. If you have a machine where you mount the tach sensor to the motor instead then Mach needs to know the reduction ratio between the motor pulley and spindle pulley. Let's say you had a 2" pulley on the motor and a 4" pulley on the spindle; that gives you a 1:0.5 ratio. So, for every one turn of the motor the spindle rotates 1/2 turn. You would then put in 0.5 in the ratio box for that pulley set.

Make sense?
Title: Re: How to use closed loop spindle rpm with SS
Post by: maddios on October 22, 2010, 11:28:46 AM
Hm, yes it does, thanks, I will try that and maybe it'll help with some of my issues. Mach manual is very vague when it describes what to put in those fields, took me forever to realize that the spindle max is the 100% side of the pwm requested.
Title: Re: How to use closed loop spindle rpm with SS
Post by: maddios on October 24, 2010, 08:15:49 PM
Alright so seems like my G540 was bad. I just tested my SS with a scope and the pwm output is perfect, however looks like the g540 has degraded further and now no-longer outputs anything. I'm feeding it a known good voltage with a 9v battery and seeing zero output from pin 8.
Title: Re: How to use closed loop spindle rpm with SS
Post by: maddios on October 26, 2010, 03:38:11 PM
I'd still like to get my Mach3 to operate closed loop though, as regardless of whether or not I have a linear setup, the motor still needs to have higher PWM when load is applied to increase power. When I'm back up and running I'll try again
Title: Re: How to use closed loop spindle rpm with SS
Post by: thosj on October 27, 2010, 11:02:39 AM
I fiddled with the settings in my VFD, Hitachi SJ200. I got the curve better. Now it's right on at the high end and off more and more as it goes lower. I see another setting in my VFD I may play with, a setting that seems to adjust the bottom. My guess is once you get your PWM coming out of your BOB correct then tuning in the VFD may get it pretty close.

I, too, would like the closed loop thing to work, that would add icing to the cake!! I'll be watching this for sure.
Title: Re: How to use closed loop spindle rpm with SS
Post by: maddios on October 27, 2010, 11:32:00 AM
I'm actually using a DC motor controller KBMM-125, it's a 16A 90VDC controller. There's really no adjustment on this thing other than max current output, accel/decel time and min/max speeds.
Title: Re: How to use closed loop spindle rpm with SS
Post by: maddios on November 21, 2010, 07:26:28 PM
So, is there no way?

Is this just a limitation of the SS driver or does the mach3 closed loop controller not work right now?

My expectation as to how it should work is that when I select type in S3000 and my rpm sensor reads say 3060 or something it'll adjust PWM output to 3000/3060*(previous PWM) applying the PID coefficient to smooth out any oscillation that this math will cause.
Title: Re: How to use closed loop spindle rpm with SS
Post by: cjwe50 on May 05, 2011, 12:56:02 PM
I am having a simular problem, before I added a smoothe stepper and c32 breakout board I had nearly perfect spindle rpm control thru all ranges. Now i can not get the spindle to work at all in PWM. I have been using anolog voltage off of the c32 BOB and it is far from good.
Can you give me a rough of your configuration to get PWM to work with the SS so maybe I can figure out what I am missing. Thanks, Cork
Title: Re: How to use closed loop spindle rpm with SS
Post by: maddios on October 23, 2011, 12:55:55 AM
Hey Cork, sorry for the super long delay, I took a long break from my cnc machine and just recently got back into it and actually started cutting stuff.

Not sure if you still need settings, but mine work with a G540 geckodrive, which outputs 0-10V.

I don't remember exactly why I chose certain settings but I do remember that the G540 had certain pwm requirements as well as the SS.

in the SS config dialog I have my spindle set to 64khz, spindle set to PWM at a 2000Hz rate.
in the Ports & Pins spindle screen I have my use spindle motor output and pwm control checked, base freq is at 50 and min pwm is 0.

From here I think all I had to do is tune the pulley settings until the pwm curve output by mach matched what my spindle did. Therein lies the problem, I'm not using a VFD so the rpm mapping is near impossible as a DC motor doesn't have linear rpm to voltage curves. So I've been trying to get closed loop spindle control but so far has been unable to get it to work. I've yet to try the latest beta SS drivers available though.

Not sure if we can get any more insight from the SS developers as to what's missing here of it it's even possible with the current SS drivers.