Spindle speed feedback
13 Nov 2018 12:08 #120531
by biqut2
Replied by biqut2 on topic Spindle speed feedback
Sure will, but it'll be tonight before I can get to. Thought about posting it last night but ran out of time.
Please Log in or Create an account to join the conversation.
13 Nov 2018 12:26 #120532
by alan_3301
Replied by alan_3301 on topic Spindle speed feedback
motion.spindle-revs is an input, and counts the number of revolutions. I assume gmoccapy.spindle_feedback_bar is an input also, so that won't work.
This would be more correct, but encoder velocity output is in units/s and you probably want your display in RPM. Using a scale component can multiply the value by 60. That should be in your HAL already if you used stepconf or pncconf.
Note that in the first line we assign the encoder velocity value to motion.spindle-speed-in. In doing so, the signal of spindle-velocity holds that value, so that you can assign it to other inputs. (pins can't connect directly to other pins. signals are the interfaces between them)
encoder.00.velocity is an output, as documented here: linuxcnc.org/docs/html/man/man9/hostmot2.9.html#encoder
motion.spindle-speed-in is an input, as documented here: linuxcnc.org/docs/html/man/man9/motion.9.html#PINS
net spindle-velocity encoder.00.velocity => motion.spindle-speed-in
net spindle-velocity gmoccapy.spindle_feedback_bar
This would be more correct, but encoder velocity output is in units/s and you probably want your display in RPM. Using a scale component can multiply the value by 60. That should be in your HAL already if you used stepconf or pncconf.
Note that in the first line we assign the encoder velocity value to motion.spindle-speed-in. In doing so, the signal of spindle-velocity holds that value, so that you can assign it to other inputs. (pins can't connect directly to other pins. signals are the interfaces between them)
encoder.00.velocity is an output, as documented here: linuxcnc.org/docs/html/man/man9/hostmot2.9.html#encoder
motion.spindle-speed-in is an input, as documented here: linuxcnc.org/docs/html/man/man9/motion.9.html#PINS
The following user(s) said Thank You: biqut2
Please Log in or Create an account to join the conversation.
13 Nov 2018 12:28 #120533
by alan_3301
Replied by alan_3301 on topic Spindle speed feedback
and I'm not sure if software encoder uses encoder.0.velocity or encoder.00.velocity, like the hardware encoder counter.
The following user(s) said Thank You: biqut2
Please Log in or Create an account to join the conversation.
13 Nov 2018 15:27 #120557
by andypugh
Replied by andypugh on topic Spindle speed feedback
Is it a PNP or an NPN prox?
NPN prox can be fairly-easily connected to 5V inputs. PNP are a little harder
Basically an NPN prox can be considered as a switch to the 0V line, and a PNP is a switch to the +24V line.
www.mesanet.com/pdf/parallel/7i77man.pdf
Says that the encoder inputs are OK to 12V. Most prox switches need at least 6V, so there is an ovelap there.
NPN prox can be fairly-easily connected to 5V inputs. PNP are a little harder
Basically an NPN prox can be considered as a switch to the 0V line, and a PNP is a switch to the +24V line.
www.mesanet.com/pdf/parallel/7i77man.pdf
Says that the encoder inputs are OK to 12V. Most prox switches need at least 6V, so there is an ovelap there.
The following user(s) said Thank You: biqut2
Please Log in or Create an account to join the conversation.
13 Nov 2018 23:38 - 13 Nov 2018 23:46 #120635
by biqut2
Replied by biqut2 on topic Spindle speed feedback
Just got in, here is the requested HAL file. I'll dig through the other information after dinner.
Last edit: 13 Nov 2018 23:46 by biqut2.
Please Log in or Create an account to join the conversation.
13 Nov 2018 23:40 #120637
by biqut2
Its an NPN.
Replied by biqut2 on topic Spindle speed feedback
Is it a PNP or an NPN prox?
NPN prox can be fairly-easily connected to 5V inputs. PNP are a little harder
Basically an NPN prox can be considered as a switch to the 0V line, and a PNP is a switch to the +24V line.
www.mesanet.com/pdf/parallel/7i77man.pdf
Says that the encoder inputs are OK to 12V. Most prox switches need at least 6V, so there is an ovelap there.
Its an NPN.
Please Log in or Create an account to join the conversation.
14 Nov 2018 00:03 #120639
by andypugh
Replied by andypugh on topic Spindle speed feedback
For NPN and a Mesa 7i77 I think that you would need a pull-up resistor to the encoder 5V supply, and then allow the Prox to pull that pin down to ground for index. I think I would start with a 1k.
(You might need to invert the input too)
(You might need to invert the input too)
The following user(s) said Thank You: biqut2
Please Log in or Create an account to join the conversation.
14 Nov 2018 00:58 - 14 Nov 2018 01:07 #120642
by biqut2
Replied by biqut2 on topic Spindle speed feedback
Thank for the suggestion. That should be a lot better than the software encoder. Once I can confirm I am getting reasonably correct spindle feedback I've got to implement a servo to adjust the spindle speed. That machine originally had an AC servo turning the handle where you normally adjust the spindle speed on a manual mill. You guys have been an invaluable resource, thank you, my machine wouldn't be running without the help I've received here.
EDIT: I moved the gmoccapy line from the main hal file to the postgui hal file and the errors went away. everything starts up and I can start hal show and see the spindle speed change there, it just doesn't update in the gui for some reason. I suspect that a gmoccapy specific problem to pursue. As long as I can see the value updating in hal show I should be able to continue on with setting up the servo for the closed-loop control, correct?
EDIT: I moved the gmoccapy line from the main hal file to the postgui hal file and the errors went away. everything starts up and I can start hal show and see the spindle speed change there, it just doesn't update in the gui for some reason. I suspect that a gmoccapy specific problem to pursue. As long as I can see the value updating in hal show I should be able to continue on with setting up the servo for the closed-loop control, correct?
Last edit: 14 Nov 2018 01:07 by biqut2.
Please Log in or Create an account to join the conversation.
15 Nov 2018 02:15 #120728
by biqut2
Replied by biqut2 on topic Spindle speed feedback
Well, I got some time to play work on the machine this afternoon. Got the spindle feedback bar working in gmoccapy and it matches what I see in hal show. The problem is the values are way off. Put my scope on it and saw that the signal was in the kilohertz range so I switched from using the software encoder to the hardware encoder 05 on the 7i77 because I figured the frequency was too fast. This hal stuff is slowly starting to make sense, I got it working correctly, however, the pulse rate is way off by the same amount. Setting the encoder scale to 1 results in the display reading roughly half the actual spindle speed. the problem is I can clearly count approximately 34-36 teeth on the spindle looking through the sensor hole. Its worth noting as well that the scope shows a nice stable signal, I'm stumped on this one.
Please Log in or Create an account to join the conversation.
15 Nov 2018 09:59 #120742
by andypugh
Is it possible that the readout is showing 34/60 of the true speed?
It sounds a lot like a confusion between encoder velocity (RPS) and spindle speed (RPM)
Replied by andypugh on topic Spindle speed feedback
however, the pulse rate is way off by the same amount. Setting the encoder scale to 1 results in the display reading roughly half the actual spindle speed. the problem is I can clearly count approximately 34-36 teeth on the spindle looking through the sensor hole. Its worth noting as well that the scope shows a nice stable signal, I'm stumped on this one.
Is it possible that the readout is showing 34/60 of the true speed?
It sounds a lot like a confusion between encoder velocity (RPS) and spindle speed (RPM)
Please Log in or Create an account to join the conversation.
Time to create page: 0.081 seconds