Forum > 2A Dual Motor Controller
ArduinoGeneral

2A Dual Motor Controller

userHead jessy 2011-06-03 19:00:25 17601 Views19 Replies
Hi there, we have recently bought two of this - 2A Dual Motor Controller and we are having troubles making the motors go backward, all your software is working well but backward. Can you give us some help in this point please? Is quite strange because when going left or right one motor is going forward and the other one backward, so I can image is not a motor problem, looks like bridge can not manage both motors going backward...

We also bought this - Bluetooh Bee, but we can not make it work, we can see the BT device in the list of our gadgets but can not communicate with it, do you have any kind of datasheet, code example or something like that?
2011-06-11 08:31:17 I there, I can not test exactly what you ask for but I will do as soon as possible.
By the way I send you a link with the robot working now, everything works well but both motors backward.
Turns are made by: M1->forward, M2->backward and M1->backward, M2->forward.

http://www.youtube.com/watch?v=OPlwGasZ07o&feature=player_embedded

EDIT: I have tested what you asked for, backward is still not working in any motors but when left/right turn is been made the motor turn forward/backward... Looks like driver does not like backward =( =(
userHeadPic metuskale
2011-06-11 08:31:17 I there, I can not test exactly what you ask for but I will do as soon as possible.
By the way I send you a link with the robot working now, everything works well but both motors backward.
Turns are made by: M1->forward, M2->backward and M1->backward, M2->forward.

http://www.youtube.com/watch?v=OPlwGasZ07o&feature=player_embedded

EDIT: I have tested what you asked for, backward is still not working in any motors but when left/right turn is been made the motor turn forward/backward... Looks like driver does not like backward =( =(
userHeadPic metuskale
2011-06-07 18:09:26 Hi Metuskale,

Are you still having problems? if so, could you try my sample code with only one motor connected, and in the reverse cycle if it does not move on its own, try giving it a bit of a push, see if it starts up.

Let me know your results.
userHeadPic Hector
2011-06-07 18:09:26 Hi Metuskale,

Are you still having problems? if so, could you try my sample code with only one motor connected, and in the reverse cycle if it does not move on its own, try giving it a bit of a push, see if it starts up.

Let me know your results.
userHeadPic Hector
2011-06-04 02:55:52 Hi, I have tested your code without success, goes only forward and when should be going backward stays stopped.
I changed pins because my PWM pins are from 13 to 2 but this does not matter.
About batteries, I am using a 2500mha fully charged and as I know them are really powerfull.
userHeadPic metuskale
2011-06-04 02:55:52 Hi, I have tested your code without success, goes only forward and when should be going backward stays stopped.
I changed pins because my PWM pins are from 13 to 2 but this does not matter.
About batteries, I am using a 2500mha fully charged and as I know them are really powerfull.
userHeadPic metuskale
2011-06-04 02:26:03 You are right about the bee.

Why are you using different pin assignments with the motor shield. Try changing your pins to the ones in my sample code.

Cheers
userHeadPic Hector
2011-06-04 02:26:03 You are right about the bee.

Why are you using different pin assignments with the motor shield. Try changing your pins to the ones in my sample code.

Cheers
userHeadPic Hector
2011-06-04 02:23:07 Hi,

you can try this code with the two motors:



//Arduino PWM Speed Control?
int E1 = 6; 
int M1 = 7;
int E2 = 5;                       
int M2 = 4;                         

void setup()
{
    pinMode(M1, OUTPUT); 
    pinMode(M2, OUTPUT);
}

void loop()
{

  long value;
  for(value = 150 ; value <= 255; value+=5)
  {
    digitalWrite(M1,HIGH); 
    digitalWrite(M2, HIGH);     
    analogWrite(E1, value);  //PWM Speed Control
    analogWrite(E2, value);  //PWM Speed Control
    delay(300);
     
  }
    analogWrite(E1, 0);  //PWM Speed Control
    analogWrite(E2, 0);
  delay(1000);
 
for(value = 150 ; value <= 255; value+=5)
  {
    digitalWrite(M1,LOW); 
    digitalWrite(M2, LOW);     
    analogWrite(E1, value);  //PWM Speed Control
    analogWrite(E2, value);  //PWM Speed Control
    delay(300);
  }
    analogWrite(E1, 0);  //PWM Speed Control
    analogWrite(E2, 0);
delay(1000);

}


If it does not work then maybe your batteries are too weak.

What type of motors are you using?

userHeadPic Hector
2011-06-04 02:23:07 Hi,

you can try this code with the two motors:



//Arduino PWM Speed Control?
int E1 = 6; 
int M1 = 7;
int E2 = 5;                       
int M2 = 4;                         

void setup()
{
    pinMode(M1, OUTPUT); 
    pinMode(M2, OUTPUT);
}

void loop()
{

  long value;
  for(value = 150 ; value <= 255; value+=5)
  {
    digitalWrite(M1,HIGH); 
    digitalWrite(M2, HIGH);     
    analogWrite(E1, value);  //PWM Speed Control
    analogWrite(E2, value);  //PWM Speed Control
    delay(300);
     
  }
    analogWrite(E1, 0);  //PWM Speed Control
    analogWrite(E2, 0);
  delay(1000);
 
for(value = 150 ; value <= 255; value+=5)
  {
    digitalWrite(M1,LOW); 
    digitalWrite(M2, LOW);     
    analogWrite(E1, value);  //PWM Speed Control
    analogWrite(E2, value);  //PWM Speed Control
    delay(300);
  }
    analogWrite(E1, 0);  //PWM Speed Control
    analogWrite(E2, 0);
delay(1000);

}


If it does not work then maybe your batteries are too weak.

What type of motors are you using?

userHeadPic Hector
2011-06-04 02:05:48 This is the code of motor control:


int E1 = 12;    //M1 Speed Control PWM
int E2 = 11;    //M2 Speed Control PWM
int M1 = 52;    //M1 Direction Control
int M2 = 50;    //M1 Direction Control

#define speed 250

void stop(void)                    //Stop
{
  digitalWrite(E1,LOW); 
  digitalWrite(E2,LOW);     

void advance(char a,char b)          //Move forward
{
  //turn_L (0,b);
  //delay(20);
  //turn_R (a,0);
  digitalWrite(M1,HIGH);
  digitalWrite(M2,HIGH);
  analogWrite (E1,a); 
  analogWrite (E2,b);


void back_off (char a,char b)          //Move backward
{
  digitalWrite(M1,LOW);
  digitalWrite(M2,LOW);
  analogWrite (E1,a); 
  analogWrite (E2,b); 
}
void turn_L (char a,char b)            //Turn Left
{
  digitalWrite(M1,LOW);
  digitalWrite(M2,HIGH);
  analogWrite (E1,a);   
  analogWrite (E2,b);   

}
void turn_R (char a,char b)            //Turn Right

 
  digitalWrite(M1,HIGH);
  digitalWrite(M2,LOW);
  analogWrite (E1,a); 
  analogWrite (E2,b);
}
void setup(void)
{

  pinMode(E1, OUTPUT);
  pinMode(E2, OUTPUT);
  pinMode(M1, OUTPUT);
  pinMode(M2, OUTPUT); 
  Serial.begin(19200);      //Set Baud Rate

}
void loop(void)
{
  char val = Serial.read();
 
  if(val!=-1)
  {
    switch(val)
    {
    case 'w':
       
      back_off (speed,speed);
      break;
     
    case 's':
      advance (speed,speed); //this is not working
      break;
     
    case 'd':
      turn_L (speed,speed);
      break;   
     
    case 'a':
      turn_R (speed,speed);
      break;         
    }
   
    delay(40);
  }
 
  else stop();
 
}

About bee, I will try as soon as possible and will tell you something. But just one question, BT Rx and Tx should be connected to Tx and Rx in Arduino, isn't it?
userHeadPic metuskale
2011-06-04 02:05:48 This is the code of motor control:


int E1 = 12;    //M1 Speed Control PWM
int E2 = 11;    //M2 Speed Control PWM
int M1 = 52;    //M1 Direction Control
int M2 = 50;    //M1 Direction Control

#define speed 250

void stop(void)                    //Stop
{
  digitalWrite(E1,LOW); 
  digitalWrite(E2,LOW);     

void advance(char a,char b)          //Move forward
{
  //turn_L (0,b);
  //delay(20);
  //turn_R (a,0);
  digitalWrite(M1,HIGH);
  digitalWrite(M2,HIGH);
  analogWrite (E1,a); 
  analogWrite (E2,b);


void back_off (char a,char b)          //Move backward
{
  digitalWrite(M1,LOW);
  digitalWrite(M2,LOW);
  analogWrite (E1,a); 
  analogWrite (E2,b); 
}
void turn_L (char a,char b)            //Turn Left
{
  digitalWrite(M1,LOW);
  digitalWrite(M2,HIGH);
  analogWrite (E1,a);   
  analogWrite (E2,b);   

}
void turn_R (char a,char b)            //Turn Right

 
  digitalWrite(M1,HIGH);
  digitalWrite(M2,LOW);
  analogWrite (E1,a); 
  analogWrite (E2,b);
}
void setup(void)
{

  pinMode(E1, OUTPUT);
  pinMode(E2, OUTPUT);
  pinMode(M1, OUTPUT);
  pinMode(M2, OUTPUT); 
  Serial.begin(19200);      //Set Baud Rate

}
void loop(void)
{
  char val = Serial.read();
 
  if(val!=-1)
  {
    switch(val)
    {
    case 'w':
       
      back_off (speed,speed);
      break;
     
    case 's':
      advance (speed,speed); //this is not working
      break;
     
    case 'd':
      turn_L (speed,speed);
      break;   
     
    case 'a':
      turn_R (speed,speed);
      break;         
    }
   
    delay(40);
  }
 
  else stop();
 
}

About bee, I will try as soon as possible and will tell you something. But just one question, BT Rx and Tx should be connected to Tx and Rx in Arduino, isn't it?
userHeadPic metuskale
2011-06-04 01:26:51 Hi,

As for the bluetooth bee, you should be able to setup simple communication with it by connecting the Rx and Tx pins of the bee to pins 0 and 1 of the Arduino. This should at least let you communicate with the bee. So you only need 4 pins: Gnd, 3.3V, Rx, and Tx.

For the motors could you please post the code you are using?


Thanks,

Hector
userHeadPic Hector
2011-06-04 01:26:51 Hi,

As for the bluetooth bee, you should be able to setup simple communication with it by connecting the Rx and Tx pins of the bee to pins 0 and 1 of the Arduino. This should at least let you communicate with the bee. So you only need 4 pins: Gnd, 3.3V, Rx, and Tx.

For the motors could you please post the code you are using?


Thanks,

Hector
userHeadPic Hector
2011-06-03 23:10:32 [list type=decimal]
[*]I am using Mega 2560
[*]Exactly, when I turn left/right one motor gones forward and the other one backward, when I go forward both motors work well but I want to go backward nothing happens.
[*]The H-Bridge is being supplied by 6xAA = 9V separated of Arduino, which is powered by USB, at the moment
[*]The main thing with the Bee is that there are many pins that we don't know where to connect, if we connect power one (3V3, 0V) we can see in the list of devices of Windows/Mobile Phone
[/list]

Thanks.
userHeadPic metuskale
2011-06-03 23:10:32 [list type=decimal]
[*]I am using Mega 2560
[*]Exactly, when I turn left/right one motor gones forward and the other one backward, when I go forward both motors work well but I want to go backward nothing happens.
[*]The H-Bridge is being supplied by 6xAA = 9V separated of Arduino, which is powered by USB, at the moment
[*]The main thing with the Bee is that there are many pins that we don't know where to connect, if we connect power one (3V3, 0V) we can see in the list of devices of Windows/Mobile Phone
[/list]

Thanks.
userHeadPic metuskale
2011-06-03 19:11:50 Hi Could you please give me some more details about your problem?

1. Which Arduino board are you using?

2. When you turn left or right a single motor will go in reverse, but when you try to make both motors go in reverse nothing happens?

3. How are you supplying power to the motors?

4. Can you give me more details about your problem with your bluetooth bee? When power is applied you can see it in windows devices? What have you tried to communicate with it?

userHeadPic Hector
2011-06-03 19:11:50 Hi Could you please give me some more details about your problem?

1. Which Arduino board are you using?

2. When you turn left or right a single motor will go in reverse, but when you try to make both motors go in reverse nothing happens?

3. How are you supplying power to the motors?

4. Can you give me more details about your problem with your bluetooth bee? When power is applied you can see it in windows devices? What have you tried to communicate with it?

userHeadPic Hector
2011-06-03 19:00:25 Hi there, we have recently bought two of this - 2A Dual Motor Controller and we are having troubles making the motors go backward, all your software is working well but backward. Can you give us some help in this point please? Is quite strange because when going left or right one motor is going forward and the other one backward, so I can image is not a motor problem, looks like bridge can not manage both motors going backward...

We also bought this - Bluetooh Bee, but we can not make it work, we can see the BT device in the list of our gadgets but can not communicate with it, do you have any kind of datasheet, code example or something like that?
userHeadPic jessy