Heater, MOSFET and PWM [Solved]

Hi there,

I am trying to build a heater which is controller by an arduino nano Atmega328.
I can nicely control the output voltage to the heater. I use a PWM signal on pin 9 which is connected to a MOFSET N-Channel transistor. But as soon as I connect the heater to the Arduino, the power supply starts whistling and seems to be messing with the board as well. (Some Nixie Tube diodes turned off and i had to re-upload the program for proper display of the temperature)

The heater pulls 7.5 Amps at 12V… I am wondering if the power supply could “dislike” the PWM control. But before just assuming, testing and frying my arduino or the power supply, I’d like to be sure this is the only issue of my circuit. It’s a computer power supply. Do I need to add a RC low pass filter at the output of my PWM pin in series with a Zener diode? Or do you see any other issue that could cause this? Is the diode mandatory?

Anyways, here is the schematics of my circuit. The heater has a 1.6 Ohm impedance.
For simplicity, I removed the Nixie tube and thermistor.

–EDIT–

For people who don’t wish to read all the post and have a similar problem, I added a PDF of my current set-up which is working.

Final_Schematics_Heater_w_MOSFET.pdf (14.4 KB)

I like your enthusiasm, but handling 7.5A requires some amount of electronic skills. You should start with a baromic sensor and NeoPixels and so on 8)

The R and C for a slower slew-rate to the gate will make the mosfet get hot.
Only the R to protect the Arduino is good, use 220 or 470 ohm or so.
You need a protection diode from mosfet drain to 12V, because the heater might have some inductance.

One of the most complex subjects is grounding. With 7.5A, the ground currents can be a big issue.
Suppose the mosfet is turned on, and 7.5A is going from the mosfet source to the battery. That ground current could lift the voltage of the mosfet source and the mosfet gate would be still at the same voltage. Then the mosfet might turn off. Turning it off increases the voltage of gate-source and the mosfet will turn on, resulting into an 7.5A oscillator.

I'm sure that not every power supply can handle a PWM of 7.5A. You might need a filter between the heater and the power supply.

Well no risk no fun right? Thanks for the reply! I get the grounding issue and that could exactly be the problem. But if that’s the problem, how to fix it? At least, I don’t really understand why filtering between PSU and heater would help… Wouldn’t that also increase the impedance in the circuit and therefore lower the current?
Unless you put just a big capacitor between drain and ground. This would be like a RC filter with R being the heater…

Ok, i replaced the PWM by simply connecting the gate of the MOFSET to a 5V DC power supply.
The power supply does no longer whistle, so I guess that the PWM is responsible for that. But now that MOFSET is heating a lot... a lot more than my heater actually! I need a heat sink but still... is it normal for it to heat up that much? It was on for less than 15 sec and I barely touched it with my finger and could instantly smell grilled chicken!

A mosfet is about Rds(on), the resistance when it is on.
When you want to turn it on with 5V, you also need a "logic level" mosfet. The "logic level" means 5V ttl alike voltage compatible voltage level something.

Which mosfet do you use ?

This is a logic level mosfet : N-Channel MOSFET 60V 30A - COM-10213 - SparkFun Electronics
It can do 30A, that's okay, but not very interesting. It's Rds(on) = 35 milli ohm
For 7.5A, that would be 0.26V and 2 Watts. That is a lot for a TO-220 component without heatsink.
If you would use that mosfet, use a heatsink, use a few parallel or buy a better one.

This is an other mosfet : N-channel power MOSFET [30V / 60A] : ID 355 : $2.25 : Adafruit Industries, Unique & fun DIY electronics and kits
That is 10 milli ohm at 5V and 25 degrees Celsius, and 16 milli ohm at 5V and 125 degrees Celsius.
Same calculation at 25 degrees: 0.56W
This one generates about a quarter of the heat. That's a big improvement.

A opto-coupler can be used to avoid ground current and a "logic level" mosfet is not needed anymore.
I prefer a circuit like this one : http://www.mikrocontroller.net/topic/155604
However, when you power the Arduino with the same 12V power supply, a ground current might still be a problem.

A ground current does not always take the shortest route or the thickest wire. When a pulsating PWM current is used, it gets even more complex.

A 100volt mosfet is a good indication of a non-logic fet.
AFAIK, logic fets are usually <60volt.

The regulation of the computer supplies I have fixed was usually on the 5volt line.
If you only load the 12volt line, the supply’s regulation might do weird things.

Why the “31250” on the schematic diagram.
Is that the PWM switching frequency.
Not needed for a heating element, and it also adds switching losses (heat) to the mosfet.
Leo…

