Spindle encoder with one intiator but 4 pulses per revolution

  • fletch
  • fletch's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
02 Apr 2023 19:55 #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?
 

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

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
02 Apr 2023 21:38 #268118 by tommylight
linuxcnc.org/docs/html/man/man9/encoder.9.html
See under PINS
encoder.N.counter-mode
and
encoder.N.x4-mode
The following user(s) said Thank You: fletch

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

  • fletch
  • fletch's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
02 Apr 2023 22:50 - 02 Apr 2023 23:03 #268126 by fletch
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?
Last edit: 02 Apr 2023 23:03 by fletch. Reason: Refined my google-foo by asking the wrong question

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

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
03 Apr 2023 01:16 #268136 by tommylight
In the hal file, there should be a whole section about spindle feedback, there should be encoder-scale
# ---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
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.

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

  • fletch
  • fletch's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
03 Apr 2023 08:57 #268155 by fletch
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)...
The following user(s) said Thank You: tommylight

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

  • fletch
  • fletch's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
20 Apr 2023 16:24 - 20 Apr 2023 16:26 #269491 by fletch
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...
Attachments:
Last edit: 20 Apr 2023 16:26 by fletch. Reason: Randon image resizing strings in the test.

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

More
20 Apr 2023 17:39 - 20 Apr 2023 17:40 #269496 by PCW
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.
Last edit: 20 Apr 2023 17:40 by PCW.
The following user(s) said Thank You: fletch

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

  • fletch
  • fletch's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
20 Apr 2023 18:33 #269498 by fletch
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...
Attachments:

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

  • fletch
  • fletch's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
20 Apr 2023 18:43 - 20 Apr 2023 18:44 #269501 by fletch
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.
Last edit: 20 Apr 2023 18:44 by fletch.

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

Time to create page: 0.083 seconds
Powered by Kunena Forum