# Controlling a peltier element with a PWM-driven IRL530 MOSFET

Hi everyone! It's been some time since I've last posted here, because I haven't had to work with Arduino for a while. However, for my current project I do and I'm stuck with the schematics. I've spent several hours searching for a solution, but it seems I can only find partial solutions to my problem. I need to design a circuit that reads in the temperature using a thermistor, prints this to the computer and lets the user control a peltier element to gradually cool a surface. No problem with the first two parts, but the last one seems quite challenging. I've started with the following circuit, using a DS18B20 digital thermistor and controlling a LED with PWM, using two pushbuttons:

I figured if I got the code working with a LED, I could just replace the LED with the ordered peltier elements when they arrive and I would be done. However, I discovered the lab where I work has some spare peltiers lying around, so I decided to do already do some first tests. I have an education in electronics-ICT (graduated a couple of months ago) so the people at the lab expect me to know how to build this kind of circuits. Unfortunately, my education was highly IT-oriented and we never got to build more than the most simple of analog circuits. I have a theoretical understanding on how peltiers and MOSFETS work, yet I can't seem to turn this knowledge into practice. I've been given a peltier with no datasheet or type on it, just a label stating: I(max) = 6.4 A, V(max) = 14.9 V, Q(max) (delta T = 0) = 53 W, delta T(max) = 68 °C, R = 1.98 Ohm. I've also been given a box of IRL530 MOSFETS, which should be sufficient for this circuit and told to “look up a datasheet and check it for yourself”. I've found the following datasheet: http://www.datasheetcatalog.com/datasheets_pdf/I/R/L/5/IRL530.shtml. However, I cannot figure out how to check whether this should suffice. What I see is that Id @ Tc = 25 °C = 15 A @ Vgs = 5 V; I guess this is okay since the peltier will draw 6.4 A max and I can provide 5 Vgs with an Arduino output pin. What about the voltage, though? What I'm asking is:

a) How do I correctly interpret the datasheet (practically no experience in doing this, we just used examples from the textbooks)? Which values do I need to look at? b) If this indeed a good MOSFET for this application, how do I connect the Arduino, the IRL530 and the peltier? c) Am I correct in assuming I can control the amount of cooling using a PWM signal or is there a better way to do this?

Like I said, I've spent a couple of hours on forums trying to find a solution. I've found some related posts using PWM and a FET to control a motor or a LED array, but they mostly deal with to some specific components or connections in the circuit, not with selecting the right components or building the entire circuit. I've been hesitant to ask anyone for help, because I have the strong feeling that I should already know these things. However, I have to acknowledge that I don't and this seemed like the best place to ask. So, can anyone please provide a practical explanation (or point me in the right direction)?

a) How do I correctly interpret the datasheet (practically no experience in doing this, we just used examples from the textbooks)? Which values do I need to look at?

Max working voltage, Ron value, max current are the basic specs to be concerned with. For arduino use you then need to look at what gate/source voltage causes Ron to turn on to minimum ohm value.

b) If this indeed a good MOSFET for this application, how do I connect the Arduino, the IRL530 and the peltier?

No, that mosfet is a standard one where it's rated Ron spec requires +10vdc gate/source voltage, and as the arduino only outputs +5vdc, you can never turn on the mosfet to it's max current rating. You need to use a 'logic level' mosfet for direct wiring to a arduino output pin.

Here is an example of the 'logic level' N-channel power MOSFET suitable to be wired directly to an arduino output pin: http://www.sparkfun.com/products/10213 They have a datasheet you can compair with yours.

c) Am I correct in assuming I can control the amount of cooling using a PWM signal or is there a better way to do this?

You will be able to control the average current going to the peltier device from 0 to 100%, if that then will control the temp to your requirements is another thing all together. There is a lot of mechanical and heat transfer stuff to take into consideration that I can't really help with, perhaps others can

Lefty

Using PWM to control a Peltier device is controversial, some people have had good results and others not so good.

Thank you for the replies, at least I’ve got an idea what to look for now.

Grumpy_Mike:
Using PWM to control a Peltier device is controversial, some people have had good results and others not so good.

Is there a better, non-controversial way to control the peltier device?

Yes smooth the PWM before you apply it to the FETs gate and have the FET in a source follower mode. For 12V you will have to get a 12V smoothed PWM signal by using another transistor.

