Hacker News new | past | comments | ask | show | jobs | submit login
How do transistors work, anyway? (lcamtuf.substack.com)
175 points by weinzierl on Nov 29, 2022 | hide | past | favorite | 72 comments



No background in electrical engineering here.

The article began well, I hadn't previously heard the gas wave/pressure analogy. It helped me see current/voltage in a presumably useful way.

However, after introducing this analogy, the remainder of the article seemed to abandon it and instead load on more and more new terms without referencing them back to the analogy. This lost me, and toward the end I gave up.


Ditto.

I wish folks who expend the effort to create things like this would spend just a bit more identifying the target audience and ensuring they're speaking to it. I've lost count of the things I've begun reading which lose the thread in this manner.


I was disappointed with the article.

This doesn't explain anything new beyond a standard textbook. Same stuff - differently regurgitated. (If you want a swing on this topic MIT 6.004/nand2tetris does a better job & even talks about trade-offs such as doping, channel contaminations, propagation delays due to FET designs, which electrical engineers routinely deal with in production. There are few videos by Carver Mead as well who intuitively explains why transistor work the way they do.)

And for delving into F/R bias, junction effects, leakage current - there are no illustrations showing polarity or flow of charges. Sorry but this is just another low SNR article for today.


Not disappointed, it's a good introductory text with beautiful illustrations. It is called "How do transistors work, anyway?" and not "How do transistors really work?" or "The big transistor deep dive!". I think the article matches the expectations set by the title pretty well.

That is not to say an accessible transistor deep dive would be interesting. I enjoyed my fair share of band gap calculations at university and not to forget Shockley's Garage. That's what an in depth transistor coverage would be for me.

You raised very different points and I would love to read that transistor article anytime.


Normally I avoid sounding critical but since you vociferously defend the article's merit, here is what I honestly feel: As people deeply involved or passionate about tech, we hope HN to be a place where

* Read something we know from a different perspective (a.k.a the hacker way)

* Read something deeper which explains the (usually simpler) stuff in due course (i.e. deepdive)

I get it, you love the article and you want it on HN. But it does nothing more than regurgitating what we learned in university already. And the treatment of the topic is pedestrian (Please see why I critiqued it in terms of absence F/R bias & charge flow etc. Just having a sketch of the BJTs & FETs is extremely low bar)


You don't have the right to gatekeep on HN. There are plenty of people here that aren't Electrical engineers and the article will be great for them. I certainly enjoyed it. The thing I love about HN is exposure to various types of articles, even things not even remotely related to tech, and certainly YOU should not be some sort of purveyor about what belongs on HN or not.


> You don't have the right to gatekeep on HN.

Absolutely not. But I have a right to point out where an article does a lot of handwaving & is plainly shallow.

> There are plenty of people here that aren't Electrical engineers and the article will be great for them.

Neither am I. Thats the best thing about being on HN. People are very passionate about the wave of information & its quality. Also if the SNR of articles weren't high (& it was just another Medium-types) you & I won't be discussing its merits here. Thankfully HN posts manage to attract the curious minds.

> YOU should not be some sort of purveyor about what belongs on HN or not.

I am not, by any means. @dang does that - and very effectively. My job is to express views constructively & debate with facts, without resorting to emotional barrage. You shouldn't either.


>> You don't have the right to gatekeep on HN. >Absolutely not.

Then I suggest you stop. If you don't like an article, then you can skip it. There's nothing worse than people not liking an article and then decrying about it on the comments when all they need to do is move onto the next article.


"And who should you be to command me that, Mi'lord?"

You are guilty of the very things you _presume_ I am doing: Gatekeeping. I have as much entitlement to expressing myself, as you, on this site if I am doing a constructive discussion. You don't like my critique of the post? Then move on - just like you suggest. Not my suggestion but yours

Trolling me is such a wasteful spending of your time. Better would be to mind your own business instead of telling me what topics I am allowed to post or not.


Telling someone to stop gatekeeping is not gatekeeping.


I didn't learn about this in university and was interested by the article. Maybe consider that not everyone took electric engineering and move on with your day?


