Spindle as speed counter clockwise.
- timmert
 - Offline
 - Elite Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 165
 - Thank you received: 0
 
			
	
						14 Aug 2017 13:07				#97449
		by timmert
	
	
		
			
	
			
			 		
													
	
				Spindle as speed counter clockwise. was created by timmert			
			
				Hi
I have configured spindle at speed, working great (clockwise rotation)!
The lathe sometimes needs to run counter clockwise. The gui shows for example: -2.500RPM.
The problem is that the gcode doesn't continue and the spindle as speed led stays off.
How to solve this?
					I have configured spindle at speed, working great (clockwise rotation)!
The lathe sometimes needs to run counter clockwise. The gui shows for example: -2.500RPM.
The problem is that the gcode doesn't continue and the spindle as speed led stays off.
How to solve this?
Please Log in or Create an account to join the conversation.
- timmert
 - Offline
 - Elite Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 165
 - Thank you received: 0
 
			
	
						15 Aug 2017 08:56		 -  15 Aug 2017 08:57		#97496
		by timmert
	
	
		
			
	
	
			 		
													
	
				Replied by timmert on topic Spindle as speed counter clockwise.			
			
				I think the problem is that counter clockwise shows a negative value?
How can I configure it to show a positive value?
This is what I can find in my HAL file about the direction of the motor
net spindle-ccw => hm2_5i25.0.7i76.0.0.spindir
net spindle-cw <= motion.spindle-forward
net spindle-ccw <= motion.spindle-reverse
net spindle-manual-cw halui.spindle.forward
net spindle-manual-ccw halui.spindle.reverse
					How can I configure it to show a positive value?
This is what I can find in my HAL file about the direction of the motor
net spindle-ccw => hm2_5i25.0.7i76.0.0.spindir
net spindle-cw <= motion.spindle-forward
net spindle-ccw <= motion.spindle-reverse
net spindle-manual-cw halui.spindle.forward
net spindle-manual-ccw halui.spindle.reverse
		Last edit: 15 Aug 2017 08:57  by timmert.			
			Please Log in or Create an account to join the conversation.
- photomankc
 - Offline
 - Junior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 38
 - Thank you received: 4
 
			
	
						15 Aug 2017 12:50				#97502
		by photomankc
	
	
		
			
	
			
			 		
													
	
				Replied by photomankc on topic Spindle as speed counter clockwise.			
			
				Look at this:
linuxcnc.org/docs/2.4/html/hal_components.html#r1_2_1
You can feed the RPMs into that and it's output should always be a positive value. I'm not sure exactly where in your HAL that would need to be placed.
linuxcnc.org/docs/html/examples/spindle.html
That link explains how spindle-at-speed can be setup so you can probably look through your HAL to see how it's done and where to insert the ABS component to eliminate the sign.
					linuxcnc.org/docs/2.4/html/hal_components.html#r1_2_1
You can feed the RPMs into that and it's output should always be a positive value. I'm not sure exactly where in your HAL that would need to be placed.
linuxcnc.org/docs/html/examples/spindle.html
That link explains how spindle-at-speed can be setup so you can probably look through your HAL to see how it's done and where to insert the ABS component to eliminate the sign.
Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						15 Aug 2017 13:19				#97505
		by andypugh
	
	
		
			
				
What drives your spindle-at-speed input?
You probably have motion.spindle-speed-out-abs connected to the hardware with separate fwd.rev logic.
It is likely that a "wcomp" or "near" component is being used to compare the spindle speed feedback from the encoder to the commanded speed, but it is probably looking at the absolute version of the commanded speed.
The simplest answer is probably to connect the "near" to motion.spindle-speed-out-rps instead, which is a positive/negative number matching the encoder velocity output scaling and sign.
					
	
			
			 		
													
	
				Replied by andypugh on topic Spindle as speed counter clockwise.			
			Hi
I have configured spindle at speed, working great (clockwise rotation)!
The lathe sometimes needs to run counter clockwise. The gui shows for example: -2.500RPM.
The problem is that the gcode doesn't continue and the spindle as speed led stays off.
How to solve this?
What drives your spindle-at-speed input?
You probably have motion.spindle-speed-out-abs connected to the hardware with separate fwd.rev logic.
It is likely that a "wcomp" or "near" component is being used to compare the spindle speed feedback from the encoder to the commanded speed, but it is probably looking at the absolute version of the commanded speed.
The simplest answer is probably to connect the "near" to motion.spindle-speed-out-rps instead, which is a positive/negative number matching the encoder velocity output scaling and sign.
Please Log in or Create an account to join the conversation.
- timmert
 - Offline
 - Elite Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 165
 - Thank you received: 0
 
			
	
						15 Aug 2017 13:50		 -  15 Aug 2017 13:55		#97513
		by timmert
	
	
		
			
				
