- Posts: 140
- Thank you received: 0
Spindle encoder with one intiator but 4 pulses per revolution
3 years 6 months ago #268103
by fletch
This is a follow on from @Sviper's post:
forum.linuxcnc.org/38-general-linuxcnc-q...e-emulate-an-encoder
which I was hoping I could use directly. But on dismantling the sensor on my mill it turns out to be a photo interruptor with four 'windows' per revolution. I suspect this is a fairly common implementation on the import mills.
I haven't yet tried to implement the above post as I'm waiting for the hardware to arrive (I'll be running two photo interrupters - one for the mill's 'vfd' display and new one for the 7i96 to consume so I can compare the numbers) but I'm if I'm reading it correctly, I'll be reporting 4x the rpm.
Is there a way to apply a 'divide by 4' in the hal config?
I haven't yet tried to implement the above post as I'm waiting for the hardware to arrive (I'll be running two photo interrupters - one for the mill's 'vfd' display and new one for the 7i96 to consume so I can compare the numbers) but I'm if I'm reading it correctly, I'll be reporting 4x the rpm.
Is there a way to apply a 'divide by 4' in the hal config?
Please Log in to join the conversation.
- tommylight
-
- Away
- Administrator
-
Less
More
- Posts: 22012
- Thank you received: 4
3 years 6 months ago #268118
by tommylight
Replied by tommylight on topic Spindle encoder with one intiator but 4 pulses per revolution
linuxcnc.org/docs/html/man/man9/encoder.9.html
See under PINS
encoder.N.counter-mode
and
encoder.N.x4-mode
See under PINS
encoder.N.counter-mode
and
encoder.N.x4-mode
Please Log in to join the conversation.
3 years 6 months ago #268126
by fletch
Replied by fletch on topic Spindle encoder with one intiator but 4 pulses per revolution
Thank you Tommy - in the Sviper post, Andy Pugh replies saying to set counter-mode to 1 which according to the docs would mean x4-mode will be ignored.
I think perhaps I may have asked the wrong question - all encoders 'pulse' multiple times per revolution, so the question I should be asking is where do I set the encoder resolution for the spindle?
Edit: Now that I've thought about the question, position-scale seems like a suitable candidate?
I think perhaps I may have asked the wrong question - all encoders 'pulse' multiple times per revolution, so the question I should be asking is where do I set the encoder resolution for the spindle?
Edit: Now that I've thought about the question, position-scale seems like a suitable candidate?
Please Log in to join the conversation.
- tommylight
-
- Away
- Administrator
-
Less
More
- Posts: 22012
- Thank you received: 4
3 years 6 months ago #268136
by tommylight
Replied by tommylight on topic Spindle encoder with one intiator but 4 pulses per revolution
In the hal file, there should be a whole section about spindle feedback, there should be encoder-scale
In this case the encoder scale is set in the ini file and read from there.
This is from an old retrofit, so use with caution.
Code:
# ---Encoder feedback signals/setup---
setp hm2_7i92.0.encoder.05.counter-mode 0
setp hm2_7i92.0.encoder.05.filter 1
setp hm2_7i92.0.encoder.05.index-invert 0
setp hm2_7i92.0.encoder.05.index-mask 0
setp hm2_7i92.0.encoder.05.index-mask-invert 0
setp hm2_7i92.0.encoder.05.scale [SPINDLE_9]ENCODER_SCALE
net spindle-revs <= hm2_7i92.0.encoder.05.position
net spindle-vel-fb-rps <= hm2_7i92.0.encoder.05.velocity
net spindle-index-enable <=> hm2_7i92.0.encoder.05.index-enable
This is from an old retrofit, so use with caution.
Please Log in to join the conversation.
3 years 6 months ago #268155
by fletch
Replied by fletch on topic Spindle encoder with one intiator but 4 pulses per revolution
Aha! Thank you. I think I'd searched my .hal file for 'encoder' before actually assigning 'Spindle' to the 'Quad Enc-A/B/I' inputs - Doh!
I will be able to test as soon as the parts arrive (and I summon my inner Binky to make a custom bracket)...
I will be able to test as soon as the parts arrive (and I summon my inner Binky to make a custom bracket)...
Please Log in to join the conversation.
3 years 6 months ago #269491
by fletch
Replied by fletch on topic Spindle encoder with one intiator but 4 pulses per revolution
You know I can't leave this alone, don't you? So I've started designing a quadrature encoder+index that I can strap to the spindle inside the mill head (where the current single pulse encoder is):
This is currently designed with 128 'windows' which if I understand quadrature correctly and set the two readers x.5 windows apart I should get 512 position 'indications' per revolution - rigid tapping FTW?
I've tested 3D printing up to 250 windows but I'm not sure the opto switches I've ordered (EE-SX1025, 0.5mm window) will read that resolution reliably..
On the Mesa 7i96 card, I have the option of single ended or differential mode - initially for testing I'll use single ended mode as is currently working for four 'windows' non-quadrature, but was wondering about the value of trying to implement differential mode and what that circuit/electronics would look like? Probably not the right place to ask, but everyone on here seems much smarter than me...
Attachment not found
This is currently designed with 128 'windows' which if I understand quadrature correctly and set the two readers x.5 windows apart I should get 512 position 'indications' per revolution - rigid tapping FTW?
I've tested 3D printing up to 250 windows but I'm not sure the opto switches I've ordered (EE-SX1025, 0.5mm window) will read that resolution reliably..
On the Mesa 7i96 card, I have the option of single ended or differential mode - initially for testing I'll use single ended mode as is currently working for four 'windows' non-quadrature, but was wondering about the value of trying to implement differential mode and what that circuit/electronics would look like? Probably not the right place to ask, but everyone on here seems much smarter than me...
Please Log in to join the conversation.
3 years 6 months ago #269496
by PCW
Replied by PCW on topic Spindle encoder with one intiator but 4 pulses per revolution
To convert single ended to differential, you typically use a
differential driver chip like a 26ls31 or equivalent.
You can use lower resolution opto devices by using a Moire mask
(as most high resolution encoders use)
This mask is just a sector of your disk with the same pitch slots
but 2 sections with the slots in the second section having a 1/4
pitch (1/2 slot width) offset from the first section.
These allow large area light source and sensors.
differential driver chip like a 26ls31 or equivalent.
You can use lower resolution opto devices by using a Moire mask
(as most high resolution encoders use)
This mask is just a sector of your disk with the same pitch slots
but 2 sections with the slots in the second section having a 1/4
pitch (1/2 slot width) offset from the first section.
These allow large area light source and sensors.
Please Log in to join the conversation.
3 years 6 months ago #269498
by fletch
Replied by fletch on topic Spindle encoder with one intiator but 4 pulses per revolution
Brilliant! Thank you. The
26LS31
is something I shall have to investigate - a bit above my pay grade, but I'm sure I can learn...
I thought this is what you mean by Moire:
with each opto switch reading a different 'track', but now I'm thinking I've got it wrong because I can't see the difference between what I've drawn and just offsetting the two opto switches by half a slot?
I found this industrytoday.com/encoder-performance/ but they are showing an led+mask+photodiodes - the EE-SX1025 I'll be using already has a 0.5mm 'mask'. I suspect much experimentation is needed - I'm only going to 4,000rpm - the only question is, can I get the resolution good enough for rigid tapping...
I thought this is what you mean by Moire:
Attachment not found
with each opto switch reading a different 'track', but now I'm thinking I've got it wrong because I can't see the difference between what I've drawn and just offsetting the two opto switches by half a slot?
I found this industrytoday.com/encoder-performance/ but they are showing an led+mask+photodiodes - the EE-SX1025 I'll be using already has a 0.5mm 'mask'. I suspect much experimentation is needed - I'm only going to 4,000rpm - the only question is, can I get the resolution good enough for rigid tapping...
Please Log in to join the conversation.
3 years 6 months ago #269501
by fletch
Replied by fletch on topic Spindle encoder with one intiator but 4 pulses per revolution
I think I've got my head around the moire mask now - if I was using a opto receiver & separate light source it would be the right thing but don't think it would make any difference to the
EE-SX1025
's 0.5mm receiving slot.
Please Log in to join the conversation.
Time to create page: 0.195 seconds
