ArduinoGeneral

Help! dfRobot Motorshield and Arduino

userHead Magic2119 2013-02-04 13:31:37 10959 Views19 Replies
I've been having a rough time getting my arduino uno, dfRobot 2A motor shield, ping sensor, and 2 6v motors to work properly.

I have the Uno powered off of 5xAA for 7.5v.
The motor shield is powered of off 4xAA for 6v.
ping sensor powered off of the arduino and plugged into D13.

When i have the Arduino on and the motor shield off the Ping Sensor works fine. Then when I turn on the motor shield the ping sensor goes into overdrive and starts blinking really fast. I have been trying the standard code on the wiki which goes from 0 - 255 and as the voltage to the motors change the voltages on the other I/O pins all changes as well. It's almost like the power is bleeding to all of the pins.

Can anyone help me? Are all of the I/O pins supposed to be affected by the changes in voltages to the motors?

*Update* With the motors disconnected from their terminals and the motor shield on the sensor works fine.
*Update2* I tried plugging in 12v to the motor shield thinking maybe the motors were underpowered and it did not solve the issue.

Thanks!
2013-02-19 18:19:05 Hi, I tried the motorshield(SKU:DRI0009) with the arduino.nothing connect to the digital pins. the motorshield on 6v via PWRIN and the Arduino on USB. the test code is as following via PWM mode:

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

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

void loop()
{
  int value;
  for(value = 0 ; value <= 255; value+=5)
  {
    digitalWrite(M1,HIGH); 
    digitalWrite(M2, HIGH);     
    analogWrite(E1, value);  //PWM Speed Control
    analogWrite(E2, value);  //PWM Speed Control
    delay(30);
  } 
}


Everything is OK & pin 13 is about 3mV weather the motorshield is on or off. have a try~~
userHeadPic Phoebe
2013-02-19 18:19:05 Hi, I tried the motorshield(SKU:DRI0009) with the arduino.nothing connect to the digital pins. the motorshield on 6v via PWRIN and the Arduino on USB. the test code is as following via PWM mode:

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

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

void loop()
{
  int value;
  for(value = 0 ; value <= 255; value+=5)
  {
    digitalWrite(M1,HIGH); 
    digitalWrite(M2, HIGH);     
    analogWrite(E1, value);  //PWM Speed Control
    analogWrite(E2, value);  //PWM Speed Control
    delay(30);
  } 
}


Everything is OK & pin 13 is about 3mV weather the motorshield is on or off. have a try~~
userHeadPic Phoebe
2013-02-19 07:25:13 For simplicity's sake I changed the speed on the test code to 255 so I could get steady readings.

I connected the ground terminal from the PWRIN on the Motor shield to two of the ground pins on the arduino.  This did not solve the issue.  With the motor shield off the voltage on pin 13 was at 1.15v.  When the motor shield is on the voltage jumped to 1.35v if I had the grounds all connected or not.

userHeadPic Magic2119
2013-02-19 07:25:13 For simplicity's sake I changed the speed on the test code to 255 so I could get steady readings.

I connected the ground terminal from the PWRIN on the Motor shield to two of the ground pins on the arduino.  This did not solve the issue.  With the motor shield off the voltage on pin 13 was at 1.15v.  When the motor shield is on the voltage jumped to 1.35v if I had the grounds all connected or not.

