Stepper> robotbase dual HBridge>

Hi All, My background is Electronic Servicing, I once built what possibly was the first Micro Controller project using a Motorola Mc6801L, what a hoot! - However I am completely new to some things Arduino, for example, I have several stepper motors BiPolar in the main, There are many projects I would like to complete, No1 on my plate is a solarpanel rotater to keep the panel always facing squarely towards the Sun, not so much of a task!! but I can't find any instructions for- nor can I work out how to interface my Duemilanove Board to the RobotBase Dual H-Bridge I have, :-? Kiwijor.

This might be a silly question, but, why did you buy a "RobotBase Dual H-Bridge" if you had no idea whether it would work with the Arduino?

Do you have a link to this thing, or do you expect us to do all the work?

The unit was advertised as a L298 Dual H-Bridge Motor Driver - you can see it at http://www.seeedstudio.com/depot/l298-dual-hbridge-motor-driver-p-284.html

It’s not a case of “the unit can’t work with Arduino”, it’s a case of I can’t find any details of how to set it up so it works with Arduino,

I thought there might be some bright guy out there who has had experience with this particular unit. I have written to SeeedStudio, but received no reply.

Hmmm, documentation is poor, doesn't explain the pin-outs - a little experimentation is needed - note it has LEDs to show the H-bridge state so it shouldn't be hard to find out by trial and error without even connecting a motor. Each H-bridge control input is 3-pin, presumably two direction inputs and ground?

presumably two direction inputs and ground?

With three inputs, wouldn't that imply direction (forward/backward), speed (or on/off), and ground?

I'd be willing to bet that each set of pins go to the inputs on the L298 chip and the appropriate enable, and the "logic ground" is shared with the Arduino's ground, of course.

See the datasheet for the L298 here:

So - one set of the pins are for IN1, IN2, ENA (pins 5, 7, and 6 on the L298 multiwatt, respectively), and the other set of pins are for IN3, IN4, ENB (pins 10, 12, and 11 on the L298 multiwatt, respectively). To find out which pins are what, trace them from the header pins on the board to the pins on the L298 multiwatt on the board.

Operation seems fairly simple; bring the enable pin HIGH to activate, set the input pins, one HIGH and one LOW, to change the direction of the motor; if you set both HIGH or LOW while the enable pin is HIGH, you go into "braking" mode (essentially a direct short across the motor leads), if you set the enable pin LOW, current to the motor will shut off, and the motor will be in "freewheel" mode (changes to the input pins will do nothing). So - for PWM control, set your input pins appropriately for the direction you need, and apply the PWM signal to the enable pin.

:slight_smile:

[edit]Hmm - I just realized there were stepper motor outputs on that board, which the L298 can control - and you are probably expecting to use the L298 to control a stepper, not a DC motor - even so, tracing the lines from the connector to the L298 will be needed, then follow the L298 datasheet to apply the right inputs on the two 3-input pin sets to step the windings in the proper sequence - in this case the pins would be Coil A, Coil B, Enable A (pins 5, 7, and 6 on the L298 multiwatt, respectively), and the other set of pins are for Coil C, Coil D, Enable B (pins 10, 12, and 11 on the L298 multiwatt, respectively).[/edit]

Thanks for all the work put in in my behalf, I appreciate it!

I'll need to do some research, get one side /one motor functioning first, then figure out the Stepper situation.

I’d recommend you do some experiments with LEDs first. You can see exactly what is happening without stressing anything.

Just wire each output to an LED through a resistor, 1K should do.

There seem to be some instructions here:
http://www.robotbase.net.cn/?product-194.html

but it needs google translate to make any sense:
http://translate.google.com/translate?hl=en&sl=zh-CN&u=http://www.robotbase.net.cn/%3Fproduct-194.html&ei=ihHSS7n_JY3r-Qa7geG1DA&sa=X&oi=translate&ct=result&resnum=6&ved=0CCMQ7gEwBQ&prev=/search%3Fq%3D%22robotbase%22%2BL298%26hl%3Den%26client%3Dsafari%26rls%3Den

HTH
GB

Thanks GBulmer, I am gathering great detail now. :slight_smile:

I purchased this driver and I successfullyconnected to the arduino, i.e. I see led lighting up as I expect; I also connected a DC motor to proper pins, and it works fine.
What is not working is this stepper motor:
http://www.futurashop.it/allegato/8220-MOTS1.asp?L2=AZIONAMENTI&L1=ROBOTICA&L3=MOTORI%20PASSO%20PASSO&cd=8220-MOTS1&nVt=&d=13,00#sopra

B1: Filo rosa
A1: Filo arancione
A2: Filo giallo
B2: Filo blu
GND: Filo rosso

means:

B1: pink
A1: orange
A2: yellow
B2: blue
GND: red

So, I left RED wire not connected, and I connected the four wires to the four pins on the board, in the default order.

But stepper motor does not move at all.

I tested it with a multimeter: among each pin couple there are always 500 Ohm.
Is that what I should expect? Or Is my motor broken? (I just bought it!)

