Encoder seems to skip or add pulses #114
-
hi Maxim, wondering if you have some troubleshooting suggestions for me with my H2. My lathe has a 4:1 reduction through several gears inside the head stock that causes the change gear output gear to turn 1 turn for every 4 spindle turns. I've solved this by using a 4 times smaller gear on the encoder, so the encoder turns 1:1 with the spindle. The whole system has some back lash of course, because of the gears involved. I have noticed when threading, occasionally the thread will not follow the previous thread. I've investigated with an oscilloscope, and it seems that the encoder pulse width changes a bit, but also I suspect that vibtration may also cause the encoder to count extra steps due to the extra gear backlash involved, but I'm not sure. If I run the spindle very slow, it happens less. The thread tracks perfectly, except when it doesn't. It's then shifted onto tracking the new thread track that it just made. Using the angle display, I see that the revolutions do not always add up to 360, there's some loss there. I've checked the 2k pullup resistors, and the oscilloscope is showing fairly nice square edges on the pulses. I have used a dial indicator to check that there is no loss in the stepper movement, using a simple arduino sketch that just issues steps in one direction, and then back to the start. It's a closed loop stepper too that works well. On the tacho view, I can see the rpm vary by between 4 and 7 at about 600 rpm, but if I hold the encoder input shaft in the lathe chuck, there is no variation at all. That's my clue that there's something funny with maybe extra pulses due to gear train backlash. I also tried belt drive to the encoder, in case vibration was a concern. I may have to make a belt pulley for the spindle, but there is VERY little room. I might do an arbor inside the bore just to test this out. I wonder what happens in the firmware if there are two pulses from one encoder channel before the other encoder channel gets a pulse, would that cause the firmware to think it's reversed a bit of position? I think it would eventually make up for it with double pulses on the other channel though once it hits the other side of the backlash again. I feel like I saw some code that prevented it from reversing unless the spindle had come to a stop, does this affect the position tracking too? I wonder if that anti-reverse should only apply to stepper commands. It's a gear head lathe, so it's definitely possible for an interrupted cut to cause bouncing between gear teeth on a lightly loaded shaft like what is driving the encoder. I've also tried 1000uf capacitor across VIN, along with a 0.1nf ceramic to filter the power better, there was some noise there. That didn't change the behaviour of the encoder pulses at all, didn't even change the shape on the scope. Seems the filtering on the Arduino Nano is good enough. Do you have any suggestions on troubleshooting this? electrically, it seems that all is well. Also I'm using an imperial lathe, so I wouldn't mind if you could double check my math for some of the settings. I'm using a 600 ppr encoder, 1:1 with the spindle through the gear train I have set up. my leadscrew is 7 TPI (0.1428571428571429 inches of tool advance per leadscrew revolution), and I have a 2:1 reduction from my stepper to the leadscrew (the stepper has a 40t gear, the leadscrew has an 80t gear), effectively making it 0.0714285714285714 inches per rev. In metric this would be 1.814285714285714mm, and in deci-microms its 18142.85714285714 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi Chris, your math checks out. I wonder if setting Line 51 in 1f3148e |
Beta Was this translation helpful? Give feedback.
Hi Chris, your math checks out. I wonder if setting
nanoels/h2/h2.ino
Line 51 in 1f3148e