relay switching problem

Go To Last Post
44 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Where's your varistor across the relay coil? And input filtering on the shift register input?
No watchdog in your code?

Last Edited: Mon. Jul 25, 2016 - 05:21 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

Where's your varistor across the relay coil? And input filtering on the shift register input?
No watchdog in your code?

i dont used varistor yet in this circuit...i will try it after buy one... i hope here i need one rated at 300vAC.Sir i have one doubt, can i use a diode In4007 in the coil ,any use by it?

In normal 5v PIR sensor it work fine..i think program is ok,the problem with this new PIR and associated hardware.. can you help me sir?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At the very least you need a low pass filter on your shift register input to eliminate the inevitable relay contact bounce. How often do you expect your relay to be activated (once a day, once a minute?)? That can help you decide how "strong" your filter should be.

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:

At the very least you need a low pass filter on your shift register input to eliminate the inevitable relay contact bounce. How often do you expect your relay to be activated (once a day, once a minute?)? That can help you decide how "strong" your filter should be.

hello sir thanks for your reply...

first i connected a 104 disc capacitor between ground and NO pin of relay, then a 104 and a 470 uf capacitor connected parallely between gnd and NO of relay but no use ....the relay will we activated when a person enter the room so its good to select per minute or per 10 minute

Sir i am going to by  MOV, do you have any other idea to solve this issue...please help me.. Thank you very much sir

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you serious? What effect do you honestly think putting caps on the normally open relay contact will have? I will give you ten minutes to think about what you have said, then embarrass you. cheeky

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:

Are you serious? What effect do you honestly think putting caps on the normally open relay contact will have? I will give you ten minutes to think about what you have said, then embarrass you. cheeky

 

 

angel i dont feel any effect sir....its again went to stuck even after use a capacitor

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

putting a diode across an AC coil is not a real good idea - for half the cycle the diode will appear as a short circuit and cause smoke - that's why you use a varistor in an AC circuit.

470uF! You want to weld the relay contacts? 100nF is much more reasonable along with a 4k7 series resistor. Is your interwebs broken? This is pretty common stuff, most people would Google first.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK then... no response from you so....

 

Your low pass filter design, as described by you is as per the top diagram. The caps connected to the normally OPEN contacts NEVER see the bouncing 5 volt signal. Little wonder you see no effects.

 

If you assemble this, you may see an improvement. R5 and the caps form the low pass filter. The product of their values is called the time constant. The purpose of R4 is to slowly discharge the caps in between your relay events. Actual values will depend upon the timing events. The diode provides some protections for bad fingers.

 

Questions?

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ahhh, our posts passed each other.

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:

OK then... no response from you so....

 

Your low pass filter design, as described by you is as per the top diagram. The caps connected to the normally OPEN contacts NEVER see the bouncing 5 volt signal. Little wonder you see no effects.

 

If you assemble this, you may see an improvement. R5 and the caps form the low pass filter. The product of their values is called the time constant. The purpose of R4 is to slowly discharge the caps in between your relay events. Actual values will depend upon the timing events. The diode provides some protections for bad fingers.

 

Questions?

 

 thank you sir....

sir i have some questions....first, i connected two parallel capacitors on 'com' pin of my relay,sorry for my mistake...

sir if i the relay switches in every second then  can you specify the values of capacitor and resistor sir?

i hope i can use In4007 instead of IN4004?

 thank you very much for your help

Last Edited: Mon. Jul 25, 2016 - 08:30 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

putting a diode across an AC coil is not a real good idea - for half the cycle the diode will appear as a short circuit and cause smoke - that's why you use a varistor in an AC circuit.

470uF! You want to weld the relay contacts? 100nF is much more reasonable along with a 4k7 series resistor. Is your interwebs broken? This is pretty common stuff, most people would Google first.

ok sir thank you very much

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

R5 4k7
R4 22k
Capacitor 100nF
Diode preferably a 5V transzorb

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The particular diode type is not important. I simply used one from my drawing package. It could be 1N4148, 1N914, 1N4000... anything really. Likewise for the SR symbol that I used.

 

As for other component values, I do not know enough about your requirements to answer. For example...

 

- is the shift register clock input edge-triggered or level-triggered? (homework for you... why should it matter?)

- how long is the relay activated per event? (Does the PIR sensor hold the relay closed for 16 seconds like the one in my kitchen?)

 

Time for you to start thinking about why these questions matter...

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Awww Russell... too much spoon-feeding...

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey, I'm waiting for a train - gotta kill some time..... And it's cold and raining.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:

The particular diode type is not important. I simply used one from my drawing package. It could be 1N4148, 1N914, 1N4000... anything really. Likewise for the SR symbol that I used.

 

As for other component values, I do not know enough about your requirements to answer. For example...

 

