Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: OB Cues on February 16, 2010, 07:02:11 PM

Title: step and direction spindle control
Post by: OB Cues on February 16, 2010, 07:02:11 PM
Hello all, I am new to this forum.

I use a stepper for a work rotation spindle. I normally turn the work at about 350 rpm.

I am having trouble understanding the setup for this. I don't think what I have is working properly.

The velocity, by the manual, is rev's per second, which would mean I should set mine to 12.5. (750 rpm / 60 seconds) when I do this my stepper moves really slow when commanded to 60 rpm. If I bump it up to 750 for rev's per minute I get much faster speed, but not 60 rpm. If I continue to increase it the motor speed continues to go up, but if I increase it substantially, the motor tries to overspeed and stalls.

I would expect that the velocity would set a cap, and as long as I was under the cap, then my motor speed would be a function of the set rpm and the steps per unit for my motor and driver. If this is true, the changing the velocity would not affect the spindle speed unless i was commanding a speed in excess of the current velocity setting.

I'm hoping someone has been through this already.

Royce Bunnell
www.obcues.com
Title: Re: step and direction spindle control
Post by: Hood on February 16, 2010, 07:13:35 PM
I have servos on my lathe and mill spindles and a stepper on the coil winder. I however use a SmoothStepper on all of these machines and with it the Velocity is definitely Rev/min, so presuming it may well be the same for the parallel port.

Ok so here is how I think you should do it.
Steps per unit will be the amount of steps you need for  one revolution, for example your stepper may be 200 per rev and you have a 10 micro step drive so steps per unit would be 2000.
Velocity would be set to the Rev/min that you want (or can get) with a servo its easy as you know what the rated speed is but with a stepper it will be trial and error, so you say you run it at 350RPM so try that for a start and see.
 When you command a M3S350 that is what it should do, if you command M3S400 and you max velocity is 350 it should not attempt to do 400 but rather just go to 350, not sure if it will throw an error message or not.

Hood
Title: Re: step and direction spindle control
Post by: Hood on February 16, 2010, 07:15:21 PM
Oh and set the accel low for a start and work your way up.

Hood
Title: Re: step and direction spindle control
Post by: OB Cues on February 16, 2010, 07:24:53 PM
hood,

Thanks for the input.

My steps per unit is 1600, (200x8) for a xylotex board.

If I set the velocity to 540, for 540 rpm, and I command 60 rpm (m3 s60) I get a particular speed from the spindle that seems much lower than 60 rpm. If I up the velocity to say 2000, then my spindle speeds up noticably with the same command. If I go up way high with the velocity, my motor will obviously attempt to go too fast and stall instantly.

My motor speed seems to be relative to the velocity as opposed to being limited by it.

Royce
Title: Re: step and direction spindle control
Post by: Hood on February 16, 2010, 07:27:08 PM
Are you using the parallel port or do you by chance have a SmoothStepper?
Hood
Title: Re: step and direction spindle control
Post by: OB Cues on February 16, 2010, 07:31:03 PM
oops, I forgot to mention I am using a smooth stepper on this particular machine.

What started all this is the smooth stepper, but when I really look at all my machines, I have 4 of them, I don't think any of them are right. They will all change the rpm based on a change to the velocity.

weird!

Royce
Title: Re: step and direction spindle control
Post by: Hood on February 16, 2010, 07:35:55 PM
I thought it might be a SmoothStepper, I had issues with my Mill which I just finished recently and eventually Brian and I worked out where the problem was. I was having to set crazy steps per unit to get to the speed I wanted and couldnt understand why. Turns out that for some reason the SS looks at the Spindle Pulleys Max speed and takes that into the equation. So what you need to do is go to Config menu then Spindle pulleys and make sure you have the pulley set to the same Max as you have in Spindles motor tuning, also make sure the ratio is 1 if you are direct drive.
Hood
Title: Re: step and direction spindle control
Post by: OB Cues on February 16, 2010, 07:39:23 PM
Hood,

OK, I will try that right now. Do I need to change all 15 pulleys? I will, and I will do it on both machines, one SS, and one Parallel port.

Be right back

Royce
Title: Re: step and direction spindle control
Post by: OB Cues on February 16, 2010, 07:47:33 PM
OK

I set the pulley ratio to 1. The PP machine was already there, and the SS machine I had set to 100 for 100%. They are now both set to 1.
I didn't change all the pulleys, just the number one. I don't command any pulleys so I think this should do it. I set the pulley rpms to 500 as well as the velocities.

If I set the SS machine to 60 rpm, it looks pretty good. If I set it to 350 it stalls. I routinely run this speed on my other machines.

If I set the PP machine to 60 rpm it looks pretty good. If I set it to 350 it runs as expected as this machine has been running good for some time.

Now, if I go to the SS machine and command M3s350, I get an instant stall. If I go to 200 it runs, but is noticably faster than the PP machine.


I still have speed that is linear to the velocity as opposed to the gcode.

Royce
Title: Re: step and direction spindle control
Post by: Hood on February 16, 2010, 07:55:52 PM
Can you attach your xml for the SmoothStepper machine please.
Hood
Title: Re: step and direction spindle control
Post by: OB Cues on February 16, 2010, 08:02:44 PM
how do I attach it.

