Can someone help me please!!!? IRFZ44n MOSFET heats up driving TEC Peltier

Thread Starter

Stefrod

Joined Dec 9, 2021
5
Hello everyone, I would really appreciate if you could help me
Im making a mini fridge controller (PID), using a 4n25 optocoupler, an IRFZ44n Mosfet and a tec peltier
I connect it to a 12v and 3 A and arduino 5v


As soon as the arduino code is uploaded and I connect it, the mosfet starts to get very hot
what should I do to fix this??
I show you the diagram:
This is my code:

C++:
#include <OneWire.h>

#include <DallasTemperature.h>

OneWire ourWire(2);


DallasTemperature sensors(&ourWire);

#define PWM 13   //-------------Aquà definimos las constantes que se van a utilizar en el programa

const int analogin_potA = A0;



byte man_byte=0;  //Valor final del cambio escalon. (max = 255)


float Kc=96; //---- Constante proporcional del PID   // con kc mas grande el sistema es mas rapido

float Taui=63; //----- Constante integral del PID                       // SETPOINT  de temperatura taoui//

float Taud=0; //----- Constante derivativa del PID


float T=0.5;  //------ Periodo de muestreo de la variable de proceso


float Mk=0; //----Manipulación del PID actual                  //potencia_1

float Mk1=0; //----- Manipulación del PID del tiempo de muestreo anterior                 //potencia_2


float E=0; //----- Error actual

float E1=0;  //----- Error anterior

float E2=0; //------- Eerror 2 veces atrás del tiempo de muestreo actual


float Ref_Temp=5; //-------- Referencia de la temperatura (°C)

float Temp=0; //----- Variable de proceso (temperatura)




//---------------- Constantes del PID digital ---------------

float BC1=0;

float BC2=0;

float BC3=0;

//----------------


void setup()   {  // SETUP

delay(1000);

Serial.begin(9600);

sensors.begin();   //Se inicia el sensor


pinMode(analogin_potA, INPUT);

BC1=Kc*(1+(T/Taui)+(Taud/T));

BC2=Kc*(-1-(2*Taud/T));

BC3=Kc*Taud/T;

}



void loop() {   // Este es la función que se ejecuta cÃclicamente dentro del Arduino

sensors.requestTemperatures();   //Se envía el comando para leer la temperatura

Temp = analogRead(analogin_potA);

// Aquà va la calibración del sensor para convertir los volts leidos en °C

float Temp= sensors.getTempCByIndex(0); //Se obtiene la temperatura en ºC


Serial.print("Temperatura= ");

Serial.print(Temp);

Serial.println(" C");

delay(100);

//

E = Ref_Temp - Temp;


Mk=Mk1+BC1*E+BC2*E1+BC3*E2; // Esta es la ecuación del PID que calcula la manipulación actual (Mk)


// Aquà estamos limitando el valor máximo y mÃnimo de la manipulación a 0-255

if (Mk > 255){

Mk=255;}

if (Mk < 0){

Mk=0;}

man_byte=Mk;



analogWrite(PWM, man_byte); //Aquà mandamos la manipulación actual al pin generador de PWM (pin 5 del arduino)


//Aquà recorremos la manipulación actual a la manipulación anterior, el error actual al error anterior y el error 2 veces anterior al error anterior.

Mk1=Mk;

E2=E1;

E1=E;


//Aquà irÃa la comunicaci+on serial con la computadora para desplegar el valor de la temperatura y leer el valor de la referencia.

Serial.println("Temperatura_1");

    Serial.print(Temp);

    delay(100);

//
}
 

Attachments

Last edited by a moderator:

ericgibbs

Joined Jan 29, 2010
18,766
hi Stefrod,
Welcome to AAC.
The first thing I would do, is remove the Peltier device and replace with say a Resistor/Led load.
That would allow you to debug your code and not have it burn out the MOS.

Do you have an oscilloscope on the work bench.?
E

EDIT:
This is what your code shows on the Serial Monitor.
1639080326164.png


Added two Serial print commands to show the PWM:
I guess you know that the 4N25 inverts the PWM signal to the MOS Gate.
1639080662683.png



Added
 
Last edited:

Thread Starter

Stefrod

Joined Dec 9, 2021
5
First of all, thank you very much for your answer.!
I am also using a DS18b20 waterproof temperature sensor to measure the peltier temperature
 

Papabravo

Joined Feb 24, 2006
21,159
How much current can the Arduino suppply to the diode?
What is the current transfer ratio (CTR) of the opto?
How much collector current is there in the opto, when the MOSFET is off?

