Spindle encoder issues

More
13 Apr 2012 22:51 #19182 by Peter_Cassar
Sorry, two copies of lathe.ini , see HAL attached here.

File Attachment:

File Name: lathe.hal
File Size:4 KB
Attachments:

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

More
14 Apr 2012 08:44 - 14 Apr 2012 08:49 #19187 by cncbasher
Replied by cncbasher on topic Re:Spindle encoder issues
Peter ,
you have ... setp encoder.0.position-scale 1
this should be 100 for a 100 slot encoder

if you watch the encoder pin a you should be able to slowly rotate the spindle by hand and count each slot
the after each 100 the index pin should show a count .

are the index slot and a encoder slot in your disk in alignment , so they both give a signal at the same time ?
Last edit: 14 Apr 2012 08:49 by cncbasher.

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

More
14 Apr 2012 11:59 #19191 by Peter_Cassar
cncbasher, I was experimenting with the position-scale but have since changed it back to 100. The spindle index isn't aligned with a slot or put another way the rising edges are not synchronised. I slotted an aluminum disk and lengthened one of the slots to create the index but since then I drilled it out to make the index signal duration longer. I could always plug it and lengthen another slot to fix that.

I've been rotating the spindle by hand and I can see that the spindle-index goes true but the spindle.index-enable and encoder.0.index-enable always remain false not matter what the phase-z signal is doing. The count and position still increment beyond 100 counts basically heading to infinity. Do you think the slot alignment has something to do with this?

I've run a successfull G76 test and verified that the pitch comes out as specified in the parameters. The tool appears to be synched correctly to the spindle if I change speed manually the Z axis speeds up and slows down following the spindle speed. Something is working but I still don't understand why the counts dont reset at 100 pulses of phase-a. It's proving to be something of a mystery at the moment.

G33 is very unpredictable , sometimes it synchs with the spindle, other times it does nothing or races at full velocity.

I've used a proper oscilloscope to check the for clean signals coming from the encoder and it all looks good to me, nice square waves at near 5v. I've used some IR leds , op-amps and schmidt trigger inverters to build the encoder, it works in quadrature but I only use 1 channel plus the index. I'll plug the index hole and lengthen another slot to get the index and phase synched on edges and see if that makes a difference to the counter resets.

Cheers,
Peter.

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

More
14 Apr 2012 12:11 #19192 by cncbasher
Replied by cncbasher on topic Re:Spindle encoder issues
Hi Peter ,

i'd go for having the index pulse in alignment with one of the encoder slots ,
i dont expect the counts to reset as if it did positional information would be lost , but i must admit iv'e not checked , i'd expect an internal count to produce the rpm and an internal value to count the indexes and positional count , i.e 4 index counts and 450 encoder counts = 4 turns of 360 degrees + half a turn ( 50 counts ) ( put simply i will admit ) which would give the position exactly for screw cutting

i use a mesa card for my interface , so it just works ,

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

More
14 Apr 2012 13:28 - 14 Apr 2012 13:39 #19195 by ArcEye
Replied by ArcEye on topic Re:Spindle encoder issues
Hi

Have you tried just having this in your hal file
loadrt 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-not => encoder.0.phase-Z
net spindle-pulse parport.1.pin-10-in => encoder.0.phase-A

comment out
setp encoder.0.latch-input 1
setp encoder.0.index-enable 1
and anything else relating to the encoder

That is all I have in mine and it works perfectly.

I don't really understand why you want to set encoder.0.index-enable when you have linked it already or
why you are setting latch-input with both latch-rising and latch-falling TRUE (the default) when you are not
reading counts-latched anyway.

Regards alignment of index with a pulse, mine is not perfectly aligned and makes no difference to operation.
My index is a completely separate hall effect switch and the pulse is an optical disc.

regards
Last edit: 14 Apr 2012 13:39 by ArcEye. Reason: typo

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

More
14 Apr 2012 18:22 #19208 by jmelson
Replied by jmelson on topic Re:Spindle encoder issues
Peter_Cassar wrote:

cncbasher, I was experimenting with the position-scale but have since changed it back to 100. The spindle index isn't aligned with a slot or put another way the rising edges are not synchronised. I slotted an aluminum disk and lengthened one of the slots to create the index but since then I drilled it out to make the index signal duration longer. I could always plug it and lengthen another slot to fix that.

I've been rotating the spindle by hand and I can see that the spindle-index goes true but the spindle.index-enable and encoder.0.index-enable always remain false not matter what the phase-z signal is doing. The count and position still increment beyond 100 counts basically heading to infinity. Do you think the slot alignment has something to do with this?

spindle-index-enable only goes true at the beginning of a spindle-synched motion
until the index pulse is seen. At that moment, the encoder count is zeroed, and then
it counts in synch with the spindle until the operation is completed. So, the count will
again count up past 100. This is normal.

Synch between the index and the encoder pulses is not real critical, or at least it
shouldn't be. One possibility is that if the index pulse was shorter than one
base-period it could be missed. But, I think that is pretty unlikely.

I've run a successfull G76 test and verified that the pitch comes out as specified in the parameters. The tool appears to be synched correctly to the spindle if I change speed manually the Z axis speeds up and slows down following the spindle speed. Something is working but I still don't understand why the counts dont reset at 100 pulses of phase-a. It's proving to be something of a mystery at the moment.

It is not supposed to reset in normal operation, only at the beginning of a spindle-synch
move.

G33 is very unpredictable , sometimes it synchs with the spindle, other times it does nothing or races at full velocity.

That is odd. If G76 works, I can't see why G33 would not work.

Jon

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

More
15 Apr 2012 09:57 #19215 by Peter_Cassar
Thanks for the replies. It seems to be running quite well now and I won't worry about the counts reseting. I need to concentrate on G33 now.

Cheers,
Peter.

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

More
20 Apr 2012 11:44 #19395 by Peter_Cassar
Just an update...I have it working , both G76 and G33 perform as expected. I've cut a 5/16x32tpi thread using G76 and I've also managed to make a clock fusee which has a 16tpi thread on a concave radiused profile. So a big thanks for the help.

Peter.

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

More
20 Apr 2012 12:13 #19396 by cncbasher
Replied by cncbasher on topic Re:Spindle encoder issues
great news Peter thanks for the update . glad to hear your cutting perfectly good metal into swarf

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

More
06 Sep 2013 15:47 #38504 by Bad_German
Hi,
I am trying to get my spinlde feedback setup correctrly so that I can make use of closed loop control.
The problem is the spindle-velocity is not constant and jumps arround allot (Screenshot 2).
Does anyone know what I have done wrong or can do to improve the consistency?

I have a 360ppr encoder with index pin, which appear to have minimal interference (Screenshot3).

I am on version 2.5.3,
my lathe config is attached, HAL - standard_pinout.hal.

my spindle position also keeps increasing without resetting every revolution.
I have tried ArcEyes exact code and various other thing with no success.
Attachments:

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

Time to create page: 0.103 seconds
Powered by Kunena Forum