0

L293D Connection.. Pin refers to pin of the Arduino

The motor are not rotating in the above circuit . Or rather the Voltage between the two Motor Terminal is zero. I have checked the Pin 10 & 11 and Pin 12 & 13. They are fine and produces desired Voltage.

When I have earlier connected the circuit only to one motor then it worked[ there were no motor right, Pin 12 and Pin 13]. But now, it's not.

What's the problem? The code in the arduino is as follows:

const int echo = 7;// connected to ultrasonic sensor's echo
const int trig = 8;// connected to ultrasonic sensor's trig
const int Right1 = 10;
const int Right2 = 11;
const int Left1 = 12;
const int Left2 = 13;
void setup() {
  pinMode(echo, INPUT_PULLUP);
  pinMode(trig, OUTPUT);
  pinMode(Right1, OUTPUT);
  pinMode(Right2, OUTPUT);
  pinMode(Left1, OUTPUT);
  pinMode(Left2, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  digitalWrite(trig, LOW);
  delayMicroseconds(2);
  digitalWrite(trig, HIGH);
  delayMicroseconds(5);
  digitalWrite(trig, LOW);
  int duration = pulseIn(echo, HIGH);
  int cm = microsecondsToCentimeters(duration);
  if (cm > 4)
  {
    digitalWrite(Right1, HIGH);
    digitalWrite(Right2, LOW);
    digitalWrite(Left1, HIGH);
    digitalWrite(Left2, LOW);
  }
  else
  {
    digitalWrite(Right2, HIGH);
    digitalWrite(Right1, LOW);
    digitalWrite(Left1, LOW);
    digitalWrite(Left2, HIGH);
  }
  delay(50);
  Serial.println(cm);
}
long microsecondsToCentimeters(long microseconds)
{
  return microseconds / 29 / 2;
}
1

Try these steps

  1. Increase the delay of 50ms to a longer time.

If that fails to work try,

2.Running the motor by just directly connecting the terminal to the 9V battery which you are using.

If the motor runs then most probably the motor requires more current than what the L293D can output which as per the data sheet is 600mA. A solution to this would be using a higher current motor driver like L298N.

If the motor doesn't run directly by the battery then well change the battery to one which can supply enough current.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.