Why not heat the bed with more power?

Short version: In the config, the bed max power is 206, but the software actually uses half that, 103, for bed heating. Heating the bed is the slowest part starting a print. Why 103? Why not more?

Long version: I’ve been doing some hardcore upgrades to my TAZ5 (auto-adjusting, sled mounted, auto-leveling system - it levels itself against the extruder nozzle, so if I swap between a normal one and a volcano, I don’t need to screw with manually adjusting the auto-level switch) which required extensive modifications of the Marlin firmware (I don’t care about dual extrusion, so I’m using the unused stepper controller for E1 to adjust the auto-level switch). In doing so, I changed some stuff that broke my settings. In my hunt to figure out why my bed wouldn’t heat anymore (I changed an array size, which screwed up the EEPROM settings, so when it loaded, my PID values were gone) I noticed something…

The max heat power is set at 206 in the config.h, meaning the bed won’t get pumped at full power (255). The PWM value for the bed actually only uses half that value, 103. So in short, the bed is being given about 40% or so of the power it COULD get.

I am assuming there is a valid reason for this - but does anyone know, or can anyone explain why? I saw somewhere in the Marlin comments about if you blow the fuse, lower the power to reduce the duty cycle so less current goes to the bed. But I cannot imagine the bed pulling anywhere near 15 amps at 40% power. (Too tired to test it tonight, will do it tomorow).

Anyone have a good reason to not increase the value or decrease the divisor on the PWM value? I hate waiting for the bed. Would love for it to heat faster.

Where do you see that PWM uses only /2 the value of 206?
I was also asking about the reduced max power of bed and heater here a few days ago, got no real answer. I think only the Lulzbot Dev team knows why… Basicaly I see no reason not to set it to max. A heater ratet for 24V should be allowed to work on 24V. If it fails, then it there was something wrong with it - just my 2 cents.

So first, a little explanation for non-coders. PWM means Pulse Width Modulation. In laymans terms think of turning a light switch on and off thousands of times per second. If you had an “old fashioned” incandescent light bulb, if you were able to flick the switch that fast, the light would appear dim - it’s only getting electricity part of the time. In an Arduino (the ‘brain’ of the controller board for your TAZ) there are PWM pins. You set it a value between 0 (off) and 255 (on all the time), and anything in between ‘flickers’ at a frequency. This is used in many things, but can also be used to ‘dim’ certain components.

Now, the Arduino pins that have PWM capability both cannot produce the amount of current the heated bed requires, and are reserved for things that require true PWM (servo controllers etc).

So there is a thing called software PWM, where the controller literally turns the ‘switch’ on or off thousands of times per second, at whatever frequency is required, simulating PWM, which is plenty good enough for a heating element.

So, when you see soft_pwm below, thats what it’s referring to - the software PWM value. Ready? Ok!

