# How to Build a Computer 4: Diodes and Transistors

We all love blasting things with ions, and most of us could spend all day shooting at wafers, but eventually someone is going to ask you to build something useful. What am I doing with all this mess of silicon anyhow? Here’s where we see the use of all that stuff. What do you suppose happens when you put a p-doped chunk of silicon next to an n-doped chunk of silicon?

One last cookie photo, then I’m going on a diet. Swearsies.

Diodes to Kill For

Recall that n-doped silicon is called that because it’s got a negative charge carrier. Or don’t; it’s not like I’m paying you to. There’s phosphorus or some such providing one extra electron that nobody really wants. And p-doped silicon has a positive charge carrier; one of the atoms is an electron short of a full orbital (sounds like the sort of things chemists whisper behind each other’s back). These charge carriers (the electron and the hole where an electron ought to be) tend to diffuse around in the crystal.

Take a look at that cookie sheet again. On the left, we’ve got an antimony atom (double chocolate chunk if you’re keeping track) providing an extra electron. In the obviously-photoshopped section on the right, you’ve got boron that’s missing one. Supposing the extra electron diffuses into the missing one; what happens? Suddenly all the atoms have eight electrons and everyone’s happy. All along the junction between the crystals electrons are seeking out holes like frustrated golfers finally making birdie.

There’s a reason though that boron didn’t have that electron to bring to the party (lousy moocher). Boron comes with five protons in its nucleus, and when it’s neutrally charged it has three electrons in its outer shell. It doesn’t have the protons to a fourth electron. Relative to the electrons the protons are pretty well stuck in place (they diffuse like we covered before, but not nearly as quickly as the electrons or holes will.) As these holes and electrons merge you uncover more and more effect from the fixed charges. The p-doped side of the diode will start to generate a negative electric field, and the n-doped section will generate a positive field. The field opposes the motion of further electrons, and the whole process grinds to a stop. The metaphorical golfers get frustrated again.

On the left the N-doped crystal. On the right the P-doped silicon. In the middle a sand trap.

What you’re left with is a crystal that has an insulating layer in the middle; all those electrons are perfectly happy right where they are thank you very much. Let’s fix them. Let’s apply a voltage across the thing. Hook up your negative electrode to the p-doped silicon. The negative electrode provides extra electrons to the part of the crystal that has extra holes. What happens? The electrons fall into the holes and it gets even more insulating. Huh; that didn’t work.

Like the last picture, only with more sand trap.

Switch the electrodes around. Stick the negative electron up next to the n-doped silicon. All the fresh electrons jostle the existing electrons (and the crystal’s natural electric field) like an influx of subway passengers, and the electrons move towards the back of the car, or the positive side of the crystal.

Conversely, on the p side of the crystal, there’s a demand for electrons at the positive electrode. It starts shunting electrons that way, which narrows the depletion zone (that insulating layer I mentioned earlier.) If the voltage is high enough there’s no profit in shunting electrons into locally produced holes, it’s all in the export market. The depletion zone goes away and the diode starts conducting electricity.

Hah! I knew I’d get it to work eventually. The nine iron did the trick.

What we have then is a chunk of silicon that will conduct electricity in one direction but not in the other direction. (You can get it to run backward if you apply enough voltage, but it isn’t much good for anything afterward. Learned that one entirely by accident in the physics lab). There are plenty of interesting things you can do with just that, but wait; there’s more!

From Diodes to Transistors

What happens if you stick three crystals together? Either P-N-P or N-P-N; NNP or PPN just gives you a longer diode. Let’s talk about an NPN transistor; which I’ll represent with this Neapolitan ice cream sandwich

I said no more cookies, not no more ice cream.

The chocolate and strawberry sections are doped with boron, making them n-type crystals. The vanilla section is doped with antimony, making it a p-type crystal. Okay, you stick your electrode in either end of the sandwich, you won’t get a current going across. You can think of it as two diodes facing opposite directions; either way you choose you chose wrong.

