Topics Topics Edit Profile Profile Help/Instructions Help Member List Member List  
Search Last 1|3|7 Days Search Search Tree View Tree View  

PIC driving a Relay

:: EPE Chat Zone ­:: ­Radio Bygones Message Board :: » EPE Forum Archives 2005-2006 » Archive through 15 August, 2005 » PIC driving a Relay « Previous Next »

  Thread Last Poster Posts Pages Last Post
  ClosedClosed: New threads not accepted on this page        

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Danh
Valued Member
Username: Danh

Post Number: 15
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 08 August, 2005 - 04:50 pm:   Edit Post Delete Post Print Post

Hello,

Another simple question for you. I want to drive a relay from a PIC, and I know that I need a transistor as the coil resistance is around 100 Ohms and will draw a current of around 50-100mA. I therefore found a schematic of the components needed to drive the relay here:

http://www.mikroelektronika.co.yu/english/product/books/PICbook/7_05chapter.htm

What Transistor should I use for T1 and D1?

BC548 and 1N4148 ok?

Thanks,
Dan
Top of pagePrevious messageNext messageBottom of page Link to this message

Mikehibbett
Frequent Contributor
Username: Mikehibbett

Post Number: 120
Registered: 04-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 08 August, 2005 - 04:57 pm:   Edit Post Delete Post Print Post

The BC548 should be fine, I'm using that myself on a project here at work. Personally I use 1n4001 for the protection diode. 1n4148 are described as 'small signal' diodes which didn't seem appropriate. They may work for a while :o)

Mike.
Top of pagePrevious messageNext messageBottom of page Link to this message

Epithumia
Member
Username: Epithumia

Post Number: 9
Registered: 07-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 08 August, 2005 - 07:00 pm:   Edit Post Delete Post Print Post

I would think a 1N4148 would be OK. What you need is a diode which can handle the same current at the relay coil for a short time.

I checked Philips and Fairchild. Both quote 200mA forward current and much higher peak current. Oddly Maplin quote 75mA, but that will be average not peak, so should still be OK.

Now I haven't checked, but my instinct would be to avoid a rectifier such as 1N4001, because rectifiers are not high speed components. The worry is that the back EMF from the relay might get up quite high before the rectifier starts to conduct.
The price of getting what you want is getting what you once wanted.
Top of pagePrevious messageNext messageBottom of page Link to this message

Mikehibbett
Frequent Contributor
Username: Mikehibbett

Post Number: 121
Registered: 04-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 08 August, 2005 - 08:16 pm:   Edit Post Delete Post Print Post

Good point, I'd only thought about peak current in the past and not turn on speed. I may take some measurements to see what its like in my application.

Cheers,

Mike.
Top of pagePrevious messageNext messageBottom of page Link to this message

Danh
Valued Member
Username: Danh

Post Number: 17
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 08 August, 2005 - 10:01 pm:   Edit Post Delete Post Print Post

I've often been told that a 1N4148 is fine for most applications with Relays, so will give it a go. Given the supply voltage will be 5V, I doubt the diode will break down, so should be suffient for this application.

Thanks for your help.
Dan
Top of pagePrevious messageNext messageBottom of page Link to this message

Magnum4
Frequent Contributor
Username: Magnum4

Post Number: 83
Registered: 04-2005


Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 08 August, 2005 - 10:27 pm:   Edit Post Delete Post Print Post

I have always used 4001 or 4004. No problems yet touch wood:-/
Maybe im missing something but would the diode not start to conduct at around .7V ? Regardless of the rise time?, Therefore presenting a short to the applied reverse voltage?
Maybe im missing a vital point , sorry if so
Regards,
Jim
Top of pagePrevious messageNext messageBottom of page Link to this message

Arw
Board Administrator
Username: Arw

Post Number: 118
Registered: 04-2005


Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 08 August, 2005 - 11:16 pm:   Edit Post Delete Post Print Post

When we wrote Teach-In '93, we captured the back emf spike from a 12V relay, and it peaked at over 300V!
--
Alan Winstanley
EPE Online Editor
Top of pagePrevious messageNext messageBottom of page Link to this message

Epithumia
Member
Username: Epithumia

Post Number: 10
Registered: 07-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, 09 August, 2005 - 01:22 pm:   Edit Post Delete Post Print Post

Hmm, I was thinking of the 'reverse recovery time' of the diode, which is 4ns for the 1N4148 (sold as a fast diode) and not specified for the 1N4001 (in the data I used).

Having checked up, I think 'reverse recovery time' applies to the opposite condition:
a) the diode has been conducting
b) a reverse bias is applied
c) the diode, though reverse biased, continues to conduct for a short time

Here we have a diode going from reverse to forward biased.

In short, either diode should be OK for most purposes, but I feel an experiment coming on... :-)
The price of getting what you want is getting what you once wanted.
Top of pagePrevious messageNext messageBottom of page Link to this message

Mark
Member
Username: Mark

