Pages: [1]   Go Down
Author Topic: Help! L298N Dual H-brigde, Arduino uno and at bipolar stepmotor  (Read 1393 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi smiley 

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:
http://www.robotshop.com/eu/content/PDF/datasheet-mot103b1m.pdf

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

Arduino Uno: 
http://store.arduino.cc/eu/index.php?main_page=product_info&cPath=11&products_id=195
Logged

0
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12725
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need to connect the enable pins HIGH I think - if you've connected them to 2 and 4 then
Code:
 pinMode (2, OUTPUT); digitalWrite (2, HIGH) ;
  pinMode (4, OUTPUT); digitalWrite (4, HIGH) ;
Or you can wire them to +5V.

BTW note the code tags that can be used to include code examples as above (the # button)


[ Also did you say bipolar?  And you're using Stepper.h - go read the documentation about how to wire a bipolar motor for the Stepper library, I think you've got the wrong circuit ]
« Last Edit: May 18, 2012, 05:51:19 am by MarkT » Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you very much smiley

I will try to do so, and see if I can make it work smiley
Logged

Pages: [1]   Go Up
Jump to: