relay switching problem

hello Friends,

I am doing an automation project.In it i use a PIR sensor for human detection with an input shift resister and atmega 32 controller...data communication is through Ethernet module...The output of the PIR sensor is 230v so i cant give it directly to the input shift resister so i used a AC relay(coil voltage is 230v). My problem is that when AC relay switch some time my controller going to stuck and stop communication, when i reset controller its start to work fine...so how can i solve this problem,when relay switch some time my controller going to stuck.here i attached the circuit of connection.I hope my friend can help me in this issue.. Thank you very much

|500x231

First of all this is a strange setup! Normally you use a relay to control AC mains from 5V DC not the other way round. You can get low voltage PIR sensors such as : THIS and avoid messing with mains voltages.

What exactly are you trying to do? Why use a shift register when you can connect directly to arduino pin?

You also need to post some code ..

One thing for sure is that the relay coil needs an MOV. Use one rated at 275-300VAC and connect it across the coil. How close is the relay to the electronics? Also curious about the shift register.

Watcher: First of all this is a strange setup! Normally you use a relay to control AC mains from 5V DC not the other way round. You can get low voltage PIR sensors such as : THIS and avoid messing with mains voltages.

What exactly are you trying to do? Why use a shift register when you can connect directly to arduino pin?

You also need to post some code ..

hello friend thanks for your reply...here we use a PIR sensor it has more range of detection and more efficient so we bought it...i use a shift register because here in circuit i only shown one PIR but actually there is number of sensors connected,so we using a shift resister....In normal PIR sensor it work fine..i think the problem with this new PIR and associated hardware.. can you help me friend?

dlloyd: One thing for sure is that the relay coil needs an MOV. Use one rated at 275-300VAC and connect it across the coil. How close is the relay to the electronics? Also curious about the shift register.

thank you for your valuable reply.... we do not use varistor yet... i will try it...the relay and electronics is about 50 to 60 cm distance...

The lock-up problem when AC relay is energized or de-energized is due to emissive EMI/RFI from the relay coil during switching. A common solution is an MOV across its coil. You also may need to further separate the AC circuit and relay from the low voltage DC electronics.

EDIT: Your reply came in about the same time ... thanks. You'll notice a great improvement with the MOV.

thank you sir.. thank you very much for your sincere help.. i will update the result after use it... thank you very much

hello friends.. can i replace the relay with an opto coupler.. any way? please help me

If you use an opto coupler you'll get 50/60Hz or 100/120Hz signal (depending if its bidirectional input or not), which would require debouncing.

A mains-powered opto isolation should be capacitively driven to avoid wasting a lot of heat in series resistors, and its vital to get mains-rated capacitor for this, and to understand how to calculate the value. If using unidirectional opto-isolator you need a back-to-back diode across its input to avoid reverse-breakdown on the LED.

[ found an example: http://electronics.stackexchange.com/questions/239343/how-to-detect-220-vac-voltage-using-an-opto-isolator ]

Thank you very much to all my friends for their sincere help... thank you