MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.17k stars 19.21k forks source link

Heater power mystery #688

Closed justmyopinion closed 10 years ago

justmyopinion commented 10 years ago

My heaters are run by PID (Extruders+bed). by M105 PWM only reports max power of 127 to host, so what have I missed in settings? I assume heaters are fully pwm controlled so maxpower should be 255 or is this pwm control a fake? PID temp controls seems to be fully functional and can be auto tuned, but I am not happy if power output is reduced to 50% by fw for some reason.

alexborro commented 10 years ago

No, Marlin uses a 7 bits PWM (0~127), so 127 means full power.

Best Regards.

Alex.

2013/12/19 justmyopinion notifications@github.com

My heaters are run by PID (Extruders+bed). by M105 PWM only reports max power of 127 to host, so what have I missed in settings? I assume heaters are fully pwm controlled so maxpower should be 255 or is this pwm control a fake? PID temp controls seems to be fully functional and can be auto tuned, but I am not happy if power output is reduced to 50% by fw for some reason.

— Reply to this email directly or view it on GitHubhttps://github.com/ErikZalm/Marlin/issues/688 .

"Não é o mais forte da espécie que sobrevive, nem o mais inteligente. É aquele que se adapta melhor as mudanças" ( Charles Darwin )

Alex Borro

justmyopinion commented 10 years ago

