relay switching problem

Thread Starter

ecworks

Joined May 3, 2016
12
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
 

AlbertHall

Joined Jun 4, 2014
12,625
What is the purpose of the shift register?

The first possible problem I see is that the relay contacts will bounce and generate multiple pulses to the shift register for each relay operation. To fix this you need a circuit like the one below. I don't know whether this will cause the uC lockup.


 

Thread Starter

ecworks

Joined May 3, 2016
12
What is the purpose of the shift register?

The first possible problem I see is that the relay contacts will bounce and generate multiple pulses to the shift register for each relay operation. To fix this you need a circuit like the one below. I don't know whether this will cause the uC lockup.


 

Thread Starter

ecworks

Joined May 3, 2016
12
Its a building automation project we used a number of sensors like PIR(230v),smoke sensor, door sensor etc.. all are controlled by atmega 32 controller...because of using so much sensors we use a input shift register ics and connect the sensors to the input shift register and read it by using controller...
i already used a simple RC filter on the output of the relay,but it doesn't solved the problem...
whats your opinion about a 275VAC MOV across the relay coil...
 

AlbertHall

Joined Jun 4, 2014
12,625
If this problem only occurs when the relay is switched then the MOV is worth a try.
Alternatively, ditch the relay and use an opto-isolator.
You might also try more decoupling on the 5V supply and the 5V regulator input.
 

Thread Starter

ecworks

Joined May 3, 2016
12
If this problem only occurs when the relay is switched then the MOV is worth a try.
Alternatively, ditch the relay and use an opto-isolator.
You might also try more decoupling on the 5V supply and the 5V regulator input.
yes... the circuit work fine with 5v PIR sensor... problem started after connect the 230v PIR sensor and 230v relay
opto coupler idea sound good.. thank you very much for your valuable replies
 

Thread Starter

ecworks

Joined May 3, 2016
12
Which Atmega 32 controller?
How do you know the controller is stuck?
Can you share the code? It may be a software problem.
controller is ATMEGA32A PU
he circuit work fine with 5v PIR sensor... problem started after connect the 230v PIR sensor and 230v relay. I am using an Ethernet module for communication...after some relay switch the communication will lost and in command prompt i get "request timed out" or "destination unreachable" messages ..and the output light do not respond to the input PIR..After reset the controller it start work properly ,i get the ping in command prompt .... i dont think its software issue... i will share the code but its long one include other functions too.. thanks for your valuable replay sir
 

djsfantasi

Joined Apr 11, 2010
9,237
I just noted that the other position of the relay is floating. It should be connected to the 5V supply ground. Otherwise, you cannot determine the relay position. Run it through a 4k7 resistor or greater to minimize current draw. Or even better, also connect the relay common terminal to ground via the resistor.
 

Thread Starter

ecworks

Joined May 3, 2016
12
I just noted that the other position of the relay is floating. It should be connected to the 5V supply ground. Otherwise, you cannot determine the relay position. Run it through a 4k7 resistor or greater to minimize current draw. Or even better, also connect the relay common terminal to ground via the resistor.
i pull down the input shift register,sorry it is not in the circuit..sorry for the mistake...and also i am using an RC filter 4.7k and 22nf capacitor.. but it cant solve the issue sir...
 
Top