- is the shift register clock input edge-triggered or level-triggered? (homework for you... why should it matter?)

- how long is the relay activated per event? (Does the PIR sensor hold the relay closed for 16 seconds like the one in my kitchen?)

 

Time for you to start thinking about why these questions matter...

 

sir shift register clock is edge triggered...y should it matter...actually stuck my controller or input shift register...i thing controller because when it stuck the Ethernet module show message "request timed out" in command prompt, after reset controller i get ping again

the sensor has option to select activation time 5sec,2minut,5minut,10 minute and 15 minute..we selected it for 2 minute yet
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:

Awww Russell... too much spoon-feeding...

 

 

oh no sir cheekylaughcrying

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

R5 4k7
R4 22k
Capacitor 100nF
Diode preferably a 5V transzorb

 thank you sir ...

i tested a 22nf series with a 4.5 k resistor but not solved the issue

 i will try the next circuit... thank you very much.. happy journey.. enjoy rain :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If that didn't work, then there's other problems. Layout has a big effect as does power supply.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

If that didn't work, then there's other problems. Layout has a big effect as does power supply.

I tested just with a filter with a resistor and capacitor. don't do the other circuit yet by valuesoft , i need to buy that components.Whats your opinion about connecting a mov 275VAC across the coil of the relay?

Last Edited: Mon. Jul 25, 2016 - 09:28 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You seem convinced that your problem is caused by hardware.

 

Try testing it with a simple program that just blinks a LED.  See if the PIR & Relay causes the LED to stop flashing.

 

Another test is using your current program but disconnect the PIR and Relay and connect a switch to +5 in their place.  See if toggling (pushing) the switch causes the uC to hang.

 

 

Last Edited: Mon. Jul 25, 2016 - 09:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:

The particular diode type is not important. I simply used one from my drawing package. It could be 1N4148, 1N914, 1N4000... anything really. Likewise for the SR symbol that I used.

 

As for other component values, I do not know enough about your requirements to answer. For example...

 

- is the shift register clock input edge-triggered or level-triggered? (homework for you... why should it matter?)

- how long is the relay activated per event? (Does the PIR sensor hold the relay closed for 16 seconds like the one in my kitchen?)

 

Time for you to start thinking about why these questions matter...

 

 hello sir.. actually the com point of relay not going to the clock pin of input shift register...its going to the pin D0 to D7 to detect the corresponding sensor is ON or OFF...the controlling pin CP and CE are connected to the micro controller...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Chuck99 wrote:

You seem convinced that your problem is caused by hardware.

 

Try testing it with a simple program that just blinks a LED.  See if the PIR & Relay causes the LED to stop flashing.

 

Another test is using your current program but disconnect the PIR and Relay and connect a switch to +5 in there place.  See if toggling (pushing) the switch causes the uC to hang.

 

 

sir please dont get angry....

sir i did the second test...i connected a switch and toggle it fast,but no problem the whole circuit work fine...i checked  this circuit with normal 5v PIR sensor its was also worke fine so much days.. problem started after connected the new 230v PIR and Relay to the circuit....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ecworks wrote:

sir please dont get angry....

 

Why would I get angry?

 

Thank you for the additional information.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Chuck99 wrote:

ecworks wrote:

 

sir please dont get angry....

 

Why would I get angry?

 

Thank you for the additional information.

 

 

 because i am asking questions repeatedly... please tell me sir, whats your opinion about a 275VAC MOV across relay coil?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh $deity!! Now you deem to tell us what you are really connecting. What an absolute waste of time and fingertips. If chuck99 is not going to get angry... I will.

 

You are on your own now as far as I am concerned. What a waste...

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ecworks wrote:

please tell me sir, whats your opinion about a 275VAC MOV across relay coil?

 

Kartman and Valusoft would know about that better than I.

 

As for your problem, I seems that the PIR & Relay are generating noise that is getting into the +5V line or the ground line.

 

If you have a scope, see how the +5V supply looks when the relay closes and then opens.

 

On your uC, do you have any brown-out detection?

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:

Now you deem to tell us what you are really connecting.

 

He provided some history. 

The problem started when he replaced the 5VPIR with the 230AC PIR & Relay combo.

 

Why are you angry?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:

Oh $deity!! Now you deem to tell us what you are really connecting. What an absolute waste of time and fingertips. If chuck99 is not going to get angry... I will.

 

You are on your own now as far as I am concerned. What a waste...

 

 i don't understand what you mean..... sir please say clearly if you have any misunderstanding..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Chuck99 wrote:

ecworks wrote:

 

please tell me sir, whats your opinion about a 275VAC MOV across relay coil?

 

Kartman and Valusoft would know about that better than I.

 

