Issues with L298N heating up

Hello, I am revamping a school lab and I am having issues with the L298N motor driver's heat sink getting extremely hot. I am new to coding and wiring, but i have had my wiring hcecked by a teacher and they told me it was fine. so i think the heating issue has to do with my code. my goal is to be able to use the petentiometer to control the speed of my Nema 17 stepper motor using a 12V power source. (Updated) I just spoke to the teacher and he mentioned another avalible motor driver he has avalible is the TMC2208. would this be feasible with the setup?
Motor Datasheet
TMC2208 Data

#include <Stepper.h>

const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
// for your motor
int stopType =0;

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

int stepCount = 0;  // number of steps the motor has taken

void setup() {
  // nothing to do inside the setup
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW);
}

void loop() {
  // read the sensor value:
  int sensorReading = analogRead(A0);
  // map it to a range from 0 to 100:
  int motorSpeed = map(sensorReading, 0, 1023, 0, 100);
  // set the motor speed:
  if (motorSpeed > 4) {
    myStepper.setSpeed(motorSpeed);
    // step 1/100 of a revolution:
    myStepper.step(stepsPerRevolution / 100);
  }
  if (motorSpeed <= 4){
    setup;
  }
}

My circut diagram

1 Like

Please post a data sheet for your stepper motor.

The L298 is not an appropriate driver for modern bipolar stepper motors. Those should have a proper current controlling stepper driver.

Please do not post screen shots of code. Read the forum guidelines to see how to properly post code and some good information on making a good post.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Please go back and fix your original post

14 different steppers are listed there but You don't tell which one.
Clear is that Your teacher is ignorant/incompetent telling You use incompatible motor and driver.

Hi. can you tell me more about this ?
I purchased L298 as it was cheap and a frequent reference on the net, but I am totally ignorant about your point. Do you know if the stepper included in the arduino starter pack belong to the "modern" category?

That is fine for small, brushed DC motors found in toys, but it wastes up to half the motor supply power in a typical application, due to extreme inefficiency.

Pololu has a great collection of modern, efficient drivers for both steppers and brushed DC motors, and they provide excellent product support. Spend some time looking at their site.

I know nothing of the Arduino starter pack in particular, but the stepper that comes many starter kits is a small unipolar stepper and a ULN2003 driver. Those are not NEMA 17 motors.

NEMA 17 describes the only physical dimensions of the motor. NEMA 17 does not tell the electrical characteristics that we need to know. Post the exact and full part number please.

The L298 is indeed popular with beginners. It is cheap and plentiful. But it is very old technology. It is very inefficient. It drops from 2V to over 4V of the motor power, dissipating it as heat. Ask yourself, why does it need that giant heat sink? Look at the stepper motor driver of similar specifications at Pololu. No giant heat sinks and look at the size of the boards. 1/4 the size of the L298.

thks @groundFungus and @jremington.

actually, my L298 is connected to brush DC motor in a toy car!

Good luck with your project.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.