Welcome! Log In Create A New Profile

Advanced

tuning Bed and Extruder heaters + M109 question

Posted by aussiephil 
tuning Bed and Extruder heaters + M109 question
May 22, 2016 11:54PM
Gents,

I've read multiple things and thought I had it largely understood till I got to this from the wiki....................

RepRapFirmware (v1.09 onwards)

H: Is the heater number, and is compulsory. H0 is the bed, H1 is the first hot end, H2 the second etc.
P: Interprets a negative P term as indicating that bang-bang control should be used instead of PID (not recommended for the hot end, but OK for the bed heater).
I: Integral value
D: Derivative value
T: Is the approximate additional PWM (on a scale of 0 to 255) needed to maintain temperature, per degree C above room temperature. Used to preset the I-accumulator when switching from heater fully on/off to PID.
S: PWM scaling factor, to allow for variation in heater power and supply voltage. Is designed to allow a correction to be made for a change in heater power and/or power supply voltage without having to change all the other parameters. For example, an S factor of 0.8 means that the final output of the PID controller should be scaled to 0.8 times the standard value, which would compensate for a heater that is 25% more powerful than the standard one or a supply voltage that is 12.5% higher than standard.
W: Wind-up. Sets the maximum value of I-term, must be high enough to reach 245C for ABS printing.
B: PID Band. Errors larger than this cause heater to be on or off.

An example using all of these would be:
M301 H1 P20 I0.5 D100 T0.4 S1 W180 B30


I assume the default values become the starting point and you vary around them.

For both the bed and extruder heat up fast and overshoot by 5 to 7 degrees then both will settle down to oscillate around 0.4 degrees each side of the set point.

I'm assuming that I need to Increase D, decrease P as per the wiki?


Second Question, S3D has both M104 and M109 lines in the g-code to set the E0 heater, whilst it seems M109 should cause everything to wait it doesn't. The very next line (G32 in my case) executes immediately..... lucky at the moment that the Extruder heats up inside the 40 seconds the 13 point probe takes to run smiling smiley

Should M109 actually pause everything though?

thanks in advance
Phil
Re: tuning Bed and Extruder heaters + M109 question
May 23, 2016 04:53AM
PID adjustment

For the hot end, if you are getting overshoot then just reducing the S parameter will probably be the simplest way to cure it. Otherwise, here is one approach to tuning the PID constants:

1. Set S to 1.0, P to 20, B to 30, and I, D and T to zero.

2. Command the hot end to a high temperature, say 250C. As soon as it reaches 160C, command it to 0C. Watch the temperature to see how much it overshoots. Set the B value to about 5 to 10 higher than the amount of overshoot.

3. Command the temperature to 250C and wait. It won't ever reach 250C because of the zero I and T terms. When the temperature has stopped increasing, read it off, also use M573 P to get the average PWM. Set the T value as follows:

T = (255 * average_pwm) / (temperature_reached - room_temperature)

4. Now follow classic Zeigler-Nicholls tuning. With the temperature set to e.g. 200C, increase P up to the point at which the temperature shows regular oscillations. Call this value Posc. Measure the period of the oscillations, call this Tosc. Then:

P = Posc/3 (increase/decrease this if desired to increase/decrease the overshoot)
I = 2P/Tosc
D = Tosc * P/3

M109

M109 should wait until the temperature has been reached. If it doesn't, that probably means that no tool had been selected when the M190 command was executed. You need a T0 command before the M109 command.

Edited 1 time(s). Last edit at 05/23/2016 09:10AM by dc42.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: tuning Bed and Extruder heaters + M109 question
May 23, 2016 06:09AM
Thanks David

That's all makes sense and should be straight forward.... I played around this evening before you posted that. Fixed the overshoot but it oscillates more, so I'll start with your process above.
When I say coil late it's by about 0.8 deg each way

Yeah no tool selected first was the issue

Cheers and thanks

Phil
PRZ
Re: tuning Bed and Extruder heaters + M109 question
May 23, 2016 07:09AM
In the step 3, shall the result of M573 be timed by 255 (or 256), according this message [forums.reprap.org] ?

Quote
dc42
PID adjustment

For the hot end, if you are getting overshoot then just reducing the S parameter will probably be the simplest way to cure it. Otherwise, here is one approach to tuning the PID constants:

1. Set S to 1.0, P to 20, B to 30, and I, D and T to zero.

2. Command the hot end to a high temperature, say 250C. As soon as it reaches 160C, command it to 0C. Watch the temperature to see how much it overshoots. Set the B value to about 5 to 10 higher than the amount of overshoot.

3. Command the temperature to 250C and wait. It won't ever reach 250C because of the zero I and T terms. When the temperature has stopped increasing, read it off, also use M573 P to get the average PWM. Set the T value as follows:

T = average_pwm/(temperature_reached - room_temperature)

4. Now follow classic Zeigler-Nicholls tuning. With the temperature set to e.g. 200C, increase P up to the point at which the temperature shows regular oscillations. Call this value Posc. Measure the period of the oscillations, call this Tosc. Then:

P = Posc/3 (increase/decrease this if desired to increase/decrease the overshoot)
I = 2P/Tosc
D = Tosc * P/3

M109

M109 should wait until the temperature has been reached. If it doesn't, that probably means that no tool had been selected when the M190 command was executed. You need a T0 command before the M109 command.

Edited 1 time(s). Last edit at 05/23/2016 07:26AM by PRZ.


Pierre

