Spindle encoder issues

More
10 Apr 2012 11:13 #19087 by Peter_Cassar
I've upgraded to linuxcnc 2.5 and returned to configure the spindle encoder. Looking at the HAL meter I don't see the spindle position reset to zero it just keeps incrementing the position values with each clock pulse on phase A. I've obviously got something wrong here see below. Even the spindle velocity looks dodgy, it shows a random value in the HAL meter. My encoder is a 100 slot disk with index (optical) G33 just gives me maximum velocity regardless of the spindle speed.

#### SPINDLE ENCODER

addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread

setp encoder.0.position-scale 100.
setp encoder.0.counter-mode 1


net spindle-position encoder.0.position-interpolated => motion.spindle-revs
net spindle-velocity encoder.0.velocity => motion.spindle-speed-in
net spindle-index-enable encoder.0.index-enable <=> motion.spindle-index-enable

net spindle-index parport.0.pin-11-in => encoder.0.phase-Z
net spindle-pulse parport.0.pin-10-in => encoder.0.phase-A

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

More
10 Apr 2012 12:49 #19089 by BigJohnT
Replied by BigJohnT on topic Re:Spindle encoder issues
The example in the manual doesn't use position-interpolated...

linuxcnc.org/docview/html/examples/spind...d_spindle_feedback_a

John

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

More
10 Apr 2012 13:29 #19090 by ArcEye
Replied by ArcEye on topic Re:Spindle encoder issues
Hi

My lathe with 120 hole optical disc has the below hal listing, which is ALMOST identical to yours;
setp encoder.0.position-scale 120
setp encoder.0.counter-mode 1
net spindle-position encoder.0.position-interpolated => motion.spindle-revs
net spindle-velocity encoder.0.velocity => motion.spindle-speed-in
net spindle-index-enable encoder.0.index-enable <=> motion.spindle-index-enable

net spindle-index parport.0.pin-11-in-not => encoder.0.phase-Z
net spindle-pulse parport.1.pin-10-in => encoder.0.phase-A

The difference is that I set phase-Z to pin-11-in-not because otherwise the BOB inverted the signal and had index permanently on and just off once per rev.

Is this what is happening to you?

regards

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

More
10 Apr 2012 22:16 #19111 by Peter_Cassar
I don't think so . The HAL scope shows the index is low for most of the cycle. I did look at your config and got some ideas. I think I've missed setp encoder.0.index-enable 1 so the count isn't resetting after each 100 pulses. I'm going to make this change and try again.

Cheers,
Peter.

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

More
11 Apr 2012 07:30 #19122 by cncbasher
Replied by cncbasher on topic Re:Spindle encoder issues
yea i'd say the they need reversing , they should be high , then drop low on pulse , what sensors are you using ? , if you have any other opto's in the signal path they will invert the signal

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

More
11 Apr 2012 08:23 #19124 by Peter_Cassar
I'm using a homemade encoder but I'll try inverting the index signal.

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

More
13 Apr 2012 09:46 #19165 by Peter_Cassar
Hi All, I've tried inverting the index signal and it makes no difference. I'm not sure about the index-enable signal either. They way I understand the documentation is that the counts and position are supposed to be reset to 0 on the rising edge of the index signal. I don't see this happening at all. The counts and position keep incrementing as seen through the HAL meter. I've set up the HAL scope to monitor the signals and I see that the index and phase A signals are clean and regular.

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

More
13 Apr 2012 12:53 #19173 by cncbasher
Replied by cncbasher on topic Re:Spindle encoder issues
please post your hal and ini file , and i'll take a look

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

More
13 Apr 2012 13:09 #19174 by BigJohnT
Replied by BigJohnT on topic Re:Spindle encoder issues
Peter_Cassar wrote:

Hi All, I've tried inverting the index signal and it makes no difference. I'm not sure about the index-enable signal either. They way I understand the documentation is that the counts and position are supposed to be reset to 0 on the rising edge of the index signal. I don't see this happening at all. The counts and position keep incrementing as seen through the HAL meter. I've set up the HAL scope to monitor the signals and I see that the index and phase A signals are clean and regular.


encoder.N.index-enable bit i/o

When true, counts and position are reset to zero on the next rising edge of Phase-Z. At the same time, index-enable is reset to zero to indicate that the rising edge has occurred.

Otherwise it is not reset.

linuxcnc.org/docview/html/man/man9/encoder.9.html

John

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

More
13 Apr 2012 22:50 #19181 by Peter_Cassar

File Attachment:

File Name: lathe.ini
File Size:2 KB

File Attachment:

File Name: lathe.ini
File Size:2 KB


I've attached my hal and ini files. I've checked things in the HAL components window and unlinked encoder.0.index-enable then executed setp encoder.0.index-enble and I can see the count and position reset to 0 but I don't know why it doesn't work when linked to spindle-index-enable and motion.spindle-index-enable using

net spindle-index-enable encoder.0.index-enable <=> motion.spindle-index-enable

also if I have

setp encoder.0.index-enable 1

in the HAL file I don't see this set to true in the HAL Meter as it always remains false even at start up.

Thanks for looking,
Peter.
Attachments:

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

Time to create page: 0.124 seconds
Powered by Kunena Forum