I am getting issuse with esp32 and Arduino getting burned whenever I am working with l298n motor driver

I am getting issuse with esp32 getting burned whenever I am working with l298n motor driver sharing the circuit
and code

int in1 = 18;
int in2 = 19;

void setup() {

pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);

digitalWrite(in1, LOW);
digitalWrite(in2, LOW);

}

void loop() {
directionControl();
delay(1000);
}

void directionControl() {

digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
delay(2000);
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
delay(2000);
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);

}

There is no GND between the esp32 and the L298.
Please post designated schematics for helpers not knowing the circuits by heart.
What's voltages on the power sources?

1 Like

You can not source power for a motor driver and motor with the ESP32. You must use an external power supply for the motor driver and motor power source.

1 Like

Don't connect USB with/when ESP VIN connected to 5V.

Thanks,

I have connected VIN and GND to external 5v power supply of ESP32
The L298n module is connected to 12 power supply
I connectd the GND pin of esp32 to L298n module GND to make it as common.

So -- how's that working out?

No The ESP32 getting burned...... My 2 ESP32 damaged

Maybe what you have depicted in your diagram is not consonant with what you are doing in practice.

1 Like

The code doesn't seem anything wrong with it. I burnt an Arduino Uno too by powering the Uno with the 5V regulator, even if it's 5V it's too high current for an Arduino to handle so i'd reccomend using a Lm7805 regulator connected straight to the power source then plugging in the 5V regulated output to the 5V pin but i still can't reccomend it. Because if it's too high current (Arduino's reccomended max current (mA = A/1000): ~750mA) it'll burn the onboard 5V regulator and kaput. If you're not sure it'll handle it, either get a 7.4V rechargable battery or just a 9V battery. Also you need common grounding otherwise it won't work. What i mean is: 12V on the L298N, 5V on the Arduino if you're using a L298N or derivatives needs common grounding so 12V Negative goes to 5V Negative.