Ok thankyou, but confusing that all configuration settings suggest 0-255 then :-(

nophead commented 10 years ago

Yes, in particular this line from configuration.h

define PID_MAX 255 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current

ErikZalm commented 10 years ago

In the past PWM was generated by the hardware PWM controllers. Some board designers decided that heaters do not need to be connected to PWM pins. That is why I switched to soft PWM. To keep the configuration the same the values are divided by 2. 255 is full power.

justmyopinion commented 10 years ago

Exactly Nophead. I can accept the the internal algorithm have a transformed working limit of 0-127 hidden to user, but if Input have a setting of 0-255 it would be more logic that any output had the same range specially when it is only for display purpose and does no really harm

1125lbs commented 10 years ago

What about the duty cycle?

1125lbs commented 10 years ago

Im looking for the same point around and cant find anything, i dont know if anything is wrong but my heating never pass from 87C working with a 30a current

justmyopinion commented 10 years ago

1125lbs I think you may have to find your problems in your hw installation unless you have set your PID_MAX less than 255. I checked the PWM with a scope and it does output full power even that it is a sw pwm. I would prefer hw pwm implementation, but it probably does not matter with these slow devices. Even a bang-bang relay controller would work. But I still do not like the reporting from PWM.

nicolas-rambaud commented 10 years ago

Have you tried to put some cork sheet under your bed? On my side it helped a lot to reach 110°C

Maybe you are using the wrong probe table to get this reading.

The 87°C you have is from Firmware display or from direct measurement?

De : Thiago Sanchez [mailto:notifications@github.com] Envoyé : jeudi 19 décembre 2013 17:11 À : ErikZalm/Marlin Objet : Re: [Marlin] Heater power mystery (#688)

Im looking for the same point around and cant find anything, i dont know if anything is wrong but my heating never pass from 87C working with a 30a current

— Reply to this email directly or view it on GitHubhttps://github.com/ErikZalm/Marlin/issues/688#issuecomment-30941178 .[image: Image supprimée par l'expéditeur.]

ledvinap commented 10 years ago

It could possibly be dangerous to use wood as insulation material for heated bed : http://www.doctorfire.com/low_temp_wood1.pdf

nicolas-rambaud commented 10 years ago

Thanks for the document, very interesting.

De : ledvinap [mailto:notifications@github.com] Envoyé : vendredi 20 décembre 2013 12:43 À : ErikZalm/Marlin Cc : Nicolas Rambaud Objet : Re: [Marlin] Heater power mystery (#688)

It could possibly be dangerous to use wood as insulation material for heated bed : http://www.doctorfire.com/low_temp_wood1.pdf

— Reply to this email directly or view it on GitHubhttps://github.com/ErikZalm/Marlin/issues/688#issuecomment-31004438 .[image: Image supprimée par l'expéditeur.]

1125lbs commented 10 years ago

i had check with the probe and a digital thermometer( laser ones) which had some little diference, but i reach from comparison, with my extruder temp table, which is using the same thermistor and better reading i deduce that the same table works, the generic 100k glass ones... my doubt by the way was about the @127 displayed on pronterface. why its full power on firmware 255 on max current and why its showed @127 on pronterface...

1125lbs commented 10 years ago

but its already explained on top ...

1125lbs commented 10 years ago

very thank you by attention

scotty1024 commented 10 years ago

I use and recommend this material for use under the heated bed. I bought a roll 18 months ago and still have many heated beds left to insulate on it. :-)

http://www.homedepot.com/p/Reflectix-16-in-x-25-ft-Staple-Tab-Insulation-ST16025/100012574?N=bedf#.UrSJUX-9KK0

On Dec 20, 2013, at 5:24 AM, Nicolas Rambaud notifications@github.com wrote:

Thanks for the document, very interesting.

De : ledvinap [mailto:notifications@github.com] Envoyé : vendredi 20 décembre 2013 12:43 À : ErikZalm/Marlin Cc : Nicolas Rambaud Objet : Re: [Marlin] Heater power mystery (#688)

It could possibly be dangerous to use wood as insulation material for heated bed : http://www.doctorfire.com/low_temp_wood1.pdf

— Reply to this email directly or view it on GitHubhttps://github.com/ErikZalm/Marlin/issues/688#issuecomment-31004438 .[image: Image supprimée par l'expéditeur.] — Reply to this email directly or view it on GitHub.

bkpsu commented 10 years ago

I can attest to the fact there is something off with the heater power in the firmware. I had been using bang-bang for bed heating, and it took about 30 minutes to get to 110 (seemed to get really slow upon reaching 80-degC, bed LED never went off). Tonight, I modified the configuration to enable bed PID, and I was up to temp (107) in 11 minutes. No change in ambient temperature, drafts or other external factors...

Setup is Prusa i3 w/Mk2a bed, RAMPS 1.4, 12v 30A power supply.

bstott commented 10 years ago

suggest this issue - closed.

Answered by Erik/Zalm and nophead - The value in firmware of 255 is full power and the 255 level is divided by 2 in soft PWM which is why the serial output level will show 127 as maximum power. Adjust from 0-255 linearly as (0-127) as required. Examples: 0 = 0, 127 = 63, 255 = 127.

Side note: RAMPS 1.4 has an under sized 11A fuse (polyswitch) and 95W 55V 55A Mosfet for the D8 heated bed outputs. The heated beds we are using have an internal resistance of <1.3 Ohm on average and draw more than 95W at ~10A. This often causes the components to overheat, the fuse to trip and the bed never attaining temperature. Some have success with a fan but, the best solution is to upgrade to a 15A fuse and higher wattage capable Mosfet. Example components: RHEF1500-2 (15A polyswitch) & stp80nf55-08 Mosfet (rated @ 55V 80A & 300W). This allows RAMPS to power a lower Ohm rated heated bed without a fan. (Fan still recommended.)

nophead commented 10 years ago

Note the Wattage and current rating of the MOSFET are largely irrelevant as long as they are not exceeded and this application comes nowhere near easier. Neither affect how hot it will get. Also there is no connection between the load power and the MOSFET power rating. What determines how much power the MOSFET dissipates, and thus how hot it gets, is its on resistance (RDSon) when the gate voltage is a little under 5V and the square of the current. With no heatsink that needs to be less than 2W.

stp80nf55-08 is not a suitable MOSFET as its gate threshold (the point where it just starts conducting 0.25ma) can be as high as 4V. It needs 10V gate drive to reach its stated RDSon. MOSFETs designed for logic drive should be used

bstott commented 10 years ago

Ha, ha... Thanks nophead. But, the problem was real and the solution is tested. And from you - Easier? It replaces two very large through hole components with two very large through hole components. What is not easy?

The parts now installed and printing run - Much Cooler. The fuse does not trip because the bed can draw 10+A without overheating the fuse. I've seen many having this exact problem and this solves it. You say maybe only the fuse change then? Why is the Mosfet cooler too?

How does the heated bed 110-120 Watt rating then relate to the Mosfet sizing if not through dissipation capability?

Prior to my working out this - wrong - solution the HBP caused the fuse to overheat and blow while the stock Mosfet was extremely HOT. The heat bed would not get past 80-90 C without blowing the Fuse from HEAT due to overload. Now with the combined changes the fuse you can touch for some seconds at full bed temp and while driving the bed to temp from 14C to 110C. The Mosfet is still quite hot but, not near the skin scorching it was before. That is without a fan. Gate threshold on the Mosfet? Isn't it it adequate since we are with a low tech heater AND IT WORKS!? Maybe it is a good thing I did not know what I was doing this time. Doesn't happen too often but, you can get a different part. I am surprised you hammered me and didn't give an option for a different part. Over the years you've been pretty helpful that way. Those parts I spec'd are working better for the job than stock. Thanks for the edumacation though. I am not fully EE conversant (ME) and I always learn a lot from you!

Brian.

OH - The wattage of the Mosfet was exceeded - by over 15W. But, that is now me guessing because the math I used may not be for the dissipation of the device. I calculated the need of the Heated Bed. Here I can use a clue. ---- Yes, wordy.... I've been cooped up with no communications.

nophead commented 10 years ago

Power is volts times amps. The wattage rating of the MOSFET is how much power it can dissipate (with a massive heatsink). Nothing to do with how much power it can send to the load. If the bed takes 10A then it dissipates 120W because it has 12V across it. The MOSFET only has a fraction of a volt across it when hard on and 10A is flowing through it, so the power it dissipates is much smaller. To run cool without a heatsink it has to be substantially less than 1W.

Put another way a 95W 55V 55A MOSFET could switch a 3KW given a big enough heatsink, provided that its on resistance is low enough to dissipate less than 95W with 55A flowing through it.

Your original MOSFET did not fry because it was rated for 95W switching a 120W load. It fried because its on resistance was not low enough with a 5V gate drive.

The gate threshold is the point where the MOSFET starts to turn on. It is between 2 and 4V on the stp80nf55-08 datasheet so if you are lucky and get a 2V one it might be sufficiently turned on at 5V. If you get a 4V one and your 5V rail is 10% down then it will probably fry. It only has a guaranteed low RDSon with 10V gate drive. There are lots of MOSFETs that are designed for 5V logic drive. They specify RDSon at say 4.5V and have a threshold no more than about 2V.

bstott commented 10 years ago

@nophead
Thank you very much for the explanation. I see that my selection gained barely by a lower RDSon and losing on a higher 2-4V gate threshold, My selection then is barely working - but, is cooler. I got lucky and should find a better selection or tell others to leave well enough alone with the stock Mosfet and simply upgrade the fuse. Also, I understand now that the 300W dissipation means nothing for this application as does the 95W for the previous Mosfet. This component with the heated bed will not be dissipating those amounts of Watts. --- Use a a heatsink and get those fans working. I'll monitor my circuits and if a problem I have the old Mosfet - undamaged.

You agree - Bigger fuse? and leave stock Mosfet?

Brian.

[See: https://github.com/nophead/Mendel90 for a well designed 3D printer....]

nophead commented 10 years ago

Yes a bigger fuse as 11A is marginal because the resistance of PCB beds varies somewhat and also depends on temperature. A lot of boards don't bother with a fuse and rely on the over current trip in an ATX PSU.

bstott commented 10 years ago

Ok, bigger fuse is good.

MOSFET substitute - If one were to swap out the stock stp55nf06l MOSFET - What about a IRLB3036GPBF HEXFET power MOSFET ?

It has:

Data sheet and Mfg Marketing information - http://www.irf.com/product-info/datasheets/data/irlb3036gpbf.pdf http://ec.irf.com/v6/en/US/adirect/ir?cmd=catSearchFrame&domSendTo=byID&domProductQueryName=IRLB3036G


From: Chris notifications@github.com To: ErikZalm/Marlin Marlin@noreply.github.com Cc: Brian Stott bstott2002@yahoo.com Sent: Thursday, February 6, 2014 2:58 PM Subject: Re: [Marlin] Heater power mystery (#688)

Yes a bigger fuse as 11A is marginal because the resistance of PCB beds varies somewhat and also depends on temperature. A lot of boards don't bother with a fuse and rely on the over current trip in an ATX PSU. — Reply to this email directly or view it on GitHub.

nophead commented 10 years ago

Yes that is "Optimized for Logic Level Drive" so will work properly. MOSFETs that aren't require a gate driver. RDSon is 2.8 mOhm, so at 10A it will only dissipate 0.28W worst case. RθJA is 60, so the max temperature rise will be 17C, so it will not need a heatsink and will only get luke warm.

The body diode only conducts when the drain source voltage is less than 0V, so is not relevant in this application.

bstott commented 10 years ago

Hmmm... I'm thinking then the stp80nf55-08 MOSFET I used on my RAMPS has a VGS of 2-4V. With this VGS, as you told me (?), it will not fully turn on (saturate). But, if fully turned on it is capable of 80A total. Thus, am I correct in thinking, partially open that it would pass 10-12A easily with 5V on the Gate? I see on the datasheet graphs that it likely is passing the required 10-12A partially open at 4V? I am thinking through logic to guesses here. And with an RDSon 0.0065 Ohms (typical) if it does pass 10A through - it will dissipate at best/worst - 0.65W. It has a RθJA of 62. This would be 40C or about 65C @ 25C (room temp.). Not near as finger friendly as the other but, not too bad. Oh, the other (IRLB3036GPBF) - is discontinued :-(

Next - What about inductance spikes from the circuit/bed coil? And isn't there an inherent surge when turning off the MOSFET? How will this affect the Arduino (Atmega) since it PWM direct drives the MOSFET gate to control the heated beds? Our frequency is ~7.5kHz? Is there any need of a fly back diode, cap and R as a snubber? Or other protection circuit so the Atmega pin doesn't have to sink the massive V spike? There is one - Right?

arno-millenaar commented 10 years ago

The surge / spike coming from a BED is indeed HUGE and gets clamped down by the internal two-way Zenerdiode. Its this spike, that causes a lot of potential trouble as it gets superimposed on the main power en typically gets into your 5v VCC circuit. As your 5v VCC is also your reference voltage for your Analog Input it can cause some issues. See a picture I recently took when investigating some erratic behavior caused by this signal/noise: http://www.millenaar.com/download/20140206_2.bmp

Also the power dissipation calculation being used in this thread are not correct. The power dissipation needs to be calculated as the (Amp x Amp x R). This means that with a 10Amp you need to use 10 x 10 x 0.0065. Now you have a HOT MosFet (!) if it does not have a heat-sink as most RAMP 1.4 boards for example do not have. Also the 0.0065 in my measurements seems to be optimistic as it is measured at 25 Celsius. So in fact it only gets worse, especially in the beginning of heating up the BED when the MosFet is still switched on for 100% of the duty cycle.

nophead commented 10 years ago

@bstott, Technically saturation means something different when talking about MOSFETs compared to bipolar. When a MOSFET is saturated the current can no longer get any higher so the voltage across it rises, so it has pretty much the opposite meaning. When used as a switch you want a bipolar transistor to saturate but you want a FET to not saturate.

At 5V stp80nf55-08 might pass enough current but it won't reach its minimum RDSon, so the voltage across it is higher. RDSon is typically 0.0065 with 10V gate drive so will be substantially higher at 5V. Plus your 5V rail might be 10% low. So you would have to interpolate the output characteristic to estimate the voltage across it when the current is 10A and the gate drive 4.5V. Hard to do because it is right in the bottom corner of the graph because the MOSFET is not indented for use at such low gate voltages. In contrast logic drive MOSFETs give an RDSon figure at 4.5V.

When designing electronics you should use all the worst case figures if you want it to be guaranteed to work every time you build one. If you rely on the typical figures then most will work but there will be an unlucky few that don't. In this case there are no hard figures on the datasheet for VGS =4.5V, just interpolation of a tiny graph of typical values.

The bed is not very inductive because it is a zigzag rather than a coil. However it will give a back EMF as every wire has some inductance. That will be clamped to 55V by the avalanche diode in the MOSFET and as long as you don't exceed the avalanche energy rating the MOSFET will survive. As pointed out by @arno-millenaar the massive spikes might affect other things so a better design might have a clamping diode or a snubber.

PWM for bed at 7.5kHz is crazy as it has such a high thermal constant. You could use a much lower frequency to reduce the EMI and the MOSFET temperature.

@arno-millenaar, This thread has been using I2R for power. 10 x 10 x 0.0065 = 0.65 x 62 = 40C rise. My example was 10 x 10 x 0.0028 x 60 = 17C rise. Added to ambient one is luke warm and the other is too hot to touch.

arno-millenaar commented 10 years ago

@Nophead, good comments and useful explanation and the RDSon, as indeed it will typically not even get close to what the specs tell you when driving it at 5v on the gate. I just posted an article on the 'Creatr' forum with some additional pictures and what PID heating dose compared to Bang-Bang heating for those who are interested. You will also see what a Ferrit-Choke can do and at least take away some of the EMF noise generated by the BED Heater. (BTW: on the Creatr we drive the BED Heater at 24v.)

URL: http://creatrtips.freeforums.org/banding-pwm-and-pid-for-the-bed-heating-t129-30.html#p642

Picture before adding a choke: http://www.millenaar.com/download/20140206_2.jpg

Picture after adding a choke: http://www.millenaar.com/download/20140207_450919.jpg Picture after adding a choke: http://www.millenaar.com/download/20140207_450839.jpg

Picture of the Choke: http://www.millenaar.com/download/14.36.46.jpg

Rgds, Arno

nophead commented 10 years ago

What sort of heater is that? I use the Prusa MK2 PCB with the tracks pointing downwards and thermistor on the tracks, so I have always assumed bang bang is sufficient because it will switch rapidly and the top surface and glass will not change much. I have heard of Kapton heaters stuck directly to glass causing this effect.

arno-millenaar commented 10 years ago

The glass bed, when receiving heat will need to expand, if it likes it or not. As the edge of the glass is staying behind (i.e. colder than center), something has to give. So the glass bed only has 2 options, a) going up or b) going down. (third option is to 'explode'.). Therefor having PID, with in my case less than 0.01 Celsius fluctuation after 5 minutes of reaching target temp, solves this 'natural-expansion' problem. Putting the tracks, up or down, won't change the effect, only perhaps making it 'go slower'. therefor moving to PID control, allows for a more controlled 'supply' of heat. Not to much and not to less (assuming you have tuned your PID parameters). Running in bang-bang is like trying to drive a car with either Full Throttle or Full Brakes ...

nophead commented 10 years ago

When the thermistor is closely coupled to the tracks the power cycles very quickly, so the change in temperature is smaller. Then you have the thermal resistance of the PCB and the thermal mass of the bed, which together smooth out those fluctuations like an RC filter. That is why I think PID is probably unnecessary if the PCB is the right way up and the thermistor is on the hot side, as I have never seen the effect you describe.

I also like to drive my car that way as well, much to my wife's disgust.

bstott commented 10 years ago

@nophead - hmmm. yeah. she probably would be better with Bonine before your driving. As for PID vs Bang-Bang. Like a Mercedes vs a '64 VW Bug. Both will get you there but, in what condition? Oops - I rode with an Uncle that drove Bang-Bang style. Wished I'd had Bonine.

Heater Circuit - received MOSFET suggestions from the robo3d forum: IRL1404 & IRLB3036PBF. Hmmm - maybe a RAMPS 1.5? A better heat circuit w/snubber, upgrade for fans, 2 hotends + 2 extruders & ?

bstott commented 10 years ago

Oooppsss! Sorry about the PWM frequency mis-type ---- It is 7Hz! Definitely not kHz!!! Wow......

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.