Arduino Forum

Using Arduino => Project Guidance => Topic started by: mrwigster on Jan 12, 2016, 07:55 pm

Title: Stepper Motor with L298n driver and 12v - slow/no torque?
Post by: mrwigster on Jan 12, 2016, 07:55 pm
My setup is fairly simple.
Arduino Uno (USB PC Powered) with ports 8 to 11 connected to the L298n driver. L298n driver powered by a 12v wall wart (2A).

My setup is basically the exact same as this tutorial:
Tutorial (http://tronixlabs.com/news/tutorial-l298n-dual-motor-controller-module-2a-and-arduino/)

However my stepper is slightly different with different coloured wires:

Stepper motor on Amazon (http://www.amazon.co.uk/gp/product/B00EYIFW70/ref=as_li_tl?ie=UTF8&camp=1634&creative=19450&creativeASIN=B00EYIFW70&linkCode=as2&tag=trul03-21)

Some pictures of the setup:
(http://i.imgur.com/EqQt1F6.jpg)
(http://i.imgur.com/XpNvUtQ.jpg)
(http://i.imgur.com/tp0DKRR.jpg)

Using this code:
Code: [Select]

/*
 Stepper Motor Control - one revolution

 This program drives a unipolar or bipolar stepper motor.
 The motor is attached to digital pins 8 - 11 of the Arduino.

 The motor should revolve one revolution in one direction, then
 one revolution in the other direction.


 Created 11 Mar. 2007
 Modified 30 Nov. 2009
 by Tom Igoe

 */

#include <Stepper.h>

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

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

void setup() {
  // set the speed at 60 rpm:
  myStepper.setSpeed(10);
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one revolution  in one direction:
  Serial.println("clockwise");
  myStepper.step(stepsPerRevolution);
  delay(500);
}



However the motor spins very slowly and has very little torque (can stop it with a slight pinch of the fingers). Is this normal? I was hoping to use this motor to pull the cord of some window blinds.

I've tried changing the setSpeed value to values between 1 and 60, towards 60 the motor just starts jittering like it can't keep up with the command rate.

Only thing I can possibly think of is bad wiring somewhere or the code isn't correct. Am I meant to have a ground also running back to the Arduino board?

At the moment I'm a little lost -- any ideas would be great?
Title: Re: Stepper Motor with L298n driver and 12v - slow/no torque?
Post by: Robin2 on Jan 12, 2016, 09:41 pm
The L298 is very inefficient and will not be presenting the full 12v to the motor. I have similar motors that I control with Pololu A4988 stepper drivers. The motors also work much better with 20v or more. The A4988 can limit the current to protect the motor.

...R
Stepper Motor Basics (http://forum.arduino.cc/index.php?topic=284828.0)
Title: Re: Stepper Motor with L298n driver and 12v - slow/no torque?
Post by: DVDdoug on Jan 12, 2016, 11:33 pm
The Adafruit website (https://www.adafruit.com/product/324) has the specs and it shows the wire-pairs as red-yellow and green-brown/grey.  So, it looks like you're wired correctly.    As long as the pairs  are right you should get full-torque.    (It might run backwards if the wiring is otherwise wrong.)

I can't tell if the green wires are correct.

I don't have any experience with that driver board, but if the heatsink doesn't seem to be overheating that means most of the power is being delivered to the motor.


P.S.
Your close-up picture looks like you're connected to the wrong arduino pins.  Your software says you're connected to pins 8, 9, 10 and 11.
Title: Re: Stepper Motor with L298n driver and 12v - slow/no torque?
Post by: mrwigster on Jan 13, 2016, 10:44 am
The pins definitely are in the right way (8,9,10,11) the picture is just a little confusing.

I've done a quick test with a multimeter and found that across the 12v pins there's definitely 12v being measured.

However on the outputs that go to each coil-- it's hardly even measuring 1v?
(http://i.imgur.com/kHbMQHM.jpg)
(http://i.imgur.com/qZ6ENqH.jpg)
(http://i.imgur.com/K44xM7l.jpg)
Title: Re: Stepper Motor with L298n driver and 12v - slow/no torque?
Post by: Robin2 on Jan 13, 2016, 11:21 am
Was the motor moving or stationary when you measured the voltage on the coils?

Have you a simple DC motor that you could use to test the L298?

If the stepper rotates it must be getting some current.

Have you tried rotating the motor when it is disconnected - to get a feel for the effort required?
It should be much more diffficult to rotate when powered up?

I don't know about the L298 but disconnecting a motor from an A4988 driver while the driver is powered is supposed to destroy the driver.

...R
Title: Re: Stepper Motor with L298n driver and 12v - slow/no torque?
Post by: jremington on Jan 13, 2016, 05:59 pm
Quote
However on the outputs that go to each coil-- it's hardly even measuring 1v?
Have you connected the Arduino ground to the motor driver GND? I don't see it.

Assuming everything is wired correctly, as Robin2 pointed out, if you have ever disconnected the motor from the driver while powered up, the driver output transistors may have been destroyed.

The motor is specified to be 12V/350 mA, which should work well with the L298 driver, however up to 4 of the 12V will be lost in the driver.
Title: Re: Stepper Motor with L298n driver and 12v - slow/no torque?
Post by: mrwigster on Jan 13, 2016, 06:24 pm
Have you connected the Arduino ground to the motor driver GND? I don't see it.

Assuming everything is wired correctly, as Robin2 pointed out, if you have ever disconnected the motor from the driver while powered up, the driver output transistors may have been destroyed.

Ground -- nope I haven't, the tutorial I followed didn't mention this however I did find it odd.

I'm thinking at the moment your's and Robin2's suggestion about the driver being broken may be true, I did try changing the coils whilst it was powered several times (at least 5) -- as I wasn't aware this was that destructive. I'm going to buy a new motor driver and see the outcome (without doing stupid changes on the fly this time!).

Thanks for the help so far.
Title: Re: Stepper Motor with L298n driver and 12v - slow/no torque?
Post by: jremington on Jan 13, 2016, 06:28 pm
Quote
Ground -- nope I haven't, the tutorial I followed didn't mention this however I did find it odd.
Yes, it did. Try that before you buy another driver!

From the tutorial:
Quote
Next, connect your power supply - the positive to pin 4 on the module and negative/GND to pin 5. If you supply is up to 12V you can leave in the 12V jumper (point 3 in the image above) and 5V will be available from pin 6 on the module. This can be fed to your Arduino's 5V pin to power it from the motors' power supply. Don't forget to connect Arduino GND to pin 5 on the module as well to complete the circuit.
Title: Re: Stepper Motor with L298n driver and 12v - slow/no torque?
Post by: Robin2 on Jan 13, 2016, 08:15 pm
I'm going to buy a new motor driver and see the outcome (without doing stupid changes on the fly this time!).

Get a specialized stepper driver NOT another L298

...R
Title: Re: Stepper Motor with L298n driver and 12v - slow/no torque?
Post by: mrwigster on Jan 14, 2016, 12:09 pm
Yes, it did. Try that before you buy another driver!

From the tutorial:
Ahh, so I should jam both the 12v cable for Negative/Ground in along with the GND that goes to the Arduino in the same hole of the l298n?
Title: Re: Stepper Motor with L298n driver and 12v - slow/no torque?
Post by: jremington on Jan 14, 2016, 04:43 pm
In effect.
Title: Re: Stepper Motor with L298n driver and 12v - slow/no torque?
Post by: zenData on Jan 11, 2018, 11:25 am
i done this with.  would u like the code and pics?
Title: Re: Stepper Motor with L298n driver and 12v - slow/no torque?
Post by: mrwigster on Jan 11, 2018, 11:31 am
i done this with.  would u like the code and pics?
Sure--that would be great!