As for your problem, I seems that the PIR & Relay are generating noise that is getting into the +5V line or the ground line.

 

If you have a scope, see how the +5V supply looks when the relay closes and then opens.

 

On your uC, do you have any brown-out detection?

 

 

 i aslo think so sir... problem with the relay..Sir whats your openion about replace the relay with an opto coupler... will it work?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ecworks wrote:

Sir whats your openion about replace the relay with an opto coupler... will it work?

 

I don't know.

 

You could just try one and see if it works.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try the mov. You could also try a light bulb as this will provide a load.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

Try the mov. You could also try a light bulb as this will provide a load.

ok sir . thanks for your valuable comment...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Need to see a complete, and accurate schematic of the full circuit.

 

Need to see a photo of the setup.

 

JC 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This has gone on long enough as well.

 

Ecworks,

Please provide the following:

1) EXACT part numbers of EVERY component in your circuit/system...ESPECIALLY the PIR.

2) A clean, complete schematic that has all the components involved on it.  Make it large enough to read on a screen.

3) A photograph of your current setup.

4) Is this for a commercial product?

 

Until the above 4 points are answered I would suggest to all the posters in this thread to stop wasting your valuable time playing the OP's game. 

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you @DocJC, @jgmdesign.... thank for your reply....i will give the complete details

 

its a automation project we use door sensor,PIR sensor for control light,smoke sensor for alarm in some rooms, and its connected to the child board in a controlling room...a child board consist input shift register 74HC165 and output shift register 75hc595 with a ULN2803...the child board is connected to the mother board with controller atmega32...the mother board is connected to a computer via an Ethernet module enc28j60. IN output section the output shift register connect to a relay(Unison relay,not coiled type) and output of relay connected to lights,alarm etc...here i attached my set up photos and photo of relay connected with new 230v PIR

Now this project for installing in my office

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The opto is a waste of time.
Is your power supply earthed?
What is that blue wire draped across the circuit board?

Last Edited: Tue. Jul 26, 2016 - 06:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

The opto is a waste of time.
Is your power supply earthed?
What is that blue wire draped across the circuit board?

 thanks for your reply sir...blue wire is just a out put light placed under.. power suplly is a two pin 5v 5Amps SMPS....sir can i replace the relay with opto coupler?

Last Edited: Tue. Jul 26, 2016 - 07:37 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Solve one problem at a time!
Either use a relay or an optocoupler.
Your power supply needs to be earthed.
The blue wire has mains voltage? Why is it draped across your circuit board?
Do you have any knowlege of basic electromagnetism?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

Solve one problem at a time!
Either use a relay or an optocoupler.

 

ok sir....Relay has the issues so i though to replace it. i am sorry

 

Kartman wrote:

The blue wire has mains voltage? Why is it draped across your circuit board?

yes its mains... i moved it from circuir baord...

 

Kartman wrote:

Do you have any knowlege of basic electromagnetism?

sadcrying no i dont have

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd suggest you get some basic electronics knowlege. As for electromagnetism, we're told that an alternating current flowing in a wire creates a magnetic field that creates a current in a nearby wire- Faraday's law of induction. Usually this is a transformer, but you're making your own by putting mains wires near to your low voltage wires. Gotta keep them separated.
Also looking at your pcbs - i cannot see any bypass caps on the mega32. No wonder you sneeze and it locks up. You probably haven't interspersed 0V with your signals on your flat cable. You'll probably get random effects with your shift registers.
We could also talk about electrical safety. I'd suggest you not put this near a building unless you want to burn it down.
Sorry to be critical, but there's a number of critical defects from my cursory glance at your photos.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

I'd suggest you get some basic electronics knowlege. As for electromagnetism, we're told that an alternating current flowing in a wire creates a magnetic field that creates a current in a nearby wire- Faraday's law of induction. Usually this is a transformer, but you're making your own by putting mains wires near to your low voltage wires. Gotta keep them separated.
Also looking at your pcbs - i cannot see any bypass caps on the mega32. No wonder you sneeze and it locks up. You probably haven't interspersed 0V with your signals on your flat cable. You'll probably get random effects with your shift registers.
We could also talk about electrical safety. I'd suggest you not put this near a building unless you want to burn it down.
Sorry to be critical, but there's a number of critical defects from my cursory glance at your photos.

yessad

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

Also looking at your pcbs - i cannot see any bypass caps on the mega32. No wonder you sneeze and it locks up.

 

ecworks, was the "IMASTER MOTHER" board circuit designed by you or was the board purchased? 

Can you show us the schematic for this board?

 

Also, I don't see any traces on the top surface of the board - maybe it's just the photo.

Is this board a single sided PCB?  Any components on the bottom side of the board?

 

 

Last Edited: Wed. Jul 27, 2016 - 05:43 AM