Making two DC geared motors run simultaneously

Yesterday I wrote a simple program to run two DC geared motors using Arduino UNO, Adafruit motor shield v1 and powered them with a 12V power adaptor by keeping the jumper in place. First Motor moves slowly and second motor makes some noise, but don’t turns even. And if I put two simple DC motors then both turns at the same speed. And to test my power source, If I connect the same geared motors in parallel outside of Arduino and shield then both runs quite fast. So guide me what I am missing.

#include <AFMotor.h>
AF_DCMotor f_motor(1); // Front motor connected to port 1
AF_DCMotor r_motor(2); // Rear motor connected to port 2

void setup(){
  Serial.begin(9600);
}

void loop(){
    f_motor.setSpeed(100);
    r_motor.setSpeed(100);
    f_motor.run(FORWARD);
    r_motor.run(FORWARD);
}

Congratulations on using the code tags in your first post!

You have the motors set to run at less than half speed. Try using setSpeed(255).

Steve

Thanks.

I already tried setting the setSpeed by two ways but no luck

for(int i=0; i<255;i++) {
    f_motor.setSpeed(i);
}
f_motor.run(FORWARD);

&

f_motor.setSpeed(255);

Maybe there is a bad connection in the power circuit. Check the voltage across the two motors to see if it is anywhere near 12V.

Hi,
OPs pic.


If you are trying to power a RC cart motor with that motor controller?
That is your problem.

What is the rating of the motors?
What is the rating of the outdated motor controller?

Look up the specs/data and please post a link to them.

Tom... :slight_smile: