ArduinoGeneral

Romeo power issues

userHead mjorte 2011-12-06 04:12:43 11432 Views19 Replies
Hi,
I have a power issue with Romeo.
Romeo is powered using 7.6v LiPo battery and board it self seems to work fine, all 5v pins are showing that power is connected and PING sensor is working nicely. However no power is going to motors connected to both motor lines. If I attach a led to Motor control pins (4-7) I can see that pins go from High to low according result that I get from PING. Any advice what I could check?

[code]/*
OBJECT AVOIDING ROBOT CODE FOR ARDUINO - DFRduino RoMeo - PARALLAX PING)
THIS CODE IS FREE TO ANYONE THAT WISHES TO USE IT, MODIFY IT, OR STEAL IT IN GENERAL.
*/
int E1 = 5; //M1 Speed Control
int E2 = 6; //M2 Speed Control
int M1 = 4; //M1 Direction Control
int M2 = 7; //M2 Direction Control
int ultraSoundSignal = 10;
int ledPin = 13; // sets the indicator led to pin 13
unsigned long dist = 0;

// *************************** SETTING UP THE PROGRAM ***********************************
void Motor1(int pwm, boolean reverse)
{
analogWrite(E2,pwm); //set pwm control, 0 for stop, and 255 for maximum speed
if(reverse)
{
digitalWrite(M2,HIGH);
}
else
{
digitalWrite(M2,LOW);
}
}
void Motor2(int pwm, boolean reverse)
{
analogWrite(E1,pwm);
if(reverse)
{
digitalWrite(M1,HIGH);
}
else
{
digitalWrite(M1,LOW);
}
}
void setup()
{
int i; // for(i=6;i<=9;i++) //For Roboduino Motor Shield
// pinMode(i, OUTPUT);//set pin 6,7,8,9 to output mode
for(i=5;i<=8;i++) //For Arduino Motor Shield
pinMode(i, OUTPUT); //set pin 4,5,6,7 to output mode
Serial.begin(9600);
//motor.setSpeed(80); // sets motor 1 speed to 80
//motor2.setSpeed(80); // sets motor 2 speed to 80

pinMode(ultraSoundSignal, OUTPUT); // sets enable as output

straight(); // initializes go straight
}

// *************************** MAIN PROGRAM LOOPS ***********************************
void loop() {
distCalc();
avoidObjects();
delay(40);
Serial.println(dist); // ADDED TO APPEND DISTANCE TO SERIAL MONITOR SO I COULD SEE PROBLEMS..
delay(280);
}
// *************************** MAIN STRAIGHT ROUTINE ***********************************
void straight(){
//motor.run(FORWARD);
//motor2.run(FORWARD);
Motor1(90,true); //You can change the speed, such as Motor(80,true)
Motor2(90,true);

Serial.print("Forward"); // ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR
}
// *************************** MAIN TURNING ROUTINE ***********************************
void turnRight()
{
//motor.run(BACKWARD);
//motor2.run(FORWARD);
Motor1(80,false);
Motor2(80,true);
Serial.print("TurnRight"); // ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR
}
void turnLeft()
{
//motor.run(BACKWARD);
//motor2.run(FORWARD);
Motor1(80,true);
Motor2(80,false);
Serial.print("TurnLeft"); // ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR
}

// *************************** PING FUNCTIONS TO GET DISTANCES ***********************************
float distCalc() // distance calculating function converts analog input to inches
{
pinMode(ultraSoundSignal, OUTPUT); // Switch signalpin to output
digitalWrite(ultraSoundSignal, LOW); // Send low pulse
delayMicroseconds(2); // Wait for 2 microseconds
digitalWrite(ultraSoundSignal, HIGH); // Send high pulse
delayMicroseconds(5); // Wait for 5 microseconds
digitalWrite(ultraSoundSignal, LOW); // Holdoff
pinMode(ultraSoundSignal, INPUT); // Switch signalpin to input
digitalWrite(ultraSoundSignal, HIGH); // Turn on pullup resistor

unsigned long echo = pulseIn(ultraSoundSignal, HIGH); //Listen for echo
dist = (echo / 58.138) * 0.39; //convert to CM then to inches

return dist;
}

