Problem in using a relay board with arduino

Hello friends, I am using a 8-relay board to control certain electrical gadgets.And I am controlling it with a custom made arduino compatible board. Once I get an input in pin 12, it will turn on all the relays connected right from pin 2 to 10.

A strange problem which i am facing is that, when ever I connect a relay through the ULN2803 ic, the relay is continuously turning on and turning off. But when I touch the usbport on the arduino board or connect the ground pin to earth, there is no such problem. More over when I connected a LED between the respective output pin and ground, I was able to see the LED glow with mild flickering.

Am I having any unnecessary noise in my circuit, if so please can any one explain me what is happening and what should I do to fix this problem.

Got a schematic?
I have a relay shield that I designed, uses a shift register to control the relay coils.

Uno relay board in action with 8 LED strings, check it out

Got any code? Are you setting those pins as outputs?

This is my code.

int r1 = 2; int r2 = 3; int r3 = 4; int r4 = 5; 
int r5 = 6; int r6 = 7; int r7 = 8; int r8 = 9;
int p1 = 11; int p2 = 12; int p5 = 13;

void setup()
{
  pinMode(r1, OUTPUT); pinMode(r2, OUTPUT); pinMode(r3, OUTPUT); pinMode(r4, OUTPUT);
  pinMode(r5, OUTPUT); pinMode(r6, OUTPUT); pinMode(r7, OUTPUT); pinMode(r8, OUTPUT);
  pinMode(p1, INPUT); pinMode(p2, INPUT); pinMode(p5, INPUT);
  digitalWrite(r1, LOW); digitalWrite(r2, LOW); digitalWrite(r3, LOW); digitalWrite(r4, LOW);
  digitalWrite(r5, LOW); digitalWrite(r6, LOW); digitalWrite(r7, LOW); digitalWrite(r8, LOW);
}

void loop()
{
  if ((digitalRead(p1)) == HIGH)
  {
    digitalWrite(r1, HIGH); digitalWrite(r2, HIGH);
  }

  else if ((digitalRead(p2)) == HIGH)
  {
    digitalWrite(r3, HIGH); digitalWrite(r4, HIGH);
  }

  else if ((digitalRead(p5)) == HIGH)
  {
    digitalWrite(r1, HIGH); digitalWrite(r2, HIGH); digitalWrite(r3, HIGH); digitalWrite(r4, HIGH);
    digitalWrite(r5, HIGH); digitalWrite(r6, HIGH); digitalWrite(r7, HIGH); digitalWrite(r8, HIGH);
  }

  else
  {
    digitalWrite(r1, LOW); digitalWrite(r2, LOW); digitalWrite(r3, LOW); digitalWrite(r4, LOW);
    digitalWrite(r5, LOW); digitalWrite(r6, LOW); digitalWrite(r7, LOW); digitalWrite(r8, LOW);
  }

}

This is the schematic https://drive.google.com/file/d/0B0_IhQLqxL9lVlFLT0hUSXM0bEE/view?usp=sharing

Hi, Can you write in pin numbers and what the pins are on the relay pcb.

Tom... :)

Im using pins 2 to 9 as output pins, to control the relay.
And I am using 11,12,13 as input pins.

The program is also pretty simple, if I have my 13 pin as HIGH, all 8 of my relays must be turned on.

Even now, im having the same problem. As soon as connect the arduino to my relay board, the relays go haywire. They just start turning on and off rapidly.
But if I touch the ground pin of the power source,or the USB port of arduino, it does not happen.

Please someone help me with this problem.
I have tried pull down resistors also with the input pins. Nothing is working out.

PLEASE some one help!

Even if I connect a single relay,it goes crazy. I seriously don’t understand what the problem is. My project is hanging in the middle because of this problem.

I would seriously appreciate any help asap…

And thanks in advance to those who take interest in reading this post and replying.

PLEASE some one help!

It is hard to help when you do not cooperate.

I asked for a schematic, you have not posted a proper one. Tom asked you to fill in the pin numbers you did not.

Without identifying the connections what you drew is useless. It sounds like you have a floating ground, can you cope with that? Without a schematic we can't see where your ground connection is missing.

HI mike n tom I just thought that I have given enough information, anyways I apologize if that was sufficient enough.

Anyways guys believe it or not, I just rewrote the same code and uploaded,its working like a charm. I am not able to believe that. The same code which I have posted in the forum only.

If possible, someone can try the same code and lemme know if you have the same problem. I checked the code several times but I dont think that I found any error, if anyone interested, can figure out the cursed code :P

Thanks a lottt goys for your timely support and help. I really appreciate all your support.

if this is solved edit the subject line on your first post and add

[solved]

to the end

Problem in using a relay board with arduino[solved]