Shop OBEX P1 Docs P2 Docs Learn Events
Quick Question — Parallax Forums

Quick Question

willthiswork89willthiswork89 Posts: 359
edited 2006-09-02 02:04 in BASIC Stamp
If i want to run 3 Micro Relays Running at 5VDC and Nominal Current is 89.3Ma what do i need?

i have a NPN silicone transistor 2N4401
Rated at Ic: 600Ma
VCeo: 40V
VCbd: 60v

and 2 PNP Transistors 2N3906

CBV= 40V
CEV = 40V
EBV = 5V
it says its good for running currents from 10uA t 100 mA


will this work or do i need smthing different? Im still kinda confused on the difference between PNP NPN i kow that the properties make up for the way they transfer molecules and such but if anyone had a BetterDefintion ide Appreciate it. Thanks Guys....

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Learn somthing about everything, and Everthing about somthing-

Comments

  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-08-30 02:10
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-08-30 02:14
    Oh, and Chapter 3 of process Control has more basic information on the transistor and it's operation....

    http://www.parallax.com/detail.asp?product_id=122-28176

    -Martin (again)
  • Mike GreenMike Green Posts: 23,101
    edited 2006-08-30 02:25
    Theoretically you could do it with the 3 transistors you have, but I strongly suggest you get another two NPN transistors like the 2N4401. Partly, you have to hook up PNP and NPN transistors differently and, without experience, you could easily get them backwards. Also, the 2N4401 seems to be rated at several times the current requirements of the relays while the 2N3906 doesn't have as much margin since the relay current is nominal, not maximum.

    For NPN transistors, you connect the base (B) lead to a 1K resistor and the other end of the resistor gets connected to a Stamp pin. You connect the emitter (E) lead to ground. You connect the collector (C) lead to one end of the relay coil and the other end to a +5V supply with maybe 100ma of extra capacity. When the Stamp pin is HIGH, the relay will turn on. When the Stamp pin is LOW, the relay will be off. You can do the same thing with the other 2 relays. Your 5V power supply has to have about 300ma total extra capacity in case all 3 relays are on at the same time. You might want a diode (like a 1N4001) connected across the relay with its cathode (the bar symbol) attached to +5V end of the relay and its anode (the triangle symbol) attached to the transistor end of the relay. When the transistor turns off, the magnetic field in the relay generates a reverse current as it collapses and the diode dissipates it rather than having it destroy the transistor. With a small relay, this is not likely to be a problem, but, for large relays or coils or transformers, some kind of protection is needed.
  • T ChapT Chap Posts: 4,223
    edited 2006-08-30 20:06
    you could order some darlington array ic's and run 8 relays off one ic.

    here is one example:

    http://www.allelectronics.com/cgi-bin/category.cgi

    use that ic wired like that last paragraph above, except on this ic, you only hook up GND to one pin on the ic, very neat and clean hard to screw it up. the are older but still available, there are newer ones, like ULN2803 these will make your life simpler than sorting out what npn and pnp transistor you have on hand.

    this type of relay driving circuit as Mike mentioned is called "sinking", whee you are supplying th GND to the motor, as the motor already is hardwired to the + " source" would be where you'd supply the + when motor is already hardwred to GND

    an hbridge can supply both + and GND, as it switches between the two. think of an hbridge this way:

    get a battery and a motor and two wires, plu the two wires onto the motor, and hold the other ends in your hand. then touch the two wires and make the motor tirn, now reverse your wires and make it run the other wau. that is what an hbridge does.

    if you want to goodle up ULN2803 circuit for lots of reading

    you can connect it directly to the Stamp with no resistors, and directly to the motor. so very few parts to deal with.

    some good examples here:

    http://www.southwest.com.au/~jfuller/sio5works.htm

    http://www.circuitcellar.com/library/details/0999/c99cd5.asp
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-31 02:23
    mike,

    i thought the collector "collects" from the source nd when the base is turned it Emits out the emitter the higher voltage? or is tht PNP? i dunno ill read up on them and goto radio shacknad bu ya fe more NPN, one question i have... is there that much of a difference between the two? that much that i shouldnt use the PNP, and why dopeople normally in hbridges use two phpand two NPN?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Learn somthing about everything, and Everthing about somthing-
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-08-31 03:01
    The way a transistor works is: It's a current device. Current, running in the 'base', and going out the 'emitter', controls a larger amount of current which comes in the 'collector', and goes out the emitter. That's for an NPN device. The multiplicative factor is called Hfe. If it were 10, then when 1 mA goes in the base, 10 mA will come in the collector. That's assuming you have the voltage biased correctly. "Correct bias" means the collector is more positive than the base, which is more positive than the emitter.

    In digital use, we tend to 'saturate' the transistor -- that is, use it like a switch, either fully 'on' or fully 'off'. So, if the collector is sitting at 5 volts, and the base is at zero volts, and the emitter is at zero volts, there's no current flowing, the transistor is 'off'. If the base goes to 5 volts, and the collector stays at 5 volts, and you have a current limiting resistor in the base, then current will flow in the collector, and the transistor will be 'on'.
  • Mike GreenMike Green Posts: 23,101
    edited 2006-08-31 04:16
    Please read the chapters in Process Control that Martin recommended. They should clarify this much better than I can even begin to do in brief notes. Another good reference is The Amateur Radio Handbook published by the ARRL, but that costs money and the Parallax Process Control book is free as a download.
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-31 11:38
    i understand how they work completley, i just didnt know the difference between PNP and NPN and why they are connected differently. Ill do my research and try looking at that book again! thanks for the help guys

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Learn somthing about everything, and Everthing about somthing-
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-08-31 15:22
    If you "understand how they work completely", then you'd know the difference between PNP and NPN. But I'll let that go.

    Let's start with a P-N junction, like you find in a Diode. You start off with plain Silicon, which is electrially neutral. Then you 'dope' (add a chemical) one-half of the silicon with atoms that have an excess of electrons. This gets you an 'N' material. Then you 'dope' the other half of the silicon with atoms that have a deficit of electrons in their 'outer-shell'. This gets you a 'P' material. At the line between the halves, you have a "P-N Junction". With no voltage applied, the electrons a little way into the 'N' side will travel a little way into the 'P' side, making a 'voltage barrier' to further electron flow.

    Now, the 'deficit of electrons' is also called 'holes'. So you have 'electrons' with negative charge, and 'holes' with positive charge.

    Now, when you 'forward bias' a diode by putting a postive voltage on the 'P' side, and ground on the 'N' side, electrons flow from N to P. This fills in the 'holes' left on the 'N' side when its electrons went to fill some of the 'holes' on the P side. At the same time, 'holes' flow into the 'P' side, and pull away those 'extra' electrons at the junction.

    As a result, at some applied voltage (0.7 volts, in fact) the 'voltage barrier' disappears, and the diode acts like a resistor which will drop 0.7 volts across itself.

    Ok. So, an NPN transistor consists of TWO P-N junctions. The convention is Collector-Base-Emitter, so an NPN transistor will have an N-doped Collector, a P-doped Base, and an N-doped Emitter. There's a P-N junction between the Base and Collector, and another P-N junction between the Base and Emitter.

    If the Base-Emitter leads have zero volts across them, then you get that 'voltage barrier', and current can't flow. If the Base-Emitter leads have more than 0.7 volts across them, then current can flow from the Base to the Emitter, and the 'voltage barrier' drops, and current can also flow from the Collector to the Emitter. In fact, the devices are created such that the amount of current flowing from the Collector to the Emitter is proportional to the amount flowing from the Base to the Emitter.

    Now, a PNP transistor works the same, but with reversed voltage biases. This is very handy in an H-Bridge application, for instance.

    OK, so now a disclaimer. While the above is accurate as far as it goes, it does gloss over lots of tiny details, and was written off the top of my head. You definitely should read the Parallax docs called out earlier. But hopefully the above will give you a good perspective to start with.

    Post Edited (allanlane5) : 8/31/2006 3:27:20 PM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-08-31 15:34
    One more thing. The little arrow on a diode symbol points from the 'P' side to the 'N' side. This is repeated on the Transistor symbol, which also has a little arrow inside it. That arrow tells you if the transistor is NPN or PNP, because again it will be pointing to the "N" side. So, since the arrow on a 3904 points TOWARD the 'emittter', you can tell from the schematic that the 3904 has an 'N' emitter, and therefore must be an NPN device.

    If the little arrow points AWAY from the 'emitter', then the Base is 'N', and you have a PNP device.
  • Paul Sr.Paul Sr. Posts: 435
    edited 2006-08-31 17:56
    A simple method of recognition I was taught in the "way back machine":

    If the "little arrow" is

    (N)ot (P)ointing i(N) = NPN

    (P)ointing i(N) = PNP
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-31 19:27
    Paul,

    ·· I haven't heard that one before, but I like it...I always think of it in terms of, "The arrow points to N".

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-31 20:28
    Okay so correct me if im wrong,

    The NPN

    Ground->N-> Base -> N->Relay needing Negative
    |
    Voltage to "Open" and "Close" Valve for flow


    Bipolar transistors work as current-controlled current regulators. In other words, they restrict the amount of current that can go through them according to a smaller, controlling current. The main current that is controlled goes from collector to emitter, or from emitter to collector, depending on the type of transistor it is (PNP or NPN, respectively). The small current that controls the main current goes from base to emitter, or from emitter to base, once again depending on the type of transistor it is (PNP or NPN, respectively). According to the confusing standards of semiconductor symbology, the arrow always points against the direction of electron flow:

    why couldnt someone just say that? i have to say for all the times i come here and the attacks of "im not trying" and what not, you guys lave some very confusing comments. Im not compalining ive got alot of help but ive been stressing out about the whole transistor thing because i dont wanna here that im stupid once more on this forum. I read what im told and take the information to heart and these overly complicated terms and discriptions are more then i need. But why would you what a current to go through the base in a PNP? wont that damage the stamp?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Learn somthing about everything, and Everthing about somthing-

    Post Edited (willthiswork89) : 8/31/2006 8:44:04 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2006-08-31 20:47
    Just for an aside, when transistors were new, most of them were PNP. It was easier to make PNP transistors out of germanium which was used before silicon. I think it was because boron was used as a dopant and it worked better with germanium. Anyway, most transistor circuits used a positive ground because that worked with the PNP transistors and there weren't any NPN transistors at that time. Later, there were NPN transistors, particularly when silicon started to be used as a substrate. It was easier to use arsenic with silicon and that created N substrates and you could make NPN transistors. PNP silicon transistors were harder, but eventually they were made as well (more expensive at first). In the meantime, most circuitry had converted over to negative ground (to go from PNP to NPN, just switch polarity of everything and vice versa). Now, you can mix and match and, with CMOS, you're always using both anyway (but they're FETs, not junction transistors - very different).
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-08-31 21:04
    Well, one of the things about circuitry and schematics is -- Electronic circuits and symbols were created assuming 'positive' current flow. Which is DEFINED as, positive charges, moving from a Plus voltage to ground. Thus the diode is a little arrow symbol pointing in the direction of positive current flow.

    Now, the physics of the situation is a little different. In actuality electrons each have a negative charge. So lets make a really simple circuit -- one battery, with one resistor going from the 'Plus' terminal to the 'negative' terminal. Ohm's law says V = I * R, or Voltage = Current * Resistance. So, if you have a 6 volt battery, and a 100 ohm resistor, then Ohms law says that V = I * R, or V / R = I, or 6 / 100 == 0.0600, or 60 mA of current will flow. That's POSITIVE (by definition) current, flowing OUT of the current source (the battery positive terminal) through the resistor, and then in to the other terminal of the battery to complete the circuit.

    In reality, the battery through chemical action is putting a surplus of charges on the negative side of the battery, and these charges then flow in a NEGATIVE (by definition) direction through the wire, through the resistor, and into the Plus terminal of the battery.

    We've occasionally had religious discussions about which is the proper way to teach electronics. The "conventional" way, where positive charges are 'pushed' through the wire in a positive direction by positive voltages? Or the "real" way, where negative charges are 'sucked' out of the ground and flow in a 'negative' direction into the 'plus' terminal?

    I call these "religious" because it doesn't really matter which way you understand it, the effect is the same. Doesn't change the circuit, in other words. And "religious" because people sometimes get very angry that the other side "has it completely wrong". Personally, I find schematics (and electronics) MUCH easier to understand and get right if you go with the 'positive charge', 'positive current', 'positive voltage' model.

    So in answer to your simple question -- the reason people don't always give you a simple answer to a simple question is that the issue you've asked a simple question about is not in fact simple. And by asking a 'simple' question, you often leave out lots of detail that would make a simple answer much more likely.
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-08-31 21:07
    Also, sometimes you have to come to your own understandings in your own words. But yes, it sounds like you have it right.
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-31 23:08
    Okay, well ill tell you my problem i had at attempting this last time, For somereason the stamp couldnot power all three relays at the same time which is why im reattempting this after cooling down about the subject, im not sure why it couldnt but it couldnt, im pretty sure the battery im using has more then enouhg MA to supply three relays but i may be wrong.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Learn somthing about everything, and Everthing about somthing-
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-31 23:27
    Alright i got all three hooked up, it runs perfect with two running but again when it tries three they go

    DEDEDEDEDEDEDEDEDEDEDEDE

    like, a machine gun? it scares me cuz they are expensive so i hurry up and cut the power to them. this is the case of a battery not being able to supply the current if im correct? these are some cheapo batteries from like walmart that say HEAVY DUTY on them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Learn somthing about everything, and Everthing about somthing-
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-09-01 00:56
    If you put a:

    SEROUT 16, 16384, [noparse][[/noparse]"Reset!", 13]

    At the start of your project, then you can see the 'Reset' string on the debug terminal to see if you're resetting the BS2.

    And yes, 300 mA is a LOT to take out of any battery. And a "Heavy Duty" battery doesn't have much energy in it. I'd recommend either using a 'wall-wart' supply (6 volts DC or above) or use Alkaline batteries -- though they aren't going to last very long.
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-09-01 00:59
    okay yes its saying RESET! a trillion times a second lol, im using the Homework board in fear of ruining my BOE so i casnt use a wallwart, what about getting a 9 volt lithium or maybe a rechargable 9volt?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Learn somthing about everything, and Everthing about somthing-
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-09-01 01:16
    9-volts only put out like 50 to 100 mA, they have very high "internal resistance". However, radio-shack DOES have a 9-volt 'stand-in' wall-wart supply. You'll want to make sure the supply puts out 500 to 1000 mA, as well as getting the right plug. Whatever you do, use a volt meter on the supply clips, to insure you don't connect the DC voltages backwards.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-09-01 01:24
    willthiswork89 said...
    i dont wanna here that im stupid once more on this forum
    Absoluteley nobody has said that (that you know of.)
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2006-09-02 02:04
    willthiswork89

    I had the same problem i need to use a relay that the current was 80 ma

    So i used the UN2803 but what i did i put·one 220·ohms on each on·and used one Stamp I/O pin

    ·········································· >>>>> STAMP I/O PIN····································>>>>>> Relay OutPut
    ·(UN2803)···InPut1 >> 220 Ohm>>^·····························//··· ··········· ··· OutPut1 >>^
    ············ ·· ·InPut2 >> 220·Ohm>>^····························//··· ·(UN2803)·· OutPut2 >>^
    ·············· · InPut3 >> 220·Ohm>>^···························//···················· ·OutPut3 >>^

    (3) inputs ·and tied·the outputs are tied together and that works great

    ·I did ·this way because i did not·want the UN2803 to be warm at all

    ·I·see no reason why this should not work

    ·I going to try this very soon myself and i let you how well this works


    ·Sam······
    ··Ps······ ·This is just my 2 cents worth· of an ·idea.gif
Sign In or Register to comment.