Shop OBEX P1 Docs P2 Docs Learn Events
sink vs source ?? — Parallax Forums

sink vs source ??

ShoonShoon Posts: 4
edited 2005-04-17 00:18 in BASIC Stamp
Hello,

Can someone please explain the difference between sink and source? I’m a beginner.

If the BS2 sources 20mA and sinks 25mA, where does the 5mA come from? That is, if the current is max at 20mA through the Stamp’s pins. ??

~shoon

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-05 14:23
    Simply:

    Source = Connect pin to + (Vdd) side of supply
    Sink = Connect pin to - (Vss) side of supply

    The difference has to do with chip construction; some microcontrollers can source and sink the same current on a pin. Also note that in addition to a maximum current per pin, there is a maximum current per group of pins that cannot be exceeded (and this value is less than the sum total of the pin max currents).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-04-05 14:37
    This should be an FAQ somewhere.

    Well, you know the BS2 has a connection to Vdd and Vss to "power the chip". When you tell the BS2 to make an output high, like:

    HIGH 1 ' Make pin 1 an Output, and put a High on it.

    then the BS2 internally turns on a transistor to connect its Vdd to pin 1. Thus current can flow from the BS2 Vdd pin through the transistor and out Pin 1 -- thus "Sourcing" current out pin 1. (Note here we are talking by convention of 'Positive' current, which consists of 'positive' charges flowing in a 'positive' direction from high voltage (+5) toward a lower voltage (0 volts, or ground)).

    When you tell the BS2 to make an output low, like: LOW 1 ' Make pin 1 an output, and put a Low on it.
    then the BS2 internally turns off the transistor connecting its Vdd to pin 1, and turns on a transistor connecting its Vss to pin 1. Thus an external 5-volt signal on that pin will be 'pulled low', by the transistor 'sinking' current from Pin 1 into the BS2's Vss pin.

    Now a transistor is not an infinite device. Conducting current generates heat. Thus the transistors in the BS2 have a limit in how much current they can conduct before they become a 'fuse' and melt. For the 'source' transistor, that limit is 20 mA. For the 'sink' transistor, that limit is 25 mA. This means if you let the pin source more than 20 mA, that driver transistor acts like a fuse and dies. Forever. That pin will no longer source any current.

    Now the Vdd and Vss pins also have a limit. So only two I/O pins can sink 25 mA at the same time, or you exceed the amount of current that the chip can put into Vss without burning up. Thus the chip as a whole has a limit on total current.

    The limiting factor here is the resistance that YOU put into the circuit. If you do a LOW 1, and then connect a +5 volt source to that pin, without any resistance in the circuit, then the BS2 transistor will conduct as much as it can, become a fuse, and die. If
    you connected a 220 ohm resistor between the two, then the equation becomes:

    V=I*R. Voltage = Current * Resistance (Ohm's Law). Or, Voltage/Resistance = Current.
    So, 5 Volts / 220 Ohms == 0.02272 Amps, or 22.72 milli-Amps (mA).

    Now, since the 'sink' transistor can sink up to 25 mA, it doesn't die. But the only thing limiting that current is that resistor in there. There's nothing intrinsic about the I/O pin that limits the current. The published limit tells you how much it can do just before it destroys itself.

    P.S.·fixed a little phrase on 'sink'· 4/5/05

    Post Edited (allanlane5) : 4/5/2005 5:23:05 PM GMT
  • ShoonShoon Posts: 4
    edited 2005-04-05 14:38
    Jon,

    thankyou!

    I’m brushing the dust off my old physics book. Unfortunately this book only gives theory. I’m missing the practical application of basic theory.

    ~shoon
  • ShoonShoon Posts: 4
    edited 2005-04-05 14:57
    allanlane5,

    This is an excellent explanation about the mechanics going on in the inside of the stamp.
    I can see now in my minds-eye. Helps a lot, since I’m a spatial learner.

    ~shoon
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-04-05 15:19
    I'm a spatial thinker/learner myself. Glad I could help.
  • Wade SmithWade Smith Posts: 25
    edited 2005-04-05 17:13
    I don't know about spatial thinker/learners,· but I know about·slow learners, like me,·and allanlane5's explanation was very helpful for me too!
  • Nightrider7731Nightrider7731 Posts: 46
    edited 2005-04-05 21:12
    I always put a 220 or 270 off any pin I used, but when you connect the other end·to an IC like a 595 or 165, is it the internals of the IC that determine how much mA the chip draws?· So even though the pin can can sink 22.72 mA with a 220 resistor, the IC on sends a fraction of the ma?

    ·
  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2005-04-05 22:51
    To perhaps shed some light as to why there is a difference in the fist place between source and sink currents stems from the
    physical construction of the NMOS and PMOS transistors. Where complementary CMOS circuits with equal rise time and fall time
    are required, the size of PMOS transistor is at least twice the effective size of the NMOS transistor.

    Conceptually, MOSFETs are like resistors in the on-state, and shorter resistors have less resistance, so the smaller MOSFETs
    allow more current to pass. Also, smaller MOSFETs have smaller gates, and thus lower gate capacitance. These two factors
    contribute to different switching speeds, so to create a balance, the size of the complementary transistors are adjusted to
    compensate for the "best fit".

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe - Mask Designer III

    National Semiconductor Corporation
    Latest Company News
    (Communication Interface Division)
    500 Pinnacle Court, Suite 525
    Mail Stop GA1
    Norcross,GA 30071
  • The Dead BugThe Dead Bug Posts: 73
    edited 2005-04-06 02:34
    First, let me say that I highly respect Allanlane5. He is experienced and knowledgable, and what he posts can be taken as gospel. He has been kind enough to post on my Blog on a similar issue, and I take his points with respect and due defference. Now let me give you a different perspective.

    For years there has been two schools of thought on current flow. One is simple and easy to understand, and the other is right.

    Indeed, today there are electronics textbooks that are published in two versions; conventional current flow (the fantasy) and electron flow (the reality). Each version is identical save for the arrows that depict the direction of current in the circuits. This is because there are two schools of thought in how we should teach electronics (no one actually believes that there are two valid opposing theories of current flow, only how we should teach it).

    I would venture that Allanlane5 doesn't actually believe that electric current flows from positive to negative, but he believes that it is harder for you to grasp the concept of current flow if we don't perpetuate that model. There is good reason for this viewpoint; Electricity is like plumbing; we all know that water flows from high pressure to low pressure. It is an easy extrapolation to think of electric current flowing from positive "pressure" to less positive "pressure". But it just isn't true. And, with due respect to Allanlane5, if you teach it wrong up front, you (or someone else) will eventually have to fix the error because ultimately the model will fail. In my opinion, it's better to "bite the bullet" early on, and learn how things really work as early as possible.

    Electron flow
    Electrons make electric current. It is the flow of free electrons that produces electric current. Electrons have a negative charge.·Coulomb showed that like charges repel. Therefore when you have an abundance of free electrons in a space, they tend to try to move away from each other. If you give them a path (e.g.copper wire), they will travel through the wire which makes current. This shows that electrons move from a source of an abundance of negative charges to a place where there are less negative charges. In other words, electric current flows from negative to positive.

    The Implications
    By the above definition, a source is a place where electrons come from (more negative) and a sink is a place where electrons flow to (more positive). So if the BS2 can "source" 20 mA, that means that 20mA of current can flow out of an output to drive a load. That means that the Stamp is more negative than the load. In other words, one end of the load is connected to Vdd and the other end is connected to an output pin. The Stamp is supplying electrons "up" into the load and to the more positive Vdd. This would mean that the output is "0", or "LOW" which is more negative than Vdd (Vdd is positive 5V)

    If the BS2 can sink 25mA, that means that current flows into an output. To do that the output must be more positive than the load, and the load is situated between ground (Vss) and the output. Vss is supplying electrons to the load, and after flowing through the load, they enter the output and flow to the "drain", (Vdd).

    This is the reason why Vss (ground, the more negative pole) is called Vss. the "ss" is for "source" It is the source of electrons in electron flow. And this is why Vdd, the more positive pole, is called Vdd. The "dd" stands for "drain" where the electrons drain into and go down the "sink".

    Therefore "current sourcing" means electrons flow out of it, and it's more negative than the load, and "current sinking" means electrons flow into it and it is more positive than the load. Intuitive? Probably not. Right? Definitely. I would propose that if you want to really understand what is going on in a circuit, don't follow "conventional current" flow. Bite the bullet and learn how current really flows. Then you will be better prepared for more advanced electronic concepts.

    Bruce

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Name: Bruce Clemens

    Work:· Clemensb@otc.edu
    Good Stuff on my Blog: http://theDeadBug.journalspace.com

    Post Edited (The Dead Bug) : 4/6/2005 12:54:50 PM GMT
  • KenMKenM Posts: 657
    edited 2005-04-06 03:05
    Bruce,

    I totally agree and personally, I think in electron flow. It was the way I was taught.

    Beau,

    What makes you an expert on MOS technology !!!· *rib jab*.....because he designs the stuff for a living !!

    Nice info Beau.

    Ken
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-04-06 13:01
    Umm, Bruce, that's why I said "By Convention". The actual physics are what you state, but the convention is as I stated it.

    And the 'Sink' and 'Source' definitions I've run into in my professional life follow the convention. So do the diagram symbols, by the way. A 'Source' is a pin that 'sources' (puts out) positive current, from high voltage to low voltage. A 'Sink' is a pin that provides a path for current INTO the chip. A 'diode' symbol is a little arrow pointing in the direction of positive current flow.

    Now the actual physics may be that a 'source' is providing a path for electrons to come up out of the Ground (under the force of the positive voltage 'sucking' them up) and go into the 'source' pin and from there into the positive terminal of the power supply. That's another perfectly valid way of looking at it.

    It would be convenient for your model if a 'source' actually sourced electrons -- but it doesn't. I wouldn't have said anything, because I do respect your point of view and the information on your "dead bug" web-site. Unfortunately when you said a 'source' sources electrons you began saying things that are actually not correct.

    Oh, and the specification sheets for the PIC are also written this way -- though now that I think of it they may be specifying "Max I output high" and "Max I Input Low". The point stands though.

    Otherwise, there's no harm in understanding that what is REALLY going on is electron flow. But if you find that confusing, there's also no harm in understanding positive current flow from a positive voltage to ground.
  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2005-04-06 15:35
    KenM,

    Just flying by the seat of my pants most of the time...

    Perhaps more than anybody want's to know, but here is a good read that might further explain a few things...See Chapter 5

    bwrc.eecs.berkeley.edu/Classes/ICDesign/EE141_f01/notes.html

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe - Mask Designer III

    National Semiconductor Corporation
    Latest Company News
    (Communication Interface Division)
    500 Pinnacle Court, Suite 525
    Mail Stop GA1
    Norcross,GA 30071
  • clayljclaylj Posts: 9
    edited 2005-04-06 16:34
    This seems to be a never ending battle.

    I took basic electronics way back in 1969 and at that time the "convention" was to teach true current flow; current flows from negative to positive. We were told that conventional current flow was a misconception on the part of early scientists and that the concept hung on purely out of inertia. Realize that at this time, although the transistor was gaining a foothold, the world ran on vaccum tubes.

    Now the transistor takes over and conventional current flow comes back with a vengeance. They now teach that current is the flow of holes from positive to negative. A hole being a place that a future electron can reside. This is why the arrows in transistors and diodes point toward the negative. I guess that you could say that the positive terminal is the source of holes and the negative is the drain for said holes.

    I vote for current being the flow of electrons from negative to positive. tongue.gif

    Ban conventional current!!!

    Larry
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-04-07 04:48
    ·· This debate reminds me a little of the debate between the US measurement system and the metric system adopted by much of the rest of the world.· Old-School people seem to have trouble thinking any other way than what they were brought up.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2005-04-07 05:14
    As far as I know, all IC's in the US are designed with metric... smilewinkgrin.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe - Mask Designer III

    National Semiconductor Corporation
    Latest Company News
    (Communication Interface Division)
    500 Pinnacle Court, Suite 525
    Mail Stop GA1
    Norcross,GA 30071
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-04-07 17:08
    claylj said...

    I took basic electronics way back in 1969 and at that time the "convention" was to teach true current flow; current flows from negative to positive. We were told that conventional current flow was a misconception on the part of early scientists and that the concept hung on purely out of inertia. Realize that at this time, although the transistor was gaining a foothold, the world ran on vaccum tubes.

    Now the transistor takes over and conventional current flow comes back with a vengeance. They now teach that current is the flow of holes from positive to negative. A hole being a place that a future electron can reside. This is why the arrows in transistors and diodes point toward the negative. I guess that you could say that the positive terminal is the source of holes and the negative is the drain for said holes.

    I vote for current being the flow of electrons from negative to positive. tongue.gif

    Ban conventional current!!!

    Larry
    This convention actually arose from Ben Franklin and his experiments with electricity. In one of his papers he stipulated that current flowed from the positive to the negative. Since modern physics was still a hundred years in the future, there was no means for experimentally testing this hypothesis. By the time that the theory was disproven, the concept was already a matter of convention and persists to this day.
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-04-07 17:43
    I can sympathize with this debate, because getting started I too always tried to think of things in physical terms. However, when you reach a certain point in the study of electrical engineering, it all becomes moot, and mathematical circuit analysis becomes an abstraction. You study networks of electical devices that have two or more terminals, and the network is governed by Kirchoff's current law (currents at a node add up to zero) and voltage law (voltages around a loop add up to zero). You start off with a circuit (say an op amp and a few resistors), and rather arbitrarily assign + and - signs to each element that join at each node, and by convention arrows from + to - along each element at a node. Each element has what is called a "constitutive relationship", something like V = IR, that relates the voltage (+ and - signs) to the current (arrows). Then you write a bunch of equations and solve them. You could make an arrow go from - to + if you want, but then the constitutive equation would be V = -IR instead of V = IR, and as it turns out, the solution works out to be the same. How you think about it physically really fades into the background. The circuit could contain a beaker of solution with both positive and negative charge carriers (ions), or a p or n channel FET, or a proton accelerator, or a superconducting ceramic (where the nature of the conduction is stil mysterious). The important thing for network analysis is to come up with a good model and a good constitutive relationship. That is the physical level where you can argue about whether the charge carriers are negative or positive and how and what is actually moving. But at the level of the network analysis, at some point you at some point have to leave behind the physics and deal at a higher level of abstration.

    I just bring that up for young people who are thinking of going into engineering. That is what you get into in EE 101 circuit theory at college level.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • ForrestForrest Posts: 1,341
    edited 2005-04-07 18:45
    Sometimes I think EE's need to backup from the abstraction and start looking at the parts. Being in the electronics manufacturing business, you'd be surprised how many designs I see where LED footprints are sometimes marked on the anode side and other times they're marked on the cathode side. FYI most LED's have the cathode marked (flat side or a dot) and IPC-7351 states that the cathode side should be marked on all diodes.
  • tsindostsindos Posts: 9
    edited 2005-04-16 06:15
    Is it possible to take a poll to see what most people think of this?

    It could help authors to write in a more understandable way for newbies like us.

    Personally, I was taught that flow of electrons is from negative to positive...
  • ForrestForrest Posts: 1,341
    edited 2005-04-16 11:05
    "Now the transistor takes over and conventional current flow comes back with a vengeance. They now teach that current is the flow of holes from positive to negative. A hole being a place that a future electron can reside. This is why the arrows in transistors and diodes point toward the negative. I guess that you could say that the positive terminal is the source of holes and the negative is the drain for said holes."

    This is the convention I was taught (early 80's) and it makes sense to me when looking at a schematic that uses transitors and diodes. Being a mechanical engineer - I was taught a diode is like a one-way check valve - that only allows electricity to flow in 1 direction. A transistor is like a flow control valve - with the collector being the input side, the base controlling the flowrate the the emitter being the output.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-04-17 00:18
    Semiconductor theory (by lightyears the most difficult grad level class I ever took) teaches that holes travel slower through a semiconductor lattice than electrons, this always perplexed me. I think it was explained that holes have more mass than electrons, but again this perplexes me for obvious reasons.
Sign In or Register to comment.