When I looked at how to encode the spindle on my new to me 70 yo Sheldon, my eyes kept coming back to the front bull gear thats locked to the spindle, Nothing else inside the headstock was locked to the spindle. So I silicone glued a 6-32 steel screw so it was aligned with a tooth of the gear effectively giving me one wide tooth I could used for an index. This was on the back edge of the gear.
Then I made from 1/2 fairly hard alu plate, a bracket I could mount with a 5mm bolt, that had an inside curve wrapped around about 40 degrees of this gear. And filed the back where it was pulled to the casting so when the bolt was tight, it cleared the teeth by 10 thou or so. Then I made 3 slots in the inside of the curve just deep enough to hide 3 ats-667 hall effect detectors in those slots. I reversed one of them so it detected the added screw rather than the teeth. Then found my math for spacing was bad and had to widen the slots until I was getting a 90 degree quadrature A/B signal, and glued everything into place with a heavily gelled superglue.
That was 2 years ago and it hasn't missed a count since. On my Sheldon thats a 60 tooth bull gear, so linuxcnc gets a new report that includes both direction and speed every 1.5 degrees. Everytime one of those hall detectors changes state
My .hal file does not do spindle speed feedback as I've put a 3 phase motor on a vfd in it so speed is pretty steady. but my "at speed" comparator is set to only go true when the speed is within 10% of requested. I normally set the right end of a G76 around 3 turns off the end of the bar, and generally it just works.
For G33.1 rigid tapping, since the hole is usually blind and the tap could hit the bottom of the hole and break it, I've some hal code that measures the distance and the spindle turns in the fwd direction after the reverse at the bottom of the hole has been issued, A definite problem when the chuck weighs 40 some lbs. The vfd is making the belts yelp while its doing the turnaround. So I make an air cut and note the overshoot and subtract that from the depth of the G33.1 move. Haven't broken a tap since.
I just don't trust something that works by position when there are pulleys and or belts involved. Get rid of them and make your own if possible. So thats what I did.