userHeadPic Magic2119
2013-02-19 02:15:51 Hi, Sorry for replay so late.
The microcontrlller should share the same GND with the motor shield.  Suggest you connect two GND together ;)
userHeadPic Phoebe
2013-02-19 02:15:51 Hi, Sorry for replay so late.
The microcontrlller should share the same GND with the motor shield.  Suggest you connect two GND together ;)
userHeadPic Phoebe
2013-02-14 15:28:38 I'm using the DFrobot 2WD mobile Platform
[url=http://www.robotshop.com/productinfo.aspx?pc=RB-Dfr-16&lang=en-US]http://www.robotshop.com/productinfo.aspx?pc=RB-Dfr-16&lang=en-US[/url]
So it's what ever motors come with that.

I have the motorshield on 6v (4x AA) via PWRIN and the Arduino on USB
I have the PWM code uploaded and the jumpers set to PWM
With the arduino on and the motorshield off D13 reads 1v
When i turn the motorshield as the motor goes from 0 < 255 the voltage on D13 goes from 1.0 < 1.2.
The voltage on pin D13 goes up evenly as the power to the motor shields go up.
D12 is at .5v with the motorshield off and goes from .5v < 1.5v with the motor shield on.
The voltage on pin D12 goes up evenly as the power to the motor shields go up.
The same results are had on all of the I/O pins that aren't used by the motorshield.

Thanks for your help so far Phoeve

userHeadPic Magic2119
2013-02-14 15:28:38 I'm using the DFrobot 2WD mobile Platform
[url=http://www.robotshop.com/productinfo.aspx?pc=RB-Dfr-16&lang=en-US]http://www.robotshop.com/productinfo.aspx?pc=RB-Dfr-16&lang=en-US[/url]
So it's what ever motors come with that.

I have the motorshield on 6v (4x AA) via PWRIN and the Arduino on USB
I have the PWM code uploaded and the jumpers set to PWM
With the arduino on and the motorshield off D13 reads 1v
When i turn the motorshield as the motor goes from 0 < 255 the voltage on D13 goes from 1.0 < 1.2.
The voltage on pin D13 goes up evenly as the power to the motor shields go up.
D12 is at .5v with the motorshield off and goes from .5v < 1.5v with the motor shield on.
The voltage on pin D12 goes up evenly as the power to the motor shields go up.
The same results are had on all of the I/O pins that aren't used by the motorshield.

Thanks for your help so far Phoeve

userHeadPic Magic2119
2013-02-07 23:03:06 Hi, first make sure weather the motor shield is OK or not. Just use the sample code in the product wiki page.
[url=https://www.dfrobot.com/wiki/index.php?title=Arduino_Motor_Shield_(L298N)_(SKU:DRI0009)]https://www.dfrobot.com/wiki/index.php?title=Arduino_Motor_Shield_(L298N)_(SKU:DRI0009)[/url]
& power the shield 6V. check weather it works well.  By the way ,what motors you use?
You say it would be leaking voltage to all of the other pins, do you know how much is the voltage of other pins except digital4,5,6,7?
userHeadPic Phoebe
2013-02-07 23:03:06 Hi, first make sure weather the motor shield is OK or not. Just use the sample code in the product wiki page.
[url=https://www.dfrobot.com/wiki/index.php?title=Arduino_Motor_Shield_(L298N)_(SKU:DRI0009)]https://www.dfrobot.com/wiki/index.php?title=Arduino_Motor_Shield_(L298N)_(SKU:DRI0009)[/url]
& power the shield 6V. check weather it works well.  By the way ,what motors you use?
You say it would be leaking voltage to all of the other pins, do you know how much is the voltage of other pins except digital4,5,6,7?
userHeadPic Phoebe
2013-02-07 19:10:54 I've used PLL and PWM making sure to change the jumpers and PWM seems to be worse with changing the voltages on the rest of the board.  I have tried all of the other pins.  I wonder if the Motor shield is just bad?  I have no idea why it would be leaking voltage to all of the other pins. userHeadPic Magic2119
2013-02-07 19:10:54 I've used PLL and PWM making sure to change the jumpers and PWM seems to be worse with changing the voltages on the rest of the board.  I have tried all of the other pins.  I wonder if the Motor shield is just bad?  I have no idea why it would be leaking voltage to all of the other pins. userHeadPic Magic2119
2013-02-06 22:24:31 Yes, I think the code is very simple and clear ,  there should be no problems in your code. You use the PLL  mode  to driver the motors. Have you try to driver the motors via PWM mode ? Make sure the control mode selection jumpers are correct. Also have you try to connect the Ping sensor to other digital pins? userHeadPic Phoebe
2013-02-06 22:24:31 Yes, I think the code is very simple and clear ,  there should be no problems in your code. You use the PLL  mode  to driver the motors. Have you try to driver the motors via PWM mode ? Make sure the control mode selection jumpers are correct. Also have you try to connect the Ping sensor to other digital pins? userHeadPic Phoebe
2013-02-06 06:05:17 [code]#include <NewPing.h>
   
#define TRIGGER_PIN  13
#define ECHO_PIN    13
#define MAX_DISTANCE 500
   
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

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

void setup()
{
    pinMode(M1, OUTPUT); 
    pinMode(M2, OUTPUT);
    Serial.begin(9600);
}

void loop()
{
  int uS= sonar.ping_median(5);
      Serial.print("Ping: ");
      Serial.print(uS / US_ROUNDTRIP_CM);
      Serial.println("cm");
     
  int value;
  for(value = 0 ; value <= 255; value+=1.5)
  {
    digitalWrite(M1,HIGH); 
    digitalWrite(M2, HIGH);     
    analogWrite(E1, value);  //PWM Speed Control
    analogWrite(E2, value);  //PWM Speed Control
    delay(30);
  }
}[/code]

When I started having issues I cut my code down to just the essentials.  While I have the sensor getting data I'm only printing it to serial right now. 

The sensor I'm using in the Parallax Ping Sensor.
userHeadPic Magic2119
2013-02-06 06:05:17 [code]#include <NewPing.h>
   
#define TRIGGER_PIN  13
#define ECHO_PIN    13
#define MAX_DISTANCE 500
   
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

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

void setup()
{
    pinMode(M1, OUTPUT); 
    pinMode(M2, OUTPUT);
    Serial.begin(9600);
}

void loop()
{
  int uS= sonar.ping_median(5);
      Serial.print("Ping: ");
      Serial.print(uS / US_ROUNDTRIP_CM);
      Serial.println("cm");
     
  int value;
  for(value = 0 ; value <= 255; value+=1.5)
  {
    digitalWrite(M1,HIGH); 
    digitalWrite(M2, HIGH);     
    analogWrite(E1, value);  //PWM Speed Control
    analogWrite(E2, value);  //PWM Speed Control
    delay(30);
  }
}[/code]

When I started having issues I cut my code down to just the essentials.  While I have the sensor getting data I'm only printing it to serial right now. 

The sensor I'm using in the Parallax Ping Sensor.
userHeadPic Magic2119
2013-02-05 19:39:06 Hi,

What's the Ping sensor you use? Can you post your code here? Maybe there is some problems in your code ;)
userHeadPic Phoebe
2013-02-05 19:39:06 Hi,

What's the Ping sensor you use? Can you post your code here? Maybe there is some problems in your code ;)
userHeadPic Phoebe
2013-02-04 13:31:37 I've been having a rough time getting my arduino uno, dfRobot 2A motor shield, ping sensor, and 2 6v motors to work properly.

I have the Uno powered off of 5xAA for 7.5v.
The motor shield is powered of off 4xAA for 6v.
ping sensor powered off of the arduino and plugged into D13.

When i have the Arduino on and the motor shield off the Ping Sensor works fine.  Then when I turn on the motor shield the ping sensor goes into overdrive and starts blinking really fast.  I have been trying the standard code on the wiki which goes from 0 - 255 and as the voltage to the motors change the voltages on the other I/O pins all changes as well.  It's almost like the power is bleeding to all of the pins.

Can anyone help me?  Are all of the I/O pins supposed to be affected by the changes in voltages to the motors?

*Update*  With the motors disconnected from their terminals and the motor shield on the sensor works fine.
*Update2* I tried plugging in 12v to the motor shield thinking maybe the motors were underpowered and it did not solve the issue.

Thanks!
userHeadPic Magic2119