MOSFETS typically get HOT when they are operating in their linear region, neither all the way on or all the way off.
They can also get hot if they are miswired.
I second the notion of replacing the Peltier device with a resistor for testing.
 

BobTPH

Joined Jun 5, 2013
8,808
The 5V is for the Arduino. What is supplying the gate voltage? If you are using higher supply for the optocoupler, it might be able to work. How about a schematic so we can see what you are doing, instead of guesssing.

Bob
 

John P

Joined Oct 14, 2008
2,025
What current is the Peltier unit rated for, and how much current would flow from the 12V supply if you just had the unit connected with no transistor at all? I'm wondering if the transistor is getting hot simply because there's too much current passing through it.

I do not like the way you've got the transistor wired up so that if the Arduino isn't powered, the transistor is on. I think it would be better to invert the positions of the isolator and resistor, so the default state would be "off".
 

Thread Starter

Stefrod

Joined Dec 9, 2021
5
Hello everyone, I would really appreciate if you could help me
Im making a mini fridge controller (PID), using a 4n25 optocoupler, an IRFZ44n Mosfet and a tec peltier
I connect it to a 12v and 3 A and arduino 5v


As soon as the arduino code is uploaded and I connect it, the mosfet starts to get very hot
what should I do to fix this??
I show you the diagram:
This is my code:

C++:
#include <OneWire.h>

#include <DallasTemperature.h>

OneWire ourWire(2);


DallasTemperature sensors(&ourWire);

#define PWM 13   //-------------Aquà definimos las constantes que se van a utilizar en el programa

const int analogin_potA = A0;



byte man_byte=0;  //Valor final del cambio escalon. (max = 255)


float Kc=96; //---- Constante proporcional del PID   // con kc mas grande el sistema es mas rapido

float Taui=63; //----- Constante integral del PID                       // SETPOINT  de temperatura taoui//

float Taud=0; //----- Constante derivativa del PID


float T=0.5;  //------ Periodo de muestreo de la variable de proceso


float Mk=0; //----Manipulación del PID actual                  //potencia_1

float Mk1=0; //----- Manipulación del PID del tiempo de muestreo anterior                 //potencia_2


float E=0; //----- Error actual

float E1=0;  //----- Error anterior

float E2=0; //------- Eerror 2 veces atrás del tiempo de muestreo actual


float Ref_Temp=5; //-------- Referencia de la temperatura (°C)

float Temp=0; //----- Variable de proceso (temperatura)




//---------------- Constantes del PID digital ---------------

float BC1=0;

float BC2=0;

float BC3=0;

//----------------


void setup()   {  // SETUP

delay(1000);

Serial.begin(9600);

sensors.begin();   //Se inicia el sensor


pinMode(analogin_potA, INPUT);

BC1=Kc*(1+(T/Taui)+(Taud/T));

BC2=Kc*(-1-(2*Taud/T));

BC3=Kc*Taud/T;

}



void loop() {   // Este es la función que se ejecuta cÃclicamente dentro del Arduino

sensors.requestTemperatures();   //Se envía el comando para leer la temperatura

Temp = analogRead(analogin_potA);

// Aquà va la calibración del sensor para convertir los volts leidos en °C

float Temp= sensors.getTempCByIndex(0); //Se obtiene la temperatura en ºC


Serial.print("Temperatura= ");

Serial.print(Temp);

Serial.println(" C");

delay(100);

//

E = Ref_Temp - Temp;


Mk=Mk1+BC1*E+BC2*E1+BC3*E2; // Esta es la ecuación del PID que calcula la manipulación actual (Mk)


// Aquà estamos limitando el valor máximo y mÃnimo de la manipulación a 0-255

if (Mk > 255){

Mk=255;}

if (Mk < 0){

Mk=0;}

man_byte=Mk;



analogWrite(PWM, man_byte); //Aquà mandamos la manipulación actual al pin generador de PWM (pin 5 del arduino)


//Aquà recorremos la manipulación actual a la manipulación anterior, el error actual al error anterior y el error 2 veces anterior al error anterior.

Mk1=Mk;

E2=E1;

E1=E;


//Aquà irÃa la comunicaci+on serial con la computadora para desplegar el valor de la temperatura y leer el valor de la referencia.

Serial.println("Temperatura_1");

    Serial.print(Temp);

    delay(100);

//
}
Guys thanks for helping me!
I just found the mistake.....
the MOSFET burned out and it no longer works, as I found it is because it reached the saturation zone :/
 
Top