Transistor Selection for Switching Relay Coil-with a little bit of info on my "ARSC"


Closed Thread
Results 1 to 25 of 25

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    You won't need Diodes across the Relays, or any other components with the ULN2004 - they're all built-in to the chip, which makes it neat and easy to connect. Download the Datasheet for the chip. The pin with all the Diodes internally connected to it is wired to +12v. +12 also goes to one side of your Relay. The other side connects to one of the seven Output channels. The input to the channel connects to the PIC I/O. Drive High for Relay ON, and Low for Relay OFF. Unused channels can simply be left unconnected. Good practice states you ground the unused inputs, but you don't have to on this part.

    There's nothing wrong with putting Relays on your 5v line if your 5v PSU is solidly built (and it looks like Dave builds solid gear!). Most folks on this list are hobbyists or new to electronics. The chances of building a crappy supply are high, putting a heavy load (Power Relay Coil) onto the same voltage line that becomes a REFERENCE for your ADC or Comparators is asking for trouble at best, and at worst is going to start resetting your PIC by tripping it's MCLR or corrupting EEPROM.

  2. #2
    Join Date
    Oct 2008
    Location
    Ashland, KY
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    You won't need Diodes across the Relays, or any other components with the ULN2004 - they're all built-in to the chip, which makes it neat and easy to connect. Download the Datasheet for the chip. The pin with all the Diodes internally connected to it is wired to +12v. +12 also goes to one side of your Relay. The other side connects to one of the seven Output channels. The input to the channel connects to the PIC I/O. Drive High for Relay ON, and Low for Relay OFF. Unused channels can simply be left unconnected. Good practice states you ground the unused inputs, but you don't have to on this part.

    There's nothing wrong with putting Relays on your 5v line if your 5v PSU is solidly built (and it looks like Dave builds solid gear!). Most folks on this list are hobbyists or new to electronics. The chances of building a crappy supply are high, putting a heavy load (Power Relay Coil) onto the same voltage line that becomes a REFERENCE for your ADC or Comparators is asking for trouble at best, and at worst is going to start resetting your PIC by tripping it's MCLR or corrupting EEPROM.
    I will download the datasheet for the ULN2004 in the next few minutes, before I place my order for these parts. As for the power supply, could I get by with installing an additional 5V regulator (7805, LM2931T-5.0, LM2940CT-5.0, etc) to power a seperate 5V rail for the 5V relays that would be pretty much isolated from the PIC's 5V supply?

    Don't get me wrong, I'm going to take your advice and install the 12V relays on this prototype, but I've got a lot of the 5V versions of the relays and figured that if the additional regulator would allow me a "clean and solid" power supply, then I could go that route for the next project I build using the 5V relays.

    I usually always install both a 10uF (50/63V electrolytic) and a 0.1uF (200V ceramic) input cap on the inlet side of the regulator (and in this case, from +12V to ground), as well as the same type and value capacitors on the output side of the regulator as bypass caps. Is this sufficient for a solid power supply; it will be connected to the vehicle's ignition hot or to a constant hot fused position by means of a SPST switch so it only operates when the owner wants it to. I know that sometimes the alternator can cause voltage spikes and current surges throught some components, so I really plan on getting my hands on some good automotive 5V regulators like the LM2931T-5.0 (only 500mA in a T0-220 package) or the LM2940CT-5.0 (1-1.5A in a T0-220 package), which both have built-in protection designed for these types of spikes and surges...

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    That's fine. Your isolating the PICs supply from that used for other significant switching loads, which is the whole idea. What that 'other' supply becomes, is irrelevant.

    I really can't comment on the size of your Capacitors without knowing what your total worst-case load will be and what is actually going to be used as the Regulator. Build it and see...

    If it's an automotive application, you should really be using 12v Relays. All you are accomplishing (other than using up your stock of 5v components) is heating up the planet! When the ice caps melt, it's now public knowledge that it'll be YOUR fault.

  4. #4
    Join Date
    Oct 2008
    Location
    Ashland, KY
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    That's fine. Your isolating the PICs supply from that used for other significant switching loads, which is the whole idea. What that 'other' supply becomes, is irrelevant.

    I really can't comment on the size of your Capacitors without knowing what your total worst-case load will be and what is actually going to be used as the Regulator. Build it and see...

    If it's an automotive application, you should really be using 12v Relays. All you are accomplishing (other than using up your stock of 5v components) is heating up the planet! When the ice caps melt, it's now public knowledge that it'll be YOUR fault.
    I'm sure the "carbon footprint" of my modified vehicles doesn't exactly qualify me as an "environmentalist", either.

    As for your suggested components, I have downloaded the datasheet for the ULN2004 and briefly read through it. Since I'm currently classified as a "student" (even though my classes don't begin until January), I've requested some samples of both the ULN2004 and the ULN2803 from TI, but at least ten of each are on my next Digikey purchase, which will be placed before the end of this weekend. The 12V relays are coming from both Digikey (two different kinds-Omron's G5LA series and Tyco's PB114012-eight of each for the time being) and anykits.com (along with a few additional PIC peripheral components and development boards). I should have both orders in by the 6th, so I'll concentrate on writing the code for the '690 in the meantime...

    I made sure to download the correct manufacturer's datasheet for both transistor arrays...

    Again, I really appreciate the time you've taken to help me out with this. It's people like you (Melanie and Dave) that make this forum a wonderfully educational site that I'm proud to be a part of. Thanks to you guys, I'm sure that my "A.R.S.C." project will be a success...

    Sincerely,
    -Adam Collins

  5. #5
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    My personal choice, at the tinkering stage, would be to use a plain old 2N7000 MOSFET to drive each relay (with flywheel diode, of course).

    Multiple device drivers are handy and certainly have their place, but they also have some inherent limitations, one of which is the total power dissipation available in the DIP package. For example, see the thermal curves for the ULN2004.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  6. #6
    Join Date
    Oct 2008
    Location
    Ashland, KY
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by RussMartin View Post
    My personal choice, at the tinkering stage, would be to use a plain old 2N7000 MOSFET to drive each relay (with flywheel diode, of course).

    Multiple device drivers are handy and certainly have their place, but they also have some inherent limitations, one of which is the total power dissipation available in the DIP package. For example, see the thermal curves for the ULN2004.
    In all honesty, I'll most likely build two, three, or four prototypes of this project. I've installed the air ride suspension and all the related components on the vehicle that this project will control, but I've got a couple of other friends wanting to go the digital route with their air ride suspensions and have push-button control over their ride height/psi level as well. So instead of using up my solder braid to remove the 5V relays, I'll start fresh with a new prototyping PCB (www.anykits.com #K003, the only thing I dislike about it is the single-sided copper clad) and build the new one for the "Phantom" (the vehicle I installed the air ride on-a Johnson Motor Company re-worked '88 Pontiac Firebird, Nova/Chevy II front frame clip, and custom fiberglass work to resemble an older Rolls Royce Phantom) with Melanie's suggested parts. When I placed the orders, I did happen to find a good deal on a few IRF540 N-channel MOSFETs in a T0-220 package, so I picked up a few of those in hopes to use with either the 5V relay PCB or for a different future project when the need arises (and I learn a bit more about transistors)...

    I'll build the important prototype-the "Phantom's"-with Melanie's suggested parts, but I don't want to discard the other. If nothing else, I'll be able to teach myself something about transistors along the way with it. I have enough 16F690's to be able to fry one or two without worry...

    Remember-I'm still a "noob" in the general area of electronics, but I'm a quick learner. Thermal curves on datasheets aren't usually something I study at the time being, but I WILL compare the ones on both of the transistor array datasheets I've ordered (the ULN2004 and the ULN2803A) and the IRF540 and 2N7000 MOSFETs.

    Are you familiar with the IRF540, Mr. Martin? Regardless, I know what I need to do to figure out if it's interchangable with the 2N7000 you've recommended-download and read the datasheet. The most visited site on my notebook (and the one I download the most from) is probably www.datasheetarchive.com...

    Thanks for all the input, info, and help you guys have given me, I sincerely appreciate it. It seems I've learned something new with almost every post on this topic, and of course there's always more than one way to skin a cat, SOOOO...even if I do use the board with the 5V relays it'll most likely go to a buddy of mine that only drives his air ride equipped truck for a few hours on nice, sunny weekends. I don't think that would contribute a great deal to melting the polar ice caps...

    Back to "The Art of Electronics"...
    -Adam Collins
    Last edited by rxforspeed; - 2nd November 2008 at 03:30. Reason: Added signature and title of book that my nose is currently stuck in...

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi, Rx

    Sorry for NOT having read all your explanations in details ( Difficult for me to read BIG pieces of prose on the screen ...)

    BUT

    There's one thing I didn't see in all these posts ...

    use a RC filter between Relays supply and Pic Supply ... Small R ( 10 - 100 Ohms ) not to drastically reduce PIC voltage and BIG C ( 1000 + µF -Low ESR is best- ).

    The only Drawback is to power the possible Leds from the relay side of the RC Filter ( inverted logic, then ) ... not too difficult, in fact; and also use an external ref. for ADCs.

    For ULN 2x0x ... keep in mind those are Darlingtons outputs ... so Vce sat ~1 v ... 5v - 1v = not so much for 5v relays ...

    Now ... for the Ice Cap ... nothing keeps you away from using a switching regulator like LM 2575 ... instead of a linear low drop '2940.


    In the end ... do not forget to play the S.Gainsbourg 's tune "Melody Nelson" ... more than perfect for THE Phantom atmosphere.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  8. #8
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rxforspeed View Post
    Are you familiar with the IRF540 . . . ?
    It strikes me as overkill for driving garden-variety relays. Do you need that kind of current and voltage capability? The 2N7000 is a venerable old workhorse good to 60 VDC for up to 200 mA continuous duty.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. Sleep Mode
    By Pesticida in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th March 2008, 10:31
  3. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 00:55
  4. Serial Relays
    By tazntex in forum General
    Replies: 3
    Last Post: - 17th May 2007, 17:42
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts