Truncated match.
PICList
Thread
'Relay problem'
1999\04\07@012505
by
Peter Tran
Whenever the 5V output from PIC is applied to relay, the microprocessor
will run unexpectedly. If I put relay in a separated board, it's OK. I think
the problem is the noise from the inductance of relay. Can anyone tell me
how to eliminate this problem? Thank you.
________________________________________________________
NetZero - We believe in a FREE Internet. Shouldn't you?
Get your FREE Internet Access and Email at
http://www.netzero.net/download.html
1999\04\07@140723
by
Ron Fial
|
When the microprocessor turns off the current through the relay, the magnetic fi
eld around the relay coil collapses, and a momentary high voltage appears across
the relay. The best cure is to put a silicon diode across the relay, which wil
l allow current to flow from the relay coil through the diode starting at the mo
ment the PIC turns its output off. The diode should be arranged so that it is b
ackwards for current flow from the pic pin to the voltage source. If one end of
the relay is connected to +5 volts, then the cathode of the diode should be con
nected to the +5 volt end. In other words, the arrow for the diode 'points' to
the +5 volts. This 'fix' will make the relay take a few extra milliseconds to
'release', but in most applications this is not an issue.
It helps to make sure that the +5 of the relay has a separate wire back to the +
5volt source, instead of sharing the wire or trace that brings +5 Volts to the P
IC.
Regards,
Ron Fial
At 10:06 PM 4/6/99 -0700, you wrote:
{Quote hidden}> Whenever the 5V output from PIC is applied to relay, the microprocessor
>will run unexpectedly. If I put relay in a separated board, it's OK. I think
>the problem is the noise from the inductance of relay. Can anyone tell me
>how to eliminate this problem? Thank you.
>
>________________________________________________________
>NetZero - We believe in a FREE Internet. Shouldn't you?
>Get your FREE Internet Access and Email at
>
http://www.netzero.net/download.html
>
1999\04\07@140935
by
Reginald Neale
|
> Whenever the 5V output from PIC is applied to relay, the microprocessor
>will run unexpectedly. If I put relay in a separated board, it's OK. I think
>the problem is the noise from the inductance of relay. Can anyone tell me
>how to eliminate this problem? Thank you.
Hi Peter. I'll try not to avoid the dyslexia that plagued me
Sunday when I tried to help someone else with a similar problem.
:-(
If you could find a relay that would operate on 20mA of current,
you could theoretically drive it direct from the PIC, but it
would still be a bad idea.
Don't drive the relay directly. Drive the base of a switching
transistor thru a series resistor. For a typical low voltage
relay, use a 2N2222 and put the relay in the collector circuit.
Use a 470 ohm resistor to drive the base. In parallel with
the relay coil, place a general-purpose diode with the CATHODE
toward the (+) supply voltage.
It's a good idea to return the (-) side of the relay supply
directly to the transistor emitter, which should also be
logic ground.
Make sure that MCLR is asserted high and that your supply will
deliver the current your circuit is demanding from it.
If that doesn't stop the resets, email me directly and I'll
try to help you further.
Reg Neale
1999\04\07@143041
by
MEDICINTEKNIK KB
I have found that the PIC is very reliable and tolernat to noice. BUT if you don't have the 0.01 myfarad capacitor across it's Vcc/Vdd, it is very sensitive. In your case maybe try«0.1 AND 1000pF instead. Close to the chip.
Sven
-----Ursprungligt meddelande-----
FrŒn: Peter Tran <spam_OUTltranTakeThisOuT
NETZERO.NET>
Till: .....PICLISTKILLspam
@spam@MITVMA.MIT.EDU <PICLIST
KILLspamMITVMA.MIT.EDU>
Datum: den 7 april 1999 16:12
€mne: Relay problem
{Quote hidden}> Whenever the 5V output from PIC is applied to relay, the microprocessor
>will run unexpectedly. If I put relay in a separated board, it's OK. I think
>the problem is the noise from the inductance of relay. Can anyone tell me
>how to eliminate this problem? Thank you.
>
>________________________________________________________
>NetZero - We believe in a FREE Internet. Shouldn't you?
>Get your FREE Internet Access and Email at
>
http://www.netzero.net/download.html
>
1999\04\07@205120
by
Wagner Lipnharski
Just to be the pest of the day... :) what means myfarad? I don't have
any farad, do you? :)
of course everybody knows you meant uF (micro Farad), but "uF" is easy
and the correct way to write it... I told you... to be the pest of the
day... :)
Wagner.
MILTON MEDICINTEKNIK KB wrote:
>
> I have found that the PIC is very reliable and tolernat to noice. BUT if you don't have the 0.01 myfarad capacitor across it's Vcc/Vdd, it is very sensitive. In your case maybe try«0.1 AND 1000pF instead. Close to the chip.
>
1999\04\07@221546
by
Peter Tran
Thank you all for your help. My relay is driven by a 2N3904, whose base is
connected to the PIC through a 4.7K resistor. I did use a diode (cathode to
+) across the relay, and the 0.01uF cap between Vdd and ground. However,
whenever the PIC output high, the serial communication between the PIC and
the DS1620(thermostat chip) become unexpected. I think the noise or the
magnetic field from the coil of relay might:
1. interfere the communication
2. affect to the normal working conditions of the PIC or the DS1620
Please give me some advises. Thank you.
{Original Message removed}
1999\04\08@083522
by
Reginald Neale
|
>Thank you all for your help. My relay is driven by a 2N3904, whose base is
>connected to the PIC through a 4.7K resistor. I did use a diode (cathode to
>+) across the relay, and the 0.01uF cap between Vdd and ground. However,
>whenever the PIC output high, the serial communication between the PIC and
>the DS1620(thermostat chip) become unexpected. I think the noise or the
>magnetic field from the coil of relay might:
>1. interfere the communication
>2. affect to the normal working conditions of the PIC or the DS1620
> Please give me some advises. Thank you.
>
Peter:
Is this a 5V relay, operating from the same supply that powers
the PIC? In that case, if your theory about EMR is correct,
temporarily supplying the relay from a separate power supply
will make no difference. If that is indeed the case, then
you have to consider parts placement, shielding, careful layout
of power and ground busses, perhaps an RC snubber and/or
varistor in addition to the relay diode, etc.
Your 4.7K resistor will give you only about 1 mA of base drive
for the transistor. A 2N3904 transistor has a min beta of 30
at 100 mA, so you are probably not driving it into saturation.
470 ohms would be better.
What are the other PIC terminals doing? If pins are left as
inputs, are they pulled up or down so that they are in an
assigned state? Is MCLR driven by a brownout circuit, or tied
to +5 thru a low-value resistor? Do you have a scope to look at
what the supply voltage is doing during the glitch? 0.01 is not
a big enough capacitor for many power supplies. Leave it there
and add a 100uF in parallel.
Just a few ideas; doubtless others will suggest more. Let us
know what happens.
Reg Neale
1999\04\08@101901
by
Lawrence Lile
Hmm, Peter, I do this all the time without much trouble. Another post
suggested using a lower value drive resistor, I usually use 2K. The diode
is good.
Is there a way you can avoid doing serial communications when the relay is
being driven on or off? Throw away the current reading from the temperature
chip and get another one? Tell the chip to shut up for a minute (nicely) ?
I assume you are describing a problem that happens when the PIC output
changes.
are you using any kind of brownout protection at the PIC? Perhaps a
temporary low voltage is causing the PIC to go haywire either WITH or
WITHOUT brownout. WITH, the PIC skips a serial beat, WITHOUT the PIC may do
random things....
{Original Message removed}
1999\04\08@115115
by
Dave VanHorn
>>Thank you all for your help. My relay is driven by a 2N3904, whose
base is
>>connected to the PIC through a 4.7K resistor. I did use a diode
(cathode to
>>+) across the relay, and the 0.01uF cap between Vdd and ground.
However,
>>whenever the PIC output high, the serial communication between the
PIC and
>>the DS1620(thermostat chip) become unexpected. I think the noise or
the
>>magnetic field from the coil of relay might:
>>1. interfere the communication
>>2. affect to the normal working conditions of the PIC or the DS1620
>> Please give me some advises. Thank you.
Making that cap larger will probably help. It has to handle the
transients when the relay is turned on and off. On isn't so much of a
problem, but 10-100uF would be a lot better. Also, when the relay
turns off, the diode returns the energy in the collapsing field to
VCC, which can cause VCC to spike high if you don't have enough C
online to absorb the energy.
1999\04\08@123655
by
Peter Tran
Thank you all for your advises. I solved this problem simply by using 10uF
between vdd and ground. Again, thank you all.
{Original Message removed}
1999\04\08@192255
by
paulb
Dave VanHorn wrote:
> Also, when the relay turns off, the diode returns the energy in the
> collapsing field to VCC, which can cause VCC to spike high if you
> don't have enough C online to absorb the energy.
No it doesn't!
--
Cheers,
Paul B.
1999\04\12@123741
by
Brian Scearce
On Sun, 4 Apr 1999 Reginald Neale <.....nealeKILLspam
.....SERVTECH.COM> wrote:
> You didn't say what the design voltage of the relay is. In any
> case, there is no way you can drive this relay directly from a PIC
> pin.
Never say never. Jameco sells some 5VDC DIP reed relays from Excel
Cell Electronics with a coil resistance of 500 ohms, and any PIC
can source or sink 10mA. There's even a model that has a diode
across the coil, so you don't have to add one externally.
Brian
More... (looser matching)
- Last day of these posts
- In 1999
, 2000 only
- Today
- New search...