Let's Make Robots!

motors not starting- l293d motor controller

Hello guys

I made the connections as per my knowledge. However, the motors dont work. Could you help me out??

Sorry for the confusing connections. And, i have powered my arduino through the usb cable.

Thankyou guys, you know this one!!!

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Chris the Carpenter's picture

Connect your enable pins to something. For initial testing, just connect them to +5v. Once it works with this set-up, then you can transfer these enable pins to (2) PWM pins on your arduino. These PWM pins will become your speed conrol while the direction pins (the ones you are using now) will continue to work in the same way.

Geir Andersen's picture

Just to cover the obvious. Have you connected the motor battery with Arduino ground?

Enigmerald's picture

i havent geir....i didn't know that.....lemme try that

Dan M's picture

The first thing I notice is that the extra battery for motor drive is not hooked to the right spot.

 OK, I see the amended drawing, so this one is now changed.

Secondly, I am wondering if you are using PWM signal to drive the motors? If so, I notice that of the wires hooked to pins 4, 5, 6, & 7, only two of those are capable of PWM.   nevermind that. I see the program now.  Looking it over.

 

 Ok, next thing to check, where are the enable leads hooked to?  Enable1 and Enable2

 

Enigmerald's picture

oh....and here is the program

int motor_left[] = {7, 6};

int motor_right[] = {5, 4};

 

// --------------------------------------------------------------------------- Setup

void setup() {

Serial.begin(9600);

 

// Setup motors

int i;

for(i = 0; i < 2; i++){

pinMode(motor_left[i], OUTPUT);

pinMode(motor_right[i], OUTPUT);

}

 

}

 

// --------------------------------------------------------------------------- Loop

void loop() { 

 

drive_forward();

delay(1000);

motor_stop();

Serial.println("1");

 

drive_backward();

delay(1000);

motor_stop();

Serial.println("2");

 

turn_left();

delay(1000);

motor_stop();

Serial.println("3");

 

turn_right();

delay(1000);

motor_stop();

Serial.println("4"); 

 

motor_stop();

delay(1000);

motor_stop();

Serial.println("5");

}

 

// --------------------------------------------------------------------------- Drive

 

void motor_stop(){

digitalWrite(motor_left[0], LOW); 

digitalWrite(motor_left[1], LOW); 

 

digitalWrite(motor_right[0], LOW); 

digitalWrite(motor_right[1], LOW);

delay(25);

}

 

void drive_forward(){

digitalWrite(motor_left[0], HIGH); 

digitalWrite(motor_left[1], LOW); 

 

digitalWrite(motor_right[0], HIGH); 

digitalWrite(motor_right[1], LOW); 

}

 

void drive_backward(){

digitalWrite(motor_left[0], LOW); 

digitalWrite(motor_left[1], HIGH); 

 

digitalWrite(motor_right[0], LOW); 

digitalWrite(motor_right[1], HIGH); 

}

 

void turn_left(){

digitalWrite(motor_left[0], LOW); 

digitalWrite(motor_left[1], HIGH); 

 

digitalWrite(motor_right[0], HIGH); 

digitalWrite(motor_right[1], LOW);

}

 

void turn_right(){

digitalWrite(motor_left[0], HIGH); 

digitalWrite(motor_left[1], LOW); 

 

digitalWrite(motor_right[0], LOW); 

digitalWrite(motor_right[1], HIGH); 

}