Arduino UNO Is Not Getting Power From L293D

I am trying to create a line following car with L293D, 4 Motors, 11-12V of external power supply and Arduino UNO. However while everything is working fine it is only working when USB is connected to my UNO. Even IR sensors are turning on ONLY WHEN USB is attached. However at the same time when USB is attached to Arduino motors are not running unless I switch on the power supply (3 cells each approx 3.7-4V).

My conclusion is that it’s because cells are not providing enough power to board and that is why it is not turning on. But I am no expert I’m just doing it for University project my domain lies on software side, so this all is very confusing to me.


#include <AFMotor.h>

//defining pins and variables
#define lefts A0
#define rights A1

//defining motors
AF_DCMotor motor1(1, MOTOR12_1KHZ); 
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);



void setup() {
  //Setting the motor speed
  motor1.setSpeed(100);
  motor2.setSpeed(100);
  motor3.setSpeed(100);
  motor4.setSpeed(100);
  //Declaring PIN input types
  pinMode(lefts,INPUT);
  pinMode(rights,INPUT);
  //Begin serial communication
  Serial.begin(9600);
  
}

void loop(){
  //Printing values of the sensors to the serial monitor
  Serial.println(analogRead(lefts));
  Serial.println(analogRead(rights));
  //line detected by both
  if(analogRead(lefts)<=350 && analogRead(rights)<=350){
    //Forward
    motor1.run(FORWARD);
    motor2.run(FORWARD);
    motor3.run(FORWARD);
    motor4.run(FORWARD);
  }
  //line detected by left sensor
  else if(analogRead(lefts)<=350 && !analogRead(rights)<=350){
    //turn left
    motor1.run(FORWARD);
    motor2.run(FORWARD);
    motor3.run(BACKWARD);
    motor4.run(BACKWARD);
    
  }
  //line detected by right sensor
  else if(!analogRead(lefts)<=350 && analogRead(rights)<=350){
    //turn right
    motor1.run(BACKWARD);
    motor2.run(BACKWARD);
    motor3.run(FORWARD);
    motor4.run(FORWARD);
   
  }
  //line detected by none
  else if(!analogRead(lefts)<=350 && !analogRead(rights)<=350){
    //stop
    motor1.run(RELEASE);
    motor2.run(RELEASE);
    motor3.run(RELEASE);
    motor4.run(RELEASE);
   
  }
  
}

You need to show us a wiring diagram/schematic of how you have things connected.

The UNO is missing in the picture.

We must assume the UNO/Arduino is under the motor shield.

:thinking:

  • Take out your voltmeter and check Arduino +5v when the UNO is not plugged into the USB.

  • There is probably a jumper on the shield that needs to be added so the battery can provide power to the Arduino Vin pin.

Looks like the motor shield described on this page.

Motor Power Connections
The shield supports a motor voltage range of 4.5 to 25 volts. This power can be shared with the Arduino or used separately. In order to choose between the two, a special jumper labeled PWR is provided near the two-terminal power connector.

Did you set this jumper?

1 Like

There it is:

IMG_2322

  • Suggest keeping the battery 7 to 9v.

IMG_2320

There is no jumper on my board?

Correct. But there are holes in the PCB where the jumper would go. What are you going to do now?

I have contacted the person who sold it to me, he is saying he can get it soldered.

Do you think that will fix it for good?

  • Adding the jumper will connect the battery to the Arduino Vin pin as seen in the schematic.

  • The Vin pin connects the battery to the Arduino 5v regulator which will then power the Arduino when the Arduino is not connected to USB.

  • Best limit the battery voltage to 7-9V

I would say this. Somehow, you got into a university, right? :wink: Make the most out the opportunity that you can. You are surrounded by thousands of skilled and knowledgeable people. Take advantage of that, learn every bit of knowledge and skill you can. They won't mind. They will be so pleased! Don't limit your mind by telling yourself you are in the "software domain" and can't do anything else. Learn about electronic circuits. Learn how to solder. Who knows what skills you might benefit from later in your life/career. End of lecture :wink:

1 Like

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