That's true. Heating doesn't need PWM (why didn't I think of that?).

RED_:
Ok, i replaced the PWM by simply connecting the gate of the MOFSET to a 5V DC power supply.
The power supply does no longer whistle, so I guess that the PWM is responsible for that. But now that MOFSET is heating a lot... a lot more than my heater actually! I need a heat sink but still... is it normal for it to heat up that much? It was on for less than 15 sec and I barely touched it with my finger and could instantly smell grilled chicken!

You haven't told us which MOSFET you are using, it may be completely inappropriate.

Devices heat up in predictable manner depending on the on resistance and current and the
thermal management (aka heatsinking). What is normal is to calculate this and make sure its
within bounds before powering up. You can't just guess these things with power electronics and
expect things to work, always you are calculating power dissipation... Heatsinks and device
packages will have a thermal resistance (usually quoted as degrees C per watt). You multiply
this by the power dissipation to get the rough temperature increase above ambient. Check
the datasheet for maximum allowable dissipation for any given temperature.

Thank you all for your replies. Yes, my MOFSET is absolutely inappropriate. A very poor “choice” indeed: http://pdf1.alldatasheet.com/datasheet-pdf/view/66284/INTERSIL/BUZ21.html

Especially since it is not a logic level, with a Vgs of 5V, it’s On-resistance goes up to 0.225 Ohm. At 7.5 Amps, that’s ~12.5 Watt. :s

I’ll buy a different one…

@wawa: I kept the 5 V on my PSU as I intended to power my arduino with it. I just didn’t use it because I read somewhere it was prefereable to power the arduino up with in the Vin pin.
And yes, 31250 (Hz) is the PWM switching frequency of Arduino. I was just looking at what R*C I would need if I was to filter it. Note that I have an error in the formula. It should be 1/RC < 39269.

@Peter_n: I’m not sure on how to solve the grounding current issue. My power supply only has one ground and I wasn’t planing on having 2 power supplies. Could I/should I use a couple of diodes to force the current down the right path?

Also, I’d like to control the heaters temperature at +/- 1 degC accuracy. This is why I thought I’d use PID and PWM. I mean, I could also emulate a very low switching frequency in C++ (like 1Hz)… would that be preferable? But I don’t think I can achieve a proper temperature control with a on/off regulation.

Using PID with on/off is often used. With a good temperature sensor it should be accurate. I admit, using PWM makes it smoother (on paper). If it will be smoother in the real world, that I don't know.

The switching frequency of the Arduino PWM is about 500 Hz.

When you power the Arduino with 5V, and you connect a computer to the usb connector, then current can flow into the computer. Especially when the computer is turned off ! One Arduino user has reported a damaged computer probably due to this.

At least 7.5V to VIN or the power jack is preferred.

About the ground current:
The worst case is when you apply the power GND (0V) to a GND pin of the Arduino and connect the heater ground to another GND pin of the Arduino. Then the 7.5A is going through the Arduino board.
You could make a common ground point (for example at the power supply) and connect every GND to that single point. Another option is to use mosfet source as a GND for the Arduino to make sure that the gate voltage does not change. Draw it on a piece of paper and check for wrong routes of the current, maybe also check what happens for example when the heater GND gets lose.

Use 0.1Hz even. Definitely going to be easier on the power supply that kHz.

You don't need hardware PWM for that kind of speed.

You are right that proportional control rather than bang-bang (hysteresis drive) will give
much better temperature control. The resolution of the temperature sensor may become
the limiting factor once the PID loop is tuned.

Peter_n:
The switching frequency of the Arduino PWM is about 500 Hz.

The "stock" PWM freq on pins 3, 9, 10, 11 is 490 Hz, but on pins 5 and 6 it's 976 Hz.

Yes, all the grounding is done at the MOFSET source. I don't use the second ground pin at all.

Concerning the temperature sensor, it would indeed be the limiting factor. At first, I was getting a reading all over the place at +/- 2 degC. I tried filtering but didn't have the right hardware. I then smoothed it by doing an exponential average and now I get steady ambient temperature readings that vary only by +/-0.1 deg C. It affects the response time a little but remains manageable.

You have been told Vin needs 7.5volt, because Vin is pre onboard 5volt regulator.
A Nano is a bit different from other Arduinos, and is generally happy with 6volt.

5volt on Vin would have given you 4volt on the 5volt rail.
Your mosfet would have been in trouble (heat).
And if you use an analogue temp sensor with default Aref in the code, it would have been all over the place.

No problem to put 12volt on Vin, as long as you don't hang heavy loads on the 5volt rail.

You also have been told that default PWM frequency is ~500hz or ~1000hz.
This is low enough for low switching losses.
Not sure why you want to destroy (almost) lossless PWM with capacitors.
If you do, mount the fet on a heatsink. It could use upto half of the power of the heating element.

Tell us what temp sensor you're using.
You might have to read an analogue sensor with 1.1volt Aref.
Leo..

Wawa:
You have been told Vin needs 7.5volt, because Vin is pre onboard 5volt regulator.
A Nano is a bit different from other Arduinos, and is generally happy with 6volt.

5volt on Vin would have given you 4volt on the 5volt rail.
Your mosfet would have been in trouble (heat).
And if you use an analogue temp sensor with default Aref in the code, it would have been all over the place.

No problem to put 12volt on Vin, as long as you don't hang heavy loads on the 5volt rail.

You also have been told that default PWM frequency is ~500hz or ~1000hz.
This is low enough for low switching losses.
Not sure why you want to destroy (almost) lossless PWM with capacitors.
If you do, mount the fet on a heatsink. It could use upto half of the power of the heating element.

Tell us what temp sensor you're using.
You might have to read an analogue sensor with 1.1volt Aref.
Leo..

My Mosfet actually already is in trouble because it requires a much higher Vgs voltage than 5 V to be fully switched on. I'm ordering a new one.

If I use PWM, the power supply whistles and funny things happen (like diodes switching off on my nixie tube). I guess the power supply is not designed to supply 7.5 Amps on and off at 0.5 - 1 kHz. This is why I thought that RC filtering would avoid the on and off switching and provide a true analog output out of pin9 instead of a PWM signal. But I understand now that mosfet aren't made for that type of use as they are intended to be used as switches and not as amplifiers. Could I use a linear current amplifying transistor instead? Like this one: TIP142
This way, I could filter the output of pin9, supply it to the TIP124's base and have a smooth current flow in my heater circuit... Or am I missing something?

My sensor is a thermistor 100k@25C with beta of 3950. I'm reading the resistance value with a voltage divider set up.

The IRF3205 is not a logic level MOSFET either.

IRF3706 is logic level, rated 20V and 8.5 milliohm, voltage rating a little on the low side,
an STP80NF55L might be better (logic level, 55V, 5.5 milliohm)

RC filtering would be a catastrophy. Power electronics these days is always switch mode,
its so much more efficient. Things are either on or off, both being low-dissipation states.

An analog power stage would be a heater!

Run your PWM at ~0.1Hz as I said, which is easily doable in software. The PSU will probably
cope with this (if not then its not going to work for switching on and off the heater at all).

Tie in a PID loop and tune...

OP did not explain what type of heater, and what it is used for.
My heater switches on and off six times an hour.
You could call that PWM too.

Optimum PWM frequency depends on if you want to control.
The temp of the heater, or the temp of what it is heating.
Leo..

MarkT:
The IRF3205 is not a logic level MOSFET either.

Yes I realized that just after posting and edited it out. I got this one instead: IRLU8743_IR.

I will stick to ~0.1Hz and tune frequency as well as PID.

@wawa: heater is self made with thin steel plate (~1 mm) and nichrom wire. I expect it to heat up quite fast but also to dissipate pretty fast as well. The thermistor measures the temperature of the steel plate.

RED_ , please tell us what your egg griddle is for. We can help with better ideas, if we can visualize your project.
Perhaps you put something on the plate that lowers the temperature.
Perhaps you want more than 1000 degrees.
Perhaps it is submersible.
Perhaps you need a certain programmed temperature curve.
You see, there are too many possibilities, each with its own requirements.

This way, I could filter the output of pin9, supply it to the TIP124's base and have a smooth current flow in my heater circuit... Or am I missing something?

You are not trying to use the mosfet as a linear audio amp. You are trying to use it as a switch. The idea of "smoothing" the arduino output signal to the mosfet is completely misconceived.

Mosfets waste the most amount of power, when they are turning on, and turning off. When they are turned off, they don't waste power. When they are completely turned on, the Rds of the mosfet is as low as possible, and they don't waste power.

High frequency is completely useless for your problem. Use a lower frequency.

When you turn the mosfet ON, you want the gate voltage to rise as soon as possible. You need a voltage at the gate which is enough to turn the mosfet completely on. You need to choose the resistor between the arduino control output and the mosfet gate, to supply the gate capacitance current to the mosfet as quickly as possible, within the current limit of the arduino digital output.

You probably also need a resistor between the mosfet gate and ground, to discharge the mosfet gate capacitance as quickly as possible, to limit the time it takes the mosfet to turn off.

Your stupid capacitor is contrary to all of these needs.

If you have a coil-wound type of heater, you may need to consider the consequences of its inductance.