Dev.to WebDev 🛠 Dev 👁 2 📖 1 min read

Zener diode regulator in JavaScript: output stays put even when input jumps 25%

A Zener diode run backwards past its breakdown voltage holds a nearly fixed voltage across itself no matter how much current flows through it. Put one in series with a resistor and feed it a varying input, and the load s

A Zener diode run backwards past its breakdown voltage holds a nearly fixed voltage across itself no matter how much current flows through it. Put one in series with a resistor and feed it a varying input, and the load sees a voltage locked to the Zener's breakdown value - the series resistor absorbs every volt of variation instead.

The circuit rule

Current from the source splits between the Zener and the load: I_total = I_zener + I_load, where I_total = (Vin - Vz)/Rseries and I_load = Vz/Rload. As long as I_zener stays positive, V_load stays pinned at Vz regardless of Vin.

Checked in JavaScript

function zenerRegulator(Vin, Vz, Rseries, Rload) {
  const Itotal = (Vin - Vz) / Rseries;
  const Iload  = Vz / Rload;
  const Izener = Itotal - Iload;
  return { Itotal, Iload, Izener };
}

console.log(zenerRegulator(12, 6, 100, 1000));
// { Itotal: 0.06, Iload: 0.006, Izener: 0.054 }   -> Vout = 6 V

console.log(zenerRegulator(15, 6, 100, 1000));
// { Itotal: 0.09, Iload: 0.006, Izener: 0.084 }   -> Vout = still 6 V

console.log(zenerRegulator(12, 6, 100, 500));
// { Itotal: 0.06, Iload: 0.012, Izener: 0.048 }   -> Vout = still 6 V
Condition Vin Rload I through Zener Output
Baseline 12 V 1 kOhm 54 mA 6 V
Line surge (+3 V in) 15 V 1 kOhm 84 mA still 6 V
Load drops to 500 Ohm 12 V 500 Ohm 48 mA still 6 V

Whether the input jumps from 12 V to 15 V (a 25% line surge) or the load resistance is halved, the output stays locked at exactly 6 V. The series resistor and the Zener's own current simply reroute to absorb each change - that's line regulation and load regulation in the same two-component circuit.

If the load would need more current than I_total can supply, I_zener goes to zero, the diode comes out of breakdown, and regulation fails: the output then just follows a plain resistor divider instead.

I build PractiSci (https://www.practisci.in), a free virtual physics lab, where the Semiconductor Electronics chapter has an interactive Zener regulator you can load-test yourself: Zener diode regulator lab, or browse all Class 12 physics practicals.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.