Help! seeedstudio L298 Dual H-brigde and a Stepping motor

Hi :slight_smile:

I am completely new to Arduino and electronics at all, and therefore have i ran in to some problems in connecting an Arduino Uno and the Seeedstudio L298 Dual H-brigde and a bipolar stepping motor.

Currently i have connected the 1I to pin 8, 2I to pin 9, 3I to pin10 and 4I to pin 11.

The signal EA is connected to pin2, and EB to pin3.

Basically its:

//H-Bridge pins
int. I1 pin 8
int. I2 pin 9
int. I3 pin 10
int. I4 pin 11
int speed. EB pin 4 //PWM
int speed EA pin 2 //PWM

The Arduino Sample that i have loaded on to my Arduino is the sample sketch from the library.

/*
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(60);
// initialize the serial port:
Serial.begin(9600);
}

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

// step one revolution in the other direction:
Serial.println(“counterclockwise”);
myStepper.step(-stepsPerRevolution);
delay(500);
}

I know that this input is not enough but I don’t know how to write a proper program… so basically my question is: Is this setup correct and how could i alter the sketch so it fits my purpose, which basically is to make to motor spin 60 steps oneway and then 60 steps back the other way.

I apologize if theres any misspellings or sentences which are hard to understand since english is not my native language.

Best regards Mathias.

The H-brigde:
robotshop.com/eu/content/PDF … 103b1m.pdf

Stepping motor:
reprap.org/mediawiki/images/a/af … torque.pdf
it’s a 42mm high torque hybrid stepping motor, with a step angle of 1.8 degrees.

Arduino Uno:
store.arduino.cc/eu/index.php?ma … cts_id=195

Hi,
Here is my controlled 4 wire stepping motor example.The arduino stepper library look like can not work corrected because of the sequence of control signals for 4 control wires that I really can not understand it.

//H-Bridge pins
I1 -> pin 8
I2 -> pin 9
I3 -> pin 10
I4 -> pin 11
EA/EB -> HIGH(5V)

Motor A -> Stepping Motor 1
Motor B -> Stepping Motor 2
Motor C -> Stepping Motor 3
Motor D -> Stepping Motor 4

[code]
#define IN1 8
#define IN2 9
#define IN3 10
#define IN4 11
#define time 10
void setup() {

pinMode(IN1,OUTPUT);
pinMode(IN2,OUTPUT);
pinMode(IN3,OUTPUT);
pinMode(IN4,OUTPUT);

}
void loop() {
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
digitalWrite(IN3,LOW);
digitalWrite(IN4,LOW);
delay(time);
digitalWrite(IN1,HIGH);
digitalWrite(IN2,HIGH);
digitalWrite(IN3,LOW);
digitalWrite(IN4,LOW);
delay(time);
//1
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
digitalWrite(IN3,LOW);
digitalWrite(IN4,LOW);
delay(time);
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);
delay(time);
//2
digitalWrite(IN1,LOW);
digitalWrite(IN2,LOW);
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);
delay(time);
digitalWrite(IN1,LOW);
digitalWrite(IN2,LOW);
digitalWrite(IN3,HIGH);
digitalWrite(IN4,HIGH);
delay(time);
//3
digitalWrite(IN1,LOW);
digitalWrite(IN2,LOW);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
delay(time);
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
delay(time);
}[/code]

Hope it can help you .
Deray