Absolutely. But would you like to base your understanding on something well written, intuitively illustrated (not necessarily math or physics heavy) OR something which is a refined copypasta from any garden variety electronic textbook?

If I could show you where to find a better place to learn, would you still consider me to "mind my own business"

I am not HN's knight crusader. But I would be happy if people got a better appreciation of things others love. And that needs some constructive critique at times. At HN discussions I try to do that whenever I can.


Could you please share the source you mentioned above. Although a computer scientist by profession, I had to "just accept" lots of basic electrical engineer concepts in my undergrad days just because there was no one available that I could ask.


For a very quick reference, if you don't know anything (Edit: A grandpa level introduction)

https://www.digikey.com/en/articles/transistor-basics

And then,

https://youtu.be/qhJaq3kl6Dc https://youtu.be/AnEVas6cl6Y

Someone even mentioned Ben Eater's videos on SC & PN Diodes & P-N-P/N-P-N transistors. I liked those too when I was learning. Finally the first 10-15 pages in Chapter 1 of Milman & Halkias (PDFs widely circulating) are such a clear read, if something still doesn't click.

For the deep dive details I mentioned in parent post, follow 6.004 Computation Structures' first few lectures. Nand2Tetris lectures also cover how circuits are built from these basic units to make functional units of computer (Bonus: they used to have a simulation software with the book which was neat).

This will build a conceptual model of whats going on in these tiny semiconductor bits - unlike other places which throw in a bunch of facts & expect you to build on top of them


I think the Digikey page is a far worse introduction than the article. It explains what transistors are, but not at all how they work. It doesn't mention what N and P type silicon are, no mention of depletion zone, there are tables filled with PNs before we even get to the word "electron", and the history is fascinating but not particularly illustrative or helpful for how transistors actually work. I think they're intended for different audiences.

I think the article is an excellent introduction to the subject. Maybe the videos explain things better, but I didn't watch them, sorry. I'd much prefer to read a 5m article than 2hrs of video, and I think that's pretty common here. I personally think this fits great on HN.

Edit: Second video was very nice; it's short and sweet and covers the same material as the article. I still prefer the article, but some may prefer the different format.


> I think the Digikey page is a far worse introduction than the article.

I started with a disclaimer: If you know nothing - absolute zero. If this was the first time you heard about it. And it does the thing its intended to do i.e. tell a concise history and introducing some of the jargons

To each his own. I think the OP article is pretty poorly written & handwavy. My complaint of not showing charge flow or polarities still holds.


Completely understood, but still completely disagree. My point is that I feel the DigiKey page is not a good introduction if you're starting from scratch. It barely introduces and doesn't explain any of the jargon. It spends less than 2 paragraphs to cover the material from the article, and includes the same plumbing valve diagram. It doesn't cover what a semiconductor is or what makes them useful. It misses all the information about how/why transistors work and jumps straight to how to design around them.

In other words, the DigiKey page fails to answer the question: How do transistors work, anyway?


> In other words, the DigiKey page fails to answer the question: How do transistors work, anyway?

No, it is to first familiarize What is a transistor anyway?.

If I had to teach Complex Analysis, I would start with a calculus refresher. Or if I had to teach Deep learning, I would probably first explain what's a neural network. My recommendation followed a structure. You could even swap out Digikey product description pages for Wikipedia, I couldn't care any less if it just has to introduce what not how. But when it comes to teaching "how the stuff works", anything less than showing biases, polarities & charge flow is a handwave. I am not making arguments for the sake of arguments - if anyone thinks they got it without touching those, they are tricking themselves in.


That's not the point of this thread though, is it? It asks and answers a very different question. I do not think the history or specs are at all helpful in understanding what makes transistors tick.

"How do tower cranes work?"

"They can carry 20 tons and have a travel of 50 meters and were invented in 1950."


See also https://nandgame.com -- it's not nearly as comprehensive as the nand2tetris simulator, but it's a lot of fun to work through.


Serious question: you consider rectangles with crosshatching "beautiful illustrations"?

I completely agree with the OP. This is a _pure_ regurgitation of introductory material one could find anywhere. The internet is overflowing with this exact description of how a transistor works.

