Tuning stepper motors with encoder or glass scale feedback

More
23 May 2024 00:10 #301170 by tommylight
-THIS IS NOT FOR CLOSED LOOP stepper systems with encoder wired to their drive.

-This howto will detail tuning the PID for a stepper system with normal steppers and stepper drives, and added encoders or glass scales that feed back to LinuxCNC, be it through parallel port or Mesa hardware.
-This howto implies creating a config using the PncConf wizard.
CAUTION:
Encoder scale and step scale in hal are not the same thing!!!
DO NOT close the text editor while editing files, you can always go back with CTRL+Z in case something does not work.
DO NOT copy lines from here and into your config files, these are examples.
-
1. Make sure the machine is set up and working correctly with no feedback to LinuxCNC:
1.1. the step scaling is correct in the ini file
1.2. the P value must be 1000 in the ini file
1.3. the FF1 value must be 1 in the ini file
1.4. position feedback in hal must be tied to stepgen-fb in the hal file (net x-pos-fb <= [HMOT](CARD0).stepgen.00.position-fb)
1.5. encoder feedback must be omitted in the hal file (both lines #net x-pos-fb <= [HMOT](CARD0).encoder.00.position and #net x-vel-fb <= [HMOT](CARD0).encoder.00.velocity)
1.6. save both files, start the config, do some test runs, if all seems fine, move on
-
2. Set these parameters in hal and ini files
2.1. omit the stepgen feedback in hal (example: #net x-pos-fb <= [HMOT](CARD0).stepgen.00.position-fb)
2.2. remove # from both encoder feedback lines (net x-pos-fb <= [HMOT](CARD0).encoder.00.position and
net x-vel-fb <= [HMOT](CARD0).encoder.00.velocity)
2.3. set the P value to 50
2.4. set the FF1 value to encoder_scale/step_scale= (example for encoder scale 500 and step scale 1500 is 500/1500=0.333 , so FF1=0.333)
2.5. save both files and start the config, DO NOT enable the machine, DO NOT press F1 or F2
2.6. move the motor by hand or by pushing while watching the DRO on screen
2.7. check if moving the machine in positive direction also changes the DRO value up, and vice-versa (if reversed, add - in front of encoder scale in the ini file)
2.8. Make sure that moving 10CM also shows in DRO as 10CM, or 10 inch are 10 inch on DRO
2.9. If all checks are OK, enable the machine and try jogging it, if it starts shaking/vibrating disable the machine and change the P value to something smaller, try 10. If it seems OK raise the jog speed gradually and jog, repeat till it reaches maximum velocity/speed.
-
Enjoy watching the machine zip away ! :)
The following user(s) said Thank You: Clive S, besriworld, cornholio

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

More
11 Jun 2024 04:01 #302791 by jtrantow
I'd add a step to move the axis over the travel range and compare the stepgen distance to that reported by the encoder. This can catch encoder misalignment.

Next run a collection gcode script and plot stepgen vs encoder (both directions). This can confirm your encoder alignment and measure backlash over the travel range. If you see weird things in the plots figure them out (before enabling encoder feedback which can complicate funding problems) weird things can include periodic wiggles from bent or misaligned shafts, different slopes from the encoder both parallel to motion, excessive backlash from loose bearings, etc

Encoders can be great especially for faulting before scrapping a part, but they should be carefully verified.
The following user(s) said Thank You: tommylight

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

Time to create page: 0.106 seconds
Powered by Kunena Forum