Bot not wanting to run... :/

Hey guys…, I took an old RC Truck apart, swapped the steering servo out, and hooked the motors up to my Uno, and for some reason it doesn’t want to run well(at all). Suggestions?

I’m using a 7.2v 2000mAh Ni-Cd battery, Seeed Motor Shield, Arduino Uno, a Radioshack brand ultrasonic sensor and servo, and the original drive motor and gear assembly of the car.

It’s trying to chug along, but doesn’t seem to have enough juice… :confused:

int pinI1=8;//define I1 interface, Motor Pin
int pinI2=11;//define I2 interface, Motor Pin 
int speedpinA=9;//enable Motor A
int speed =1000;//define the spead of motor
const int pingPin=7;//UltraSonic Sensor Pin. let it be noted that const means constant
int servopin = 4;//Servo Pin
int pulse = 1500;//Servo

void setup()
{
  Serial.begin(9600); //initializes serial communication
  pinMode(pinI1,OUTPUT);
  pinMode(pinI2,OUTPUT);
  pinMode(speedpinA,OUTPUT);
  pinMode(servopin, OUTPUT);
}

void Forward()
{
  analogWrite(speedpinA,speed);//input a simulation value to set the speed
  digitalWrite(pinI2,LOW);
  digitalWrite(pinI1,HIGH);
}

void Backward()//
{
  analogWrite(speedpinA,speed);//input a simulation value to set the speed
  digitalWrite(pinI2,HIGH);
  digitalWrite(pinI1,LOW);
}

void Stop()
{
  digitalWrite(speedpinA, LOW);
  delay(1000);
}

void Servo_Motor_Turn()
{  
  digitalWrite(servopin, HIGH);
  delayMicroseconds(pulse);
}

void Servo_Motor_UnTurn()
{
  digitalWrite(servopin, LOW);
  delayMicroseconds(pulse);
}

long Sensor_loop()//this funtion is going to need to be played with
{
  long microseconds, inches;//establishes variables: duration(microseconds) and distance(inches)

  //the next little bit is to initiate Pulse(HIGH) for 2 or more microseconds. Sends LOW pulse beforehand to ensure a clean HIGH pulse
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  microseconds=pulseIn(pingPin, HIGH);

  //code to convert time to distance
  inches= long (microseconds/74/2);
  //code to print distance values
  Serial.print(inches);
  Serial.print("in, ");
  return inches;

  delay(100);
}

void loop()//Main program
{
  long inches = Sensor_loop();
  {
    if (inches>6)
      {
        Forward();
        delay(2000);
      }

    else if (inches<=6)
    {
      Stop();
      Servo_Motor_Turn();
      Backward();
      delay(2000);
      Stop();
      Servo_Motor_UnTurn();
      delay(2000);
      Stop();
    }
  }
}

HI, Matt, have you tried running the motors from the battery direct to see how fast they run?
Have you loaded a simple sketch that just makes the motors run?

You will have to start debuging one step at a time, so start with getting the motors to run reliably.

How have you connected the motor shield the power the motors?

Hope to help....Tom.... :slight_smile:

The servo works just fine... And the drive motor, when hooked up to a 9v, ran but stuttered as it did... Like it was on some sort of delay. I assumed it was caused by a spotty connection at the battery.

When flipped on it's back, it runs. Wheels spin. But for some reason not moving at max speed- compared to what it did prior to me stripping it from it's original board, as I had anticipated. And the second the wheels touch the floor it bogs down.

Hi, what happens when you run the motors directly from the 7.2NiCad pack, the 9V you quote testing, is it a small one with clips on the top? If so they don't have the grunt to run a motor.

As I said, try it on the 7.2V to check performance, and then write a sketch that purely runs the motors.

Tom.... :slight_smile:

Yea, it was just a traditional 9v. And I'll try that... The original board had a transformer inlined with the motor... Could that possibly have something to do with the performance difference?

Hi, a transformer or a coil, how many wires, if just two wires in series with the motor it is an inductor.
They are used to help stop electrical noise from the motor causing interference with the RC receiver.

Tom..... :slight_smile:

Transformer, and I'd have to check... But I thought 4. It was sodered onto the original board.

Hi, possible to post a picture of the transformer, could just be a bifilar wound inductor.

Have you tried a sketch just to drive the motors.

Tom..... :slight_smile:

Not yet... Unfortunately I'm away from my bot and computer at the moment

It reads:
FRM3W-2A10
DC 5V
10A/24VDC/220VAC

And I’m about to try coding just for the motor, and powering the motor streight from the 7.2v battery.

Coded to run just the drive motor, has no effect on it. And connecting the motor directly to the battery, it floors it. So it would seem my output is too low. Suggestions how I can fix this?

Hi, Matt.

Can you please post a copy of your circuit, in CAD or picture of hand drawn circuit in jpg, png or pdf format.

Tom.... :slight_smile:

I don’t know enough about circuits to draw one out…
But, I was able to find a quick sketch of the board at:
http://www.seeedstudio.com/wiki/Motor_Shield_V1.0
My servo is plugged into J15, the ultrasonic into J18, my 7.2v battery to the external power jack, and my drive motor to M1, and obviously the motor shield to the Uno via its the headers.

Like I said, I ditched the original board that was in the RC truck and the steering motor and swopped them out for the Uno, Seeed motor shield, and a servo; and kept the original motor and gear assembly.

600px-Motor_shield-hard3.jpg

The blue and yellow wire are to the drive motor