In the example photo, we’ve got the negative probe stuck into the chocolate and the positive into the strawberry. The chocolate-vanilla diode is perfectly willing to let electrons pass, but the vanilla-strawberry diode won’t. Okay, it’s a multimeter and not actually something that provides power; I’m looking to make an example not fry my ice cream. Quibbles aside, hook up a positive electrode from another source to the vanilla (p-doped) silicon.

Electrons can flow from the chocolate to the vanilla to the third electrode. However, because you’ve now got electrons moving in that vanilla section they can also move across the depletion zone (that area where all the holes are filled) and into the strawberry section. If you take away the voltage from the third electrode acting on the middle section then the electrons no longer have an excuse to get into the vanilla and from there mosey into the strawberry. The current across the whole thing switches off.

So What’s it to Me?

Practically what this gets you, you’ve got a switch that you can turn on and off with electricity. It doesn’t seem like much but it opens a world of possibilities. Bell Labs developed it to amplify a phone signal (a weak signal on the middle part of the transistor from New York City will toggle a strong local current in Philadelphia, and can be relayed on to points beyond. Coast-to-coast calling.)

But the real interesting thing you can do with this is logic. Line up a whole mass of transistors and set them to turning themselves on and off. You can do math with that. With clever math, you can produce absolutely everything else a computer is capable of. Join us next week when we do some simple transistoring in “NPN Junction What’s Your Function?” or “They Said There Would Be No Math.”

This is part four of my ongoing series on building a computer, the Russian Novel way. You may find previous parts here: 1 (silicon) 2 (crystallography) 3 (doping)  or all of them under the tag How to Build a Computer. This week’s post has been brought to you by Fyodor Dostoevsky. If there’s one man who knows excellent extremely long form writing it’s Fyodor Dostoevsky.

1. Contributor
Gary McVey
@GaryMcVey

I can’t believe I’ve started to rearrange my Saturday nights around the publication of Hank’s wondrous stories, which will take us from subatomic particles to unimaginable realms of hyper-sized clusters of mega-galaxies, pausing–at least for the time being–at the level of what it takes to build a computer.

But…yeah, I can believe it. They’re that good, and damnedly entertaining. Thanks so much! And where the hell where you when I struggled to put together some of the pieces of this information circa 1966?

Oh yeah, I forgot.  You wouldn’t be born yet for another twenty years.

Like that’s an excuse.

2. Member
Judge Mental
@JudgeMental

Forget about that stuff… I want to know why the ice cream sandwich is giving a voltage reading.

3. Contributor
@HankRhody

Forget about that stuff… I want to know why the ice cream sandwich is giving a voltage reading.

Me too; me too.

4. Member
Arahant
@Arahant

Anyone else getting hungry?

5. Member
Major Major Major Major
@OldDanRhody

What you’re left with is a crystal that has an insulating layer in the middle; all those electrons are perfectly happy right where they are thank you very much. Let’s fix them. Let’s apply a voltage across the thing. Hook up your negative electrode to the p-doped silicon. The negative electrode provides extra electrons to the part of the crystal that has extra holes. What happens? The electrons fall into the holes and it gets even more insulating. Huh; that didn’t work.

The signs of the voltages applied to the electrodes in the picture don’t match what you’re saying in the text; or, as we learned in The Three Stooges Meet Hercules, “You’ve got your anodes where your cathodes should be, and your cathodes where your anodes ought to be.”

6. Reagan
GLDIII
@GLDIII

These Saturday Night physics lessons are strangely spiking my A1C levels. Hank you need to put down the cookies and ice cream or somebody is going to go into a diabetic shock. (Sort of like what happens when you force feed to many electrons on the wrong side of your diode).

7. Member
RightAngles
@RightAngles

This is why they always say that if there were an apocalypse, the tech guys would rule the world. I mean they can make a computer out of cookies and an ice cream sandwich, it’s amazing. Who needs boron and antimony when you have dessert foods, am I right?

8. Contributor
@HankRhody

