Soft spindle start with change direction

More
10 Jun 2012 06:25 - 10 Jun 2012 07:22 #20794 by grandixximo
I'd like to control a spindle in acceleration, deceleration, and I want it to turn clockwise and counter clockwise, and be able to do rigid tapping.

I'm having some issues doing this.

I'm using the code for the spindle soft start to accelerate and decelerate, I have to set up pwm-enable to be always on, otherwise I would not have deceleration, this make the clockwise button on the axis interface disappear, which is bearable, but if there is a solution to make it appear again and having pwm always enabled would be nicer.

other issue is the inversion of motion of the spindle, if I go from M3 to M4, or if I do a rigid tap G33.1 at high rpm, the direction is switched too soon, resulting in the spindle doing some crazy reverse movement or the server going in alarm.

for example I do M3 S5000, then M4 S5000, in the instant that I send the M4 command the direction is switched, but the speed is still decelerating, so the motor is trying to reverse the motion from 5000 clockwise to 5000 counter clockwise, it cannot do it at high speed but I have seen it at low speed, the motor will do sudden moves.

what I want is to send the clockwise direction until the spindle has decelerate to speed zero, and then send the counter clockwise direction to reach 5000 rpm again.

any ideas on how I can do this?
Last edit: 10 Jun 2012 07:22 by grandixximo.

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

More
10 Jun 2012 09:07 #20798 by andypugh
Spindle ramp is often easiest to set up as a setting in the spindle drive. Most VFDs have that as an option.
What sort of spindle motor and drive do you have?

I think your solution is probably not to use motion.spindle-forwards and motion.spindle-reverse (but to reinstate net spindle-on motion.spindle-on => pwmgen.0.enable)

If you look in Halmeter you will see that M3 sends positive values to motion,spindle-speed-out and M4 sends negative values.
You will also see that M3 and M4 set the motion.spindle-forwards and motion.spindle-reverse pins instantly.
So, what you are seeing is a 5000rpm forwards command, which instantly becomes a backwards command. Then the Limit2 ramps down from 5000 to 0 then ramps back up to -5000, which has an identical PWM value to +5000.

If you look at the pwmgen function it has two output pins, the PWM pulses, and a did pin, which goes high when the input value is negative. The trick in your case is probably to use this pin to set your forwards/reverse parport pins.

Using the wiki example, you would change
net spindle-fwd motion.spindle-forward => parport.0.pin-16-out
net spindle-rev motion.spindle-reverse => parport.0.pin-17-out

to
#set pin 16 so it is high when sent a 0
setp parport.0.pin-16-out-invert 1
#now send the pwm direction pin to both pins
net pwm-dir pwmgen.0.dir => parport.0.pin-16-out parport.0.pin-17-0ut

With this scheme the spindle will always have either forwards or reverse "pressed", but at 0 PWM when LinuxCNC thinks that the spindle is off. (because M5 sets speed to 0 too)
Most VFDs are perfectly happy like this, but if yours isn't then you could use the windowed comparator to set only forwards or reverse when fractionally above or below 0
www.linuxcnc.org/docview/html/man/man9/wcomp.9.html You would use the "under" and "over" pins.

Axis creates/hides buttons based on a fairly simplistic parsing of the HAL file. You can probably get the buttons back by adding a few dummy signals linked to the spindle pins.
However, I think you really do want pwm-enable linked to spindle-on anyway.

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

More
10 Jun 2012 10:55 #20800 by grandixximo
Thank you, Andy always very helpful, I'll try what you just explained I think it will work.

As for pwm-enable linked to spindle-on, if I do this when I send m5 the pwm will be disabled instantly and I will not have deceleration.

Unless you have a better solution I'll keep pwm always enabled. And do some dummy connection in Hal to have the button appear.

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

More
10 Jun 2012 11:41 #20801 by andypugh
grandixximo wrote:

As for pwm-enable linked to spindle-on, if I do this when I send m5 the pwm will be disabled instantly and I will not have deceleration.
Unless you have a better solution I'll keep pwm always enabled. And do some dummy connection in Hal to have the button appear.


Maybe link to machine-is-on so you _don't_ get the decel in an e-stop situation

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

More
11 Jun 2012 03:23 #20811 by jmelson
grandixximo wrote:

I'd like to control a spindle in acceleration, deceleration, and I want it to turn clockwise and counter clockwise, and be able to do rigid tapping.

I'm having some issues doing this.

Just for another data point, I had the same situation on my mill.
If you look at the bottom of this file :
pico-systems.com/codes/jebport/ppmc_motion.hal
You will see that after scaling the spindle speed value it
passes it through the lowpass component to slow the
rate of speed change. I have been using this for
rigid tapping for a couple years, and it works great.

I also had to disable the "electronic motor protection"
feature in the VFD, otherwise it would trip after tem
minutes or so of tapping work. The spindle motor is designed
to take this abuse.

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

More
13 Jun 2012 08:38 - 13 Jun 2012 08:39 #20867 by grandixximo
Thanks to both, i have solved the problem with Andy's solution.

I use a single pin to control direction, so i simply connected the pwmgen.0.dir to my pin for control direction, works like a charm.

the pwm.0.enable, is still setp to 1, because i need deceleration even in emergency cases.

the motion.spindle-reverse, and motion.spindle-forward are connected to two dummy signals, and everything is working just fine :laugh:

PS

i karma +1'd you both :P
Last edit: 13 Jun 2012 08:39 by grandixximo.

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

Time to create page: 0.126 seconds
Powered by Kunena Forum