Bizzare motor behavior

Hey all,

I followed the following connection schematic for a dc motor with an H-bridge

My connection is below.


This is the following code I am running

//www.elegoo.com
//2016.12.12

/************************
Exercise the motor using
the L293D chip
************************/

#define ENABLE 5
#define DIRA 3
#define DIRB 4

int i;
 
void setup() {
  //---set pin direction
  pinMode(ENABLE,OUTPUT);
  pinMode(DIRA,OUTPUT);
  pinMode(DIRB,OUTPUT);
  Serial.begin(9600);
}

void loop() {
  //---back and forth example
    Serial.println("One way, then reverse");
    digitalWrite(ENABLE,HIGH); // enable on
    for (i=0;i<5;i++) {
      digitalWrite(DIRA,HIGH); //one way
      digitalWrite(DIRB,LOW);
      delay(500);
      digitalWrite(DIRA,LOW);  //reverse
      digitalWrite(DIRB,HIGH);
      delay(500);
  }
  digitalWrite(ENABLE,LOW); // disable
  delay(2000);

}
   

I have videos of whats going on but it seems we cant upload videos. If that is necessary maybe I could upload them to youtube and link them.

I have not connected a battery to the breadboard power supply unit however the motor begins to turn (ie the program runs) though its slow. When i connect the battery it is faster.

Could someone please suggest what could be wrong with my connection or what could be causing the issue?

Edit: I think i can redefine my problem. Why could the motor run when pin 8 on the L293D is not connected to a battery?

If im understanding your reply, is it that pin 16 on the L293D should be connected to 5V on the arduino?

If so, I tried that and have just tried it again, unfortunately gives the same result

Ah and also the ground connections on the other side too I have tried those

Links to the behaviour im describing:

When battery is not connected

When battery connected

Please do not start multiple topics with the same subject.

Please, I'd endear you to fully read both. That was a circuit I tried setting up on tinkercad (actually to see if i could use software to figure up the problem i describe in this post), and this is another problem entirely.

I found the issue to the other problem too.

However I am stumped here, though I will move on for now. If you could please offer any help I'd be grateful.

Thank you

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.