Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Relay making MCU hang

Status
Not open for further replies.

harsha_fractal

Newbie level 2
Joined
Mar 29, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,297
HI
this problem seems to be coming for a lot of people . My MCU , an 89s51 hangs every once in a while when switching a solenoid thorugh a relay. Im driving the transistor through a transistor circuit like the one attached below and i have noticed that when the relay switches there is some 'noise' that is visible in the MCU driving pin . one solution seems to be to put an optocoupler in series with the pin and isolate the transistor circuit from the MCu but im interested in other solutions . are their any ideas??
 

Attachments

  • relay.JPG
    relay.JPG
    14.5 KB · Views: 68
Last edited:

Yes,harsha_fractal. When the relay picks and holds its state,it usually need more current at moment.For safe,you'd better add a optocoupler to isolation.
 

thanks for the reply. I forgot to mention though, that when theres no load, theres no disturbance on the MCU pin line at all. im actually hoping for a non optocoupler solution bcos i have about hundred of these boards , some even on field and the easier the fix the easier it will be to fix all the boards.what about inductors or ferrites or some sort of low pass filter??
 

Hi Harsha_fractal. We make thousands of solenoid drivers and the MCU never hangs up. If you do not observe the problem without load then I would guess the noise comes from the relay. When the contact closes you may generate an arc which will create huge electromagnetic disturbances. Make sure to have one or two small decoupling capacitors near the microcontroller. The optocoupling will not do anything to your problem. The current in a coil rises very gently and you are using bipolar transistors which are also very slow. Therefore the real problem is in the contacts for which the optocoupling does not help.
You can try to accelerate or slow down the switching. If you switch fast the contact may bounce back which will induce further disturbances.
 

I second elactis repply but also want to add the following:

-Also make sure the reset line has a pull-up resistor. (Not a joke, I've seen some people getting nuts because of a floating reset line. A floating reset line can pick up noise.)
-You should also connect a varistor across the relays contacts.

@shell.albert

A relays is a resistive device. it will not draw more current when it's switching. An opto-coupler will surely not take the load away from the power supply.

Inventor(y)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top