However, that puts the FET into linear mode and so it will dissipate a lot of heat meaning a bigger FET and a large heat sink.

retrolefty:
a) How do I correctly interpret the datasheet (practically no experience in doing this, we just used examples from the textbooks)? Which values do I need to look at?

Max working voltage, Ron value, max current are the basic specs to be concerned with. For arduino use
you then need to look at what gate/source voltage causes Ron to turn on to minimum ohm value.

b) If this indeed a good MOSFET for this application, how do I connect the Arduino, the IRL530 and the peltier?

No, that mosfet is a standard one where it’s rated Ron spec requires +10vdc gate/source voltage, and as the arduino only outputs +5vdc, you can never turn on the mosfet to it’s max current rating. You need to use a ‘logic level’ mosfet for direct wiring to a arduino output pin.
[/quote]
Ahem, read the datasheet, it is a logic level MOSFET rated at Vgs=4V and Vgs=5V so it’s fine for the purpose. Perhaps you typed “IRF530” instead of “IRL530” into google?

I’d add that the Imax is an irrelevant spec in most situations since its invariably the thermal limit and without a large heatsink and forced air cooling you won’t be going there.

Calculate the dissipation in the MOSFET from I-squared-R and if more than 0.5W you’ll need a heatsink…

Grumpy_Mike: Yes smooth the PWM before you apply it to the FETs gate and have the FET in a source follower mode. For 12V you will have to get a 12V smoothed PWM signal by using another transistor.

However, that puts the FET into linear mode and so it will dissipate a lot of heat meaning a bigger FET and a large heat sink.

Alternatively, stick with PWM drive to the mosfet but increase the frequency and smooth the output using an inductor and a Schottky power diode. That way the mosfet stays cool. But you need to choose the inductor carefully.

dc42: Alternatively, stick with PWM drive to the mosfet but increase the frequency and smooth the output using an inductor and a Schottky power diode. That way the mosfet stays cool. But you need to choose the inductor carefully.

This seems like an interesting way to do it. How do I achieve the increase in frequency, though? By playing around with the timer settings? Is this necessary because the FET will otherwise switch on and off all the time because the current frequency is too low, or is there another reason?

Perhaps an alternative way to achieve the same results (the temperature of the surface should gradually drop and then stay constant for a certain amount of time) would be to just use the transistor as a switch. Since I'm already measuring the temperature, I could program the Arduino to automatically switch the transistor off when the desired temperature has been reached and switch it on again when it drops beneath some threshold. I could use a button for manual control as well. In this case I could drop the PWM. Would I still need a smoothing circuit or is the 5V output of the Arduino smooth enough to drive the transistor?

Mihasi: How do I achieve the increase in frequency, though? By playing around with the timer settings? Is this necessary because the FET will otherwise switch on and off all the time because the current frequency is too low, or is there another reason?

The reason for increasing the frequency is to allow you to use a smaller inductor. See http://www.arduino.cc/playground/Code/PwmFrequency for how to increase the frequency. I suggest leaving timer 1 alone so that millis() and delay() continue to work.

Mihasi: Perhaps an alternative way to achieve the same results (the temperature of the surface should gradually drop and then stay constant for a certain amount of time) would be to just use the transistor as a switch. Since I'm already measuring the temperature, I could program the Arduino to automatically switch the transistor off when the desired temperature has been reached and switch it on again when it drops beneath some threshold. I could use a button for manual control as well. In this case I could drop the PWM. Would I still need a smoothing circuit or is the 5V output of the Arduino smooth enough to drive the transistor?

No, you wouldn't need a smoothing circuit.

I decided to test it today, and it worked perfectly in switch configuration with the following circuit (the LED is still there to indicate when the transistor is switched on):

I attached a cooling fin from a computer to the transistor (the IRL530), but it doesn't get very hot. That's probably because it's dissipating about 30 W, while the datasheet recommends applications below 50 W. I've also attached a cooling fin with a fan on top to the peltier element so as to keep it from overheating (the fan is connected directly to the 12 V source).

Surprisingly, it works with PWM as well in this exact configuration. I tested it with a 12 V, 20 W light bulb first, then with the peltier. With 100% PWM the circuit draws peltier draws 3.3 A, with 70% it goes down to about 2.4, with 50% it's 1.5, etc. No smoothing or extra components necessary. Apparently, I'm amongst the lucky few who have good results with this. ^^