I'm not an EE, but from time-to-time I dabble with electronics. When curiosity gets the best of me I go looking for articles about how transistors work. They all look like this one. What makes this disappointing is that the author sets up the article like they are about to wow you with their particularly special insight into the topic, but proceeds to copy paste the explanation from a textbook.


> Serious question: you consider rectangles with crosshatching "beautiful illustrations"?

Yeah, particularly compared to everything else mentioned so far in this thread (with the possible exception of the YouTube videos I have not investigated).

> This is a pure regurgitation of introductory material one could find anywhere.

Can you share a better presentation of this material? The current suggestions include a full MIT course, a pair of 2 hour long lectures, "the book from the class we all took in college," and the Wikipedia page for transistors, all of which feel like they're targeting very different audiences than a short illustrated article such as this. Ben Eater's vids are great and a lot closer in scope, but YouTube is very different format and many (such as myself) prefer reading.


Since you asked again:

1. https://www.build-electronic-circuits.com/how-transistors-wo...

2. https://www.learnabout-electronics.org/Semiconductors/bjt_03...

> The current suggestions include a full MIT course, a pair of 2 hour long lectures, "the book from the class we all took in college," and the Wikipedia page for transistors,

You have taken my other set of answer out of context: In case you missed the text, I mentioned first couple of lectures of 6.004 (probably 2nd & 3rd ~40 min even if you listen the whole thing). Carver Mead's long lecture is a deepdive into understanding from physics - completely optional & it is pretty obvious from YT page description. You acknowledged the other one was really short & something you appreciate. Milman & Halkias suggestion was for Chapter 1 (~15 pages) only. The "grandpa introduction to someone who starts at 0" seems also been quoted out of context for Wikipedia.

Misquoting someone isn't nice & probably not in good faith. I can't say for everyone, but a sizeable crowd here would consider that wasting other person's time rather than seek answers.


For the record, this is my first time asking this question and it's the first time these links have been posted to this thread. I had no intention of misquoting you, nor do I believe I have done so. I'll be honest, I missed your mention of Millman & Halkias as I've scanned the thread. Why assume ill intent?

I love these! Thanks! However, I still take the same issue with them...

The first link still seeks to answer very different questions than the article. Note how there's still no mention of doping, depletion region, or really anything about how transistors actually work. It seems like it's more interested in answering "how would I use transistors?" instead of "how do transistors work?"

The second article is a lot closer in scope, but still skips the whole how and why semiconductors issue. It also feels like it relies on the user already having a practical background (and sure enough, it's module 3.3 of a full course).

To illustrate my point, I find the first three sections of the article to be the most interesting: The physics of conduction, The case of semiconductors, and Semiconductor junctions. I've yet to see similar treatment of these topics in any of the other links presented.

(Note: Millman & Halkias actually do seem to cover exactly this!)

> Also are you worried about the information or the presentation? You need non-handwavy info in textual format strictly.

Frankly, no. That's what courses and reference texts are for, and if you're working with electronics you can easily find one.

Since this was posted on HN, I view this article from the lens of a software engineer who's curious what goes on inside their processor. The type of person who has no intention of soldering anything together, but who would love an explanation for what makes their computer tick. Your short video did a fine job of this, but I personally find Ben Eater's the best YouTube content (hence why I mentioned only it), but I still maintain this is the perfect piece for curious hackers who prefer to read.


You might be interested in this substantially more in depth collection of article about semiconductor physics: http://britneyspears.ac/lasers.htm


https://youtu.be/KqIOGGjPFQU

I find this to be the best concise explanation of the PN junction, which is enough to figure out how a transistor works on one’s own.


Agreed. One of the best books to understand how transistors work is the GE transistor manual from 1964 :). [1] PS: pdf link

[1] https://worldradiohistory.com/BOOKSHELF-ARH/GE-Books/GE-Tran...


Bob Widlar also wrote an intro to semiconductors



I like how he had his retirement period in the middle of his life and not at the end.

This quote in the section about his retirement in the Wikipedia article made me chuckle:

His proud statement: "I don't work" caused him frequent troubles when crossing the Mexican border and eventually, Widlar created a set of fake business cards presenting him as a "road agent" for "Morgan Associates".