- Safety [reprap.org]
- Embedded help system for Duet and RepRap Firmware [forums.reprap.org]
- Enclosed delta printers Lily [rouzeau.net] and Lily Big [rouzeau.net]
- OpenScad delta printer simulator [github.com]
- 3D printing on my site [www.rouzeau.net]
Re: tuning Bed and Extruder heaters + M109 question
May 23, 2016 09:11AM
Quote
PRZ
In the step 3, shall the result of M573 be timed by 255 (or 256), according this message [forums.reprap.org] ?

Thanks for pointing this out. I have edited my previous post.

btw some time in the future I am looking to replace PID by predictive temperature control with automatic calibration.

Edited 1 time(s). Last edit at 05/23/2016 09:13AM by dc42.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: tuning Bed and Extruder heaters + M109 question
May 24, 2016 09:32AM
sad smiley
Well either I didn't get it or that just won't work when dealing with high power fast heating setups.

Example, at step three I easily shot past 250 and reached 260 before I set it to zero again..... Hotend is a Dyzend with 300c thermistor and 24V 60w heater cartridge.
The time to heat from 10c to 160c was approximately less than 20 seconds.......

After reverting to what i had the day before, I did some further manual tweaks to arrive at
M301 H1 P22.0 I0.2 D180 T0.2 S1 W180 B30

this holds temperature to with 0.5c during printing with about a 2c overshoot on the way up.

I haven't play with the bed at all as despite it running in bang bang mode at this time bed stays with 1 degree of set temperature with a 5c overshoot on the way up......
Measuring the build plate upper surface temperature shows that it is 5c hotter than the thermistor reading across the main 500mm heated area.
PRZ
Re: tuning Bed and Extruder heaters + M109 question
May 24, 2016 10:29AM
[edit] I did'nt get good results with Ziegler-Nichols method either.

0.5°C stability with 2°C overshoot is a good result, so no reason to complain.
Indeed, your parameters looks ok for the power. Maybe proportional coefficient is a bit high.
Did you insulated with Kapton the heating block (that will change a bit the T parameter) ?

PID control on the bed gives me a lot of improvement over bang-bang control, but our configuration is not quite comparable.

Edited 1 time(s). Last edit at 05/24/2016 10:32AM by PRZ.


Pierre

- Safety [reprap.org]
- Embedded help system for Duet and RepRap Firmware [forums.reprap.org]
- Enclosed delta printers Lily [rouzeau.net] and Lily Big [rouzeau.net]
- OpenScad delta printer simulator [github.com]
- 3D printing on my site [www.rouzeau.net]
Re: tuning Bed and Extruder heaters + M109 question
May 24, 2016 01:55PM
Quote
aussiephil
sad smiley
Well either I didn't get it or that just won't work when dealing with high power fast heating setups.

Example, at step three I easily shot past 250 and reached 260 before I set it to zero again..... Hotend is a Dyzend with 300c thermistor and 24V 60w heater cartridge.
The time to heat from 10c to 160c was approximately less than 20 seconds.......

60C is much higher than most people use. E3D hot ends use 25W, other hot ends use typically 40W. You could try repeating step 3 commanding 200C with P reduced to 10. Wait for the temperature to settle before calculating T.

Alternatively, try halving P, I, D and T in this command (or use it as-it but set S to 0.5): M301 H1 P10 I0.10 D100 T0.50



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: tuning Bed and Extruder heaters + M109 question
May 24, 2016 07:28PM
Quote
PRZ
Indeed, your parameters looks ok for the power. Maybe proportional coefficient is a bit high.
Did you insulated with Kapton the heating block (that will change a bit the T parameter) ?

PID control on the bed gives me a lot of improvement over bang-bang control, but our configuration is not quite comparable.

Pierre, the heater block is sort of insulated, there is ceramic paper over the top and on the side between it and the IR sensor board. this creates very effective isolation from the heat break cooling and the heat block itself. Once I'm comfortable that all is good we will wrap the heater block in 1mm ceramic paper so that when summer arrives I will be able to run a layer cooling fan with little to no impact to the heater.

smiling smiley Yeah my print bed is not so common, I was pleasantly surprised how well it maintain temperature in the 55 to 70c range..... be interesting when I ramp up to do some ABS testing..... one thing I have already found is I absolutely need to stage the rise to 110c....... first run up to 110 from ambient of 16c resulted in even the cast plate bowing quite well..... scared the crap out of me but it flattened back out fine.

Question for readers.... Is there a "wait and do nothing" G-Code? this would allow a simple macro to bring the bed up in stages.


Quote
dc42
Quote
aussiephil
sad smiley
Well either I didn't get it or that just won't work when dealing with high power fast heating setups.

Example, at step three I easily shot past 250 and reached 260 before I set it to zero again..... Hotend is a Dyzend with 300c thermistor and 24V 60w heater cartridge.
The time to heat from 10c to 160c was approximately less than 20 seconds.......

60C is much higher than most people use. E3D hot ends use 25W, other hot ends use typically 40W. You could try repeating step 3 commanding 200C with P reduced to 10. Wait for the temperature to settle before calculating T.

Alternatively, try halving P, I, D and T in this command (or use it as-it but set S to 0.5): M301 H1 P10 I0.10 D100 T0.50

Dave, the 60w heater is the only available and default heater at 24v for the Dyzend hotend, I am only using the 300c Thermistor at this time though..... I need to find the temperature probe for the multimeter to check actual temperature as I suspect it is reading a little high (by a few degrees)

I'm comfortable with what I have at the moment but offer my services to test your proposed predictive temperature control with automatic calibration on a high power setup.
Sorry, only registered users may post in this forum.

Click here to login