Day 5: The diode I–V curve — sweep the 1N4148
The diode equation, then measured
The junction from Day 4 obeys the Shockley diode equation: I = Is·(exp(V/(n·Vt)) − 1). Is is a tiny saturation current, n is the ideality factor (~1–2), and Vt = kT/q ≈ 26 mV at room temperature is the thermal voltage. The exponential is why the current is nearly nothing until ~0.6–0.7 V, then rises almost vertically — the familiar diode 'knee' is just where an exponential gets steep.
The breadboard sweep
Wire a known resistor in series with a 1N4148 diode. Drive the top of the resistor with a stepped voltage, measure the voltage *across the diode* with an Arduino ADC, and compute the current from the resistor: I = (V_drive − V_diode) / R. Sweep the drive voltage and log (V_diode, I) pairs — that table is your measured I–V curve.
const float VREF = 5.0; // ADC reference (measure yours!)
const float R = 1000.0; // series resistor, ohms
const int DIODE_PIN = A0; // node between R and diode
void setup() { Serial.begin(115200); Serial.println("Vdiode_V,I_mA"); }
void loop() {
// drive the resistor from a PWM/DAC pin stepped 0..5 V externally,
// or step a bench supply by hand; here we just read one point:
int raw = analogRead(DIODE_PIN); // 0..1023
float vDiode = (raw / 1023.0) * VREF; // volts across the diode
float vDrive = VREF; // known drive voltage
float iA = (vDrive - vDiode) / R; // amps through R (= through diode)
Serial.print(vDiode, 4); Serial.print(",");
Serial.println(iA * 1000.0, 4); // mA
delay(200);
}Typical measured 1N4148 forward I–V — note the log y-axis: the current is exponential in voltage.
Cross-check in ngspice (your first SPICE contact)
Build the same circuit in ngspice and run a DC sweep. The simulated curve should track your measured one in shape (and roughly in position). Meeting SPICE now — deliberately early — pays off in Stage 5, when the *same* solver family models your standard cells' timing arcs.
* Diode DC sweep
Vd n1 0 DC 0
R1 n1 n2 1k
D1 n2 0 Dmod
.model Dmod D(Is=4n N=1.9 Rs=0.6) ; ~1N4148-ish
.dc Vd 0 1.0 0.01
.control
run
plot i(Vd) ; current vs swept voltage
.endc
.endThis exponential comes back
The exp(V/Vt) you just measured is not a one-off. The MOSFET's subthreshold region (Day 8) follows the same exponential law — it's why leakage current is exponential in gate voltage, and why the '60 mV/decade' subthreshold-swing limit exists. Learn the diode's curve well; you're really learning the atom of device physics.
Key terms
- Shockley equation
- I = Is·(exp(V/(n·Vt)) − 1): the exponential current–voltage law of an ideal PN junction.
- Saturation current Is
- The tiny reverse-leakage scale factor in the diode equation.
- Thermal voltage Vt
- kT/q ≈ 26 mV at room temperature; sets the steepness of the exponential.
- Ideality factor n
- A fudge factor (~1–2) accounting for non-ideal recombination in a real diode.
- .dc analysis
- A SPICE sweep of a source over a range, computing the operating point at each step.
Ship for Day 5
Why is the diode current essentially zero until ~0.6–0.7 V, then rises almost vertically?