Chamber heater - First reach Temperature then Bang-Bang

  • 2 Questions:

    1. How can I set a chamber temperature and just have the Duet (stupidly with no fancy-pants feedback) feed the chamber heater full blast until the desired temperature is reached, then switch to Bang-Bang or PID control?
    2. What do I change in the config.g file to switch between Bang-bang and PID control for a chamber heater?

    Details for Question 1:
    I have a good enclosure made. It is sealed. Once it gets up to temperature, It will hold 100°C with greatly decreased active heating. The problem is the initial warm up period to get the chamber to 100° takes approximately 45 minutes. As you can imagine this gradual increase in temperature plus the fluctuations in temperature readings from the thermistor in the open air of the chamber causes the temperature control algorithm to trigger an error "Heating fault on heater 2, temperature rising much more slowly than the expected 1.5°C/sec" To avoid this error, my current work around is to preheat the chamber manually. Once it reaches the desired temperature, I am switching to Duet control. I want to automate this so that I am not forced to pre-heat the chamber manually. How can I accomplish this?

    Details for Question 2:
    This may be the source of my problem. Bang-bang might solve my issue, but the documentation about Bang-bang is very poor and thus, I cannot figure out how to make it function properly. On the Duet Dozuki page about setting up a Chamber heater it says this setting will run Bang-Bang instead of PID:

    M301 H3 B1 ; use bang-bang control for the chamber heater

    Looking up the command "M301" on the RepRap G-code page: we see that the above setting should be running PID because it is necessary to set a negative P value to activate Bang-bang. Therefore, I set my printer up with the following line:

    M301 H2 P-1 ; use bang-bang control for the chamber heater

    This has a strange effect. The chamber heater is not activated if I set the temperature to 100°, but if I set it to -100° it turns on about 50%, If I set it to -200° it turns on the chamber heater full blast. So the signal is inverted and not calibrated.

  • Moderator

    @punamenon said in Chamber heater - First reach Temperature then Bang-Bang:

    Nope, don't use that one. That's the gcode wiki. Use the Duet maintained gcode wiki that is specific to reprapfirmware and kept up to date (as much as possible)

    Also, have you seen this page?

    And this is the page you're referring to?

    I really don't think M301 H2 P-1 is what you want.

    What happens when you use M301 H3 B1 as described in the chamber heater wiki?

  • Ok, here are more specific questions:

    1. How can I correctly activate Bang-bang for use with a chamber heater, so that it behaves as expected (not inverted as I talked about previously)?
    2. If question #1 does not have an easy answer, how can I change the "temperature rising slowly" safety protocol for my chamber heater? This is clearly set WAY too sensitively. There is no reasonably affordable chamber heater that could possibly heat a cubic meter of air by 1.5° per second. That's crazy talk.

    What happens when you use M301 H3 B1 as described in the chamber heater wiki?

    It turns off the heater, triggers a fault condition, and gives me the warning
    "Heating fault on heater 2, temperature rising much more slowly than the expected 1.5°C/sec"

    I suspect that using the line you asked about does not activate bang-bang. As I said, the documentation is poor. Near as I can tell the "B1" parameter does not activate bang-bang. The documentation you referred me to does not say anything about a "B" parameter, however the documentation you told me to disregard does say the "B" parameter sets the sensitivity of the PID band (Errors larger than this cause heater to be on or off).

    It looks like PID control will not work with a Chamber Heater unless the user can set the "XYZ° rise per second" parameter that triggers the heater fault for a chamber heater (M141). Otherwise, PID control will not work for chamber heaters. In that case, with PID not working, we need a way to get bang-bang working correctly. I believe it may be appropriate for me to move this discussion to the "firmware wishlist" category. I seem to have stumbled upon an undeveloped corner of the Reprap firmware. Alternately, I am mistaken, and this is a faulty implementation that I've done. In which case, the documentation should be edited.

  • If you want to use bang-bang mode instead if PID, then you activate it with M307 command, not M301. See

  • @aidar
    Thank you. I will dive into this tomorrow. At first glance it seems like your reply may solve my problem. However, I welcome other feedback. I will be making a video on the subject, so any help which you provide to me will be passed on to many others. This is me:

  • @punamenon
    Have you tried tuning PID for the chamber? Unless I misunderstand you, PID should do what you want if it is tuned correctly. That is to say, when the actual temperature is a long way below the set temperature, the heater should be fully on in giving the fastest warm up time, and only switch to being PWM controlled as the actual temperature gets close to the set temperature.

  • bang-bang mode simply turns on the heater until the set temperature is reached, then turns it off. bang-bang mode does exactly what the OP was asking about in the first place.

    PID will heat up until it approaches the set temperature, then the temperature rise will slow down to minimize overshoot. It will take longer to get to the set temperature than bang-bang mode.

    If the OP doesn't like how long it takes to get the chamber up to the set temperature, he needs more heater power.

    It seems like the signal he is using is inverted (unlikely), or he has miswired the SSR that switches power to the heater (more likely). Post a diagram of the wiring, please...

    This is how I configured the chamber heater in my printer. I have a line powered 500W heater switched by an SSR. It takes about 20 minutes to get to the typically set temperature of 50C which I find adequate for printing ABS.

    M141 H2 ; Assign chamber heater to heater 2
    M307 H2 A11 C99000 D2000 B1 ; chamber heater operates in bang-bang mode
    M305 P2 T100000 B4138 C0 R4700 ; Set thermistor + ADC parameters for chamber
    M143 H2 S60 ; Set temperature limit for chamber to 60C

    alt text

    I used a 208VAC fan and wired it across the heater so that if the SSR fails leaving the heater on, the fan will also run. Line voltage here is 117VAC, so the fan turns slowly and quietly. It keeps the heater from getting too hot but doesn't create a gale inside the enclosure. If the fan fails, everything will get too hot, at which point the TCO should do its job.

    Make sure the + and - inputs on the SSR are connected to the + and - heater outputs on the controller board.

  • @mrehorstdmd If that was aimed at me, I'm fully aware of the differences between bang-bang and PID.

  • @deckingman "aimed"? Your credentials are above reproach. I was merely trying to answer the OPs question, which didn't seem to be getting answered, at least not directly.

  • Moderator

    @punamenon said in Chamber heater - First reach Temperature then Bang-Bang:

    how can I change the "temperature rising slowly" safety protocol for my chamber heater?

    I don't think you really need to use bang-bang to get a working system here, you just need the heater model parameters dialed in a bit. Ideally this is accomplished by the auto-tuning, but there are cases such as a very slow heating chamber like this where the auto-tune by default isn't able to cope. The link I posted above on tuning heaters has a troubleshooting section that recommends increasing the deadtime and/or gain for cases like this.

    Once the auto-tune is successful you should have a more accurate model for the heater performance and it should be able to heat to set temp quickly, and then maintain it smoothly. Unfortunately, you may need to do some manual PID settings first before an autotune will work.

    Once again, this link does contain the information you need to understand to get a working PID model and a successful auto-tune.

  • This post is deleted!

Log in to reply