I don't find an attach file choice
Title: Re: step and direction spindle control
Post by: Hood on February 16, 2010, 08:05:26 PM
You will find an additional options button on the reply page, just click that then choose and browse to your xml. You may have to rename your xml first though as the forum will only accept a file name once and if you have a standard profile it will have been posted before, so copy it to your desktop first and rename to something like OBCues.

Hood
Title: Re: step and direction spindle control
Post by: OB Cues on February 16, 2010, 08:08:02 PM
I bet that was it. Lets see how this works


Royce
Title: Re: step and direction spindle control
Post by: Hood on February 16, 2010, 08:26:42 PM
Ok a few things,
First is set the kernel speed to 25KHz, it can affect feedrate readings when using the SS, actual feedrate will  be correct, just displays wrong.

Next set the E-Stop up to a port and set it active low if you dont have one, that way you wont get the annoying message.

You seem to be set to pulley 4 according to that xml so set to pulley 1 or best bet is set all pulleys to the max speed you will be doing on the spindle.

Your acceleration seems  high for a stepper spindle and is a likely cause of you stalling when you command a high speed, I would try 10 for a start, remember its revs/s/s as opposed to a normal axis being units /s/s

Go into the SS plugin and set the pulse width to 1.5, with it set at 5 you will likely saturate the step signal as there is no divider on the spindle signal like there are on the axis.

Hopefully these will sort you out, if not I will check in the morning, its 1:30am here so I better get some sleep :D

Hood
Title: Re: step and direction spindle control
Post by: OB Cues on February 16, 2010, 09:03:42 PM
Hood,

Thanks for the help.

I will try those things. It's 8 here, and I am home now. I will try them in the morning and see what happens.

Thanks again

Royce
Title: Re: step and direction spindle control
Post by: OB Cues on February 17, 2010, 04:44:03 PM
Hood,

Thanks for your help! I have it working right now.

I set the Kernel back to 25khrz and matched my pulley speed and velocity setting. Art gave me a good explanation on the yahoo forum as to how Mach calculates the spindle speed. It's interesting! Here it is:

Royce:
>
> The velocity is in mm or inches per minute. In the case of the spindle
> that would be 540 would be the correct setting for that 1600 step value.
> This works out to (1600 * 540) /60 steps per second. Thats 14400 steps
> per second, or 9 revs per second.
>
> The reason the speed changes when you affect the slider is that some
> of the math for the spindle uses a variable called SpindlePerSecond,
> which is
> scaled from the top speed youve set. SO if you change the slider you
> do affect the entire range of the spindle. In other words the spindle
> is set as a maximum value. ( in your case 540RPM ), so when you select
> S270, the system actually just grabs the max speed and gets 50% of
> that to calcuate the
> actual commanded speed. SO the slider always has an effect on the
> actual speed output. It should always be accurate in terms of the end
> speed,
> but you may have to restart the software so the SpindlePer is
> recalculated, somethign like that may be going on..
>
> So use 540 as the correct number, but if you reset the slider any try
> restarting the software after saving to see if its still working properly.
>
> Thanks,
> Art

I should note that these settings only work, with the Smooth Stepper, when the pulley speed and the velocity settings are the same! My other machines don't seem to be sensitive to this, but this one is.

I even jumped everything up to 1000 on both the velocity and the pulley speed and my speeds are correct.

It is very important to restart Mach any time you change a setting with the spindle. As Art stated above, it has to recalculate the SpindlePer number.


Thanks for everyone's help!

Royce Bunnell
www.obcues.com
Title: Re: step and direction spindle control
Post by: Hood on February 17, 2010, 05:13:40 PM
Yes it is only the SmoothStepper that looks at the spindle pulleys max speed for this, not sure why Greg did that but it took a while to work out why I was having to set weird numbers to get things correct.

As for Arts explanation, that will be for the parallel port and I think the SS probably does it itself rather than Mach, however it is likely to be very similar.
Hood
Title: Re: step and direction spindle control
Post by: OB Cues on February 17, 2010, 05:35:12 PM
Thanks!

The other thing that was a big problem is my xylotex board must have a short.

I have it jumper'd for micro step, 1/8th, but it must be shorted because I have to program 400 steps per unit instead of 1600 to make it work right.

go figure!

With it all set right, I was actually able to get 1000 rpm out of my little Pac Sci stepper I am using for the spindle. I have never been able to get over 650 or so before. I also had intermittent issues with positioning, and those are gone now. I am assuming they were parallel port issues as I don't think it was missing steps due to load or acceleration or anything like that.

I have 4 machines total, one 4 spindle 2 axis that uses 4 table saw blades to do the cutting. Boy can it make some sawdust! 2 smaller single spindle machines using routers to cut with and one 2 spindle that uses routers. The 2 spindle is vertical and is basically in a closet on wheels. I can roll it to where I need it, hook up dust collection and power and cut away!

Thanks again for your help.

Royce Bunnell
www.obcues.com
Title: Re: step and direction spindle control
Post by: Hood on February 17, 2010, 05:46:38 PM
It was likely your pulse from the parallel port was not great, thats where a smoothstepper will be of great benefit as it produces a nice clean pulse :)

Hood