Dual H-Bridge L293D and 90 rmp 12V motor

Hi everyone,
I need help asap!
I am working with a dual H-bridge L293D and a 12V motor with 90 rmp. My goal is to spin that motor clockwise and counterclockwise to spin my lead screw.
The problem: the motor’s speed isn’t that high.
I have connected my 12V adapter to the H-bridge, VCC to 5V in arduino GND to GND, pin 9 to M1A and pin 10 to M1B. Then my P2 for M1 positive and negative is connected to my motor. The code compiles well and it spins but I realized that when I remove the adapter the motor functions in the same speed. Which I assume it means the motor is running on the 5V provided by the arduino.
What am I doing wrong??


Thank you

Posting an images of code is a waste of time

The easier you make it to read and copy the code the more likely it is that you will get help

Please follow the advice given in the link below when posting code

int M1_Left=9; //direction
int M1_Right=10; //direction

void setup(){

pinMode(M1_Left, OUTPUT);
pinMode(M1_Right, OUTPUT);
digitalWrite(M1_Left,HIGH);
digitalWrite(M1_Right,LOW);

}
void loop() {
turn(1);
delay(10000);
turn(2);
delay(10000);
stop();
delay(5000);
}

void turn(int direction){
boolean inPin1=LOW;
boolean inPin2=HIGH;

if(direction==1){
inPin1=HIGH;
inPin2=LOW;

if(direction==2){
inPin1=LOW;
inPin2=HIGH;
}
}
digitalWrite(M1_Left, inPin1);
digitalWrite(M1_Right, inPin2);
}

void stop() {
digitalWrite(M1_Left, LOW);
digitalWrite(M1_Right,LOW);
}Preformatted text

@ ritat
Did you forget to use code tags when posting your sketch ?

Please post the details on your motor, and the circuit schematic. Never run a motor
driver without the motor supply being present, that risks toasting the driver or
Arduino as high currents are using logic signal paths in that situation.

I am sorry I am new to this what are code tags?
Oh I think I know what you mean, possibly!
But how to I add them??

Is it ok if I post a picture I don’t know how to draw the schematics

You were pointed to the “How to get the best out of this forum” thread. If you
read it you would know. </> icon.


int M1_Left=9; //direction
int M1_Right=10; //direction

void setup(){

  pinMode(M1_Left, OUTPUT);
  pinMode(M1_Right, OUTPUT);
  digitalWrite(M1_Left,HIGH);
  digitalWrite(M1_Right,LOW);

}
void loop() {
  turn(1);
  delay(10000);
  turn(2);
  delay(10000);
  stop();
  delay(5000);
}

void turn(int direction){
  boolean inPin1=LOW;
  boolean inPin2=HIGH;

  if(direction==1){
    inPin1=HIGH;
    inPin2=LOW;

  if(direction==2){
    inPin1=LOW;
    inPin2=HIGH;
  }
  }
  digitalWrite(M1_Left, inPin1);
  digitalWrite(M1_Right, inPin2);
}


void stop() {
  digitalWrite(M1_Left, LOW);
  digitalWrite(M1_Right,LOW);
}

Not to worry we all started in the same spot. Try googling “drawing electrical schematics”, you will find many tutorials. I use KiCad and love it. The L293D is far from the best driver, it is bipolar and has a severe volt drop by the time the motor gets it. Look for a MOSFET bridge, you will get much more power to your motor. Since our eyes are not strong enough to see your project the best way to pass information is via a schematic, hand drawn is OK. We have to make guesses as to what parts you are using unless you include links to the hardware parts showing technical information. When you try to find a MOSFET H bridge you will get an idea of why we ask for this.

Hi, @ritat
Welcome to the forum.

Where did you get the info on how to connect your Arduino to the 293?

Thanks… Tom… :grinning: :+1: :coffee: :australia:

Thank you everyone I was able to solve the problem that yellow cap was wrongfully positioned it provided the motor the 5V of the arduino and not the adapter