Go Down

Topic: Stepper Motor with L298n driver and 12v - slow/no torque? (Read 4052 times) previous topic - next topic

mrwigster

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

However my stepper is slightly different with different coloured wires:

Stepper motor on Amazon

Some pictures of the setup:




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?

Robin2

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
Two or three hours spent thinking and reading documentation solves most programming problems.

DVDdoug

The Adafruit website 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.

mrwigster

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?



Robin2

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
Two or three hours spent thinking and reading documentation solves most programming problems.

jremington

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.

mrwigster

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.

jremington

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.

Robin2

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
Two or three hours spent thinking and reading documentation solves most programming problems.

mrwigster

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?

jremington


zenData

i done this with.  would u like the code and pics?

mrwigster


Go Up