threading pitch wrong, what happened? <encoder counts incorrect>

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

Post Reply
greenail
Posts: 23
Joined: Sun Jun 16, 2019 7:29 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 7804734935a3-0401191837
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

threading pitch wrong, what happened? <encoder counts incorrect>

Post by greenail »

I wanted to share my bone headed mistake that lead to quite a bit of time troubleshooting my thread pitch being wrong. In a nutshell my thread was cutting about 4 times too large a pitch.

I think my first mistake was that i kept getting a "z axis max rate exceeded" error. in my haste to trouble shoot this I futzed with the g76 g-code and made a terrible mistake by assuming the F parameter had something to do with speed. I ran it a bunch of times and got it to work by trial and error. the error turned out to be setting it to 0.5. I was trying to cut a 2mm pitch thread and promply forgot the change i had made to the F parameter. When it finally completed and i put my thread gauge on it it matched 2mm. I though great! now I can do something more complex. I proceeded to make up some cam to turn down 12mm to 8, thread m8 1.25 and cutoff. After much failure and a few crashes i finally got the program to the threading phase but the thread it was cutting was HUGE. I pretty much tried everything but nothing jumped out in the g-code. it took a while but my brain finally considered the encoder might be at fault. Looking at the g-code again and reading the documentation for G76 it turns out the F parameter is the pitch. 0.5 * 4 is 2mm and if it cut a 2mm pitch correctly my encoder wasn't in sync with the controller.

the way to check this is to go into setup mode and look at the absolute position or in the PID section the position. Turning the spindle once should produce close to the counts you have entered in setup.

Turns out my main mistake was to assume the spindle encoder line count parameter was setup for ppr. This is not the case.

The encoder is a quadrature encoder. there are plenty of good tutorials on how they work online. They are actually very easy to make and code for i've done both. One thing to note is there are multiple ways to read a quadrature signal. The most accurate way (4x) accounts for 16 total states which tell the processor the direction and the position. So for example a 10ppr encoder in 1x quadrature mode reads 10 steps or counts. a 2x read mode reads 20 steps. finally a 4x encoder reads 40 steps. Centroid uses 4x counting and so my 2500ppr encoder produces 10000 steps or counts. My thread happened to be 4 times bigger pitch because the processor thought a full turn occurred when only a 1/4 turn happened in reality. Once I set the count parameter correctly the pitch came out correctly!

Hope this helps someone.

Now all I have to figure out is how to tune some backlash out of my crappy lead screws so i actually cut the right diameter....

Feedback for the software folks it might be good to have a ppr field in the spindle setup and do the 4x counts on another line.
Post Reply