Post Number: 6
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, 09 August, 2005 - 02:19 pm:   Edit Post Delete Post Print Post

Use a 1N4005

If the supply is reversed or there are voltage spikes on the supply, a 1N4148 will fail.

A 1N4148 is perfectly rated to handle the relay switch off current, and operating voltage, but it is the supply reversal and voltage spikes that will take it out.

Speed is completely irrelevant

Mark
Top of pagePrevious messageNext messageBottom of page Link to this message

Mikehibbett
Frequent Contributor
Username: Mikehibbett

Post Number: 123
Registered: 04-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, 09 August, 2005 - 04:34 pm:   Edit Post Delete Post Print Post

>Speed is completely irrelevant

Could you elaborate on that Mark? I would have assumed that if the diode takes longer to start conducting then the coil will have more time in which to develop a high voltage potential, which can propogate down the circuit. I'd be interested to hear an experts view on it.

Mike.
Top of pagePrevious messageNext messageBottom of page Link to this message

Epithumia
Valued Member
Username: Epithumia

Post Number: 11
Registered: 07-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, 09 August, 2005 - 06:20 pm:   Edit Post Delete Post Print Post

You were right, Mike. I take it back.

I tried a transistor driving a relay with an old 1N4001. To the limit of what a 20MHz analogue scope can show, there is no problem with turn-on time. The back EMF of the relay was totally suppressed by the rectifier (except for the forward voltage drop of the rectifier, of course).

--

Not sure what you mean about the voltage, Mark. The 1N4148 can take 100V reverse voltage (Philips). I assume the relay is driven from 5-12V. There will be no reverse spike, and the forward spike is suppressed by the diode.

--

I tried another little experiment: a 10kHz TTL oscillator driving into a resistive divider through a 1N4001. The results are quite dramatic, and an eye opener for anyone thinking of using a rectifier in a logic circuit.

In contrast, a 1N4148 gave a nice square wave.

Experiment

However, as the scope trace shows, the rectifier's slow switching speed only applies when going from forward to reverse bias, not the other way round. This means that the rectifier can suppress back EMF fine.
The price of getting what you want is getting what you once wanted.
Top of pagePrevious messageNext messageBottom of page Link to this message

Mikehibbett
Frequent Contributor
Username: Mikehibbett

Post Number: 124
Registered: 04-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, 09 August, 2005 - 07:58 pm:   Edit Post Delete Post Print Post

Thanks for doing that, interesting to see the results.

>and an eye opener for anyone thinking of using a rectifier in a logic circuit.

ahh... ( mike hurries away to update a schematic! )
Top of pagePrevious messageNext messageBottom of page Link to this message

Boris
Frequent Contributor
Username: Boris

Post Number: 61
Registered: 05-2005


Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, 09 August, 2005 - 08:35 pm:   Edit Post Delete Post Print Post

Am I seeing junction capacitance?
www.pyxia.com - BASIC was never less basic.
Top of pagePrevious messageNext messageBottom of page Link to this message

Epithumia
Valued Member
Username: Epithumia

Post Number: 12
Registered: 07-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, 09 August, 2005 - 10:07 pm:   Edit Post Delete Post Print Post

I don't think it's capacitance, Boris. The junction capacitance is allegedly 15pF, which won't cause a glitch that big.

I think it's the reverse recovery time of the diode. When a diode is suddenly reverse biased it takes a while for the minority carriers to leave the semiconductor junction. During this time, the diode conducts in the wrong direction (or so my copy of Millman & Halkias says).
The price of getting what you want is getting what you once wanted.
Top of pagePrevious messageNext messageBottom of page Link to this message

Mark
Member
Username: Mark

Post Number: 7
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, 10 August, 2005 - 10:21 am:   Edit Post Delete Post Print Post

Mike, Speed is irrelevant because the diode is turning on not off. I don't think you can force the forward voltage across a diode junction to rise much above 1 Volt under any circumstances.

I think Epithumia has also made and illustrated the same point.

My comment about voltage is the result of experience (blown up 1N4148s testify!) It probably is unimportant in 5V logic systems because something else will fail and stop the supply from rising too far, but in automotive systems 200 volt spikes can (and do) happen and anything less than 1N4005 is just not worth the risk.
I don't mean spikes caused by the relay, - cars have motors and unclamped solenoids as well as relays all over the place - sending spikes down the harness.

There are other more reliable ways of protecting relays and their driver transistors in extreme conditions. Let me know if you might need them.

Mark
Top of pagePrevious messageNext messageBottom of page Link to this message

Mikehibbett
Frequent Contributor
Username: Mikehibbett

Post Number: 129
Registered: 04-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, 10 August, 2005 - 10:59 am:   Edit Post Delete Post Print Post

Thanks Mark.
Fortunately my need for back emf suppression is not in a 'mission critical' application, just some simple test equipment used in our lab. But it's always interesting to pick up new tips and ideas so I'm glad for the feedback.

Thanks,

Mike.

Administration Administration Log Out Log Out   Previous Page Previous Page Next Page Next Page