Thanks for all the help, guys.

I'm glad you got it working. A couple of points:

1. Mosfets have a large input capacitance, and it's normal to connect a series resistor in series with the gate of the mosfet to limit the current surge when the pin switches. 100 to 150 ohms is about right for the Arduino. This is especially important if you are using PWM because the surge happens every time the mosfet switches.

2. The mosfet shouldn't be dissipating as much 30W. Its Rds(on) in that configuration shouldn't exceed 0.2 ohms, so if the Peltier takes its maximum current of 6.4A, the dissipation will be around 8W when it is conducting. There are other mosfets with lower Rds(on), some so low that you wouldn't need a heatsink at all.

dc42:

1. Mosfets have a large input capacitance, and it’s normal to connect a series resistor in series with the gate of the mosfet to limit the current surge when the pin switches. 100 to 150 ohms is about right for the Arduino. This is especially important if you are using PWM because the surge happens every time the mosfet switches.

When you say in series, do you mean I should put a resistor between the gate of the mosfet and the wire going to pin 13 on the Arduino? If this resistor is to limit the current surge, wouldn’t it make more sense to connect it parallel to the gate, i.e. between the gate and the ground? (It seems to me that if it’s between the pin and the gate, the same current goes through the wire so it doesn’t limit the surge at all.)

dc42:
2. The mosfet shouldn’t be dissipating as much 30W. Its Rds(on) in that configuration shouldn’t exceed 0.2 ohms, so if the Peltier takes its maximum current of 6.4A, the dissipation will be around 8W when it is conducting. There are other mosfets with lower Rds(on), some so low that you wouldn’t need a heatsink at all.

You’re right, that was a miscalculation on my part (no idea how I got there). The resistance of the peltier is 1.98 ohms, so the total theoretical current should be 12 V / (0.16 + 1.98 ohms) = 5.6 A; which would result in a dissipation of 5.6 A ^ 2 * 0.16 ohms = 5 W. The actual power dissipation is closer to 3.3 A ^ 2 * 0.16 = 1.7 W. Since this exceeds 0.5 W, it’s safer to keep the heatsink on, right?

Mihasi: When you say in series, do you mean I should put a resistor between the gate of the mosfet and the wire going to pin 9 on the Arduino? If this resistor is to limit the current surge, wouldn't it make more sense to connect it parallel to the gate, i.e. between the gate and the ground? (It seems to me that if it's between the pin and the gate, the same current goes through the wire so it doesn't limit the surge at all.)

The resistor goes in series with the gate, i.e. between the gate and the Arduino pin in place of the wire you have currently. A resistor between gate and ground wouldn't limit the current surge. However, a much larger value resistor between gate and ground or (better) between Arduino pin and ground is sometimes used to ensure the mosfet stays switched off while the Arduino is starting up. You led and resistor will probably have the same effect, at least if the led is a red one.

Mihasi: You're right, that was a miscalculation on my part (no idea how I got there). The resistance of the peltier is 1.98 ohms, so the total theoretical current should be 12 V / (0.16 + 1.98 ohms) = 5.6 A; which would result in a dissipation of 5.6 A ^ 2 * 0.16 ohms = 5 W. The actual power dissipation is closer to 3.3 A ^ 2 * 0.16 = 1.7 W. Since this exceeds 0.5 W, it's safer to keep the heatsink on, right?

Yes. Mosfets in TO-220 cases should be OK to dissipate 1W without a heatsink, but for more than that I would use one. Or use two of those mosfets in parallel, which will halve the total power dissipation and hence reduce the dissipation per mosfet to around 0.45W, so no heatsinks will be needed.

dc42: The resistor goes in series with the gate, i.e. between the gate and the Arduino pin in place of the wire you have currently. A resistor between gate and ground wouldn't limit the current surge. However, a much larger value resistor between gate and ground or (better) between Arduino pin and ground is sometimes used to ensure the mosfet stays switched off while the Arduino is starting up. You led and resistor will probably have the same effect, at least if the led is a red one.

Okay, I misunderstood current surge. Note to self: next time google first, ask questions later. I guess it's getting late. :p What difference does it make what color the LED is? (But yes, it is a red one.)

Mihasi: What difference does it make what color the LED is? (But yes, it is a red one.)

The voltage at which a red LED starts to conduct is lower than for the other visible colours, so it should keep the gate-source voltage below the gate threshold voltage.