I do use the near component
Not sure anymore how to edit it
# ---Setup spindle at speed signals---
net spindle-vel-cmd-rps => near.0.in1
net spindle-vel-fb-rps => near.0.in2
net spindle-at-speed motion.spindle-at-speed <= near.0.out
setp near.0.scale 1.10
					
	
	
	
			 		
													
	
				Replied by timmert on topic Spindle as speed counter clockwise.			
			I do use the near component
Not sure anymore how to edit it
# ---Setup spindle at speed signals---
net spindle-vel-cmd-rps => near.0.in1
net spindle-vel-fb-rps => near.0.in2
net spindle-at-speed motion.spindle-at-speed <= near.0.out
setp near.0.scale 1.10
		Last edit: 15 Aug 2017 13:55  by timmert.			
			Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						15 Aug 2017 14:07				#97516
		by andypugh
	
	
		
			
	
			
			 		
													
	
				Replied by andypugh on topic Spindle as speed counter clockwise.			
			
				OK, that HAL looks right to me.
Can you monitor near.0.in0 and near.0.in1 with halmeter and tell us the numbers at 500rpm fwd and 500 rpm reverse?
					Can you monitor near.0.in0 and near.0.in1 with halmeter and tell us the numbers at 500rpm fwd and 500 rpm reverse?
Please Log in or Create an account to join the conversation.
- timmert
 - Offline
 - Elite Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 165
 - Thank you received: 0
 
			
	
						15 Aug 2017 14:14				#97517
		by timmert
	
	
		
			
	
			
			 		
													
	
				Replied by timmert on topic Spindle as speed counter clockwise.			
			
				I don't see a near 0.in0 in the halmeter
I can see a near 0.in1 and 0.in2
0.1
CW 500RPM = 8.33333....
CCW 500RPM = - 8.3333...
0.2
CW 500RPM = 8.5
CCW 500RPM = 8.5
					I can see a near 0.in1 and 0.in2
0.1
CW 500RPM = 8.33333....
CCW 500RPM = - 8.3333...
0.2
CW 500RPM = 8.5
CCW 500RPM = 8.5
Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						15 Aug 2017 15:09				#97519
		by andypugh
	
	
		
			
				
This seems to say that spindle-vel-fb-rps does not go negative when the spindle reverses.
That is directly linked to the encoder, so that seems to indicate that the encoder only shows positive numbers.
And this is why:
Do you only have a single-pulse spindle encoder by any chance? (Do you have index?)
counter-mode can's sense direction. If you do have a proper quadrature encoder then set that to 0.
If you don't have a quadrature encoder then one solution is to use:instead of the current net.
A better solution is to fit a proper encoder, so you can do rigid tapping.
					
	
	
			 		
													
	
				Replied by andypugh on topic Spindle as speed counter clockwise.			
			0.1
CW 500RPM = 8.33333....
CCW 500RPM = - 8.3333...
0.2
CW 500RPM = 8.5
CCW 500RPM = 8.5
net spindle-vel-cmd-rps => near.0.in1
net spindle-vel-fb-rps => near.0.in2
net spindle-at-speed motion.spindle-at-speed <= near.0.out
setp near.0.scale 1.10This seems to say that spindle-vel-fb-rps does not go negative when the spindle reverses.
That is directly linked to the encoder, so that seems to indicate that the encoder only shows positive numbers.
And this is why:
setp    hm2_5i25.0.encoder.00.counter-mode 1Do you only have a single-pulse spindle encoder by any chance? (Do you have index?)
counter-mode can's sense direction. If you do have a proper quadrature encoder then set that to 0.
If you don't have a quadrature encoder then one solution is to use:
net spindle-vel-cmd-rps-abs=> near.0.in1A better solution is to fit a proper encoder, so you can do rigid tapping.
		The following user(s) said Thank You: timmert 	
			Please Log in or Create an account to join the conversation.
- timmert
 - Offline
 - Elite Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 165
 - Thank you received: 0
 
			
	
						16 Aug 2017 07:45		 -  16 Aug 2017 07:46		#97551
		by timmert
	
	
		
			
	
	
			 		
													
	
				Replied by timmert on topic Spindle as speed counter clockwise.			
			
				Thanks Andy, it's working!
I have an index single and 150ppr encoder
It's a (rotary?) encoder connected to the spindle with a belt.
What do you recommend?
A index and quadrature encoder?
					I have an index single and 150ppr encoder
It's a (rotary?) encoder connected to the spindle with a belt.
What do you recommend?
A index and quadrature encoder?
		Last edit: 16 Aug 2017 07:46  by timmert.			
			Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						16 Aug 2017 09:07				#97555
		by andypugh
	
	
		
			
	
			
			 		
													
	
				Replied by andypugh on topic Spindle as speed counter clockwise.			
			
				I would be surprised if the encoder is a single channel + index? Do you have the B-phase connected?			
					Please Log in or Create an account to join the conversation.
		Time to create page: 0.144 seconds