So, I left RED wire not connected, and I connected the four wires to the four pins on the board, in the default order.

What does "in the default order" mean? Do you have a link to the HBridge?

What code is running on the Arduino?

“default order” means as wires appear in the motor connector:blue,pink,yellow, orange.

The driver is the one you’re talking of in the thread.
http://www.seeedstudio.com/depot/l298-dual-hbridge-motor-driver-p-284.html

Datasheet:
http://www.seeedstudio.com/depot/datasheet/L298%20Dual%20H-Bridge%20Motor%20Driver%20datasheet.pdf

This source works fine with a DC motor: (disregard comments)

int pinI1=8;//define I1 port 
int pinI2=9;//define I2 port 
int speedpin=11;//define EA(PWM speed regulation)port 
int inByte = 0;         // incoming serial byte
void setup() 
{ 
    pinMode(pinI1,OUTPUT);//define this port as output 
    pinMode(pinI2,OUTPUT); 
    pinMode(speedpin,OUTPUT); 
    Serial.begin(9600);
        analogWrite(speedpin,1000);//input a value to set the speed 
        digitalWrite(pinI1,LOW);// DC motor rotates clockwise 
        digitalWrite(pinI2,HIGH); 
        analogWrite(speedpin,100);//input a value to set the speed 
        delay(500);
        analogWrite(speedpin,100);//input a value to set the speed 
        digitalWrite(pinI1,HIGH);// DC motor rotates clockwise 
        digitalWrite(pinI2,HIGH); 
        analogWrite(speedpin,100);//input a value to set the speed 


} 
void loop() 
{   /*
    analogWrite(speedpin,100);//input a value to set the speed 
    delay(2000); 
    digitalWrite(pinI1,LOW);// DC motor rotates clockwise 
    digitalWrite(pinI2,HIGH); 
    analogWrite(speedpin,100); 
    delay(2000); 
    digitalWrite(pinI1,HIGH);// DC motor rotates anticlockwise 
    digitalWrite(pinI2,LOW); 
    analogWrite(speedpin,100); 
    delay(2000); 
    digitalWrite(pinI1,HIGH);// DC motor stop rotating 
digitalWrite(pinI2,HIGH); 
delay(2000); */
  int i;
  if (Serial.available()) {
    inByte=Serial.read();
     Serial.write("Ricevuto...");
     if (inByte == 'A') {
       Serial.write("A");
        analogWrite(speedpin,100);//input a value to set the speed 
        digitalWrite(pinI1,LOW);// DC motor rotates clockwise 
        digitalWrite(pinI2,HIGH); 
        analogWrite(speedpin,100);//input a value to set the speed 
     }
     if (inByte == 'B') {
       Serial.write("B");
        analogWrite(speedpin,100);//input a value to set the speed 
        digitalWrite(pinI1,HIGH);// DC motor rotates clockwise 
        digitalWrite(pinI2,LOW); 
        analogWrite(speedpin,100);//input a value to set the speed 
     }
     if (inByte == 'C') {
       Serial.write("C");
        analogWrite(speedpin,100);//input a value to set the speed 
        digitalWrite(pinI1,HIGH);// DC motor rotates clockwise 
        digitalWrite(pinI2,HIGH); 
        analogWrite(speedpin,100);//input a value to set the speed 
     }
  }
}

This source works fine with a DC motor

Do you expect that code to make the stepper motor spin, too. If so, I'm afraid you are going to be disappointed. Stepper motors work by applying current in one direction, or the other, to adjacent coils.

You should probably be using the Stepper library, telling it which pins you have connected the two dir and two speed pins to (in the proper order, which may not be all that easy to figure out).

Seeedstudio also has a forum and a contact us mechanism, and are generally pretty good about answering questions on how to use their products. Generally, they include details in the data sheet about how to use their products every way they should work. Contact them for details on how to use this driver with stepper, and I'm willing to bet they will provide an answer AND fix the data sheet.

As far as I can understand from the brief driver datasheet, I have just to connect arduino to one side of the driver board, stepper motor to the other, connect 12 V power, and then send to the driver proper values for pins EA, I1 and I2; than the L298 chip on the board should take care of driving the stepper motor!

Why should I need a library?

and then send to the driver proper values for pins EA, I1 and I2;

Why should I need a library?

Because the library takes care of the “send to the driver proper values…” task.

Because the library takes care of the "send to the driver proper values..." task.

But did you read the datasheet and my posts?!? :-?

For those who read them... here it is also the L298 datasheet:

From what I can see, pins 2/3 and 13/14 are for motor driving, and on the board I see they are connected to the four pins marked as "stepping motor" in this order:
2,3,13,14

My motor datasheet says:
B1: pink
A1: orange
A2: yellow
B2: blue
GND: red

I thought number referred to motor and letter to motor pin, but maybe it's the opposite? I'll check.

I thought number referred to motor and letter to motor pin, but maybe it's the opposite? I'll check.

The letter refers to the motor.