I've just bought a Nema 17 (Motor NEMA 17 40mm 1,2A 2,6kg/cm 1,8º 42STH40 1204A CNC) to build a pet feeder, and to control it I'm using a L298N driver I've also bought. I've wired everything together as shown in the following photo. I attach a 12V, 1.5A power adapter to the female jack over to the right. The Arduino gets powered up from the 5V + GND from the L298N


I'm using Arduino's Stepper library and it works ok. However the L298N board quickly heats up and gets very hot, I cannot even touch the heat sink. I'm pretty sure I'm doing something wrong. Why does it get so hot?

Edit 1: Here are the specs of the motor.

  • 4-wire bipolar operation
  • Compatible with NEMA17 standard
  • Dimensions: 42 x 42 x 40mm
  • Motor shaft diameter: 5mm
  • Step angle: 1.8 degrees
  • Step Count per revolution: 200
  • Standard Voltage: 2V
  • Phase current: 1.2A
  • Phase resistance: 1.7 ohm
  • Holding torque: 4N.m (minimum)
  • Weight: 290g
  • \$\begingroup\$ heat like toy are talking about comes from mostly one place: i^2 * R. So do you know the current your motor demands at 12V, and do you know what the L298N has to say about Rds_on? \$\endgroup\$
    – vicatcu
    Commented Jan 28, 2020 at 22:49
  • \$\begingroup\$ Is the motor this one? ebay.com/itm/… \$\endgroup\$ Commented Jan 28, 2020 at 23:34
  • \$\begingroup\$ Is it heating on load or simply when turning freely? It is quite easy to go over-current with stepper motors and yours seem to be the case. Also, the motor is rated at 1.2A but your power supply is 1.5A, and your motor driver is 2A MAX. This means that you'll have heat issues once your motor is on load...or worse. \$\endgroup\$
    – Natsu Kage
    Commented Jan 28, 2020 at 23:37
  • 1
    \$\begingroup\$ Well, what is the resistance of the motor? 12 volts divided by resistance of the motor tells you what current will flow. I suspect it is too high! I think you need a series (power) resistor. \$\endgroup\$ Commented Jan 29, 2020 at 1:35
  • \$\begingroup\$ I've added the specs of the motor. @BruceAbbott yep that's the one. There's no load on the motor for now. I thought the 1.5A on the power supply was the max current. \$\endgroup\$ Commented Jan 29, 2020 at 7:09

3 Answers 3


The cheap L298 modules don't have a chopper or current setting so you have to add a big power resistor in series with each winding if you want relatively high performance. You could also lower the supply voltage to about 5V from 12V which would work, but the motor would not be able to accelerate as fast.

To get 2V with a 12V supply, you would need to throw away 10V in the resistors and chip which is really wasteful. If you want to try it, you could try 1A or 1.1A, with something like a 6.8\$\Omega\$ or 7.5\$\Omega\$resistor on each winding, rated for 10W or so.

Or buy a stepper driver that has a current setting and chopper circuit. You can probably source one of those for not much more than the two power resistors. Some of them will allow you to increase the supply voltage to 24 or 36V which will give you better performance. You need to set the current (see the instruction for how to do that) to something like 1A or 1.1A) and the driver will automatically PWM the power to the motor to keep the current at close to the correct level from idle to maximum speed. Some also have an idle current reduction feature that reduces the current through the coils to a lower level so the motors won't easily turn (as they would if you completely turned the current off), but they run cooler.

Edit: The series resistor (or PWM but I'm not discussing that here) means that the time constant L/R is reduced significantly (L being the coil inductance). In the case of a 6.8 ohm resistor in series with a 1.7 ohm coil, it's reduced by a factor of 5.

  • 1
    \$\begingroup\$ I've read about the DRV8825 and preemptively ordered one off ebay for a couple euros. Would that one work? That one does have a current setting for the stepper motor. \$\endgroup\$ Commented Jan 29, 2020 at 11:06
  • \$\begingroup\$ Seems like a good choice. \$\endgroup\$ Commented Jan 29, 2020 at 11:30

It pays to read specs.

Standard Voltage: 2V
Phase current: 1.2A
Phase resistance: 1.7 ohm

The Hi+Lo side drivers have some specs which are roughly equivalent to 1 ohm per side, so you have...

Pd= 5V^2/3.7=6.75W per phase x2=13.5W with 2/3.7=54% of the total power dumped into the heatsink which based on about 1sq"/W (my rule of thumb) makes this heatsink too hot to touch and your current limiting inadequate.

Try PWM to reduce the current on idle.

They say it's OK to use 12V on these motors, but not on idle after step complete. The thermal limit is 2V average across the windings.


This is an old post, but I thought to bring something more helpful to the newbies. The stepper.h include file does only provide a very basic stepper motor object. The L298N is a very basic motor controller.

What is missing is an idle function. Notwithstanding the issue of specs, I feel like a pet-feeder should not require industry strength controllers.

When using the stepper.h file, the stepper always stops at a position at which it is held at full current. This kills the L298N and it heats up like a frying pan.

Usually the Arduino pins used for driving the L298N are 8, 9, 10 and 11. Make sure the output pins are set to 0 after a myStepper.step() instruction. Use this simple routine after every step (see example). You can run this forever without the controller getting hot.

void setup() {
  // set the speed at 60 rpm:
  // initialize the serial port:

void setStepperIdle() {
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW);

void loop() {
  // step one revolution  in one direction:

  // step one revolution in the other direction:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.