In the Marlin source code, temperature.cpp (visible at https://github.com/MarlinFirmware/Marlin/blob/RC/Marlin/temperature.cpp)

First, the lines of code that turn the heater on:

There is a loop that is called based on the hardware timer inside the controller. Inside that function at line 1447, the heater is turned on or off based on the soft_pwm value:

      #if HAS_HEATER_BED
        soft_pwm_BED = soft_pwm_bed;
        WRITE_HEATER_BED(soft_pwm_BED > 0 ? 1 : 0);
      #endif

For the non-coder, that says, if your config.h has said that you HAS_HEATER_BED, set the variable soft_pwm_BED to equal soft_pwm_bed (No clue why, that line seems unnecessary).

The next line is a macro to send an arduino write command to the bed heater pin, to turn it on or off. If the soft_pwm_BED is greater than zero, send a 1 (on), otherwise, send a 0 (off).

Other code adjusts that on/off value depending on if it should be on or off at the time, and that frequency is controlled by that soft_pwm_bed value.

Where does that value come from? Well at line 261, this is the pid auto-tuning function - where the machine figures out the most efficient way to keep your bed or extruders at the right temperature:

    #if HAS_PID_FOR_BOTH
      if (extruder < 0)
        soft_pwm_bed = bias = d = (MAX_BED_POWER) / 2;
      else
        soft_pwm[extruder] = bias = d = (PID_MAX) / 2;
    #elif ENABLED(PIDTEMP)
      soft_pwm[extruder] = bias = d = (PID_MAX) / 2;
    #else
      soft_pwm_bed = bias = d = (MAX_BED_POWER) / 2;
    #endif

It runs the PWM pin at MAX_BED_POWER / 2.

Then, later at line 798, where it’s actually figuring out what the soft_pwm_bed value is when turned on full tilt to heat:

      soft_pwm_bed = current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP ? (int)pid_output >> 1 : 0;

pid_output is set earlier to be the bed’s max power, 206, as written in the config for the TAZ. The >> 1 is sorta-complicated-to-explain computer math function, but in essence, it says divide by 2 and drop any decimal. In effect, just halve the pid_output.

And lastly, if you turn your bed on, then run a M105 command to get a report of the statuses, it will show B@103, meaning the bed is heating at PWM value 103.

From everything I can see, the bed is being heated at about 40% of the available power, slowing down the heating considerably.

After I finish breakfast I’m going to take my multimeter to the bed and read the current draw and see what it says.

That is more 80% power at 50% of the time actually. 80% to not blow the fuse and give it recovery time. (AKA - Not melt.)

I imagine the 50% is for the other part in the circuit that is NOT the heat bed.

Explain where 80% came from? And if it’s 80% to not blow the fuse, then only having it on 50% of the time is a waste of time. 80% (that wont blow the fuse) 100% of the time will heat faster.

And “I imagine” does not hold any water. I scoured the code last night. Max power is 206. It’s only sending a PWM of 103. Thats 40.39% of max power. And it’s not for “the other part” of the circuit. Thats like your auto mechanic telling you that the noise your car is making is normal, because “I imagine the noise is normal because of that other part of the car thats using it.” - that makes no sense.

The FET turns on 15 AMPs 80% of the time, and not 80% of 15 AMPs. BIG difference for a 15 AMP fast blow fuse. It needs time to cool and not melt down to the open condition. Which is how a fuse works. The 80% is the max ‘average’ draw the fuse will like to handle.

The 50% is for the only other part on the RAMBo that runs the heat bed - The power FET. Which needs time to cool down also. It does have a resistive component during operation, which is not much but at that current does add up to some heat.

Of course this also takes into account that you might have noticed the power supply is heating up, and it needs time to take the heat away.

The answer is quite simple:

Ok, I’m coming late into this thread, but to answer the previous question about “@127”, it’s actually 255. Marlin has its own soft PWM implementation that runs over 127ms “frames”. So that requires the PID CO to be shifted 1 bit to the right (effectively dividing by 2, rounding down).

Source

So its not running at 50% in reality :wink:

So the only real question is: Why would Lulzbot limit the max. current. I don’t see a limit due to power supply or fuses.

I’ve noticed my T6 takes significantly longer than my T5 did to heat the bed. When going from about 80C-110C it just barely creeps while incrementing 1 degree every 20-30 seconds or so.

It is supplying the max current! The firmware is controlling the pulse width of how long the current is demanded.

Of course, but nut at the maximum duration which results in the same shower heat up as with reduced current :wink:

Thanks for that explanation. That clears up why it appears to be running at 50% power. It was confusing the heck out of me why the PWM was being halved.

That being said, I believe the max power can be upped from 206. I just took a multimeter to the bed and first tested the voltage… it’s a 24v bed and the power, when heating, pulsed between 18v and 21.5v max. The 18v I believe was just the low end that the multimeter was reading as the power pulsed on and off, and it was likely jumping between 0v and 21.5v or so.

Next I read the amps running to the bed. Again, the pulsing on and off, but the amps never went above 12.4 or so. I’m going to play with the power settings here in a little bit and see what I can safely push it to without crossing 14.5 amps or so. I understand the fuse will blow if it hits 15 amps, however, it still feels like the bed is being underpowered, especially when you consider the PWM ‘pulsing’. Maybe 206 is the ‘really safe’ value they set so that no one will have an issue, but for those who mod their printers, I’m pretty confident that can be pushed up a bit.

And as a side note, I wonder if it might be possible for those who really want to turbocharge their printers to mod the bed so that it uses an external power supply and possibly a relay so that the bed can pull a full 24v at 15amps and heat up in twice the time. One project at a time however. I’ll post any findings on tweaking the bed power.

Edit: Just looked up the specs on the TAZ5 power supply. The supply itself can EASILY handle the 360 watts for an initial bed heating. It’s likely the rambo board itself/mosfets/etc that need to be careful with the power. By bleeding off 24v from the power supply before it enters the rambo, and setting up a relay, I’m failing to see why the bed could not be run full power for the initial heat up. Once it’s at temperature, sure, run the pulsing/lower power PWM, but by heating it directly you could probably double the speed for the initial heat up. The biggest issue for ‘wide adoption’ would be the custom firmware mods it would take. I’ve already modded the hell out of the Marlin firmware for some other tweaks I’ve made (using the second extruder stepper controller to run an auto-leveling auto-level probe. Not a typo, the probe auto-levels itself against the extruder head before the whole thing does an auto-level, so I can change nozzles without re-adjusting the whole thing) but with a mod like that, there’s no way the standard Marlin could be used.

Looks like I’ve a new project in my future.

I just wanted to make a few comments. I was just thinking about this myself a few days ago since it takes the TAZ 6 a very long time to heat the bed.

I honestly, don’t know anything about the electronics in the TAZ but I’ve done a bunch of stuff with microcontrollers over the years. Here are a few observations.

  1. The reading you are getting from the meter is probably not the peak current. Most meters will average the current over some period of time. To get the peak(the value when the PWM is on), you probably need to use something like an oscilloscope. Depending on how the power supply and the fuses of the TAZ works, it may have been necessary to design for the peak.

  2. The relay you are talking about is kind of already in the circuit. You can’t control that much current directly from a microcontroller, so you need to have a power transistor(probably a MOSFET) to do the actual switching. It essentially acts like the relay you are referring to.

  3. Most microcontrollers will allow the PWM value to be set to the max or greater then the max to make the PWM always on without an off period. I would be surprised if it wasn’t true for the TAZ as well.

I suspect much of the limitations are due to the choice to use 24V as opposed to something higher like 48V. 48V would have allowed then to use half the current which would make the wires smaller and electronics cheaper, but then you have a much greater risk of hurting people with shocks if the machine fails.

Hmm… get a higher wattage PSU. Recently replaced my OEM TAZ 5 with a 600W… seems to have made a difference with heating time of bed, and dual extruders simultaneously. I want to say its 5-7minutes from a cold machine to printing.

If you go higher than 600W, the internal wiring may need to be replaced… In my case, I smelled burning plastic/rubber and took a peek with a thermal camera to find the main input wires running pretty hot.

Another factor you need to look at is changing the type of connector pins used. The amount of current running through the power pins into the printer and the pins running to the heat bed need to be gold plated if possible to reduce hear build up/power losses due to corrosion. The power pins running in are gold plated but I do not think the pins to the heat bed on the back of the control box are.