If I could think of anyone being Rick Sanchez (of Rick & Morty) in real life, it had to be Bob Widlar: Brash, extremely genius & mostly drunk.


It's an extremely underappreciated text


my undergraduate analog circuits professor worked with Bob Widlar. He had some great stories. Widlar was a pioneer!


Can you recommend a better article?



I am glad that this article emphasizes the messiness of the bipolar junction transistor, but also disappointed that it doesn't engage with the "obvious" question I had back in the day, when I was taking high school electronics, and also doing hobby electronics (this would be early 1980s....)

If you've worked with them at all, you know that bipolar junction transistors are not symmetric -- if you put them in your circuit with the collector and the emitter reversed, then they don't behave the same as if you put them in the right way. Hobbyists know that the schematic-diagram symbol always has the arrow on the base-emitter leg, and the arrow points from P to N.

But the BJT diagram in this article and in elementary textbooks is symmetric -- there's no physical structural difference between the collector and the emitter in the picture.

This isn't necessarily bad, simplifying the problem to illustrate the fundamentals is a legitimate pedagogical technique.

The "obvious" question is, what else is going on in real devices?

I think the answer is that actual commercially-available discrete BJTs are fabricated on a planar substrate, the same way they're done for integrated circuits, and then cut out of the wafer and packaged for individual use. In this process, the collector (I think?) is generally the lowest layer on the wafer, and is much larger than the emitter, which is on top, and is generally much smaller. In the planar case, there's an obvious geometric asymmetry that explains the device's asymmetric behavior.

I'm not 100% solid on that explanation, and I don't recall where I saw it, but this is the kind of next-level detail that I would have liked to see from the article.

(Minor edits for clarity.)


IIRC one side is more heavily doped than the other, but I cannot recall anything beyond that...

Update: The lack of symmetry [with respect to electrical rather than structural properties] is primarily due to the doping ratios of the emitter and the collector. The emitter is heavily doped, while the collector is lightly doped, allowing a large reverse bias voltage to be applied before the collector–base junction breaks down. The collector–base junction is reverse biased in normal operation. The reason the emitter is heavily doped is to increase the emitter injection efficiency: the ratio of carriers injected by the emitter to those injected by the base. For high current gain, most of the carriers injected into the emitter–base junction must come from the emitter.

https://en.wikipedia.org/wiki/Bipolar_junction_transistor#St...


Nifty, thanks! I'm only slightly embarrassed to discover that it's explained in the wikipedia page...


If I had not recalled that doping had something to do with it, it would have been harder to find this information.


Second to last paragraph of the article covers exactly this, does it not?

> The idealized drawing of a BJT might imply that it should be a bidirectional device, working equally well if you reverse the polarity of the collector and the emitter. In practice, the emitter region is usually doped more heavily to facilitate the transport of electrons in one direction, so reversing the component leads to compromised performance.


You're right that the collector and emitter are not identical in size nor geometry nor surface area bordering the base. There's a nice cross-section about three-quarters of the way down this page[1] that shows the basic layout for a BJT. As to why we fabricate them as nested wells instead of side-by-side rectangles, I believe it is to maximize junction area relative to die area. These layers are exceedingly thin, so almost all of the junction is top-to-bottom, not side-to-side.

1. http://www.circuitstoday.com/monolithic-ic#monolithic-fabric...


Doping concentrations are different for collector and emitter.


As someone who is not an electrical engineer, I found Ben Eater's videos on how semiconductors work and how transistors work interesting and enlightening.

How semiconductors work: https://www.youtube.com/watch?v=33vbFFFn04k

How a transistor works: https://www.youtube.com/watch?v=DXvAlwMAxiA


For me engineering mindset did a really nice job of helping me understand how they work https://youtu.be/J4oO7PT_nzQ


I think this article does a pretty poor job of explaining the most interesting and exciting idea that I think is at the core of semi-conductors. Which is that you can go from the energy levels of electrons in an atom - using the electron shell concept that you already know from school, and translate that into how current flows in a semi-conductor lattice - and that not only do we get current flow when electrons move into higher energy levels, but that you see an opposite effect where holes flow the other direction. To me, that seems like something extremely well suited for visualization and this explanation does none of that. The reason I think this is so important is because between understanding that, and understanding how doping works, the logic of everything else is very intuitive. Give me some energy band diagrams!


