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.

PIC ports drop to zero when relay is deenergized/turned off

Status
Not open for further replies.

seyyah

Advanced Member level 2
Joined
Oct 7, 2001
Messages
646
Helped
8
Reputation
16
Reaction score
8
Trophy points
1,298
Activity points
6,233
relay related problem

I'm controlling several relays and leds by pic. All of them are drived by transistors. But when a relay is deenergized or turned off, ports of the pic which are connected to leds are drop to zero for an instant then rise to 5V again. What may be the reason for this? A reset? (I didn't try whether it resets or not, yet) or something another? And how can i solve this problem?
 

Re: relay related problem

Do you have diodes in parallel with the relay coils? These are needed to divert the current in the coil around itself and be dissipated in the coil resistance.
 

Re: relay related problem

For faster turn off, using a zener diode in series with the diode is recommended. its breakdown voltage depends on your design but 5V seems to be a good value for 5V relays.
also connect the driving transistor to uC's ports by resistor in kohm range!

BEST!
 

Re: relay related problem

Diodes are connected to relays. But i didn't understand how zener will help this problem. With a zener i think, there will be still energy on the relay coils after it's turned off.
 

Re: relay related problem

Hi,

Is your relay is on the same power supply as your PIC ? If yes (5V), that means that the coil's resistance is very low and current flowing through it is quite high. When the relay is going off, it can generate some disturbance on the power supply line and eventually cause a reset to the PIC.

In this case, the solution is to provide separate power supply to the relay.

On another side, oser ideas are to use current darlington buffers such as ULN 2xxx, or eventually an optocoupler to drive the relay. In both cases, the output ports of the PIC are less solicited.
 

relay related problem

I sounds like e decoupling problem.
Have you made proper Vcc and GND routing and decoupling?
 

Re: relay related problem

I tried zener offer for relays and big capacitors for sources and pic but didn't work.
There are 3 different sources with a common ground. I think my design isn't good from the view of ground point. But i tried to solve this problem by adding some new lines for ground by using some cables. It didn't work. May be i couldn't do it very well still. I added serial reistors to relays, but didn't work. I changed didoes of relays and resistors of transistor's bases'. I controlled POR and BOR bits and wrote a procedure which gives some signal(by blinking leds) if any of these bits is zero at the beginning. But nothing happened. I also put another routine at the beginning which shows that a reset is occurred and it worked and sowed me that there is a reset. Watchdog is off. I connected a very big capacitor to MCLR pin and it also didn't work. I connected parallel capacitors to relays but didn't work. I tried to make screening by using an aluminium paper it also didn't work.
 

Re: relay related problem

Hi

Hmmm, seams to be very stange...

Try to isolate the power supply of the PIC from those of the relay, for example by connecting the Vcc point of the relay coil to an external lab power supply. Grounds, of course, shoud be connected together.
 

Re: relay related problem

Sources are already seperate. pic works at 5V. Relays are 48V.
 

Re: relay related problem

seyyah said:
I tried zener offer for relays and big capacitors for sources and pic but didn't work.
Big capacitors isn't enough, it is very important to have a small capacitor (approx 100 nF) very close to the MCU power source pins.
Big capacitor are too slow to react on fast spikes, therefore you must also have a small capacitor (100 nF is often used).
You can find a lot of aplication notes about decoupling of microcontrollers at the MCU vendors web sites.
Recently I read to app. notse about Atmel AVR, but the same design rules goes for other MCU's as well:
AVR040: EMC Design Considerations
AVR042: AVR Hardware Design Considerations
http://www.atmel.com/dyn/products/app_notes.asp?family_id=607

Find similar app. notes at other MCU vendors web sites.
 

Re: relay related problem

Try to disconnect the relay coils and see what happens-if the problem is still available then correct the software if not then try to decouple the pic totally by using optocouplers it's simple -no common GND .
 

Re: relay related problem

Small capacitors are also already connected. Without relays there is no problem. I also checked the program again and again....
Ok i solved the problem. The problem is; the ground of the capacitor which i connect to pic's mclr pin is very close to the transistors emitter which drives the relays. So we can say that the relay's ground rail is affecting the pic's mclr pin via the capacitor which is connected to mclr pin. When i take out this capacitor the problem has gone. But i wonder what may cause this problem or what's happening there that causes such an event.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top