Arduino powers up if only ground is conneted

Hello. I am using l298N motor driver module with arduino. Problem is that i used a common ground pin form l298n and connected to arduino. If i didn't connect my arduino to a computer and plug batteries in the l298n module the arduino powers up( i dont' get it, i didn't connect usb port to an arduino nor i supplied arduino voltage from batteries via Vin pin) What is happening?.

Also another issue my module wont perform the desired output i.e motors wont run if i put my fingers below the l298 moudle it works and by doing this smy usb port got fried...? Anyone help me out please?

Please make a simple pencil drawing showing how everything is connected and post a photo of the drawing. See this Simple Image Guide

Verbal descriptions of wiring are too easy to misunderstand.

...R

homie_sal: Hello. I am using l298N motor driver module with arduino. Problem is that i used a common ground pin form l298n and connected to arduino. If i didn't connect my arduino to a computer and plug batteries in the l298n module the arduino powers up( i dont' get it.

Phantom powering via the signal lines between Arduino pins and the L298N. You should never be powering up the L298N and Arduino separately as such phantom powering severly stresses the input-protection diodes and internal components in the chips.

Thank you robin. Hope this will help

Image from Reply #3 so we don't have to download it. See this Simple Image Guide

...R

What do you mean by "No USB port is attached".

You have not numbered the Arduino pins.

...R

int enA = A0;//A0
int in1 = 6;//A1
int in2 = 7;//10
// motor two
int enB = A7;//A3
int in3 = 8;//A2
int in4 = 9;//8
void setup() {

pinMode(enA, OUTPUT);
pinMode(enB, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
}

void loop()
{
straight();
left();
delay(5000);
straight();
right();
delay(5000);
straight();
delay(5000);
pause();

}
void straight()
{

digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
// set speed to 200 out of possible range 0~255
analogWrite(enA, 200);
// turn on motor B
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);
// set speed to 200 out of possible range 0~255
analogWrite(enB, 200);
// delay(2000);
}

void left()
{

digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
// set speed to 200 out of possible range 0~255
analogWrite(enA, 200);
// turn on motor B
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
// set speed to 200 out of possible range 0~255
analogWrite(enB, 200);
// delay(2000);
}

void right()
{

digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
// set speed to 200 out of possible range 0~255
analogWrite(enA, 200);
// turn on motor B
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);
// set speed to 200 out of possible range 0~255
analogWrite(enB, 200);
// delay(2000);
}

void pause()
{

digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
// set speed to 200 out of possible range 0~255
analogWrite(enA, 200);
// turn on motor B
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
// set speed to 200 out of possible range 0~255
analogWrite(enB, 200);
// delay(2000);
}

Robin, my meaning for usb port not attached is that" i uploaded the sketch depicted above from my laptop once and then unplugged my usb port and then the respective pins w.r.t to sketch are attached to arduino and ground is common between arduino and l298 moudule as shown in the diagram, arduino powers on and when i plugged in the usb port of computer with arduino my ports got burnt.." Hope this will help. Thanks again

To make it easy for people to help you please modify your post and use the code button </>
codeButton.png

so your code looks like this and is easy to copy to a text editor. See How to use the Forum

I can see that you have chosen Arduino pins in your program. But I don't know which pin is which in your diagram.

How is the Arduino powered when it is disconnected from the PC?

...R

yes this is i am wondering why it is powered up without pc.. regarding pins robin its the same as in the sketch provided. Apologies i am new to this forum so making some mistakes. Moreover i didn't mention pin numbers in the diagram beacuse it will get messy..

homie_sal: yes this is i am wondering why it is powered up without pc.

That was answered in Reply #2

You need to give the Arduino a suitable power supply.

regarding pins robin its the same as in the sketch provided.

That may be, but as there are no pin numbers on your drawing I can't relate the program to the drawing.

...R