Major Major Major Major (View Comment):
The signs of the voltages applied to the electrodes in the picture don’t match what you’re saying in the text; or, as we learned in The Three Stooges Meet Hercules, “You’ve got your anodes where your cathodes should be, and your cathodes where your anodes ought to be.”

Gah. Fixed it. I blame the lateness of the hour and the Twitter gnomes that hack congressmen when they inadvertently send something salacious.

9. Member
Matt Balzer
@MattBalzer

RightAngles (View Comment):
Who needs boron and antimony when you have dessert foods, am I right?

10. Member
RightAngles
@RightAngles

11. Member
Major Major Major Major
@OldDanRhody

Major Major Major Major (View Comment):
The signs of the voltages applied to the electrodes in the picture don’t match what you’re saying in the text; or, as we learned in The Three Stooges Meet Hercules, “You’ve got your anodes where your cathodes should be, and your cathodes where your anodes ought to be.”

Gah. Fixed it. I blame the lateness of the hour and the Twitter gnomes that hack congressmen when they inadvertently send something salacious.

I ought to fix my quotation as well:

“You heard what he said: ‘You’ve got your ano-whozits where your catho-whatsits ought to be, and your catho-whatsits where your ano-whozits ought to be.'”

12. Member
RightAngles
@RightAngles

Major Major Major Major (View Comment):
The signs of the voltages applied to the electrodes in the picture don’t match what you’re saying in the text; or, as we learned in The Three Stooges Meet Hercules, “You’ve got your anodes where your cathodes should be, and your cathodes where your anodes ought to be.”

Gah. Fixed it. I blame the lateness of the hour and the Twitter gnomes that hack congressmen when they inadvertently send something salacious.

I ought to fix my quotation as well:

“You heard what he said: ‘You’ve got your ano-whozits where your catho-whatsits ought to be, and your catho-whatsits where your ano-whozits ought to be.’”

Hey! So my names for them are correct after all.

13. Contributor
@HankRhody

Grinding on another hobbyhorse of mine, you know when The Three Stooges Meet Hercules comes out of copyright? 2057.

14. Contributor
@HankRhody

Forget about that stuff… I want to know why the ice cream sandwich is giving a voltage reading.

Me too; me too.

Further testing indicates that the numbers are in millivolts; they jump around without pattern with zero, one or two probes in a Neapolitan ice cream sandwich. They’re more stable near zero in a plain vanilla sandwich.

15. Reagan
GLDIII
@GLDIII

Forget about that stuff… I want to know why the ice cream sandwich is giving a voltage reading.

Me too; me too.

Further testing indicates that the numbers are in millivolts; they jump around without pattern with zero, one or two probes in a Neapolitan ice cream sandwich. They’re more stable near zero in a plain vanilla sandwich.

Science!

16. Member
:thinking:
@TheRoyalFamily

17. Member
Judge Mental
@JudgeMental

Forget about that stuff… I want to know why the ice cream sandwich is giving a voltage reading.

Me too; me too.

Further testing indicates that the numbers are in millivolts; they jump around without pattern with zero, one or two probes in a Neapolitan ice cream sandwich. They’re more stable near zero in a plain vanilla sandwich.

Is there going to be a part where you run a clock off an ice cream sandwich?

18. Contributor
Gary McVey
@GaryMcVey

“I could get a grand jury to indict a ham sandwich”–NY Judge Sol Wachtler, 1985.

“I could power a microscopic LED with an ice cream sandwich”–renegade physicist Hank Rhody, 2018.

19. Coolidge
dnewlander
@dnewlander

Grinding on another hobbyhorse of mine, you know when The Three Stooges Meet Hercules comes out of copyright? 2057.

Sure. Like Disney is letting the mouse pr0n out that early.

20. Coolidge
dnewlander
@dnewlander

By the way, if there had been cookies (and it hadn’t been held in the Bat Cave immediately after lunch), I would have fallen asleep in MEMS _far_ less often.

Thanks, Hank!

21. Member
The Reticulator
@TheReticulator

Grinding on another hobbyhorse of mine, you know when The Three Stooges Meet Hercules comes out of copyright? 2057.

Surely an extension will be granted by then.