IDEAS PID Tuning

Discussion in 'Guides, Mods, and Upgrades' started by Spoon Unit, Mar 11, 2016.

  1. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    Once you finally get OctoPi connected, you can finally submit GCODE and get the results. There seems no easy way to do that from the front screen alone.

    So, once you're in this position you can tune your PID - http://reprap.org/wiki/PID_Tuning

    The default values supplied in e3d's Marlin firmware are:

    // E3D v6 (PT100, 30W)
    #define DEFAULT_Kp 29.20
    #define DEFAULT_Ki 04.73
    #define DEFAULT_Kd 45.33

    Running the PID Tuning GCODE yielded

    Recv: PID Autotune finished! Put the last Kp, Ki and Kd constants from below into Configuration.h
    Recv: #define DEFAULT_Kp 22.96
    Recv: #define DEFAULT_Ki 1.60
    Recv: #define DEFAULT_Kd 82.38

    So that looks massively different from the supplied numbers. I suspect this explains a lot about the failed initial Benchys, which failed as the fan got to 70% and suddenly resulted in a massive drop in temperature that the system was not tuned to cope with. I think I'll put these numbers in, then try one more the original Benchy, even though I think that just ramps up to 100% on layer 10. It'll be interesting to see just how noisy that is, but I have a feeling it's gonna fail. So let's see.
     
  2. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    Looks like you can put these numbers into your start GCODE in S3D, which might be interesting. Can probably do that with the tool change script as well in case the two are behaving differently.

    So with the numbers above, I the fed them in via OctoPrint

    M301 P22.96 I1.60 D83.38

    I then used Control > Temp > Nozzle 1 > 210 from the display to set a target and watched it heat up. Looks like the numbers made a difference too, as the number got to, and then hovered a little at 207 before climbing to and sitting on 210. It fluctuate only one up (211) and down (209) so, happy with that I cooled it back down and tested The second PID.
     
    #2 Spoon Unit, Mar 11, 2016
    Last edited: Mar 11, 2016
  3. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    Mistakenly thought I could tune the second nozzle with

    T1
    M303 E1 S200 C8

    Ended up accidentally re running E0 pid tuning and got a second set of results

    Recv: #define DEFAULT_Kp 21.80
    Recv: #define DEFAULT_Ki 1.46
    Recv: #define DEFAULT_Kd 81.43

    They look much closer. Not entirely sure whether to stick with what I have or change to these. Thinking a little also about whether to put these in firmware or in starting GCODE and have decided on starting GCODE as I have a feeling these values will change when I test the volcano and its heat block, and I don't fancy flashing firmware for every nozzle/heater combo change when it can be managed from an S3D profile.
     
  4. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    Now testing bed PID then. This is the default settings in the supplied firmware

    //E3D BigBox Variable Power Density Heated Bed (24V)
    #define DEFAULT_bedKp 336
    #define DEFAULT_bedKi 61
    #define DEFAULT_bedKd 462.4

    M303 E-1 S60 C8 yields

    Recv: PID Autotune finished! Put the last Kp, Ki and Kd constants from below into Configuration.h
    Recv: #define DEFAULT_bedKp 204.84
    Recv: #define DEFAULT_bedKi 38.59
    Recv: #define DEFAULT_bedKd 271.82

    Again, very different numbers. Would be interested in someone's input on this. Are the differences mostly related to environment?

    Will push these numbers into my S3D profile using

    M304 P204.84 I38.59 D271.82

    Initially just fed into the console and testes with another manual test via the dial. Test looks great. Temp it 70 and sticks there. Occasional drop to 69 almost instantly flicks back to 70.
     
  5. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    With extruder and bed tuned, time to try the crazy e3d slice once more ...

    Yet another moment of terror as the e3d slice contains no g28 (home) and I have to go for the kill switch. It makes me curious what other do when setting up a print. Do you just AutoHome, then print? Print from the dump bucket?

    If you auto home/print then you end with this little mound of plastic swelling on the nozzle tip. Is that the way to go? It feels to me more like you should have the nozzle over the dump bucket when heating. Thoughts on this matter gratefully received.

    And it looks like that manic motion caused by an attempted dock FROM THE DOCK has seemingly killed bed alignment. Let's try that all again.
     
    #5 Spoon Unit, Mar 11, 2016
    Last edited: Mar 11, 2016
  6. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    Too scary to print the supplied e3d slice, so going with a test piece http://www.thingiverse.com/thing:1019228
    PID tuning embedded in the slice.
    Slice submitted via OctoPi
    Cooking with Gas !

    OK. So I thought this was interesting. As the print progressed, I was tooling around in Octoprint. One thing you see is a temperature graph, and you can clearly see where I submit the print job and the PID tuning goes on. All of a sudden the temperature is MUCH better controlled. Not much change to the bed variability though. Even with those numbers so out of whack, it seems the bed is pretty stable.

    [​IMG]
     
    #6 Spoon Unit, Mar 11, 2016
    Last edited: Mar 11, 2016
    Miasmictruth and albert stouder like this.
  7. R Design

    R Design Well-Known Member

    Joined:
    Oct 7, 2015
    Messages:
    918
    Likes Received:
    183
    Very thorough.

    Good work.
     
  8. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    One further point here for those with a Dual. Each hot end might require different PID tuning. Tune each PID with

    M303 E0 S230 C8

    and

    M303 E1 S230 C8

    Feed your results into the tool change script just below the extruder step control (as it's easy to duplicate that one:

    ;PID tuning per hotend
    {IF NEWTOOL=0}M301 P22.96 I1.60 D83.38
    {IF NEWTOOL=1}M301 P43.47 I6.5 D72.64

    As you can see, the numbers for mine are quite different. I'm not sure if a thermal runaway on a non-printing tool counts as a reason to stop the print though.
     
    Miasmictruth likes this.
  9. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,405
    Likes Received:
    731
    Do you have any experience if it matters where you place your hotend and running fans while doing the autotune sequence?
    Maybe placing the hotend in the middle of the build plate and let the fans run at 50% or so has an influence on the values for the PID.
    This might result in better PID values for an actual print situation especially when starting a print on the first 10-20 layers or so where the fans run low but the ventilated air has not so much possibility to flow away but surrounds the hotends cooling them down more than if you are on higher layers...
     
  10. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    Good thought. I ran tuning from dump bucket. Truth is, the overall system changes with every layer. The further you move from the bed, the less reflected wind you have to contend with. So much food for thought in 3d printing!
     
  11. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,405
    Likes Received:
    731
    I did the same :)

    Would be interesting to run the autotune in various situations and see how the values may change... I think the most problems might occur when the bed is real close or you have a huge flat surface of a part the printhead passes and the fans are running. I assume in those situations the heat control has to work the most...
     
  12. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,405
    Likes Received:
    731
    Ok this failed :)
    I moved the head to X150 and Y100, switched the fans to 100% and tried the PID autotune. Z was at 4.
    The PID autotune has a timeout, 10 minutes it seems.
    I wasn't able to heat up to the set 230° C within that time span and I think it will never reach the temp because it went up to 211° C and never over it the last 3 minutes...

    Problem is that you can't send commands during the autotune so you have to start the fans before starting it. So it is no option just to heat up and the start the fans...

    Will have to try with lower speeds... Think I will do 50% on the next try...
     
  13. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    You can get to temp with tuned PID and 100% fan. That said, for me the fan is never actually on for layer 1 and I wouldn't get to 100% before layer 20 I think. So far, all my cooling plans stick at 80%. Even then, you've got a part in the way. Quite hard to model anything "real" because every model has different geometry, affecting the cooling system.

    Since I tuned hotend 1, I am able to go for a plan which reaches 80% by starting the fan at 30% on layer 3, so I guess at that point the nozzle is about 1mm above the bed. That might be a good test, because that's the first time the fan comes on.

    Can't currently come out to play on this one yet as there's about 2 hours to run on the current print, and ideally I'll create the reset switch hole and maybe even install the Astrosyn damper afterwards.
     
  14. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,405
    Likes Received:
    731
    I just tried so...
    You are right this is not realistic. But in fact I was at Z = 4 that would be layer 40 on 0.1mm layer height. Ok I had no part reflecting the air flow.

    More reasonable would be to get to Z = 1. To that stage most parts could be considered flat like the build plate and then say at this height we would have the fans max at 30%.

    So my next test will be that...
     
  15. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    I guess you could stop a print then tune the PID for that print at that layer. If there's such a thing as a layer changes script, you could then tune the PID and cooling per layer. Man .... this would be a week of effort, for one part :)

    What amazed me was actually just the difference to the temp curve that PID tuning actually resulted in.

    It'll be interesting to see how much your PID tuning differs from Z=1 over the center of the print bed with fans on whatever, versus PID tuning over the mostly empty dump bucket with no fans on. That's a wildly different setup and could well result in quite a change.
     
  16. Syko_Symatic

    Syko_Symatic Well-Known Member

    Joined:
    Sep 4, 2015
    Messages:
    348
    Likes Received:
    78
    Can anyone help? I have completed the PID auto tune at 230deg. It was all fine. I changed and saved the values (M500) but now I am unable to heat up the head to any temp above about 80deg. Has a PT100 been fried?
     
  17. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,405
    Likes Received:
    731
    If you didn't change the firmware then try a M502 followed by M500, maybe a M304 to check the PID parameter are reset to factory defaults and try again.
    If the problem persists then there may be a problem with the heater or the sensor.
    If not then something got wrong with your tuning and your new PID values are way out of what they should be...
     
  18. Syko_Symatic

    Syko_Symatic Well-Known Member

    Joined:
    Sep 4, 2015
    Messages:
    348
    Likes Received:
    78
    I get MINTEMP error on HeaterID:0 as soon as it hits 90deg. Ahhhhhhh!
     
  19. Syko_Symatic

    Syko_Symatic Well-Known Member

    Joined:
    Sep 4, 2015
    Messages:
    348
    Likes Received:
    78
    So after swapping out my temp probe and getting printing again I can not seem to auto tune the PID? I set it using M303 E0 S215 C8, it starts auto tune but only ever gets to 150deg and tunes around there? Has anyone else experienced this?

    Update: Solved! Do it from a completely unheated state.
     
    #19 Syko_Symatic, Mar 17, 2016
    Last edited: Mar 17, 2016
  20. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,405
    Likes Received:
    731
    Just found that there is an option in the firmware:
    Code:
    #define PID_PARAMS_PER_EXTRUDER
    which is disabled in our default firmware...

    Turning it on will allow you to use the M301 command to set PID values with an E option.
    M301 E0 will set PID values for extruder 0, the left one.
    M301 E1 will set PID values for extruder 1, the right one.

    I am going to check my extruders and will decide if I need this and will the perhaps activate it in my hacked firmware.
     
    Miasmictruth and Spoon Unit like this.

Share This Page