thecodingidiot.com

Digital BasicsThe Transistor

The Transistor

A logic gate is a fixed arrangement of transistors. Understanding what a transistor[1] does makes the gate less abstract — and makes the chip in the next page something you have already seen in smaller form.

The transistor as a switch

A transistor has three terminals: base, collector, and emitter. In an NPN transistor[2] — the type used here — current flows from collector to emitter when a small current flows into the base. No base current: the transistor is off, collector-to-emitter is an open circuit. Enough base current: the transistor is on, collector-to-emitter conducts.

It is a switch where the switch control is a current, not a mechanical contact. The base current does not need to be large — a few tenths of a milliamp at the base can switch tens of milliamps through the collector-emitter path. The ratio is the transistor's gain (hFE).

Wiring a transistor switch

Use a 2N3904 NPN transistor in a TO-92 package. The flat face of the package faces you; from left to right the pins are: emitter, base, collector.

Wire the circuit:

+5V

[1kΩ]        ← LED current limiter

[LED anode]
[LED cathode]

 COLLECTOR

 (2N3904)

 EMITTER ─── GND
 
 BASE ─── [10kΩ] ─── control wire

Connect the collector to the LED cathode as shown. Connect the emitter directly to the ground rail. Connect the base through the 10kΩ resistor to a free wire — the control input.

The 10kΩ base resistor limits the current into the base. Without it, the base-emitter junction would draw too much current from the control signal and risk damaging the driving circuit (or the transistor itself).

Verification

Touch the control wire to +5V. The base receives current. The transistor turns on. Current flows from +5V through the resistor, through the LED, through the collector-emitter path to GND. The LED lights.

Touch the control wire to GND. No base current. The transistor turns off. No collector-emitter current. The LED goes dark.

The control wire is the input. The LED is the output. A HIGH input produces a lit LED. A LOW input produces an unlit LED. This is the simplest possible logic circuit: one input, one output, direct correspondence.

Why this matters

The 74HC00 contains no magic. Under its plastic package is a silicon die with roughly 32 transistors arranged as four NAND gates — each gate built from a handful of MOSFETs (a variant of the transistor that switches on voltage rather than current, better suited for dense ICs). The transistor you just wired is the single building block those chips are made from.

When A15 arrives at the 74HC00's gate input, it switches a transistor. That transistor switches another. The result — the inverted signal that becomes ROM CE# — emerges from the output pin in a few nanoseconds. The physics is the same as the circuit you just verified on the breadboard. The scale is different.

Footnotes

  1. Transistor - Wikipedia

  2. Bipolar junction transistor - Wikipedia