Gecko 540 Spindle Speed Detection

More
28 Jan 2020 01:04 #155969 by tko829
I recently acquired a Grizzly G0602 CNC conversion lathe. I have been working on getting Linuxcnc to function properly. I have made success to the point where I can make some parts, but I really need to do some threading. There is a optical spindle speed sensor already mounted on the lathe. It lights up every time the window in the disc passes the sensor, so I know that is working.

I can't figure out how to read the spindle speed in Linuxcnc. I have done quite a bit of searching and reading, but I have more questions than answers!

I can't figure out if there is something that I need to set in Stepconf, or HAL.

If anyone can give me a push in the right direction, it would be greatly appreciated!

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

More
28 Jan 2020 05:38 #155976 by phillc54

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

More
28 Jan 2020 23:57 #156055 by tko829
After reading that, I have more questions. It looks like Section 6.1 is what I am trying to accomplish. I found the Spindle Index option for the pin that is connected to the spindle sensor. Don't know how I didn't see that before!

Now I am not sure what to do with the HAL file. Do I write into the custom.hal file or use something else?

I appreciate the help!

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

More
29 Jan 2020 00:17 #156057 by phillc54
Use Stepconf to set up your basic machine then make sure it is working correctly.

One way to do it is:
From now on ONLY do manual edits to the HAL file that Stepconf created, do NOT use Stepconf again as it will overwrite the HAL file and remove any thing you have manually changed.
Use this single HAL file and edit it at will...

Another way is to leave the Stepconf generated HAL file as is and do all your additions in the custom.hal file.
If you do it this way and are loading additional HAL components you may need to turn TWOPASS on linuxcnc.org/docs/devel/html/hal/twopass.html
If you decide to do it this way you also need to remember that if you use Stepconf again it will also overwrite any changes you make in the INI file.

Personally I feel the first way is the safest and it is a bit easier to keep track of with everything in one file.

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

More
29 Jan 2020 23:33 #156123 by tko829
So I went the custom.hal file route. I took the example hal file and I am trying to get it to work. The example states that there is an encoder outputting 100 pulses per index. on pin 10 and the spindle index is on pin 11.

I only have a spindle index and it is on pin 10. I tried editing the hal file to match my setup, but I keep getting errors. I tried the TWOPASS in the ini file and that had a bigger debug log than before!

Here is what my HAL file looks like.

# Include your customized HAL commands here
# This file will not be overwritten when you run stepconf again

# 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 100 pulses per revolution.
setp encoder.3.position-scale 100

# set the HAL encoder to non-quadrature simple counting using A only.
setp encoder.3.counter-mode true

# connect the HAL encoder outputs to LinuxCNC.
net spindle-position encoder.3.position => spindle.0.revs
net spindle-velocity encoder.3.velocity => spindle.0.speed-in
net spindle-index-enable encoder.3.index-enable <=> spindle.N.index-enable

# connect the HAL encoder inputs to the real encoder.
#net spindle-phase-a encoder.3.phase-A <= parport.0.pin-10-in
#net spindle-phase-b encoder.3.phase-B
net spindle-index encoder.3.phase-Z <= parport.0.pin-10-in

I get an error at line 10. If I comment it out, the error is at line 13. If I comment that out, the error is at line 16, and so on, all the way to the last line.

What am I doing wrong? I don't understand this language well enough to figure it out.

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

More
30 Jan 2020 00:12 - 30 Jan 2020 00:13 #156125 by phillc54
You probably only have one encoder so it would be encoder.0 rather than encoder.3 (see note 1 at the bottom of the link to the spindle stuff)

If you only have a single pulse per rev from one source then you probably need the last three lines something like:
net spindle-pulse   encoder.0.phase-A <= parport.0.pin-10-in
#net spindle-phase-b encoder.3.phase-B
net spindle-pulse  => encoder.0.phase-Z
so the pulse feeds both phase-A and phase-Z
Last edit: 30 Jan 2020 00:13 by phillc54.

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

More
30 Jan 2020 01:44 #156130 by tommylight

There is a optical spindle speed sensor already mounted on the lathe. It lights up every time the window in the disc passes the sensor, so I know that is working.

If there is only a single slot on the disk, that will not work for threading or tapping, it does need at least another sensor with much more slots.
Can you mount an encoder there ?

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

More
30 Jan 2020 01:57 #156131 by tko829
I appreciate you working with me on this!

When I changed the HAL file like you suggested, I received an error saying that spindle-index was already linked to pin 10. I changed the HAL file created by stepconf to spindle pulse instead of spindle index and it loaded without errors.

I can't tell if that is a good thing or not... I thought there would be some type of readout showing spindle speed. When I check the HAL meter for the spindle-pulse signal it says FALSE. Even with the spindle on, there is no change there.

I double checked my spindle sensor and it is going high every time it hits the window, so I know that is working.

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

More
30 Jan 2020 02:08 - 30 Jan 2020 02:17 #156132 by phillc54
I did miss:
# set the HAL encoder to 100 pulses per revolution.
setp encoder.3.position-scale 100
That should be 1 as you only have a single pulse per rev.

Can you post all your hal files and your ini file as attachments.

If you want a readout you will need to add a PyVCP panel. linuxcnc.org/docs/devel/html/gui/pyvcp.html
From memory you can specify that in Stepconf to add a speed display.


This thread may help. forum.linuxcnc.org/38-general-linuxcnc-q...tting-up-rpm-readout
Last edit: 30 Jan 2020 02:17 by phillc54.

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

More
04 Feb 2020 23:27 - 04 Feb 2020 23:30 #156550 by tko829
Sorry for taking so long to reply.

I looked at the thread you linked and I managed to get the Spindle Speed to display using stepconf.

Since it is outputting the spindle speed will I be able to turn threads?

Edit - I just saw an older reply in this post. Apparently I will need another pulse signal to get threading to work? Will that be true for feed/rev?
Last edit: 04 Feb 2020 23:30 by tko829. Reason: updated

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

Time to create page: 0.090 seconds
Powered by Kunena Forum