Go Down

Topic: Problem with Motor Shield v3 and Tamiya Tank Gearbox (Read 2061 times) previous topic - next topic

phantompower

hello everyone.

i have a problem with my arduino based bluetooth controlled tank.
when i press a key to start the motors, arduino resets and tank doesn't move at all.

i've bought a tamiya tank kit at my local robotics shop and it comes with the motor gearbox like this one:



i also bought a motor shield (http://arduino.cc/it/Main/ArduinoMotorShieldR3) to operate the gearbox.

i've already got this bt module for arduino, and i used it with another projects without any problems.
so i know that my problem isn't related with the bt module.



i use a 7.4 li-po battery connected to the vin and ground connections on the motor shield.
my arduino code is like this:
Code: [Select]

#define A_direction 12
#define B_direction 13
#define A_speed 3
#define B_speed 11
#define A_brake 9
#define B_brake 8
int speed = 150;

void setup()
{
  pinMode(A_direction,OUTPUT);
  pinMode(B_direction,OUTPUT);
  pinMode(A_speed,OUTPUT);
  pinMode(B_speed,OUTPUT);
  pinMode(A_brake,OUTPUT);
  pinMode(B_brake,OUTPUT);
  Serial.begin(9600);
  Serial.println("Use numpad keys to operate the tank");
  Serial.println("Use numpad key 0 to stop the tank");
}

void loop()
{
  if (Serial.available() > 0)
  {
   
    int data = Serial.read();
    switch (data)
    {
      case '8' :
      digitalWrite(A_direction,HIGH);
      digitalWrite(B_direction,HIGH);
      digitalWrite(A_brake,LOW);
      digitalWrite(B_brake,LOW);
      analogWrite(A_speed,speed);
      analogWrite(B_speed,speed);
      Serial.println("N");
      break;
     
      case '2' :
      digitalWrite(A_direction,LOW);
      digitalWrite(B_direction,LOW);
      digitalWrite(A_brake,LOW);
      digitalWrite(B_brake,LOW);
      analogWrite(A_speed,speed);
      analogWrite(B_speed,speed);
      Serial.println("S");
      break;
     
      case '4' :
      digitalWrite(A_direction,LOW);
      digitalWrite(B_direction,HIGH);
      digitalWrite(A_brake,LOW);
      digitalWrite(B_brake,LOW);
      analogWrite(A_speed,speed);
      analogWrite(B_speed,speed);
      Serial.println("W");
      break;
     
      case '6' :
      digitalWrite(A_direction,HIGH);
      digitalWrite(B_direction,LOW);
      digitalWrite(A_brake,LOW);
      digitalWrite(B_brake,LOW);
      analogWrite(A_speed,speed);
      analogWrite(B_speed,speed);
      Serial.println("E");
      break;
     
      case '0' :
      digitalWrite(A_direction,LOW);
      digitalWrite(B_direction,LOW);
      digitalWrite(A_brake,HIGH);
      digitalWrite(B_brake,HIGH);
      analogWrite(A_speed,0);
      analogWrite(B_speed,0);
      Serial.println("Stop!");
      break;
     
      default:
      digitalWrite(A_direction,LOW);
      digitalWrite(B_direction,LOW);
      digitalWrite(A_brake,HIGH);
      digitalWrite(B_brake,HIGH);
      analogWrite(A_speed,0);
      analogWrite(B_speed,0);
      break;     
  }
}
}

dropdeaddick

First make sure your battery has a full charge. However, note that the standard motors that come with tamiya gearboxes are rated for 3 volts, it is possible that you will burn out the motors.


phantompower

i don't think that the problem is related with motors.
btw, i forgot to mention that when the usb cable is plugged, i don't have any problems at all.

dropdeaddick


i don't think that the problem is related with motors.
btw, i forgot to mention that when the usb cable is plugged, i don't have any problems at all.


Ok, to me that indicates a power issue, as in your battery needs a better charge. Maybe toss 4 AAs at it if you have some, just to verify.


phantompower

nope. before i switched to li-po i used 4 AA batteries. did the same.

cyclegadget


You are better off with separate power for the Arduino. To make it easy, I use a 9volt for the Arduino and I have a 4 cell pack for my motor driver. The main point is to have one battery supply for the Arduino, and one supply for the motors.
Good links: Eagle tutorial= http://www.youtube.com/playlist?list=PLDE1858BD83D19C70
General Arduion tutorials = http://tronixstuff.wordpress.com
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

Go Up