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

    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.

  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
    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

  3. #3
    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.

  4. #4
    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...

  5. #5
    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 " !!!
    *****************************************

  6. #6
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile in agreement

    Hi Adam,
    Quote Originally Posted by rxforspeed View Post
    ....what transistor would be best to use in my case and how do I wire up the collector, base, and emitter of said transistor for use as "driving" a relay-installed ...
    2N3904, 2N4401, 2N2222, PN2222 are suitable to actuate a small relay.

    <IMG SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2959&stc=1&d=122566943 0">

    Quote Originally Posted by rxforspeed View Post
    ... I do have quite a few 2N3904's, 2N3905's, 2N3906's, and a great deal more of what some would consider "common" transistors. Some of the more common ones should have the same pin-outs regardless of the brand, shouldn't they? I do have at least one manufacturer's datasheet saved for almost each transistor I have, but most of them don't have the manufacturer's logo or name printed on their T0-92 cases...
    Transistors of the same number almost always have similar pin placements, not always!

    <IMG SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2958&stc=1&d=122566926 6">

    Quote Originally Posted by rxforspeed View Post
    ....Also, if anybody knows any good tips or tricks on how to determine whether a transistor is an NPN or PNP style (or even determining/deciphering whether the transistor in question is bi-polar, an FET, BJT, Darlington, etc.) and how to figure out which leads are the collector, base, and emitter (that's a definite need for the cheap off-brand assortment of transistors I have on-hand), I would greatly appreciate any of them. ....
    Sincerely,
    -Adam Collins
    The best way to tell the type of transistor, is the transistor number. The best way to tell the “pin-out” is the data sheet.
    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.
    True, plain old 2N7000 MOSFET, or plain old BS170 MOSFET is a good choice if you have them on hand.
    <IMG SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2960&stc=1&d=122566950 3">
    Quote Originally Posted by Melanie View Post
    I wouldn't have any Relays on the PICs 5v Rail if I could possibly avoid it.

    Have a 12v Relay on the 12v line if you have one available, use any medium power NPN Transistor (Emitter to 0v, Collector to Relay). The other end of the Relay is connected to +12. Drive the Transistor Base from the PIC's I/O via a suitable current limiting Resistor (value depends on selected Transistor). You will still need a Diode reverse connected across the Relay coil (Kathode to +12, Anode to Transistor Collector).

    If you are driving multiple Relays, it's less hassle to put in something like a ULN2004. No Resistors needed, you can connect it directly to your PIC, and the suppression Diodes are built-in.

    If you are using ADC or Comparators, and if you are using the 5v rail as VRef, put NOTHING on your PICs 5v line that will unnecessarily load it, spike it, or in any way abuse it - and a Power Relay will.
    The ULN2004 is a real space saver for multiple relays.
    -Adam-
    Attached Images Attached Images    
    Ohm it's not just a good idea... it's the LAW !

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    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- ).
    I don't believe that anybody else has mentioned installing a filter between the PIC and the relays, only isolating the relay coils from the PIC's power supply. I'll have to study that section in "The Art of Electronics" before I connect the relays to the PIC's I/O pins on the 5V relay board(s)...

    Quote Originally Posted by Acetronics View Post
    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.
    I'm sure you meant LEADS here, right? That does bring to mind another idea I had-connecting LEDs to the PICs' I/O pins that will power the relay coils. I've found some schematics using 5V relays and NPN transistors that also incorporate an LED per relay coil into the design. I'm sure I can just follow those if I decide to use the LEDs; that'll just be a simple visual indication of the relay's correct operation (they'll only be on for about 100msec at a time, anyway)...

    Quote Originally Posted by Acetronics View Post
    For ULN 2x0x ... keep in mind those are Darlingtons outputs ... so Vce sat ~1 v ... 5v - 1v = not so much for 5v relays ...
    I've studied the datasheets on both the arrays I've ordered, and I believe I'll only use those for the 12V PCB-mounted relays that Melanie had suggested. I'll either use a MOSFET or an NPN transistor to switch the 5V relays on the other board(s)...

    Quote Originally Posted by Acetronics View Post
    Now ... for the Ice Cap ... nothing keeps you away from using a switching regulator like LM 2575 ... instead of a linear low drop '2940.
    I'm not familiar with the '2575, but I'll download the datasheet and compare it to the other regulators I've thought about using. Remember, I don't yet have the education you do-I'll only be starting my "higher education" this coming Spring semester (so you can rightfully still consider me a "noob")...

    Quote Originally Posted by Acetronics View Post
    In the end ... do not forget to play the S.Gainsbourg 's tune "Melody Nelson" ... more than perfect for THE Phantom atmosphere.

    Alain
    A "Phantom of the Opera" melody? I can't claim to be familair with that tune-my musical background has been limited to songs that I've learned to play on guitar, attempted to learn, or wanted to learn, and most of those were Rock/Classic Rock/Hard Rock/Metal (not the horrible death-crap, but good music like Zakk Wylde's BLS). Classical music is rather relaxing, but I wouldn't be able to differentiate between Mozart and Beethoven (sp?) if I had to. I'm sure the owner of the "Phantom", an elderly man in his seventies, would probably recognize the tune...

    BTW-Sorry for the "long-winded" post, this really is an attempt to stick to the facts and details without going to far overboard...

    Quote Originally Posted by Pic_User View Post
    Hi Adam,

    2N3904, 2N4401, 2N2222, PN2222 are suitable to actuate a small relay.
    Thanks for the schematic! I've seen a similar schematic used with Holtek's HT12D decoder IC, but even that datasheet didn't tell me whether a "high" or "low" CMOS level was output from the IC to the transistor...

    Quote Originally Posted by Pic_User View Post
    Transistors of the same number almost always have similar pin placements, not always!
    I've got datasheets for most of the transistors I have on-hand, but I'm sure some manufacturers don't follow an "industry standard". I had played around with a few different cheaper transistors from a different manufacturer (unknown) than I had the datasheet for, and the pin-out obviously wasn't the same. No more cheap transistors for me, I'll pay extra to know that the pin-outs on the datasheets I have are correct...

    Quote Originally Posted by Pic_User View Post
    The best way to tell the type of transistor, is the transistor number. The best way to tell the “pin-out” is the data sheet.
    What I had meant by the "off-brand" transistors was a cheap $4 order from e-bay for about 700pcs of two different kinds of transistors, 2N3905 PNPs and 2N3563 NPNs; neither of them have ANY markings whatsoever. They came in seperate and labeled bags, but that's one of the main reasons why I need the transistor "tester". No manufacturer name, markings, anything-just a plain black T0-92 package...

    Quote Originally Posted by Pic_User View Post
    True, plain old 2N7000 MOSFET, or plain old BS170 MOSFET is a good choice if you have them on hand.
    I've got a few 2N7000's (T0-92) on-hand. I figured I did after I checked the "My Datasheets" section of "My Documents" (under the N-Channel FET folder) and found the datasheet for it. The schematics you posted will definately help me out with the 5V relay board-thanks a lot!

    Quote Originally Posted by Pic_User View Post
    The ULN2004 is a real space saver for multiple relays.
    -Adam-
    There's currently only four relays on-board this prototype, but I'm sure I'll have one or two others down the road with eight or more relays to control not only the "fill" valves to compensate for minor leaks over time and keep a single preset ride height/psi level, but for multiple and possibly user-adjustable ride height/psi level settings that will operate all four "fill" valves and all four "dump" valves per vehicle...

    GLCD commands would come in handy here for a custom gauge display, and possible touch panel controls...but there's already a digital psi gauge in the "Phantom", I just need to control the air in the 'bags for this application.

    Thanks again for all the help and cooperation with this, I really have gained a better understanding (of at least one application) of where and how to use transistors and transistor arrays and a good basis for using relays with PICs. All your input and suggestions are greatly appreciated!

    Sincerely,
    -Adam Collins
    Last edited by rxforspeed; - 3rd November 2008 at 02:22. Reason: Caught a mistake...

  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.

  9. #9
    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
    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.
    True, I had noticed that on the datasheet after I ordered them. I got a great deal on 'em, though! I believe the total amperage needed for each relay on this prototype is only about 36mA, or somewhere close within that range. Don't quote me on that, it's been a long day-so I could be off a bit. I'm sure it wasn't much over that figure for my intended usage...

    I've got 19 T0-92 2N7000's on hand, like you had recommended, so I believe I'll use those. I didn't think I did at first, but I browsed through "My Documents" and found the datasheet there without even having to search datasheetarchives.com for it. I knew that meant that I either had them on-hand or had planned on ordering some at one time, so I checked one of my transistor storage boxes and found them neatly labeled in a little baggie under the "N-Channel FET" compartment...

    BTW-the Texas Instruments datasheets I have for the ULN2004 and the ULN2803 don't list the thermal curves for either. I've been meaning to find another manufacturer's datasheet that lists them, but I haven't gotten around to it just yet. I've been back and forth between "The Art of Electronics" and "Programming PIC Microcontrollers with PICBasic" by Chuck Hellebuyck, and have had a rather long day today with my preparation for next semester's courses. I WILL find datasheets with the thermal curves for those Darlington arrays. Thanks again for the help and advice-I really appreciate it!

    Sincerely,
    -Adam Collins

    P.S.-Just wait until I'm asking for help here on some of the problems I encounter with the four semesters worth of Calculus I'll be taking in the coming four years...

    LOL-Just kidding about the Calc. questions-I'll figure it out when I get there... I've got a "refresher" course coming up this month to better prepare me. In a little over four years from now, I should be "qualified" to actually assist others! A scary thought, huh?

  10. #10
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rxforspeed View Post

    P.S.-Just wait until I'm asking for help here on some of the problems I encounter with the four semesters worth of Calculus I'll be taking in the coming four years...

    LOL-Just kidding about the Calc. questions-I'll figure it out when I get there... I've got a "refresher" course coming up this month to better prepare me. In a little over four years from now, I should be "qualified" to actually assist others! A scary thought, huh?
    Calculus???
    Whats that?
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Post

    Quote Originally Posted by rxforspeed View Post
    BTW-the Texas Instruments datasheets I have for the ULN2004 and the ULN2803 don't list the thermal curves for either. I've been meaning to find another manufacturer's datasheet that lists them, but I haven't gotten around to it just yet.
    You might start with Figures 14 and 15 on page 10 of this:

    http://focus.ti.com/lit/ds/symlink/uln2003a.pdf

    And Figures 11 and 12 on page 5 of this:

    http://www.st.com/stonline/products/...re/ds/1536.pdf
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  12. #12
    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
    . . . Just wait until I'm asking for help here on some of the problems I encounter with the four semesters worth of Calculus I'll be taking in the coming four years...
    LOL-Just kidding about the Calc. questions-I'll figure it out when I get there... I've got a "refresher" course coming up this month to better prepare me. In a little over four years from now, I should be "qualified" to actually assist others! A scary thought, huh?
    Hints for succeeding with your calculus course(s):

    1) Memorize as many of the common integrals as possible ASAP.

    2) Do as many of the exercises as possible, even ones the instructor doesn't assign.

    3) Decide your objective: Do you want to master calculus or (recommended) pass the course(s)? (Bear in mind that many of us who took required calculus haven't used it since school.)
    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