Spindle speed feedback
12 Nov 2018 01:05 #120469
by biqut2
Spindle speed feedback was created by biqut2
I've got a 5i25 and 7i77 on my retrofit machine. I have an E2E-X1C1 proximity sensor installed in it and I have hooked the output to the input 8 on the 7i77 but for the life of me I can't figure out how to hook this up in HAL Been searing the forum and tried a few others solutions to no avail. I don't want to do tapping or anything like that, just need the feedback so I can then put a stepper or servo on the spindle speed control and figured I would start with this part. Any help would be greatly appreciated.
Please Log in or Create an account to join the conversation.
12 Nov 2018 12:43 #120487
by alan_3301
Replied by alan_3301 on topic Spindle speed feedback
How many teeth does the sensor read per revolution, and what is the max rpm of the spindle?
I think with a GPIO input, you will be limited to 1khz (what I remember reading).
Read here: linuxcnc.org/docs/html/man/man9/encoder.9.html
and here: linuxcnc.org/docs/html/examples/spindle.html#_spindle_feedback
You will want counter-mode set to true, and your gpio hooked up to phase-A (hal connection)
I'm not sure what to do about the base-thread because I don't think that is used with mesa cards. Maybe update-counters can be run in the servo thread? I'm sure someone will come around to give the specifics.
I think with a GPIO input, you will be limited to 1khz (what I remember reading).
Read here: linuxcnc.org/docs/html/man/man9/encoder.9.html
and here: linuxcnc.org/docs/html/examples/spindle.html#_spindle_feedback
You will want counter-mode set to true, and your gpio hooked up to phase-A (hal connection)
I'm not sure what to do about the base-thread because I don't think that is used with mesa cards. Maybe update-counters can be run in the servo thread? I'm sure someone will come around to give the specifics.
Please Log in or Create an account to join the conversation.
12 Nov 2018 15:15 #120493
by biqut2
Replied by biqut2 on topic Spindle speed feedback
Not 100% sure on the number of pulse per revolution but looking through the hole with a flashlight it looks to be approximately 36 teeth on the spindle. It says 3800rpm on the spindle but I'm over volting it so 4000-4500rpm max. I'm not at my laptop right now but I did enable encoder 0 and set it to model 1, also connected input 8 to phase a and can see the sensor state changing on the hall screen, just wasn't sure where to go from there.i did all of this late last night, I'll give it another look this afternoon. Thank you for the response and links. I had been reading some documentation but I check to see if it's the same as the links you provided.
Please Log in or Create an account to join the conversation.
12 Nov 2018 16:11 #120497
by PCW
Replied by PCW on topic Spindle speed feedback
Is there some reason you are not using a 7I77 encoder input for this?
Please Log in or Create an account to join the conversation.
12 Nov 2018 17:31 #120499
by alan_3301
Replied by alan_3301 on topic Spindle speed feedback
PCW, encoder inputs need to be 5 Volts right? I think his prox sensor is probably much higher voltage. I heard mention of using resistors to limit voltage, but I couldn't recommend the correct ones for him
Please Log in or Create an account to join the conversation.
12 Nov 2018 18:18 #120500
by biqut2
The sensor is 24vdc, there's is only one sensor at that so I wouldn't know how to hook it up like a quadrature. All of the single sensor examples ive seen treat it as a general purpose input and use a software encoder so that that's the route I was going with it.
Replied by biqut2 on topic Spindle speed feedback
Is there some reason you are not using a 7I77 encoder input for this?
The sensor is 24vdc, there's is only one sensor at that so I wouldn't know how to hook it up like a quadrature. All of the single sensor examples ive seen treat it as a general purpose input and use a software encoder so that that's the route I was going with it.
Please Log in or Create an account to join the conversation.
12 Nov 2018 18:33 #120502
by alan_3301
Replied by alan_3301 on topic Spindle speed feedback
This post
describes lowering the voltage if you wanted to go the route of using the 7i77 encoder counter.
if you wanted to use the software encoder it would be setup as described in the link I posted earlier, but I am unsure about the base-thread. you might have to load that one too?
If you were able to lower the voltage of the prox sensor, and use the 7i77 encoder input, it would be
I think I have that right, and not giving out false info.
if you wanted to use the software encoder it would be setup as described in the link I posted earlier, but I am unsure about the base-thread. you might have to load that one too?
# add the encoder to HAL and attach it to threads.
loadrt encoder num_chan=1
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread
# set the HAL encoder to 36 pulses per revolution.
setp encoder.0.position-scale 36
# set the HAL encoder to non-quadrature simple counting using A only.
setp encoder.0.counter-mode true
# connect the HAL encoder outputs to LinuxCNC.
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-velocity encoder.0.velocity => motion.spindle-speed-in
# connect the HAL encoder inputs to the real encoder.
net spindle-phase-a encoder.0.phase-A <= hm2_5i25.0.7i77.0.0.input-07
If you were able to lower the voltage of the prox sensor, and use the 7i77 encoder input, it would be
setp hm2_5i25.0.encoder.00.scale 36
setp hm2_5i25.0.encoder.00.counter-mode true
net spindle-position encoder.00.position => motion.spindle-revs
net spindle-velocity encoder.00.velocity => motion.spindle-speed-in
net spindle-phase-a encoder.00.phase-A <= hm2_5i25.0.7i77.0.0.input-07
I think I have that right, and not giving out false info.
The following user(s) said Thank You: biqut2
Please Log in or Create an account to join the conversation.
12 Nov 2018 18:54 #120504
by biqut2
Replied by biqut2 on topic Spindle speed feedback
Thanks alot. I'll give this a shot as soon as soon as I get home tonight.
Please Log in or Create an account to join the conversation.
13 Nov 2018 01:11 #120523
by biqut2
Replied by biqut2 on topic Spindle speed feedback
Just give it a go and had to change addf encoder.update-counters base-thread and put it on servo-thread, kept kicking errors on startup. I'm not sure if I should have made that change but at least it will start up now, When I attach gmoccapy.spindle_feedback_bar to motionspindle-revs I get errors about it already being attached. I'm just trying to get it to update in gmoccapy for now as a sanity check of sorts to make sure I really do have the correct number of pulses per revolution.
Please Log in or Create an account to join the conversation.
13 Nov 2018 11:41 #120530
by alan_3301
Replied by alan_3301 on topic Spindle speed feedback
Can you post the .hal file
Please Log in or Create an account to join the conversation.
Time to create page: 0.130 seconds