arduino hangs when connected to 220v supply through relay

i am trying to control the home appliances through the arduino board. when i connect the led and test it, it works good. but when i connect to the 220v appliances through relay my arduino functions with two or three controls and it gets hangs up and doesnt funtion until i press reset. please help me, where i am wrong.

As you're not supplying much information, I'm guessing wildly. Maybe the relays draw too much current during activity or produce too much noise. Do you have a schematics of your circuitry? What are the technical details of your relays? Links for them?

Interference from your appliance is probbly upsetting the arduino. Look for things like snubbers or surge supressors to add on to your mains appliance to cut this down.

pylon: Do you have a schematics of your circuitry? What are the technical details of your relays? Links for them?

its a simple circuit. i am connecting my 3rd,5th,6th pin to led(getting good output). when i connect the same pins to relay and other pins of relay with 220v appliance as switch, it gets hanged up.

Is it a 5v relay that draws less than 30ma? If not you need a transistor and a diode tp power the relay

jonyjakee: its a simple circuit.

Simple enough to post, so we can help you?

My understanding based on numerous posts in this forum, is that even if the Ardy can provide the current, it should be protected from any inductive device by a diode....

(Edited a bit, didn't make sense before)

here is the circuit.

ciruit.png

You certainly need a diode across the relay to absorb the EMF when you turn it off, and unless the relay coil draws less than 20mA you need to drive it via a transistor.

please give me the transistor circuit. i am having confusion with it.

Have a look here. About halfway down it explains using a transistor as a switch, as well as the protection diode.

i am choosing now to use optocoupler to solve the problem. i am using optocoupler pc-817.

here is the sample optocupler diagram.

please help me to use the appropriate resistors to use with it. because i got many different resistors value in using it.

Is the Arduino trying to turn on/off the light (OUTPUT), or is it trying to read it's state (INPUT)?

Is the Arduino trying to turn on/off the light (OUTPUT), or is it trying to read it's state (INPUT)?

Arduino trying to turn on/off the 220v appliances

Those resistor values are a good start. The LED side goes to the arduino. The transistor side goes to another transistor that then drives the relay.

please teach me in calculating the proper resistor. it will be more help full.

No you are not up to understanding it and it is not important and you will only arrive at the values you have now. This is not a critical part of the design. What is important is the circuit you use. That is what you are failing to understand or even address.

Id suggest reading about ohms law first, it will help

Start off by reading this:- http://www.thebox.myzen.co.uk/Workshop/Motors_1.html Anything you don't understand then ask.

Why complicate things with an optocoupler? You can do it with a relay, transistor, diode and a resistor. You could even get a solid state relay and drop the transistor and resistor.