As a layman, I always thought it was just simpler to just think of how conduction works in practice. By that I mean, for electricity to flow between two pieces of conducting wire, they need to be touching. If there is an air gap between two pieces of the wire, no electricity flows and the circuit is considered to be open. If you fill that gap with something conductive, then the circuit is closed and electricity flows.

So how does a transistor do this?

Simple, by placing a semiconductor in for the gap. Now if you add electricity to that semiconductor (and change it's conductance), it's like you're filling in that gap using electricity itself. If you don't, then it's like the gap remains filled with air...

Ergo, it's like connecting a gap between two pieces of wire, by using electricity itself to bridge the gap (or not depending on which state it is you want).


Bias makes transistors work. Learned that in Navy BE/E school. Nothing about them made sense until then. The article doesn't mention bias until it starts talking about FET's which is odd because bias is the reason transistors work. The voltage can be negative at all three leads. That blew my mind. Bias.


Bias is how you make transistors work in a circuit, but not how they work internally.


It's not a closed system internally. Theorizing about the open circuit voltage is legitimate for an ideal voltage source but entirely useless since it is completely isolated. It is indeed a confusing abstraction, I have to concure.


Bias is how all electric components work. All they know about is the difference in voltage between their electrodes, not any absolute voltage w.r.t the rest of the circuit.


Voltages lack the concept of zero, so we need a comparison to be able to do certain math (like addition) nicely. Here's an article explaining why!

https://math.ucr.edu/home/baez/torsors.html

Here's the post I pulled it from!

https://news.ycombinator.com/item?id=33678771


Current cutting-edge theoretical descriptions of solid-state devices (solar PV cells and their partners, light-emitting diodes, field-effect transistors, diode lasers, etc. all seem to involve applications of the complicated density functional theory, a replacement for earlier many-nuclei, many-electron wave function approaches (which were computationally intractable).

It's a very complex linear-algebra-heavy theory, but anyone interested in this field will eventually end up having to grasp it. One could philosophize as to whether the resulting theoretical picture is closer to reality than the previous approach, but ultimately these are just models, and comparison of predictions with experimental results is the real test. For an introduction:

(2014) "Density Functional Theory in the Solid State", Hasnip et al.

https://sci-hub.se/10.1098/rsta.2013.0270

See section 4, "Semiconductor physics/device technologies":

> "DFT simulations are increasingly important in the field of device technologies, and used to study everything from conventional CMOS devices to future devices based on half-metals, thermoelectrics or multiferroics. Obtaining the correct band-gap for the constituent (doped/defect) materials is essential to describe the functionality of these devices."

Since transistor sizes have now reached the so-called quantum limit, the electron tunneling phenomenon is now a limiting issue, requiring new materials and DFT-based electronic structure prediction.

P.S. Wikipedia has a good article on field-effect transistors:

https://en.wikipedia.org/wiki/Field-effect_transistor


> How do transistors work, anyway?

Yes, how do they work? This article totally reads like decades old pre-academic level textbook explanations found in schools.

> Hey, there's voltage and current. Oh, and there's this P/N magic you all heard about already? Anyway, that's how they work.


The important part is that they have asked the right question.

Besides, the rule of headlines applies.


I can infer what the "hydraulic analogy" is, but I can't say it has ever been present in my life. It certainly was never touched in high school electrical engineering. Anyone have differing experiences?


I've heard things such as "voltage is like water pressure (psi), resistance is like the size of the pipe (cross-sectional area), current is like the flow rate (gpm)" and so forth.


given how it dismissed that model, it seems odd that this article then immediately starts talking about the ‘electron gas’ and throws around an analogy of voltage to a pressure difference in the gas.

Apparently the pneumatic model is preferred over the hydraulic one.

Personally I think the problem with the ‘hydraulic model’ is that people visualize it with wires as fluid filling pipes, with pressure as the driving force. I think you get a lot further if you imagine your circuits as water running in open channels with a free surface. The water needs to be able to slosh.


This took a lot of effort to dig up (answers your questions on "thinking hydrolicaly") - so you must watch it /g

https://www.youtube.com/watch?v=OEzuZ6BpC-g

p.s. just that comment in passing starting at 12:10 is absolute gold: he casually drops the equivalence to state and function in basic electrical components. HN, this is one of the most wonderful - you will learn a lot - lectures delivered in exceptionally modest, accessible, and friendly manner.


Both in high school and college, my instructors used it. I found it useful and it remains the default go-to mental model for me. Wikipedia even has an article on it: https://en.wikipedia.org/wiki/Hydraulic_analogy


When I was a kid, my father tried to explain "how electricity works" using water analogies.

Works well enough to make a curious kid stop asking questions, but won't take you much further than that.


I guess it depends how far you want to go, but the water analogy seems pretty useful to me. It encompasses V, I, R, capacitors, resistors, and inductors.


I think it's a recent thing. I first heard about this analogy some time in the 2010s.


Voltage has been called "pressure" for a very long time, although I'm not sure if it's strictly a hydraulic analogy.


Yep. Traditionally, voltage was the "tension" applied to the system. Pulling rather than pushing there, but same idea. Still occasionally seen in "high tension lines" etc., and for some reason (worked on too many tube amps over the years?) I sometimes still write HT/LT instead of HV/LV.


Where else would you get "voltage sink", "gate" (similarly German "Gatter" - gate, flip flop, switch).


Pretty sure Maxwell used it.

The analogy is just to try to convey the concept of a field and the associated vector calculus. An analogy isn't necessary for Newtonian mechanics and scalar calculus because humans intuitively understand thrown balls etc.


Maxwell's fluids followed EM field lines, not current flow.


Those who want to know can also try this one, for example.

https://www.youtube.com/watch?v=hrpPKCDLRN0

as well as others by the same author.


There are much better explanations.

See https://www.youtube.com/watch?v=IcrBqCFLHIY for example.


Start with studying particle in a box.


And how exactly do you plan to establish the particle is indeed in the box?


I did a deep dive in this topic as an EE undergrad and I'm here to report that trying to actually understand these things will end in disappoint, not withstanding all of the cargo cult mumbo jumbo that gets past off as education in this area. My personal experience was that after badgering the prof week after week for a full term his final answer was "I don't know. Go and ask Dr. Soandso in the physics department"

It takes a lot of effort to track down the essential contradiction. In short the problem is "holes" and "electrons" stuff. In particular the "holes". In the beginning because of doping and band gaps and such the doping atom releases and electron into the conduction band which leaves behind a positively charged "hole". Ie the atom now has one more proton than electrons. So far so good. But a few weeks later we move on to the Hall Effect and now these "holes" are moving and this allows the hall effect to distinguish the N-type from the P-type (qv X h, and all that). But that can't be right because the positive charge is fixed with the doping atom and not moveable so the v should be forever zero.

Well of course the actual technology does work but the theory it's based on is far too difficult for mortal EE's (and their profs) to understand so instead they (the physicists) cooked up a bogus theory with a fatal flaw (conservation of charge - where does this new moving proton come from?) and everyone is happy cuz they never thought it through.

My recommendation is to save yourself a lot of time and worthless effort and work on the water flowing through a pipe analogy. This can take younquite a long way with DC circuits and extends with a few tweaks to ac circuits as well.

And with respect to transistors. I read through all the comments here and as far as I can tell no one distinguishes between bipolar and FET transistors. These are very different beasts with very different operating characteristics but, cutting to the chase, both behave very much like a water tap type.

With bipolar transistors the "gate" current allows a proportionally much large current to flow through the other two leads so it's and amplifier of current. Simple as that. Rotate the tap a bit and get a much bigger resonse in the water flowing.

With FET transistors the "gate" is controlled by voltage rather than current (there is a little leakage current but it's tiny) but the result of a larger current though the other two leads is pretty much the same.

Capacitors and inductors are readily added to your repertoire. When you hit phase locked loops though you're gonna have to crack some books.

In theory, practice and theory are the same. In practice they're not.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: