TransWikia.com

Arduino turning off when using bipolar stepper motor (L298N Driver)

Robotics Asked by Tushar Bandi on July 26, 2020

Sorry, this might be a bit lengthy, but I really need some help (I am aware that there is a question similar to mine that has already been asked here. However, I couldn’t come up with a solution to my problem based on the answers to that question as I am using a separate power source as stated in that question’s answers.).

This is my first project with an Arduino and a stepper motor. I did some research and found that an L298N motor driver can both drive the motor and power the Arduino if using an external 12V power supply, but it could also handle up to 35V to the motors if the jumper cable was removed and the Arduino externally powered. I wired the stepper motor to the L298N according to the diagram on this website. I removed the jumper on the L298N and hooked up the circuit with a cheap 24V 2A power brick and a 24V to 5V 3A Tobsun EA15-5V DC to DC converter (I wired the 24V positive to the Tobsun and the L298N +12V positive, and I wired the 5V output of the Tobsun to the +5V of the L298N and to the 5V of the Arduino. The ground of the Arduino and the L298N were both wired to the negative of the 24V).

I uploaded the example StepperOneRevolution example to the Arduino, and it seemed to work fine with the motor spinning as expected when the Arduino was plugged into my computer (the 24V power brick was plugged in as well). As soon as I removed the link to my computer, the Arduino and L298N seemed to turn off and on about twice a second (ALL the lights of the Arduino and L298N would flash on and off). The stepper motor would move just a fraction of a rotation when the lights of the Arduino and L298N were on and would stop when they were off. When I unplugged the wires to the motor, the Arduino and L298N would stop flashing and stay on.

After using a multimeter to measure various voltages across the circuit, I thought that maybe the cheap power brick and/or the Tobsun or my wiring were to blame, so I found a 12V 1A power brick around the home that I know works. I replaced the jumper on the L298N and re-wired the circuit to look exactly like the circuit from the same website as before (12V directly to L298N +12V,L298N +5V to the 5V of the Arduino, GND of both to the negative of the 12V brick).
This time, once I plugged in the 12V brick, the motor spun for about a second (twice as long as before), but then the Arduino and L298N turned off and the motor cut out again. This is consistent with it resetting (as stated in the answers to the similar question I mentioned at the beginning).

I have attempted to look for a solution to this, rewire the circuit again, use a different L298N controller, but all to no avail; however, one interesting thing I noticed was that if I get rid of the delay(500), then the motor spins continuously one revolution back and forth (as the StepperOneRevolution example dictates, minus the delay) and Arduino doesn’t turn off. I’m pretty sure it’s not the delay function that is causing the Arduino and L298N to turn off and on because the time between the motor turning off and on remains consistent no matter the amount I put in the delay. If I leave the delay, the motor also doesn’t spin in the opposite direction like it is supposed to after the first delay.

I know that was quite long, but I wanted to get all of the backstory there in detail so that there was no confusion as to what exactly the problem might be. Thank you very much f you read through or even skimmed those paragraphs, and I would truly appreciate if anyone could answer this very specific question! (Please let me know if I missed a detail; I tried not to, but I might have 🙂 )

One Answer

You replaced a 2A power supply with a 1A power supply, and then you're having what sounds like a brownout condition when you try to run a motor that is rated to consumer 2A. One of the reviews on the Amazon link you posted says,

In order to drive this motor you either need a current limited power supply <2A or you need to drive it at about 2V. If you supply it with 12V as stated in the spec sheet, it will draw about 11A, which is plenty to smoke-check both the motor and your H-Bridge. If you're going to use this with the L298N, you must use PWM, or wire 4-8ohm@5W resistors. If you don't know what any of this means, don't use it with the L298N modules you will end up smoke checking the motor or the bridge.

The part itself says in the specifications:

As a stepper motor, it should connect to a constant current or chopper driver. Connecting the motor directly to a power supply will destroy the motor.

What is your power supply voltage when you run it? I would guess you're basically shorting it and you'd see very low voltage if you measured it.

Correct answer by Chuck on July 26, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP