Serial communication breaks down when powering up a relay !!

I power up the arduino UNO board using USB power . The problem is whenever i power up a relay, the serial communication breaks down . . . what should i do ?? using a external power source to power up the arduino will solve the problem ??

I power up the arduino UNO board using USB power . The problem is whenever i power up a relay, the serial communication breaks down . . . what should i do ?? using a external power source to power up the arduino will solve the problem ??

What do you mean "power up a relay"? Some random relay in the next room, or is it somehow attached to the Arduino.

You'll need to provide code and circuit. Are you by any chance switching the relay with pins 0 or 1?

here's how i connected the relay to arduino . . when switching ON and OFF relay the serial communication does not work . .

arduino_relay.jpg

Which digital pin?

But yep probably a good idea to power the coil from another supply- what current does the coil draw?

give 5V usinge pin 5 and give HIGH or LOW using pin 6

You shouldn't provide power from an i/o pin except to eg an led or similar. I suspect the coil takes more than the 40mA max allowed, or certainly more than the 20mA recommended.,

Maybe try from the 5V supply pin which can give more- I can't remember the amount.

edit... I hope the motor's 5V is external not from Arduino.....

i have already used the 5V pin for other modules . . so i used the i/o pin . . . no i'm not giving 5V to the motor from arduino . . i used the 5V pin first time to give 5v to relay but the same thing happened . . so i changed to i/o pin. . .

Well if the motor is 5V as well, power the relay coil from there.

Maybe. But I like to know how you have connected the relay ?
It could be a very heavy relay, to much for the usb power. It could be wrong connected, for example directly with an Arduino pin. It could be a voltage peak because a fly-back diode is missing. And there are many more possibilities...

@crazygavinbuddy, do not cross-post. Threads merged.

I'm using a 1N4003 diode parrallel with the relay. . .