Arduino Uno not working with external power supply

Hi, I am a newbie with Arduino. I am trying to build a Line bot, but it is not working. I read a lot of information on the web but nothing solve the issue. The issue is basic, the board and the robot works fine when it is connected to the USB cable and the computer but as soon as i disconnect the USB from the computer and run with an external power supply the board stop executing the program loaded on it.

I am using a NiCd battery pack of 9.6volt used for RF cars, it is made from 8 AA battery. I can see the motor shield board and the Arduino are powered because their LED are on but the Arduino stop running the program loaded on it. If I use in parallel the External power supply and the USB cable the Arduino works fine and execute the program as expected, but if I unplugged the USB cable the Arduino stop to execute the program and restart to execute the program if I connect the USB back to the computer.

I though the program could have been to complicate but I load a simple flashing LED program and I got the same result, the LED is working only while connected to the USB cable and the computer.

I validate the power supply on the VIN pin and the ground and it seem OK the meter shows 8.7 volts.
I validate in board Manager and the right board is selected.

Please any help would be appreciated

Posting the same topic in different parts of the forum is most definitely NOT appreciated.

Duplicates deleted.
Do not cross-post, cross-posting wastes time.

Hi,

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile:

Here is the circuit diagram

Hi,
OPs diagram;
7cc36de93fc4a63b7468c454bfca80ec72e3d96c.jpg
Tom… :slight_smile:

Hi,
I think we need to see your code?

Please post it in code tags please. < / >

Have you double checked your power wires with a DMM?

Tom… :slight_smile:

#define LS 2 // left sensor
#define RS 3 // right sensor
#define LM1 5 // left motor M1a
#define LM2 4 // left motor M2a
#define RM1 7 // right motor M2a
#define RM2 6 // right motor M2b
void setup()
{
pinMode(LS, INPUT);
pinMode(RS, INPUT);
pinMode(LM1, OUTPUT);
pinMode(LM2, OUTPUT);
pinMode(RM1, OUTPUT);
pinMode(RM2, OUTPUT);
}
void loop()
{
if(digitalRead(LS) && digitalRead(RS)) // Move Forward on line
{
digitalWrite(LM1, HIGH);
digitalWrite(LM2, LOW);
digitalWrite(RM1, HIGH);
digitalWrite(RM2, LOW);
}
if(digitalRead(LS) && !(digitalRead(RS))) // turn left by rotationg left motors in forward and right ones in backward direction
{
digitalWrite(LM1, HIGH);
digitalWrite(LM2, LOW);
digitalWrite(RM1, LOW);
digitalWrite(RM2, HIGH);
}
if(!(digitalRead(LS)) && digitalRead(RS)) // Turn right by rotating right motors in forward and left ones in backward direction
{
digitalWrite(LM1, LOW);
digitalWrite(LM2, HIGH);
digitalWrite(RM1, HIGH);
digitalWrite(RM2, LOW);
}

if(!(digitalRead(LS)) && !(digitalRead(RS))) // Finish line, stop both the motors
{
digitalWrite(LM1, LOW);
digitalWrite(LM2, LOW);
digitalWrite(RM1, LOW);
digitalWrite(RM2, LOW);
}
}

Hi,
Thanks for the code,

It looks fine, can you post a picture of your project please so we can see your component layout?
Including the power supply.

Thanks.. Tom.. :slight_smile:

This question is common. Almost always the problem is that someone is attempting to provide power to the Arduino via "Vin" or the "barrel jack" and then has other modules connected to the "5V" pin.

Essentially, you cannot do this. The on-board regulator will not allow it. You need to provide a 5 V regulated power supply for the Arduino and those other modules which also connect to the 5 V pin. You need a "buck" regulator module to take your 9.6volt NiCd battery pack voltage down to 5 V, connect that to the "5V" pin and each other module.

But it could also be a bad cell in the pack, or bad wiring, ot dirty battery terminals, or ...
2-4Amp motor current on startup could bring battery voltage down to the point that the Arduino craps out.
In which case a buck regulator also won't help.
It is rarely a good idea to power Arduino and motor from the same source/battery.
Unless you make sure the above can't happen.
Leo..

Paul__B:
This question is common. Almost always the problem is that someone is attempting to provide power to the Arduino via "Vin" or the "barrel jack" and then has other modules connected to the "5V" pin.

Essentially, you cannot do this. The on-board regulator will not allow it. You need to provide a 5 V regulated power supply for the Arduino and those other modules which also connect to the 5 V pin. You need a "buck" regulator module to take your 9.6volt NiCd battery pack voltage down to 5 V, connect that to the "5V" pin and each other module.

Am a begginer and am not able to understand what you are saying please say in simple language

awsedrfttgyyhuujikolp:
Am a beginner and am not able to understand what you are saying please say in simple language

OK.

If you have things that need 5 V to operate - such as your motor shield and sensors - unless you can absolutely guarantee that they use no more than 10 mA each or 50 mA total, you cannot use the Arduino to provide 5 V to them.

You need a proper regulated 5 V power supply such as a "buck" converter from your 12 V. In which case, you should use it to power the Arduino through the 5 V pin (or USB port) and not attempt to provide any other power to it by "Vin" or the "barrel jack".