Shop OBEX P1 Docs P2 Docs Learn Events
Transistor help — Parallax Forums

Transistor help

TCTC Posts: 1,019
edited 2014-05-14 09:44 in General Discussion
Hello all,

I am working on a project for work where I need to control a relay. The relay I have to work with is an Omron G6K-2P-Y DC5. From the datasheet the coil has a resistance of 237Ω, and with a 5V input that would give me a current requirement of 21.09mA.

I have to drive the relay from a transistor, because the base of the transistor is coming from a missing pulse detector (555). With the 555, the output is high when there are no missing pulses. So I would need a NPN transistor.

I want to take this opportunity to learn the design process of a basic transistor circuit. But I don't know where to start, and I don't really know what I should look for.

I know it would be easier just to ask someone on here "what transistor do I need?" But how can I learn anything if I just ask for the answer? SO PLEASE DON'T TELL ME WHAT TRANSISTOR TO USE. But guide me to understand and find a good transistor.

Thanks
TC

Comments

  • JonnyMacJonnyMac Posts: 9,106
    edited 2014-05-06 08:13
    Order a copy of "Getting Started in Electronics" by Forrest M. Mims. It's a great, non-threatening way to learn circuit and component fundamentals. When I worked for Toro, I taught basic electronics as part of our "Toro University" program; we used this as a text book and people really enjoyed it.

    You may be able to find a copy at your local RadioShack. During the Toro University days, we used to order them by the box from RS.

    Or, there's always Amazon: http://www.amazon.com/Getting-Started-Electronics-Forrest-Mims/dp/0945053282
  • JonnyMacJonnyMac Posts: 9,106
    edited 2014-05-06 08:17
    I have to drive the relay from a transistor, because the base of the transistor is coming from a missing pulse detector (555). With the 555, the output is high when there are no missing pulses. So I would need a NPN transistor.

    Really? Do you want to activate the relay when the output goes low? This makes sense to me -- why energize the coil when there are no missing pulses (normal behavior)? You may in fact want to use a PNP circuit so that you only power the coil when the pulses go away.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-05-06 08:18
    Okay... I won't tell you which transistor, but provide a few interesting facts.

    A. Just about any transistor can switch up to about 30VDC. So you could use a 24VDC relay coil or a 5VDC relay coil with the same transistor.
    B. Just about any transistor can proivde a gain of 50 in switching mode, so 5ma in will provide 50 ma out (roughly)
    C. You can use a transistor with a current rating way over your 21ma requirement, but the more amp capacity.. the larger the transistor package gets.
  • TCTC Posts: 1,019
    edited 2014-05-06 08:36
    JonnyMac wrote: »
    Really? Do you want to activate the relay when the output goes low? This makes sense to me -- why energize the coil when there are no missing pulses (normal behavior)? You may in fact want to use a PNP circuit so that you only power the coil when the pulses go away.

    This is a safety circuit. The relays are in between (cant say much) a sensor and a computer. With the relays energized, the sensor is disconnected form the computer and our own signal is sent to the computer. The missing pulse detector is there as a back-up so that if our testing hardware stops or freezes, the missing pulse detector will not get more pulses, and release the relay. That will allow the system to work normally. That is why I was thinking of a NPN transistor.
    Order a copy of "Getting Started in Electronics" by Forrest M. Mims.

    Thanks, I was able to find a online copy.
  • TCTC Posts: 1,019
    edited 2014-05-06 08:38
    Okay... I won't tell you which transistor, but provide a few interesting facts.

    A. Just about any transistor can switch up to about 30VDC. So you could use a 24VDC relay coil or a 5VDC relay coil with the same transistor.
    B. Just about any transistor can proivde a gain of 50 in switching mode, so 5ma in will provide 50 ma out (roughly)
    C. You can use a transistor with a current rating way over your 21ma requirement, but the more amp capacity.. the larger the transistor package gets.

    Those are some good to know facts. I have a problem where I try to find parts that are exact. Mostly because I don't have the experience to know what is a good tolerance for what I am working on or with.
  • bill190bill190 Posts: 769
    edited 2014-05-06 09:16
    More learning... For the relay to not "zap" the transistor... Search google.com for the words...

    flyback diode relay

    ...and read all about it!
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-05-06 10:41
    Finding an exact transistor is really an illusion. Trust me, I spent about 60 years learning to accept that transistor selection is an inexact art... not an engineering science.

    Essentially, it is all about knowing what limitations you want to prevent from turning out badly.

    On the Base side, too much current or too high a voltage will burn up the transistor... and in some cases too much current will destroy the microcontroller or chip output that is trying to control the transistor. So we use current limiting resistors to protect whatever is controlling the base when we have a known safe voltage limit.

    Knowing the Absolute Maximums in the PDF doesn't mean those are wise operating levels. They are just indications of the points at which you should consider you have trashed your transistor. Safe levels are conservatively below those.

    Just because a transistor has a maximum voltage of something like 36 walls and a maximum current of 500ma doesn't mean that you operate with 500ma at 36 volts. That is 18 watts of power and you transistor's package may not be able to handle 18 watts of heat.

    The PDF answers questions related to multiple topics, but doesn't tell you what applies to what.

    Transistors can operate as [a] linear amplifiers or switches.
    Switching for digital switching usually try to saturate the transistor, while linear amplifiers do not.

    Gain goes down as you switch more with saturation. So a 10x gain might be all you get when the transistor is rated at 50x or 70x at its optimal sweet spot.

    You can generally ignore all the radio frequency stuff if your digital switching is less that 5000 cycles per second. The RF data is their for much higher frequency limits. You are not buillding an RF amplifier, are you? That takes a lot more specific engineering and testing.
  • User NameUser Name Posts: 1,451
    edited 2014-05-06 12:12
    Finding an exact transistor is really an illusion.

    Yup. As a six-year-old kid I went all over town (courtesy of my patient dad's gas and time) looking for a CK722, because I was certain I need THAT transistor and only THAT.

    Now, for an application like yours, I would pull out a specific transistor (that I will not name) that cost me 2.4 cents, and that happened to come in a bag with 999 of its brethren The reason why I would pick that transistor is because it is entirely competent for the job and it cost only 2.4 cents.

    Also, I would not forget the flyback diode, as bill190 aptly points out.
  • PliersPliers Posts: 280
    edited 2014-05-06 13:07
    Some LM555s can deliver 300 ma. So you don't need the transistor. The flyback diode is a good idea.
  • GenetixGenetix Posts: 1,754
    edited 2014-05-06 13:14
    The old Industrial Control text talks about controlling a relay with a transistor but unfortunately it was abandoned with the new website.

    I found you a copy here:
    http://laspace.lsu.edu/aces/Document/Parallax%20Docs/Industrial%20Control.pdf

    p. 85 (87th page of the PDF) - Current Boosting the BASIC Stamp

    There are also a few Nuts and Volts articles on transistors.
    #6 has specifications for some common transistors.
  • TCTC Posts: 1,019
    edited 2014-05-06 14:21
    bill190 wrote: »

    flyback diode relay

    I have known about the flyback diode for years. It is there to stop(or the best it can) inductive kick. When a magnetic filed collapses, it creates a much higher voltage because the field collapses at a very fast rate.

    As a kid I would use old relays, and shock my friends with it. I would take a 9V battery, hook the negative of the battery to one side of the relay coil, then add some more wire. Then I would hook the positive of the battery to the COM of the relay. Then hook NC to the other side of the coil, and adding some wire. Me and my friends would see who could hold on to the wires the longest.
    Finding an exact transistor is really an illusion. Trust me, I spent about 60 years learning to accept that transistor selection is an inexact art... not an engineering science.

    Essentially, it is all about knowing what limitations you want to prevent from turning out badly.

    On the Base side, too much current or too high a voltage will burn up the transistor... and in some cases too much current will destroy the microcontroller or chip output that is trying to control the transistor. So we use current limiting resistors to protect whatever is controlling the base when we have a known safe voltage limit.

    Knowing the Absolute Maximums in the PDF doesn't mean those are wise operating levels. They are just indications of the points at which you should consider you have trashed your transistor. Safe levels are conservatively below those.

    Just because a transistor has a maximum voltage of something like 36 walls and a maximum current of 500ma doesn't mean that you operate with 500ma at 36 volts. That is 18 watts of power and you transistor's package may not be able to handle 18 watts of heat.

    The PDF answers questions related to multiple topics, but doesn't tell you what applies to what.

    Transistors can operate as [a] linear amplifiers or switches.
    Switching for digital switching usually try to saturate the transistor, while linear amplifiers do not.

    Thank you for the advice
    Gain goes down as you switch more with saturation. So a 10x gain might be all you get when the transistor is rated at 50x or 70x at its optimal sweet spot.

    Could you(or someone) please explain this in better detail?
    You can generally ignore all the radio frequency stuff if your digital switching is less that 5000 cycles per second. The RF data is their for much higher frequency limits. You are not buillding an RF amplifier, are you? That takes a lot more specific engineering and testing.

    No, I am dealing with a simple on/off. The missing pulse detector is set up to detect a pulse longer than 250ms. So worst case, the transistor would be switching at 4Hz. But if that happens we( me and coworkers) have a bigger problem.
    Pliers wrote: »
    Some LM555s can deliver 300 ma. So you don't need the transistor. The flyback diode is a good idea.

    I do apologize, I was not completely honest with everyone in my first post. It is not 1 relay, but 3 relays in parallel. I wanted to get a understanding using 1 relay first. Then take what I learned and figure out what I need to drive 3 relays. But I did provide the correct info for the relays.
    Genetix wrote: »
    The old Industrial Control text talks about controlling a relay with a transistor but unfortunately it was abandoned with the new website.

    I found you a copy here:
    http://laspace.lsu.edu/aces/Document/Parallax%20Docs/Industrial%20Control.pdf

    p. 85 (87th page of the PDF) - Current Boosting the BASIC Stamp

    There are also a few Nuts and Volts articles on transistors.
    #6 has specifications for some common transistors.

    I was trying to find that PDF. But I was not having any luck. So thank you for posting it.


    I really do appreciate everyone's input and advice. But up until Genetix posted the Industrial Control PDF, I still did not know how do I determine what would be a good transistor to use. I received information on what transistors are used for, what they are made of, etc....All wonderful information that I learned years ago. But I had/have no full understanding on what transistor I should find. Looking at DigiKey's search boxes, I don't know what most of the search options are for. And when I think I found some information that explains what the values are, what they are for, how do I use them etc.. the author changes the subject, just posts a math equation with no real examples of what to do, or provides a simulation model.
  • ErNaErNa Posts: 1,752
    edited 2014-05-06 15:04
    A good tool to gain understanding is LTSpice, free for download and so to test the setup
  • PliersPliers Posts: 280
    edited 2014-05-06 16:45
    Three little relays, still less than 70 ma. The 555 does not need the transistor.
  • TCTC Posts: 1,019
    edited 2014-05-06 17:40
    ErNa wrote: »
    A good tool to gain understanding is LTSpice, free for download and so to test the setup

    I just got done downloading it. I am going to have to play with it for a while. Thanks
    Pliers wrote: »
    Three little relays, still less than 70 ma. The 555 does not need the transistor.

    No idea why (a lot of stress maybe), but I did not even think of that. Thanks
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-05-06 20:42
    Pliers wrote: »
    Three little relays, still less than 70 ma. The 555 does not need the transistor.

    Possibly, but a fly-back diode on the relay coil is extremely important or the reverse voltage is going to destroy the 555. Putting a transistor between the coil and the 555 might be wise as the transistor would have to handle the fly-back voltage. It might die, but the 555 would live.
  • jmgjmg Posts: 15,173
    edited 2014-05-06 23:08
    TC wrote: »
    . I have a problem where I try to find parts that are exact.

    There is no 'exact' part, if you need 20mA, or even 60mA, then the right part is one you already have in the drawer ;)

    It is rare for a transistor to be rated under 200mA, and 500mA is common in small packages.

    Grab a couple of part numbers you have lying about, choose a Rb for ~ 3mA iB, and then measure the VceSAT you get.

    If you want 600mA and low VceSAT, then selection needs more care.
  • TCTC Posts: 1,019
    edited 2014-05-07 03:26
    jmg wrote: »
    There is no 'exact' part, if you need 20mA, or even 60mA, then the right part is one you already have in the drawer ;)

    It is rare for a transistor to be rated under 200mA, and 500mA is common in small packages.

    Grab a couple of part numbers you have lying about, choose a Rb for ~ 3mA iB, and then measure the VceSAT you get.

    If you want 600mA and low VceSAT, then selection needs more care.

    Since this is a work project, I have to order all the needed parts. Sure, I could bring parts from home and use them. But why!? This is a multi billion dollar company, they can afford a small hand full of parts from DigiKey.


    I just figured out what "Rb" was, Base resistor. And "iB" is Base current. Would I just take ohm's law to figure out the Rb? Using 3mA; Rb =1.6KΩ= 5V/3mA

    Also, what is "VceSAT" and how do I measure it?
  • kwinnkwinn Posts: 8,697
    edited 2014-05-07 15:34
    VceSAT is the collector to emitter voltage when the transistor is saturated (increasing base current does not increase current through the collector). Usually specified at some specific load and voltage.
  • TCTC Posts: 1,019
    edited 2014-05-07 16:49
    kwinn wrote: »
    VceSAT is the collector to emitter voltage when the transistor is saturated (increasing base current does not increase current through the collector). Usually specified at some specific load and voltage.

    What are the up/down sides of a VceSAT out of range? And how does a transistor become saturated?
  • frank freedmanfrank freedman Posts: 1,983
    edited 2014-05-07 20:26
    There may also be still a site / series called "All About Circuits", runs from the most basic upwards. It was laid out as a course with the books free and in PDF form. May be some good reading. Also, try a college text bookstore with older books; mostly still useful and reasonable. (checked, still exists. Google it. Seems they have added some video lectures. haven't seen them yet)
  • TCTC Posts: 1,019
    edited 2014-05-08 18:08
    There may also be still a site / series called "All About Circuits", runs from the most basic upwards. It was laid out as a course with the books free and in PDF form. May be some good reading. Also, try a college text bookstore with older books; mostly still useful and reasonable. (checked, still exists. Google it. Seems they have added some video lectures. haven't seen them yet)

    Thank you so much for web site. They have a lot of good information.
  • lardomlardom Posts: 1,659
    edited 2014-05-14 09:44
    TC wrote: »
    What are the up/down sides of a VceSAT out of range? And how does a transistor become saturated?
    My understanding is basic. Linear region operation is used to amplify an AC signal. You might have a signal that swings from +0.5V to -0.5V. The tranistor is a DC device which turns on at 0.07V. To amplify that signal we would have to keep the transistor turned on at 0.7V plus the voltage difference in the signal. You would calculate a voltage divider to apply 1.8V to the transistor base. (0.7V(+0.1V)+1V=1.8V.)
    I want to say that saturation would be applying voltage maximum to the base but I'm sure I'll be corrected.
Sign In or Register to comment.