Arduino Clone Resets itself

Hi,
I've built an arduino clone following this tutorial http://www.arduino.cc/en/Main/Standalone .. It works pretty well except for a few glitches.. The clone is built on a breadboard using atmega8 .I have this code which based on inputs from a PIR sensor it turns on/off a relay. This code works perfectly in the normal arduino UNO . But in the clone for some reason ( very random, not always ) the clone resets itself whenever it tries to trigger the relay on/off . I dont know if it is a complete reset as such cause if the relay is turned ON ,it remains ON its just that the whole program starts from the beginning i.e. the calibration of the PIR sensor etc which i have included in the setup.But its not like the whole arduino resets and whatever arduino pin was high goes to low etc. It remains the same but in the serial terminal i can make out it has resetted as it runs setup() again.
In the clone i wrote seperate codes to trigger the relay on/off by giving a serial input like 'a' , 'b' etc , during those times the relay triggers and the clone does NOT reset . i even wrote seperate codes to just read PIR sensor inputs and display it in the terminal and that too works perfectly.. no resetting.. But when the code which triggers the relay based on PIR sensor input is placed the clone resets randomly although the same code works perfect on a UNO.
Does it have something to do with the relay and the PIR together drawing too much current causing the reset?its weird cause it happens only when both are connected together.
NOTE: the clone is powered by a 12v adapter through a 7805 voltage regulator. The PIR sensors and the relay have their own power source and does not take power from the clone.

Really hope to get a solution to this problem.Thank you ..

It sounds like a spike from the relay coil is causing the interference. Does the relay have a suppression diode?

Otherwise, do you have anything connected to the reset pin on the clone board? If not, try adding a resistor and/or capacitor as on the Uno. Keep the wires connected to the reset pin short and well separated from the relay.

hi.. thanks for the reply.. i dont think its anything to do with the relay board..as i said earlier the relay board works perfectly fine when its interfaced alone with the clone without the PIR..i have a 10k resistor connected b/w VCC and RESET PIN as mentioned in the tutorial.. i havent put any wire ..one end of resistor goes to VCC other end to RESET PIN..

I've built an arduino clone following this tutorial http://www.arduino.cc/en/Main/Standalone .. It works pretty well except for a few glitches.

I don't see any bypass capacitors used on that setup which certainly would explain the glitches. Try using some 0.1 uf capacitors between VCC and GND (both of them) and between AREF and GND.

Don

Edit: Try using some 0.1 uf capacitors between the VCC pins and GND (both of them) and between the AREF pin and GND.

hey..thanks for your reply..i did use a 10uF capacitor between VCC and GND..

hey..thanks for your reply..i did use a 10uF capacitor between VCC and GND..

That's only 100 x too large. The capacitors, all three of them, should be located right at the respective microprocessor pins. I edited my original reply to try to make this more clear.

Don

ok..will give that a shot..thank you so much ..