Arduino UNO + Arduino Motor Shield R3

Hello:

Experimenting with Arduino UNO + Arduino Motor Shield R3.

Notes & Situation:

  1. Arduino powered by 9v battery
  2. Typical 2 Motor configuration ( One for speed and the other for direction) - both run on 3 x AA battery
  3. VIN Disconnected on Motor Shield therefore am powering motors through 3 x AA Battery leveraging the use of the VIN and GND on Motor shield.
  4. Provided the code below that am trying to use.

Problem:
The car is just not moving when placed on the ground. Once I lift the rear wheels off the ground - the wheels spin. When I place them back on the ground, not enough power to move the car.

What am I doing wrong ? Please advice.

int MotorPinDirection = 12;
int MotorPinSpeed = 3;

int ServoPinDirection = 13;
int ServoPinSpeed = 11;

void setup() {
  pinMode (MotorPinDirection, OUTPUT);
  pinMode (MotorPinSpeed, OUTPUT);
  pinMode (ServoPinDirection, OUTPUT);
  pinMode (ServoPinSpeed, OUTPUT);
  
}

void loop(){
  
      //analogWrite(MotorPinDirection,255);
     digitalWrite(MotorPinDirection,255);
     digitalWrite(MotorPinSpeed, HIGH);
     delay(500);
     digitalWrite(MotorPinSpeed, LOW);
     delay(500);
      
      /*analogWrite(ServoPinDirection,255);
      digitalWrite(ServoPinSpeed, HIGH);
      delay(500);
      analogWrite(ServoPinDirection,128);
      digitalWrite(ServoPinSpeed,LOW);
      delay(500);
      
      analogWrite(ServoPinDirection,0);
      digitalWrite(ServoPinSpeed, HIGH);
      delay(500);
      analogWrite(ServoPinDirection,128);
      digitalWrite(ServoPinSpeed,LOW);
      
      delay(500);
 */
  
}

What motors are you using? Datasheet?
Just a guess, but you probably need more power to the motors.

Hi:
Dont know the motor spec...

model is based on this:
http://www.modelzone.co.uk/radio-control-rc/rc-cars-and-trucks/off-road/xq-toys-1-24-off-road-w-pvc-blister-cover.html

Since this is a trial, didnt want to invest too much ...

I agree with you on your initial diagnostics.. so tried using a sample code with afmotor.h library.

Guess what .. the RC moves faster than what it does with the above code.

The issue with afmotor.h library code is it moves foward however doesnot respond to backward or stop command.

Ladies & Gents:

FINALLY SOLVED THE PUZZLE ON WHY THE CAR WONT MOVE WITH THE SHIELD.

Here are the steps:

  1. Connect a 9V to Arduino CPU Board.
  2. On the motor shield, disconnect VIN by scraping the Jumper at the back of the motor shield.
  3. Connect another 9V battery to the Motor Shield independent of the Arduino CPU basically to power the two motors ( Turn and Speed).
  4. Try the following code.. Should work like a dream.
int MotorPinDirection = 12;
int MotorPinSpeed = 3;
int MotorPinBrake =9;

int ServoPinDirection = 13;
int ServoPinSpeed = 11;
int ServoPinBrake = 8;

void setup() {
  pinMode (MotorPinDirection, OUTPUT);
  pinMode (MotorPinSpeed, OUTPUT);
  pinMode (MotorPinBrake, OUTPUT);
  pinMode (ServoPinDirection, OUTPUT);
  pinMode (ServoPinSpeed, OUTPUT);
  pinMode (ServoPinBrake, OUTPUT);
}

void loop(){
  
    /* --- Forward, Brake, Reverse, Brake Sequence --- */
    //forward
    digitalWrite(MotorPinDirection, HIGH);
    analogWrite(MotorPinSpeed, 200);
    delay(1000);
    
    // brakes
    digitalWrite(MotorPinBrake, HIGH);
    delay(500);
    digitalWrite(MotorPinBrake, LOW);
    
    //reverse
    digitalWrite(MotorPinDirection, LOW);
    analogWrite(MotorPinSpeed, 200);
    delay(1000);  
    
    // brakes
    digitalWrite(MotorPinBrake, HIGH);
    delay(500);
    digitalWrite(MotorPinBrake, LOW);
    
    /* --- Turn Right, pause, Turn Left, pause Sequence ---*/
    // Turn Right
    digitalWrite(ServoPinDirection, HIGH);
    analogWrite(ServoPinSpeed, 255);
    delay(500);
    analogWrite(ServoPinSpeed,0);
    delay(500);
    
    // Turn Left
    digitalWrite(ServoPinDirection,LOW);
    analogWrite(ServoPinSpeed,255);
    delay(500);
    analogWrite(ServoPinSpeed,0);
    delay(500);
}

Am glad i got the car moving now .. truly getting started with something...