Need Help! PID Servo Tuning with SnapAmp Chicken and Egg Variables


Page 1 of 3 123 LastLast
Results 1 to 20 of 41

Thread: PID Servo Tuning with SnapAmp Chicken and Egg Variables

  1. #1
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    51
    Downloads
    0
    Uploads
    0

    Default PID Servo Tuning with SnapAmp Chicken and Egg Variables

    I have been stumbling through the documentation for the dynomotion products, but have only been able to find disjointed steps to tune DC brushed servos. I have personally lost a lot of time and productivity during this task due to the still evolving documentation for what appears to be very robust hardware.

    Hopefully, this thread will eventually fill in the blanks for a system using the Kflop, SnapAmp, and Kanalog with brushed DC servo motors.

    I found in the wiki pages some of the variables to be set within the kmotion "Step Response Screen" here. However, the starting point appears to be skipped. I could not readily find set points for the PID variables.

    1) What PID variables should be used during the Velocity, Acceleration, and Jerk process?

    2) What is the recommended process of refining the PID's, and at what stage of the tune process should it occur?

    Thank you.

    Similar Threads:


  2. #2
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3250
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Hi MadTooler,

    Sorry you are having so much trouble. But you are right it is a chicken and an egg sort of thing. Servo tuning is complex. There are no fixed set of PID settings. They will all depend on each system. It is an iterative process. Start with some very low gains to have a stable system that is able to make small slow moves. Then increase/adjust gains to make these moves accurately. Then attempt larger faster moves. Increase/adjust gains to make these moves more accurately. Etc...

    It would be helpful if you provided more information. What types of motors/drives do you have? How are they connected? What have you achieved and verified so far?

    Regards

    Regards
    TK http://dynomotion.com


  3. #3
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    51
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Tom,

    Thanks for the reply. BTW, I am that guy that burned up a snapamp last month and had to order the replacement.

    I am trying to merge a few of your sets of instructions that either approach PID first with a set of VAJ's already in place (maybe just sort of known), or the opposite where I do not see mention of the PID values in the beginning and the VAJ values are manipulated.

    My electro/mechanical system is:
    4 Axis Gantry Router

    Power:

    • 70vDC 1500 watt unregulated toroidal power supply
    • 5v/12vDC 70 watt PC style switching power supply
    • 24vDC 150 watt regulated poser supply


    All 4 axis (only working with XYZ for now) with Baldor Brushed DC servo Model# MK-3363-BLBCN
    • Driven by SnapAmp with Diff Encoders also through SnapAmp
    • 180 oz.
    • 4,000 Max RPM
    • Max 120 V
    • Voltage Constant 31.1 V/Krpm
    • 4.76 amps Cont. Current
    • 28.5 amps Current Peak
    • Encoder Line count 1,000 (4,000 quadrature)


    Ball Screws XYZ with .2" pitch

    X,Y,Z limit switches at both ends of travel
    • 24 VDC connected independently to Opto In on Kanalog


    Porter Cable 3.25HP Router
    • IO from SnapAmp driving SSR that then drives Magnetic Contactor


    Auxiliary Air Drill motor
    • IO from SnapAmp driving SSR that then drives Air Solenoid
    • Limit switch to indicate drill cycle has ended and has returned to neutral position
      24 VDC connected to Opto In on Kanalog


    Air/mist coolant
    • IO from SnapAmp driving SSR that then drives Air Solenoid


    Simple Z touch plate (cutter grounds touch plate).
    • 24 VDC connected to Opto In on Kanalog.


    Cabling:

    • Both Motor and Encoder wiring is shielded.
    • Limit switch cables are shielded.

    Tune Settings that should be good:

    • 120,000 Determined max Velocity Value do to mechanical stability


    Old Tune settings from 1993 Centroid controller (these are not stable when used with kflop/snapamp):


    I am currently running back through my system grounding in case I have some bad loops and retesting plots since I have a lot of spiking with my encoder position. Here is a plot without any filters applied:


    Hopefully the data for the plot is attached to this message as well.

    Attached Thumbnails Attached Thumbnails PID Servo Tuning with SnapAmp Chicken and Egg Variables-old_pid-jpg   PID Servo Tuning with SnapAmp Chicken and Egg Variables-y-png   PID Servo Tuning with SnapAmp Chicken and Egg Variables-y_start-png   PID Servo Tuning with SnapAmp Chicken and Egg Variables-y_cresting-png  

    Attached Files Attached Files
    Last edited by MadTooler; 08-04-2016 at 04:37 AM. Reason: typo on V value


  4. #4
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    51
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Is there any reason my PC power supply that I am using for the 5v should have any level of continuity to earth ground (continuity and less than 1 ohm resistance from Earth GND input to DC GND Output)?

    I am running through and double checking for noise, and found my meter is claiming continuity to ground from that supply. I tested a couple of other old PC supplies I have laying around, and they also have continuity from earth ground to the DC ground.

    Is this usable?



  5. #5
    Member Khalid's Avatar
    Join Date
    Apr 2006
    Location
    Pakistan
    Posts
    3487
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Why Too much noise in the signals. Check encoder wiring for electromagnetic interference. Assuming you didn't modify/extend the cable of the encoder

    http://free3dscans.blogspot.com/ http://my-woodcarving.blogspot.com/
    http://my-diysolarwind.blogspot.com/


  6. #6
    Member
    Join Date
    Dec 2012
    Location
    Norway
    Posts
    340
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    What kind of encoder? Mariss from Gecko had an article about a certain popular brand of encoder giving fits to drives and how to improve the signal. Maybe something similar can be done on your machine?



  7. #7
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    51
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Yep, stinkin' noise in the ground.

    This is a retrofit project of a USA made machine from about 1993. I pretty much have replaced all electrical except the shielded cables to the motors and encoders. I made the mistake of not 100% checking and keeping some of the prior ground connections with the assumption that they must of known something about what they were doing... Hard to tell who was the bigger fool. The guys that tied the encoder shield at the motor end to earth ground and tied the motor power shield to earth at both ends, or me for not checking before I said the new wiring was done.

    In any case, I have eliminated the spiked encoder readings. Things are running a bit smoother, so back to tuning.

    Thanks to Khalid and Stigoe for the suggestions.

    I still am unclear the best method in determining the both PID and VAJ when almost none are known. My max V should be 120,000 (I need to go back and make sure my math was correct), but I am having fun trying to simultaneously determine P, I, D, A, and J. When I simply start with A = 2xV, and J = 10xA, the stops are rough and over correcting. I have to pretty much keep my A=V and J is only about 1.5xA. I have also found the Lead/Lag filter and the Low pass 2nd are helping it not have such rough overshooting stops, but the whole thing is very sluggish and starting to growl. Most of my Bode plots with this setup is either reading 50hz or under for cross over, or keeping below the center of scale.

    I will post some more plots tomorrow.

    Thanks again.



  8. #8
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    51
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    I have further removed noise from my system by throwing out the computer style power supply (does connect earth to DC ground), and replacing it with an isolated supply. I am a bit concerned the supply may be a little under rated. It is good for 3amp at 5v. I had a mystery shutdown of Kflop that makes me wonder if I need more juice. Is that enough with Kflop, 1 SnapAmp, Kanalog, 4 encoders, and 8 Solid State Relays (160-320ma)?

    With a lot of work, I have been able to get decent results with short movements and bode plots. I still need to tighten things up and fine tune my C programs. Before I get too carried away, here are some questions.

    I have found the KmotionCNC does a great job of moving my machine for all if I set "Rapids as Feeds" (just need to make my servos a bit more quite). Without, the rapids are based upon my tune which is sluggish and troublesome at stopping after long moves. The big question about servo motor tuning... do all the tuning variables, such as integrator, error, feed forward, acceleration, jerk, iir filters, and some of the others matter if I am going to use the trajectory planner to handle ALL of the moves? If not, what are the needed variables?

    Is the initialization C program for KmotionCNC to be run by the Init button on the gcode control window and be run on thread 1?

    Is it within that same code that any watchdog programs for eStop and adjustsoftlimits should reside?

    I have been trying to get Kmotion 4.34 working on an old XP SP3 machine without luck just yet. Says invalid 32 application. Are the near future releases going to require a newer OS that my time to get this up and current are not worth putting off buying a newer PC?

    Relative to a new control PC, I saw some on GitHub playing with running Kmotion through Linux or web based here. Is there any official support for other platforms, such as Raspberry Pi 3 or better, and linux machines in the near future?

    Thanks again for everyone's support.



  9. #9
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3250
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Hi MadTooler,

    I am a bit concerned the supply may be a little under rated. It is good for 3amp at 5v. I had a mystery shutdown of Kflop that makes me wonder if I need more juice. Is that enough with Kflop, 1 SnapAmp, Kanalog, 4 encoders, and 8 Solid State Relays (160-320ma)?
    I would expect 3A to be enough. Powering the Dynomotion boards should require less than 2Amps. You would need to calculate and sum up all your IO beyond that.

    I have found the KmotionCNC does a great job of moving my machine for all if I set "Rapids as Feeds" (just need to make my servos a bit more quite). Without, the rapids are based upon my tune which is sluggish and troublesome at stopping after long moves. The big question about servo motor tuning... do all the tuning variables, such as integrator, error, feed forward, acceleration, jerk, iir filters, and some of the others matter if I am going to use the trajectory planner to handle ALL of the moves? If not, what are the needed variables?
    It probably doesn't make sense for you to be selecting "Rapids as Feeds". This should only be selected for highly non-linear kinematic systems where straight line rapid paths actually require the motor actuators to perform complex "curved" interpolated motions with varying constraints. It has the disadvantage of performing rapids with infinite Jerk rather than limited Jerk. Which should result in slower and rougher motion not the other way around. It sounds like you don't have your system characterized properly for Jerk Limited Motion and Un-limited Jerk Motion. Please re-read this article:

    Dynomotion

    There are really two different types of parameters: "Servo Tuning Parameters" and "Motion Profile Parameters". The first control how the servo performs to correct errors and follow trajectories accurately. The second are basically used to define the trajectory of motion based on Maximum Jerk, Acceleration, and Velocity. Although there is some disagreement on terminology. For example Mach3 has no servo capability at all and operates completely open loop. It refers to its Motion Profile Parameters as "Motor Tuning".

    KFLOP only has one set of Servo Tuning Parameters that are always active whenever the axis is enabled. But there are multiple modes of motion that can generate different trajectories that may or may not use the Motion Profile Parameters set in KFLOP.

    Is the initialization C program for KmotionCNC to be run by the Init button on the gcode control window and be run on thread 1?
    Normally yes

    Is it within that same code that any watchdog programs for eStop and adjustsoftlimits should reside?
    Normally yes

    I have been trying to get Kmotion 4.34 working on an old XP SP3 machine without luck just yet. Says invalid 32 application. Are the near future releases going to require a newer OS that my time to get this up and current are not worth putting off buying a newer PC?
    There isn't a Version 4.34. Only a Test Version 4.34a. Apparently it is missing some VS2015 Library files which is why it is said to be invalid. We haven't figured out the minimum files needed and how to install them automatically yet. If VS2015 is installed it should run. But that is like a 5GB install and I'm not sure if it is supported on XP. If you have time please try loading the VS2015 re-distributable to see if it resolves the problem:

    https://www.microsoft.com/en-ca/down....aspx?id=48145

    Relative to a new control PC, I saw some on GitHub playing with running Kmotion through Linux or web based here. Is there any official support for other platforms, such as Raspberry Pi 3 or better, and linux machines in the near future?
    This is great work contributed by several KFLOP Users. It should allow the KMotion Libraries to run under Raspberry Pi3. We encourage and support it where possible.

    HTH
    Regards

    Regards
    TK http://dynomotion.com


  10. #10
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    51
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Tom,

    I was able to run a couple of old jobs, but it was sketchy.

    I still had to keep the rapids as feeds, otherwise it varies from sluggish to violently fast leading to instant fault. I know I need better tunings, which is why I started this thread, but at least it is mostly running for the moment with the feed setting. My concentration is more on other functionality while I also try to catch up on backlogged production. I will re-tune as soon as I can shut down for a break again.

    I am still running Kmotion 4.33.

    My biggest and most serious issue at this time is a very problematic feed hold or gcode pause syndrome. Whenever I use the feed hold or pause, either at the time of, or more commonly some fairly random period later, I get either a generic gcode error and abort message or an end of arc error. In either case, I have to abort the program, backup to the nearest start of a subprogram (most of my gcode has the individual toolpaths noted), then start from there without issue. It then does not give an error or find an end of arc error unless I use the feed hold or pause again.

    The end of arc error was earlier very troublesome with any helix, or higher accuracy paths, so I have had to post my helix as lines and reduce my precision. This seems to be related to an old known issue in EMC. Do you have any guidelines or fixes in the works for this? Yes, I realize this is probably way too vague to answer without my machine and system information, just checking for any known good practices or issues.

    One additional hiccup I noticed when starting from mid program, the dialog box comes up and asks about the previous settings, such as feed and spindle, that where found earlier in the program and if I would like to execute them. When I do this, and it asks about starting the spindle, the spindle does not start. Is this something I need to add in, or is it not properly following the settings for the M3 command?

    Regarding the loaded gcode...
    How to unload them?
    I didn't think it would matter, but then I discovered that changes in the loaded code saves immediately to the file. I discovered that when I tried deleting the code from the window to see if it would unload.
    My initial setup intent was to have my control PC networked to my CAD/CAM workstation. I started with loading the gcode over the network. With it autosaving, I realized I may not want to do that, then I was really convinced it was a bad idea when I had a network hiccup and the gcode was aborted. Even though the file was loaded and running, when the wifi blipped, the job was aborted. My procedure now is not affected since I will only run the files local, but thought I would mention the behavior since it seemed surprising and in case it was useful feedback.

    An observations that may be in the documentation somewhere already... when running within Win XP, 100% of all power saving and screen saving must be turned off. I had everything disabled, except to let the monitor power off after 20 minutes. When it turned off, that led to the gcode being aborted. It isn't surprising there was a problem since my experience is no version of windows ever has yet to handle power and standby functions flawlessly. Yes, I am very well aware the system should never be allowed to go into a power saving or standby mode during operation of Kmotion. Maybe Kmotion can force those features to be disabled?

    In spite of the growing pains, I am enjoying the Dynomotion product line and very much appreciate your guidance.



  11. #11
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3250
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Hi MadTooler,

    I wasn't able to duplicate your first two issues. Maybe you could provide all your settings, your GCode, and an exact sequence that shows a problem.

    Regarding "unloading GCode Files": Whenever you make changes to a file the changes are not saved immediately but rather automatically saved as soon as you run the Job or select a different file. We feel always having to push "Save" or displaying a message "Are you sure you would like to save the changes" would be a nuisance. Possible ways to avoid changing a file inadvertently would be to immediately save it to a new name or make your files read only. To "unload" a file you can push the "New" button to create an empty file with a default name.

    Regards

    Regards
    TK http://dynomotion.com


  12. #12
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    51
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Tom,

    I think I may now get a chance to start re-tuning my drive system. After a bit of use, I have been running into issues with cut quality that I can no longer get by with as is. I hope to be diving into this more accurately now and better document my issues.

    For now, I will mention the major issue that is pushing me to resolve my tune is an inconsistent consistency where I find repeatable scalloping in cut path where only one axis is moving, yet at somewhat random points about the full range of motion (yes that is a totally confusing description). While there is plenty of mechanical issues I have to point fingers at here as well, it has become clear this is also some kind of control issue, almost definitely my hacked tunes. I will be taking some pictures and trying to fully document the system configuration and gcode so a correction can be found.

    Best Regards,

    Jason



  13. #13
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    51
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Resurrecting this thread to update my status and trying to fix my biggest problem.

    To update, I have retuned, mostly, and found my simple math needed work in determining my max velocity and accel. It was way oversized and now corrected KmotionCNC is able to rapid properly without rapids as feeds.

    While retuning, I have noticed a new noise issue causing significant spikes in the encoder position noted in the plots, but not always and not consistent beyond most of them most of the time occurring at the end of the move test cycle. Where distinguishable, the spikes range from 40-120 encoder steps (my encoders are all 1k with quadrature for a total of 4k per rev). These are new and did not appear at all after I had gone through the grounding issues noted prior. However, I do now find there is very significant noise being generated by the snapamp at it's 30khz switching. When my servo power is off and the drives disabled, the multiple isolated power supplies are all quite and smooth on the scope. As soon as the power is on and the drive active, huge spikes every 30us. On the 5v for Kflop, the spikes are around 2.5v (I need to recheck since I forgot if it was 2 or 3v spike). The wave form is similar to what was noted in the older thread: Newbie SnapAmp encoder connections (single-ended) - Page 2

    Even with the noise, I am able to run gcode. The results are not always good. Although, the results are the same as from before the new noise issue. The major cut issue is scalloping randomly yet very consistent. Randomly as in I can run the same gcode in the same spot with different results of where the scalloping occurs. The images are of 4 discs cut with a patterned gcode along the X axis with my prior tuning. With my new tunes, I found similar results while repeating in the same spot.PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223438049-jpgPID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223441133-jpgPID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223443533-jpgPID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223447250-jpgPID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223449250-jpgPID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223453427-jpgPID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223457499-jpg
    I tried to keep the HDPE discs in the same x/y orientation to each other to note how the deep scalloping (some as significant as 0.025") start and stop inconsistently regarding the portion of the gcode and z elevation. When it does scallop, as you can see, it does it with a very consistent repeating pattern. The gcode should be attached here as well.

    I do need to go back over the IIR filtering and rerun the bode plot after having adjusted my V,A,J, and PID (not using any D with the IIR seeming to do a better job so far). Any hope that my filters could be culprit here?

    Thanks for any replies.

    Attached Thumbnails Attached Thumbnails PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223438049-jpg   PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223441133-jpg   PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223443533-jpg   PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223447250-jpg  

    PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223449250-jpg   PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223453427-jpg   PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223457499-jpg  
    Attached Files Attached Files


  14. #14
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3250
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Hi Jason,

    However, I do now find there is very significant noise being generated by the snapamp at it's 30khz switching. When my servo power is off and the drives disabled, the multiple isolated power supplies are all quite and smooth on the scope. As soon as the power is on and the drive active, huge spikes every 30us. On the 5v for Kflop, the spikes are around 2.5v (I need to recheck since I forgot if it was 2 or 3v spike). The wave form is similar to what was noted in the older thread: Newbie SnapAmp encoder connections (single-ended) - Page 2
    Yes switching 80V at 30KHz causes much noise. I suspect (hopefully) the 2~3V spikes on 5V are not real. Maybe just being picked up by your scope leads.


    Even with the noise, I am able to run gcode. The results are not always good. Although, the results are the same as from before the new noise issue. The major cut issue is scalloping randomly yet very consistent. Randomly as in I can run the same gcode in the same spot with different results of where the scalloping occurs.
    Because the errors occur at random positions I would expect the problem to be tuning and not GCode or Trajectory planning issues. Probably one or more axes marginally stable and breaking into oscillation. If you post some Step Response Plots we might be able to help. Please include your initialization C Program and Trajectory Planner settings as well. It is also possible to capture data while running GCode and cutting using the program CaptureXYZMotionToFile.c. But usually Tuning problems can be resolved just by using the Step Response Screen.

    Regards
    TK http://dynomotion.com


  15. #15
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    51
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Tom,

    Regarding the spikes, they were reading 2.5v from numerous points, although, I stayed away from probing the boards in case I slipped and hit the wrong area. I tried probing from a 4" lead of solid copper from a 5v terminal block, and the results at first were the same. After running tuning for a little while, I checked again and the spikes were down to 1v. The tuning was just a coincidence. I was able to change the position of the probe and found the spikes were actually down at 1v or maybe less. Still a lot, but not necessarily as bad as it first appeared.

    I removed all IIR filtering and the axes were unstable during move tests in step response. I am completely starting from scratch on the tunes, again, to see if I can get this right.

    I will update the files and plots after I get some level of success.

    A few questions as I get the retune:

    I have looked and could not find the application notes. With a dc brushed servo system using the snapamp, is there a use for the "step" testing in the step response? If so, what follow error and plot form is ideal?

    My servos are much stronger and have much more overhead speed available than I am able to make use of with my gantry router due to whip in the ballscrews at higher RPM. They also have 1k cpr differential encoders providing 4k cpr in quadrature. With my 0.2" lead on my ballscrews and 1:1 servo to screw belting, I have 20,000 counts per inch. It is a gantry router with some less than ideal mechanical issues, but I do expect to be able to achieve fair accuracy. While making steps of 50,000 to achieve full speed of 80,000v (= 240ipm), how much of a following error in the "move" tests should I be considering as good?

    I have read a lot of your notes regarding various IIR options vs. feed forward vs. D settings and would like a bit of direction. I know there are a lot of variances between systems to drive the solution, but do you have a default order of which to use first and/or which to ideally use as a final tune configuration?

    For the Bode plot, what magnitude and frequency should I measure?

    Notes regarding large encoder spike noise...

    The very large random encoder noise has only been seen on ch1 and ch2 but not ch0. All three axes use differential encoders through snapamp.

    I saw another thread where someone was having similar snapamp noise and you had suggested connecting motor power cable shields tied to protective earth. Mine are tied to the DC motor supply - at my contactor, not at the snapamp. I tried connecting directly to protective ground, just my grounded enclosure, and the noise went crazy. Maybe it would be cleaner if I connected it to PE far away from the machine, but I doubt it because of the very noisy power at my facility. I think you may have also mentioned caps or resistors across some of the encoder lines and connecting them to a clean snapamp dc-. I am already directly connected to the header on the snapamp. Not sure about adding the other parts right now.

    The kflop home and limit digital io's are flashing under the digital io panel in kmotion. I need to double check if those are being used by snapamp for communication, otherwise I think they are unused and floating. Is that any kind of indicator?

    Thanks again.

    Last edited by MadTooler; 08-27-2019 at 06:23 PM.


  16. #16
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3250
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Hi MadTooler,

    I have looked and could not find the application notes. With a dc brushed servo system using the snapamp, is there a use for the "step" testing in the step response? If so, what follow error and plot form is ideal?
    I don't recommend using the "Step" button on the Step Response Screen. If an instant step is applied of any significant size it will likely result in a violent response saturating the output and not being useful. Large errors should not occur in normal operation where proper trajectories are followed. Better to use the "Move" button.


    but I do expect to be able to achieve fair accuracy.
    How accurate and under what conditions?


    While making steps of 50,000 to achieve full speed of 80,000v (= 240ipm), how much of a following error in the "move" tests should I be considering as good?
    I assume you mean "Moves" not "Steps" as a step of 50,000 would instantly generate an error of 50,000 counts.

    Every system is different but with routers maybe 0.01 inch at cutting speeds and 0.1 inch during rapids might be ok for you. Mechanical errors are likely to greater than 0.01 inches. During rapids you probably don't care what the errors are as long as it is keeping up with the trajectory.


    I have read a lot of your notes regarding various IIR options vs. feed forward vs. D settings and would like a bit of direction. I know there are a lot of variances between systems to drive the solution, but do you have a default order of which to use first and/or which to ideally use as a final tune configuration?
    D gain is somewhat simpler so I'd suggest that first. If it gives adequate results then keep it.


    I saw another thread where someone was having similar snapamp noise and you had suggested connecting motor power cable shields tied to protective earth. Mine are tied to the DC motor supply - at my contactor, not at the snapamp. I tried connecting directly to protective ground, just my grounded enclosure, and the noise went crazy. Maybe it would be cleaner if I connected it to PE far away from the machine
    Grounding is complicated. Its hard to say. Motor power is noisy so I think the idea might be to dump it away from other things.


    The kflop home and limit digital io's are flashing under the digital io panel in kmotion. I need to double check if those are being used by snapamp for communication, otherwise I think they are unused and floating. Is that any kind of indicator?
    Not sure what IO you are referring to but if they are floating then toggling could be expected.

    Regards
    TK http://dynomotion.com


  17. #17
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    51
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Quote Originally Posted by TomKerekes View Post
    Hi MadTooler,

    I don't recommend using the "Step" button on the Step Response Screen. If an instant step is applied of any significant size it will likely result in a violent response saturating the output and not being useful. Large errors should not occur in normal operation where proper trajectories are followed. Better to use the "Move" button.


    How accurate and under what conditions?


    I assume you mean "Moves" not "Steps" as a step of 50,000 would instantly generate an error of 50,000 counts.

    Every system is different but with routers maybe 0.01 inch at cutting speeds and 0.1 inch during rapids might be ok for you. Mechanical errors are likely to greater than 0.01 inches. During rapids you probably don't care what the errors are as long as it is keeping up with the trajectory.
    Yes, moves, I was referring to the size of the move as a step, sorry. I have been using "move" but unclear when "step" should be used vs "move" (I could not determine that from documentation or what the plot should look like ideally)?

    My expected tolerance of a gantry router would be +/- 0.003" for position repeatable for a sloppy system. I would think 0.01 at cut would be extreme, although, with the types of diy routers a lot of users tinker with, that is probably a dream to be that accurate. All that aside, I can fairly easily keep the follow error under 20 encoder units (0.001") with a move of 50,000 and infinite jerk, but was hoping to be under 6. I am just not sure if I am expecting too much or too little of the system.


    After trying to compare my red line output on my bode plot to those in the manual with confusion, I realized the current software changed colors of the lines. I felt a bit stupid for not noticing that for 10 minutes, but it was a relief that my output wasn't as bad as I thought.
    For the Bode plot, what magnitude and frequency should I measure?






  18. #18
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3250
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Hi MadTooler,

    My expected tolerance of a gantry router would be +/- 0.003" for position repeatable for a sloppy system. I would think 0.01 at cut would be extreme, although, with the types of diy routers a lot of users tinker with, that is probably a dream to be that accurate. All that aside, I can fairly easily keep the follow error under 20 encoder units (0.001") with a move of 50,000 and infinite jerk, but was hoping to be under 6. I am just not sure if I am expecting too much or too little of the system.
    Seems pretty accurate for a large router. You might put a dial indicator clamped to the table and measuring to the spindle. Then apply like 1 lb of force to the Spindle and measure how much it deflects. I'd be surprised if you don't get a few thousands of an inch deflection.



    For the Bode plot, what magnitude and frequency should I measure?
    Any low frequency (ie 1Hz) can be used as the idea is to lower energy of the high frequencies. Then increase amplitude until you get significant movement. You might read this.

    Regards
    TK http://dynomotion.com


  19. #19
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    446
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Quote Originally Posted by MadTooler View Post
    Resurrecting this thread to update my status and trying to fix my biggest problem.

    To update, I have retuned, mostly, and found my simple math needed work in determining my max velocity and accel. It was way oversized and now corrected KmotionCNC is able to rapid properly without rapids as feeds.

    While retuning, I have noticed a new noise issue causing significant spikes in the encoder position noted in the plots, but not always and not consistent beyond most of them most of the time occurring at the end of the move test cycle. Where distinguishable, the spikes range from 40-120 encoder steps (my encoders are all 1k with quadrature for a total of 4k per rev). These are new and did not appear at all after I had gone through the grounding issues noted prior. However, I do now find there is very significant noise being generated by the snapamp at it's 30khz switching. When my servo power is off and the drives disabled, the multiple isolated power supplies are all quite and smooth on the scope. As soon as the power is on and the drive active, huge spikes every 30us. On the 5v for Kflop, the spikes are around 2.5v (I need to recheck since I forgot if it was 2 or 3v spike). The wave form is similar to what was noted in the older thread: Newbie SnapAmp encoder connections (single-ended) - Page 2

    Even with the noise, I am able to run gcode. The results are not always good. Although, the results are the same as from before the new noise issue. The major cut issue is scalloping randomly yet very consistent. Randomly as in I can run the same gcode in the same spot with different results of where the scalloping occurs. The images are of 4 discs cut with a patterned gcode along the X axis with my prior tuning. With my new tunes, I found similar results while repeating in the same spot.
    I tried to keep the HDPE discs in the same x/y orientation to each other to note how the deep scalloping (some as significant as 0.025") start and stop inconsistently regarding the portion of the gcode and z elevation. When it does scallop, as you can see, it does it with a very consistent repeating pattern. The gcode should be attached here as well.

    I do need to go back over the IIR filtering and rerun the bode plot after having adjusted my V,A,J, and PID (not using any D with the IIR seeming to do a better job so far). Any hope that my filters could be culprit here?

    Thanks for any replies.
    The vibration inside the bottom of the pocket in the second picture might suggest you may have some vibrations in the machine as well. Is this a DIY machine? Any pictures of it? Could there be some part of the machine flexing/vibrating that could maybe throw poorly tuned servos into oscillation? I still think tuning is most your problem, just saying may not hurt to check everything else.

    Try adding a pole zero filter at 45 and 180 degrees and no D gain. I dont know the theory behind it, but my machine came with these settings and they work great. I added a 4th axis and tried traditional tuning methods without getting wonderful results so tried the same pole zero filter and it worked great first try, way better results then i could get any other way. I mentioned this to another user in the same situation and it worked great for him as well.

    I sort of see this type pattern on my machine on a much smaller scale. If you really look closely at shiny aluminum parts, you can kinda see a pattern like this on some interpolated moves. Always wondered if it was from tuning, vibration from my spindle, or my Y axis thrust bearing that should probably be replaced.



  20. #20
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    51
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    I retuned from scratch and have somewhat better results. I am near the +/- 6 encoder units follow error in the step response move testing at my max velocity and infinite jerk.

    Bode plots are maybe ok, not sure. Average 75hz and 35 deg results, but that is unknown if accurately applied. I can achieve over 45 degrees with some input values and down to mid 20's with others. I definitely need some guidance on the bode plotting to use it effectively. After re-reading the dynomotion documents, I am still left with ambiguously useful values for amplitude and frequency. Being able to run with stable results from "any frequency" is a bit infinite for me. Other than using as large of an amplitude as I can to achieve measurable results, I am not sure what is applicable. As far as frequency, what range is determined relevant?

    I ran a few parts and the machine did some better than before, but not good enough. About half the cut looked very awesome, then chattered in the rest but not as bad as before. The good news is the oscillation has become more predictable and other performances of the machine have improved. Now, when jogging with an analog joystick, I can see a resonating shutter at some speeds fairly constant. That appears mostly on my X, with a little on the Y. It also appears different in the + vs - directions. While this does more clearly appear a tune issue, it seems to be triggered by machine stiction and other resonance. My plan is to use the step response move test with various velocities and a travel that will go longer than 3.5 seconds, but will allow more capture of the trouble frequencies/speeds. From there I hope to be able to try other tune and filters to find a more effective solution. That seems like it might take some time with a modest chance of finding a one size fits all solutions.

    mmurray70,

    The vibration inside the bottom of the pocket in the second picture might suggest you may have some vibrations in the machine as well. Is this a DIY machine? Any pictures of it? Could there be some part of the machine flexing/vibrating that could maybe throw poorly tuned servos into oscillation? I still think tuning is most your problem, just saying may not hurt to check everything else.
    The noticeable chatter in the bottom of the pocket is mostly oscillation in the tune that very likely is barely stable then triggered by mechanics. The cutter used has a super fine and sharp point which also does not bottom well and showcases cut oscillation (that's why I used it). The machine is a 4'x4' gantry router that is not DIY, but the yahoos that made it back in the mid 90's flip flopped a lot on what they did well vs stupid bad. I can't post a picture of it right now with too many items around it that I can't exactly publicly post. The linear rails are round with plain bearings/bushings. I just replaced the bearings with some igus drylins that are much tighter toleranced and smoother, but the nature of this system and the wacked mount orientations used will keep a higher than desired amount of stiction and slop no matter what I do. There also were significant bloopers with the ballscrews that I have improved significantly, but cannot totally correct without full carriage rebuild. All that said, it can and has performed better than it was when I started this thread, so I know if I keep trying I can eventually get things running better via tuning.

    Try adding a pole zero filter at 45 and 180 degrees and no D gain. I dont know the theory behind it, but my machine came with these settings and they work great. I added a 4th axis and tried traditional tuning methods without getting wonderful results so tried the same pole zero filter and it worked great first try, way better results then i could get any other way. I mentioned this to another user in the same situation and it worked great for him as well.
    I had a pole zero and 0 D gain with my prior tunes. I currently am using a pole zero in my filter 0 and a low pass in the last filter. They really did help smooth out my output along with make the bode plots happier. I am positive I can further refine those to make it better. I also have a larger P, I, and D gain than I have ever run before. While it is performing better, I bet some of those values are unnecessarily correcting each other to keep things from over saturating.

    I know I need to post some plots and files so you all can review what I am doing wrong. I need to rush into some backlogged work first. I think I also need to better understand appropriate bode plotting and test a few slower velocities and make some tweaks to be able post relevant info.

    Thanks again for all the help.



Page 1 of 3 123 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

PID Servo Tuning with SnapAmp Chicken and Egg Variables

PID Servo Tuning with SnapAmp Chicken and Egg Variables

PID Servo Tuning with SnapAmp Chicken and Egg Variables