// *************************** THE AVOIDING OBJECTS ROUTINE ***********************************
void avoidObjects()
{
if(dist < 12) // if the distance is less than 12 inches
{
Serial.print("object detected closer than allowed!!!"); // ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR
digitalWrite(ledPin, HIGH); // turn on LED
turnRight(); // turns right using turnRight function
delay(40);
}
else // otherwise
{
digitalWrite(ledPin, LOW); //turn off LED
straight(); // go straight using the straight function
Serial.print(" continuing forward "); // ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR
}
}[/code]
2011-12-13 11:03:33 When you play with motors, make sure you have enough current supply.  What is your power supply for the motor? userHeadPic R2D2C3PO
2011-12-13 11:03:33 When you play with motors, make sure you have enough current supply.  What is your power supply for the motor? userHeadPic R2D2C3PO
2011-12-13 02:53:52 Hi Ricky,
Thanks for your help, I tried to put m-m jumper cable to that socket but still nothing happens :(
userHeadPic mjorte
2011-12-13 02:53:52 Hi Ricky,
Thanks for your help, I tried to put m-m jumper cable to that socket but still nothing happens :(
userHeadPic mjorte
2011-12-10 19:41:10 Just notice that you are using our oldest romeo. 

I've uploaded a picture, in the green part, you need to shorten these the sockets, simply use a M/M jumper cable. This actually servers the motor power by shorten these two jumpers.
userHeadPic R2D2C3PO
2011-12-10 19:41:10 Just notice that you are using our oldest romeo. 

I've uploaded a picture, in the green part, you need to shorten these the sockets, simply use a M/M jumper cable. This actually servers the motor power by shorten these two jumpers.
userHeadPic R2D2C3PO
2011-12-10 05:20:43 Hi Hector,
Thanks for your help but this is still no go, I have now connected motors only and used your sample code but still no power to motors. Attached is a picture of my setup.
userHeadPic mjorte
2011-12-10 05:20:43 Hi Hector,
Thanks for your help but this is still no go, I have now connected motors only and used your sample code but still no power to motors. Attached is a picture of my setup.
userHeadPic mjorte
2011-12-09 18:14:23 Hi Mjorte,


If the LEDs are lighting, then I think it might have to do with your wiring.


You can download this manual which goes through how to wire a romeo, motors, and battery.


[url=http://www.dfrobot.com/image/data/Dump/COMB0004manual_V05.pdf]http://www.dfrobot.com/image/data/Dump/COMB0004manual_V05.pdf[/url]


I know that all the hardware is not the same, but it should serve you as a good guide. Let me know.
userHeadPic Hector
2011-12-09 18:14:23 Hi Mjorte,


If the LEDs are lighting, then I think it might have to do with your wiring.


You can download this manual which goes through how to wire a romeo, motors, and battery.


[url=http://www.dfrobot.com/image/data/Dump/COMB0004manual_V05.pdf]http://www.dfrobot.com/image/data/Dump/COMB0004manual_V05.pdf[/url]


I know that all the hardware is not the same, but it should serve you as a good guide. Let me know.
userHeadPic Hector
2011-12-08 17:44:15 Hi,
Vin jumper is also set and yes I have tested Romeo with your sample code without success, same problem no power to motors, but if I set leds on motor pins I can see that they are turned on and off according command sent via serial monitor.

It seems that there is some other problems also with boar, I tried to use buttons and enabled button 1-5 using jumper, and with your sample code results vary, when I press left button I get feedback to serial monitor that I pressed down left and select buttons, right button does nothing etc. So I'm thinking that this Romeo is somehow broken.
userHeadPic mjorte
2011-12-08 17:44:15 Hi,
Vin jumper is also set and yes I have tested Romeo with your sample code without success, same problem no power to motors, but if I set leds on motor pins I can see that they are turned on and off according command sent via serial monitor.

It seems that there is some other problems also with boar, I tried to use buttons and enabled button 1-5 using jumper, and with your sample code results vary, when I press left button I get feedback to serial monitor that I pressed down left and select buttons, right button does nothing etc. So I'm thinking that this Romeo is somehow broken.
userHeadPic mjorte
2011-12-08 10:31:16 Is your Vin=M_Vin jumper also set?


Have you tried the sample code provided in our wiki to make sure everything works?


I suggest you try just operating the motors only, then adding the rest of the functionality.


[code]

//Standard PWM DC control


int E1 = 5;    //M1 Speed Control
int E2 = 6;    //M2 Speed Control
int M1 = 4;    //M1 Direction Control
int M2 = 7;    //M1 Direction Control


///For previous Romeo, please use these pins.
//int E1 = 6;    //M1 Speed Control
//int E2 = 9;    //M2 Speed Control
//int M1 = 7;    //M1 Direction Control
//int M2 = 8;    //M1 Direction Control




void stop(void)                    //Stop
        {
          digitalWrite(E1,LOW); 
          digitalWrite(E2,LOW);     
        } 
void advance(char a,char b)          //Move forward
        {
          analogWrite (E1,a);      //PWM Speed Control
          digitalWrite(M1,HIGH);   
          analogWrite (E2,b);   
          digitalWrite(M2,HIGH);
        } 
void back_off (char a,char b)          //Move backward
        {
          analogWrite (E1,a);
          digitalWrite(M1,LOW); 
          analogWrite (E2,b);   
          digitalWrite(M2,LOW);
}
void turn_L (char a,char b)            //Turn Left
        {
          analogWrite (E1,a);
          digitalWrite(M1,LOW);   
          analogWrite (E2,b);   
          digitalWrite(M2,HIGH);
        }
void turn_R (char a,char b)            //Turn Right
        {
          analogWrite (E1,a);
          digitalWrite(M1,HIGH);   
          analogWrite (E2,b);   
          digitalWrite(M2,LOW);
        }
void setup(void)
{
    int i;
    for(i=6;i<=9;i++)
    pinMode(i, OUTPUT); 
    Serial.begin(19200);      //Set Baud Rate
}
void loop(void)
{
    char val = Serial.read();
    if(val!=-1)
      {
          switch(val)
          {
            case 'w'://Move Forward
                    advance (100,100);  //PWM Speed Control
                    break;
            case 's'://Move Backward
                    back_off (100,100);
                    break;
            case 'a'://Turn Left
                    turn_L (100,100);
                    break;     
            case 'd'://Turn Right
                    turn_R (100,100);
                    break;         
            }   
          delay(40);
      }
      else stop(); 
}
[/code]
userHeadPic Hector
2011-12-08 10:31:16 Is your Vin=M_Vin jumper also set?


Have you tried the sample code provided in our wiki to make sure everything works?


I suggest you try just operating the motors only, then adding the rest of the functionality.


[code]

//Standard PWM DC control


int E1 = 5;    //M1 Speed Control
int E2 = 6;    //M2 Speed Control
int M1 = 4;    //M1 Direction Control
int M2 = 7;    //M1 Direction Control


///For previous Romeo, please use these pins.
//int E1 = 6;    //M1 Speed Control
//int E2 = 9;    //M2 Speed Control
//int M1 = 7;    //M1 Direction Control
//int M2 = 8;    //M1 Direction Control




void stop(void)                    //Stop
        {
          digitalWrite(E1,LOW); 
          digitalWrite(E2,LOW);     
        } 
void advance(char a,char b)          //Move forward
        {
          analogWrite (E1,a);      //PWM Speed Control
          digitalWrite(M1,HIGH);   
          analogWrite (E2,b);   
          digitalWrite(M2,HIGH);
        } 
void back_off (char a,char b)          //Move backward
        {
          analogWrite (E1,a);
          digitalWrite(M1,LOW); 
          analogWrite (E2,b);   
          digitalWrite(M2,LOW);
}
void turn_L (char a,char b)            //Turn Left
        {
          analogWrite (E1,a);
          digitalWrite(M1,LOW);   
          analogWrite (E2,b);   
          digitalWrite(M2,HIGH);
        }
void turn_R (char a,char b)            //Turn Right
        {
          analogWrite (E1,a);
          digitalWrite(M1,HIGH);   
          analogWrite (E2,b);   
          digitalWrite(M2,LOW);
        }
void setup(void)
{
    int i;
    for(i=6;i<=9;i++)
    pinMode(i, OUTPUT); 
    Serial.begin(19200);      //Set Baud Rate
}
void loop(void)
{
    char val = Serial.read();
    if(val!=-1)
      {
          switch(val)
          {
            case 'w'://Move Forward
                    advance (100,100);  //PWM Speed Control
                    break;
            case 's'://Move Backward
                    back_off (100,100);
                    break;
            case 'a'://Turn Left
                    turn_L (100,100);
                    break;     
            case 'd'://Turn Right
                    turn_R (100,100);
                    break;         
            }   
          delay(40);
      }
      else stop(); 
}
[/code]
userHeadPic Hector
2011-12-08 05:00:29 Hi Hector.
Yes I have jumpers set on all motor pins. Unfortunately i cant send pictures atm but basically i have power connected to power connector terminal and motors connected to motor terminals only other connection is ping sensor in pin10
Button jumpers are not connected allother jumpers are connected.
userHeadPic mjorte
2011-12-08 05:00:29 Hi Hector.
Yes I have jumpers set on all motor pins. Unfortunately i cant send pictures atm but basically i have power connected to power connector terminal and motors connected to motor terminals only other connection is ping sensor in pin10
Button jumpers are not connected allother jumpers are connected.
userHeadPic mjorte
2011-12-07 14:26:21 Have you checked your jumper settings?


Are all the jumpers set? Could you send me a picture of your setup?




Thanks
userHeadPic Hector
2011-12-07 14:26:21 Have you checked your jumper settings?


Are all the jumpers set? Could you send me a picture of your setup?




Thanks
userHeadPic Hector
2011-12-06 04:12:43 Hi,
I have a power issue with Romeo.
Romeo is powered using 7.6v LiPo battery and board it self seems to work fine, all 5v pins are showing that power is connected and PING sensor is working nicely. However no power is going to motors connected to both motor lines. If I attach a led to Motor control pins (4-7) I can see that pins go from High to low according result that I get from PING. Any advice what I could check?

[code]/*
OBJECT AVOIDING ROBOT CODE FOR ARDUINO - DFRduino RoMeo - PARALLAX PING)
THIS CODE IS FREE TO ANYONE THAT WISHES TO USE IT, MODIFY IT, OR STEAL IT IN GENERAL.
*/
int E1 = 5;    //M1 Speed Control
int E2 = 6;    //M2 Speed Control
int M1 = 4;    //M1 Direction Control
int M2 = 7;    //M2 Direction Control
int ultraSoundSignal = 10;
int ledPin = 13;  // sets the indicator led to pin 13
unsigned long dist = 0;

// ***************************  SETTING UP THE PROGRAM  ***********************************
void Motor1(int pwm, boolean reverse)
  {
  analogWrite(E2,pwm);                        //set pwm control, 0 for stop, and 255 for maximum speed
  if(reverse)
  {
  digitalWrite(M2,HIGH);
  }
  else
  {
  digitalWrite(M2,LOW);
  }
  }
void Motor2(int pwm, boolean reverse)
  {
  analogWrite(E1,pwm);
  if(reverse)
  {
  digitalWrite(M1,HIGH);
  }
  else
  {
  digitalWrite(M1,LOW);
  }
  }
void setup()
{
  int i;                          // for(i=6;i<=9;i++) //For Roboduino Motor Shield
                                  // pinMode(i, OUTPUT);//set pin 6,7,8,9 to output mode
  for(i=5;i<=8;i++)              //For Arduino Motor Shield
  pinMode(i, OUTPUT);            //set pin 4,5,6,7 to output mode
Serial.begin(9600);
//motor.setSpeed(80);          // sets motor 1 speed to 80
//motor2.setSpeed(80);          // sets motor 2 speed to 80

pinMode(ultraSoundSignal, OUTPUT);  // sets enable as output

straight();                    // initializes go straight
}

// ***************************  MAIN PROGRAM LOOPS  ***********************************
void loop() {
distCalc();                               
avoidObjects();                           
delay(40);   
Serial.println(dist);                                            //    ADDED TO APPEND DISTANCE TO SERIAL MONITOR SO I COULD SEE PROBLEMS..
delay(280);
}
// ***************************  MAIN STRAIGHT ROUTINE  ***********************************
void straight(){
  //motor.run(FORWARD);
  //motor2.run(FORWARD);
  Motor1(90,true);                                              //You can change the speed, such as Motor(80,true)
  Motor2(90,true);
 
  Serial.print("Forward");                                // ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR
}
// ***************************  MAIN TURNING ROUTINE  ***********************************
void turnRight()
{
  //motor.run(BACKWARD);
  //motor2.run(FORWARD);
  Motor1(80,false);
  Motor2(80,true);
  Serial.print("TurnRight");                              // ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR
}
void turnLeft()
{
  //motor.run(BACKWARD);
  //motor2.run(FORWARD);
  Motor1(80,true);
  Motor2(80,false);
  Serial.print("TurnLeft");                              // ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR
}

// ***************************  PING FUNCTIONS TO GET DISTANCES  ***********************************
float distCalc()                                                  // distance calculating function converts analog input to inches
{
pinMode(ultraSoundSignal, OUTPUT);                                // Switch signalpin to output
digitalWrite(ultraSoundSignal, LOW);                              // Send low pulse
delayMicroseconds(2);                                            // Wait for 2 microseconds
digitalWrite(ultraSoundSignal, HIGH);                            // Send high pulse
delayMicroseconds(5);                                            // Wait for 5 microseconds
digitalWrite(ultraSoundSignal, LOW);                              // Holdoff
pinMode(ultraSoundSignal, INPUT);                                // Switch signalpin to input
digitalWrite(ultraSoundSignal, HIGH);                            // Turn on pullup resistor

unsigned long echo = pulseIn(ultraSoundSignal, HIGH);            //Listen for echo
dist = (echo / 58.138) * 0.39;                                    //convert to CM then to inches

return dist;
}

// ***************************  THE AVOIDING OBJECTS ROUTINE  ***********************************
void avoidObjects()
{
if(dist < 12)                                                      // if the distance is less than 12 inches
{
  Serial.print("object detected closer than allowed!!!");        // ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR
  digitalWrite(ledPin, HIGH);                                    // turn on LED
  turnRight();                                                    // turns right using turnRight function
  delay(40);
}
else                                                              // otherwise
{
  digitalWrite(ledPin, LOW);                                    //turn off LED
  straight();                                                    // go straight using the straight function
  Serial.print(" continuing forward ");                          //  ADDED SO I COULD SEE PROBLEMS WITH SERIAL MONITOR
}
}[/code]
userHeadPic mjorte