11 Semiconductors, Doping, and Diodes
11.1 Learning Objectives
- Distinguish N-type (excess electrons) from P-type (holes) semiconductors and explain how doping concentration determines conductivity
- Explain PN junction behavior in forward bias (depletion narrows, current flows) and reverse bias (depletion widens, current blocked) using carrier physics
- Contrast BJT (current-controlled, continuous base drive) against MOSFET (voltage-controlled, near-zero gate current) switching behavior for IoT load control
- Select logic-level MOSFETs with Vgs(th) below your MCU GPIO voltage (3.3V or 5V) and verify Rds(on) at that gate voltage
- Calculate MOSFET power dissipation using P = I²×Rds(on) at actual gate voltage and determine if heatsinking is required
Key Concepts
- Semiconductor Doping: Intentionally adding impurity atoms to pure silicon to create excess electrons (N-type, donor atoms like phosphorus) or electron holes (P-type, acceptor atoms like boron), dramatically increasing conductivity and enabling transistor and diode fabrication
- P-N Junction: The interface between P-type and N-type semiconductor regions; free electrons from the N-region combine with holes from the P-region to form a depletion zone with an internal electric field; this built-in potential is approximately 0.6-0.7 V for silicon
- Forward Bias: Applying positive voltage to the P-side and negative to the N-side reduces the depletion zone and allows current to flow; silicon diode conducts when applied voltage exceeds approximately 0.6-0.7 V; current increases exponentially above this threshold
- Reverse Bias: Applying negative voltage to the P-side widens the depletion zone and blocks current flow (only tiny leakage current); this is the ‘off’ state of a diode — high resistance, minimal current, fundamental to rectifier and protection circuits
- Zener Diode: Operates in controlled reverse breakdown at a specific voltage (Zener voltage, typically 2.4-75 V); maintains constant output voltage across a range of currents; used as voltage references and protection circuits
- Schottky Diode: A metal-semiconductor junction diode with lower forward voltage (0.2-0.4 V vs. 0.6-0.7 V for silicon PN) and faster switching speed; used in RF circuits, high-frequency power supplies, and as flyback protection diodes where low voltage drop matters
- LED (Light Emitting Diode): A P-N junction where recombining electron-hole pairs release energy as photons; forward voltage and photon wavelength depend on semiconductor material: red (~1.8-2.0 V), green (~2.0-2.5 V), blue/white (~3.0-3.5 V)
- Diode I-V Characteristic: The exponential relationship between current and voltage in a diode: I = Is x (e^(V/nVT) - 1) where Is is reverse saturation current, n is ideality factor (1-2), and VT is thermal voltage (~26 mV at 25 C); explains why diodes have a sharp turn-on voltage threshold
For Beginners: Semiconductors and Diodes
Semiconductors are materials that sit between conductors (like copper wire that lets electricity flow freely) and insulators (like rubber that blocks it completely). By adding tiny amounts of other elements (called “doping”), engineers can make semiconductors conduct in controllable ways. A diode is the simplest semiconductor device – it acts like a one-way valve that lets electricity flow in only one direction, much like a turnstile that only lets people through one way.
11.2 Semiconductors: The Foundation of Electronics
11.2.1 Pure Semiconductors
Common Materials:
- Silicon (Si) - 95% of all semiconductors
- Germanium (Ge) - Historical use, now rare
- Gallium Arsenide (GaAs) - High-frequency applications
Pure semiconductors aren’t very useful because they don’t conduct well at room temperature.
Atomic Structure
Understanding atomic structure helps explain why silicon (4 valence electrons) makes an ideal semiconductor material.
Putting Numbers to It
Doping concentration determines semiconductor conductivity. Pure silicon has ~\(5 \times 10^{22}\) atoms/cm³ but only ~\(1.5 \times 10^{10}\) free carriers/cm³ at room temperature (300K).
N-type doping with phosphorus (1 in 10⁶ atoms):
\[n = \frac{5 \times 10^{22}}{10^6} = 5 \times 10^{16} \text{ free electrons/cm}^3\]
This increases free carrier concentration by a factor of ~\(\frac{5 \times 10^{16}}{1.5 \times 10^{10}} \approx 3 \times 10^{6}\), roughly 3 million times more than intrinsic silicon!
Carrier mobility determines switching speed. In silicon at 300K: - Electron mobility: \(\mu_n = 1400 \text{ cm}^2/(V \cdot s)\) - Hole mobility: \(\mu_p = 450 \text{ cm}^2/(V \cdot s)\)
N-type semiconductors switch 3× faster than P-type because electrons have higher mobility – this is why NMOS transistors are preferred for high-speed digital logic.
Depletion width in a PN junction with 1V reverse bias:
\[W = \sqrt{\frac{2\epsilon V}{q} \left(\frac{1}{N_A} + \frac{1}{N_D}\right)} \approx 0.1\mu m \text{ to } 1\mu m\]
This microscopic insulating region prevents current flow in reverse bias, enabling diode rectification.
Interactive: Doping Concentration Calculator
Adjust the doping ratio to see how many free carriers are created and the conductivity improvement factor over intrinsic silicon.
11.2.2 Doping: Creating Useful Semiconductors
Doping = Adding impurities (dopants) to semiconductors to control conductivity
11.3 N-type and P-type Semiconductors
11.3.1 N-type (Negative)
Doping: Add elements with extra electrons (e.g., Phosphorus)
Result: Excess of free electrons (negative charge carriers)
Silicon atom: 4 valence electrons
Phosphorus dopant: 5 valence electrons → 1 extra electron!
Properties:
- Majority carriers: Electrons (-)
- Minority carriers: Holes (+)
- Better conductivity than pure silicon
11.3.2 P-type (Positive)
Doping: Add elements with fewer electrons (e.g., Boron)
Result: Deficit of electrons creates “holes” (positive charge carriers)
Silicon atom: 4 valence electrons
Boron dopant: 3 valence electrons → 1 missing electron (hole)!
Properties:
- Majority carriers: Holes (+)
- Minority carriers: Electrons (-)
- Holes act as positive charge carriers
11.3.3 How It Works: PN Junction and Diode Bias
Diode Forward and Reverse Bias
The big picture: A PN junction diode conducts current easily in one direction (forward bias) but blocks it in the reverse direction, acting as an electronic one-way valve controlled by voltage polarity.
Step-by-step breakdown:
Forward Bias (Conducting): Connect P-side to positive voltage, N-side to ground, reducing depletion zone width from 500nm to ~10nm, allowing electron flow across junction with only 0.7V voltage drop - Real example: 1N4007 diode passing 1A forward current drops 0.9V, dissipating 0.9W as heat
Reverse Bias (Blocking): Connect N-side to positive, P-side to ground, expanding depletion zone to 5-10um, creating insulating barrier that blocks current with only <1uA leakage - Real example: Same 1N4007 diode blocking 12V reverse voltage passes only 0.5uA leakage current, negligible 0.006mW power loss
Breakdown (Destructive): Exceed reverse voltage rating (1000V for 1N4007), causing avalanche effect where electric field tears electrons free, creating runaway current that generates heat until junction melts - Real example: Applying 1200V reverse voltage to 1N4007 rated for 1000V causes catastrophic failure within milliseconds
Why this matters: Forward voltage drop (0.7V silicon, 0.3V Schottky) wastes power in rectifiers and protection circuits. Using Schottky diodes in 5V supplies recovers 8% efficiency compared to silicon diodes.
11.3.4 Transistor Types Overview
Understanding the different transistor families helps you select the right component for IoT applications:
The BJT can be understood as two PN junctions sharing a common middle layer (base). In an NPN transistor, a small base current allows a much larger collector-emitter current to flow, providing current amplification essential for sensor signal conditioning and motor driver circuits.
MOSFETs control drain-source current through gate voltage without significant gate current, making them ideal for microcontroller-driven switching. The insulated gate oxide provides high input impedance, allowing direct connection to GPIO pins for logic-level MOSFETs.
Cross-Hub Connections
Explore More Electronics Resources:
- Simulations Hub - Try interactive circuit simulators (TinkerCAD, Falstad) to build transistor switches and test diode circuits without physical components
- Videos Hub - Watch visual explanations of semiconductor physics, PN junction behavior, and transistor operation at the atomic level
- Quizzes Hub - Test your understanding of BJT vs MOSFET selection, power dissipation calculations, and circuit design decisions
- Knowledge Gaps Hub - Clarify common confusions about gate drive voltage, current vs voltage control, and thermal management
Why This Matters: Electronics fundamentals connect to nearly every IoT topic. Understanding transistors enables you to design sensor interfaces (signal conditioning), control actuators (motor drivers), optimize power consumption (load switching), and troubleshoot hardware issues (thermal problems, shoot-through).
Transistor Selection Decision Framework for IoT Projects
When choosing between BJT and MOSFET for an IoT switching application, follow this 3-step decision process:
Step 1: Determine load current
| Load Current | Recommendation | Reason |
|---|---|---|
| < 100 mA | BJT (2N2222, BC547) | Simple, $0.02-0.05, no gate driver needed |
| 100 mA - 5 A | Logic-level MOSFET (IRLZ44N) | Low Rds(on) (~22mΩ), direct GPIO drive at 3.3V |
| > 5 A | MOSFET + gate driver (IR2110) | High-side switching, proper gate voltage |
Step 2: Check supply voltage compatibility
| MCU Voltage | BJT Base Resistor | MOSFET Gate Drive |
|---|---|---|
| 3.3V (ESP32, STM32) | R_base = (3.3V - 0.7V) / (I_load / hFE) | Must use logic-level MOSFET (Vgs_th < 2V) |
| 5V (Arduino Uno) | R_base = (5V - 0.7V) / (I_load / hFE) | Standard logic-level MOSFET (Vgs_th < 3V) works |
Step 3: Calculate power dissipation
- BJT: P = V_CE(sat) x I_C = 0.2V x I_load (typically 0.1-0.3W for small loads)
- MOSFET: P = I2 x Rds(on) (e.g., 2A2 x 0.022 ohm = 0.088W for IRLZ44N at Vgs=10V)
Worked example: ESP32 driving a 12V DC fan (0.5A)
- Option A (BJT 2N2222): R_base = (3.3 - 0.7) / (0.5/100) = 520 ohm. Power = 0.3V x 0.5A = 0.15W. Cost: $0.03. Works fine.
- Option B (MOSFET IRLZ44N): Direct GPIO to gate. Power = 0.52 x 0.022 = 0.0055W at Vgs=10V (slightly higher at 3.3V Vgs). Cost: $0.65. Runs cooler.
- Verdict: BJT is cheaper and adequate at 0.5A. MOSFET becomes clearly superior above 1A where BJT dissipation exceeds 0.3W.
Interactive: MOSFET vs BJT Power Dissipation Calculator
Compare power dissipation between BJT and MOSFET switching for your load current. Adjust the sliders to see which device runs cooler.
Common Misconception: “All MOSFETs Work with 3.3V/5V GPIO”
The Misconception: Many beginners assume any MOSFET can be driven directly from microcontroller GPIO pins (3.3V or 5V), leading to circuits that “sort of work” but run hot, waste power, and fail prematurely.
The Reality with Real Numbers: Standard MOSFETs require Vgs = 10-12V to fully turn ON and achieve their datasheet specifications. When driven with insufficient gate voltage, they operate in the linear region with dramatically higher on-resistance.
Real-World Impact (IRF540N Example):
- Datasheet spec: Rds(on) = 77mΩ @ Vgs=10V
- With 5V gate drive: Rds(on) ≈ 200mΩ (2.6× higher!)
- Switching 2A load:
- Expected power: (2A)² × 0.077Ω = 0.31W (manageable)
- Actual power: (2A)² × 0.2Ω = 0.8W (hot!)
- TO-220 package without heatsink: 1W max → MOSFET runs at 80°C → premature failure
Measured in Real Projects: A student designed a smart fan controller using IRF540N driven from 5V Arduino. Initial testing worked fine for 10 minutes, but after 30 minutes the MOSFET reached 95°C and the fan speed dropped 40% due to voltage drop across the partially-on MOSFET. After switching to IRLZ44N (logic-level), temperature dropped to 35°C and fan ran at full speed.
The Solution: Always check the Vgs specification in datasheets: - Logic-level MOSFETs: Vgs(th) < 2.5V, fully on at 4.5-5V (look for “L” in part number: IRLZ44N) - Standard MOSFETs: Vgs(th) = 2-4V, but require 10V for rated Rds(on)
Cost of This Mistake:
- Wasted heat: 0.8W - 0.31W = 0.49W continuous loss
- Battery life: For a 2A load running 50% duty cycle, that’s 5.9Wh/day wasted → significant drain on any battery-powered system
- Component damage: Thermal stress reduces MOSFET lifetime from 100,000 hours to <10,000 hours
- Debugging time: Students typically spend 2-4 hours troubleshooting “hot MOSFET” before discovering gate voltage issue
Key Takeaway: When selecting MOSFETs for microcontroller projects, ALWAYS verify Rds(on) at YOUR gate voltage (not the datasheet headline spec). Add 50% safety margin for thermal calculations. Logic-level MOSFETs cost the same ($0.50) but save hours of debugging and prevent field failures.
11.4 Knowledge Check
Test your understanding with these questions.
For Kids: Meet the Sensor Squad!
The Sensor Squad learns about one-way doors and super switches!
Sammy the Sensor had a problem. “Bella, what happens if someone plugs your battery in backwards?” Bella the Battery looked worried. “That could fry Max and all our friends!”
Max the Microcontroller smiled. “Don’t worry – we have a special protector called a DIODE. Think of it like a one-way door. Electricity can flow through in one direction, but if it tries to go backwards, the door slams shut!”
“How does that work?” asked Lila the LED. Max explained: “Remember how we learned about N-type and P-type semiconductors? When you stick them together, you get a PN junction. One side has extra electrons, the other side has holes where electrons are missing. When electricity pushes the right way, electrons jump across to fill the holes and current flows. But push the wrong way, and a big empty gap forms that blocks everything!”
“Wait,” said Lila, “my name has LED in it – Light Emitting Diode! Am I a diode too?” “Yes!” said Max. “You’re a special diode that gives off light when electrons jump across the junction. Different materials make different colors – that’s why you can glow red, green, or blue!”
Then Sammy asked the big question: “But what about transistors? How do they work?” Max got really excited. “A transistor is like TWO PN junctions sandwiched together – NPN or PNP. It’s a super switch! I send a tiny whisper of electricity to the middle layer called the base, and it controls a HUGE flow of electricity through the other two layers. It’s like a kid whispering to a giant who then opens or closes a massive gate!”
Bella clapped. “So that’s how you control the big fan motor even though you’re so small!” Max nodded proudly. “One tiny signal from me, and the transistor lets all of Bella’s power flow through to spin the motor. That’s the magic of semiconductors!”
11.4.1 Key Words for Kids
| Word | What It Means |
|---|---|
| Diode | A one-way door for electricity – lets current flow one way only |
| LED | Light Emitting Diode – a diode that glows with light |
| Transistor | A super switch controlled by a tiny signal |
| N-type | Semiconductor with extra electrons (negative charges) |
| P-type | Semiconductor with missing electrons called holes (positive charges) |
| PN Junction | Where N-type meets P-type – the magic boundary that makes diodes work |
Worked Example: Selecting the Right Flyback Diode for a 12V Relay
Scenario: You are building an ESP32-controlled smart home hub that switches a 12V electromagnetic relay (coil: 120mA, inductance: 150mH). The relay controls a 120V AC lamp. What flyback diode should you use?
Step 1: Calculate the inductive voltage spike (worst case)
When the relay coil current is cut, the inductor generates: V = -L × (di/dt)
Worst-case scenario: transistor switches off in 100ns (modern MOSFETs are fast!)
V_spike = -(150 × 10⁻³ H) × (0.12A / 100 × 10⁻⁹ s) = -180,000V
Without protection, this 180kV spike would instantly destroy the transistor (rated for 60V max).
Step 2: Select diode voltage rating
The flyback diode must withstand at least the supply voltage in reverse bias: V_reverse > 12V
Add 2× safety margin: 12V × 2 = 24V minimum
Common diodes meeting this: - 1N4148 (100V, 300mA fast-switching signal diode) - 1N4007 (1000V, 1A general-purpose rectifier) - 1N5819 Schottky (40V, 1A, fast recovery)
Step 3: Select diode current rating
The flyback diode must handle the relay coil current: I_diode ≥ 120mA
All three diodes exceed this (300mA to 1A rating).
Step 4: Check reverse recovery time
When the relay switches ON again, the diode must stop conducting quickly to avoid shorting the power supply.
| Diode | Reverse Recovery Time | Suitability |
|---|---|---|
| 1N4148 | 4 ns (very fast) | Excellent for high-frequency switching |
| 1N4007 | 30 µs (slow) | Acceptable for relays (slow mechanical switching) |
| 1N5819 Schottky | <10 ns (very fast) | Best for motor PWM and high-frequency applications |
For a relay switching at <1 Hz, even the slow 1N4007 is adequate.
Step 5: Calculate power dissipation in the diode
When the relay switches OFF, the collapsing magnetic field forces current through the flyback diode.
Energy stored in inductor: E = ½ × L × I² = 0.5 × 0.15H × (0.12A)² = 1.08 mJ
This energy dissipates through the diode over several milliseconds. Average power is negligible for low-frequency relay switching.
Decision: Use 1N4007 – it is cheap ($0.02), over-specified for voltage (1000V >> 12V), handles the current easily, and the slow recovery time does not matter for relay applications.
For motor drivers or high-frequency solenoid valves, upgrade to 1N5819 Schottky for faster recovery and lower forward voltage drop (0.3V vs 0.7V).
Verification: After installing the 1N4007, measure the voltage across the transistor with an oscilloscope when switching the relay OFF. You should see voltage clamped to ~12.7V (12V supply + 0.7V diode drop) instead of the 180kV spike.
Quick Reference: BJT vs MOSFET Decision Checklist
Use this checklist alongside the detailed Transistor Selection Decision Framework above:
| Question | If YES → | If NO → |
|---|---|---|
| 1. Is load current < 100mA? | BJT (2N2222) works fine, costs $0.02 | Go to Q2 |
| 2. Is the GPIO voltage 5V or higher? | BJT or MOSFET both work | Go to Q3 |
| 3. Is GPIO voltage 3.3V? | Must use logic-level MOSFET (Vgs(th) <2V) | Cannot drive standard MOSFET |
| 4. Is switching frequency >1kHz (PWM)? | MOSFET (BJTs waste power driving base continuously) | BJT acceptable |
| 5. Is battery life critical? | MOSFET (zero gate current) | BJT acceptable |
| 6. Is load current >5A? | MOSFET with proper heatsink | Use relay or SSR instead |
11.5 Concept Check: PN Junction Behavior
Test your understanding before proceeding:
## Concept Relationships
This chapter connects to other electronics topics:
| Related Concept | Chapter Link | Relationship |
|---|---|---|
| Transistor Operation | Transistor Selection Guide | Transistors are two PN junctions sharing common layer |
| Voltage Regulation | Power Management | Zener diodes provide voltage reference |
| Flyback Protection | Motor Control Circuits | Diodes clamp inductive voltage spikes |
| Rectification | Power Supplies | Diode bridges convert AC to DC |
11.6 Try It Yourself
Challenge: Measure Diode Forward Voltage Drop
Objective: Verify diode forward voltage varies by type and current, understanding real vs ideal behavior.
Materials Needed:
- Multimeter with diode test mode
- 1N4007 silicon diode
- 1N5819 Schottky diode
- LED (any color)
- 9V battery, 1kΩ resistor, breadboard
Steps:
- Use multimeter diode mode to measure forward voltage of each diode (no circuit needed)
- Build circuit: 9V battery → 1kΩ resistor → diode → ground
- Measure voltage across diode with multimeter
- Calculate current: I = (9V - Vdiode) / 1kΩ
- Compare measured Vf at load current vs diode test mode
Solution Example:
- 1N4007 diode test: 0.65V (low current ~1mA)
- 1N4007 in circuit at 8mA: 0.72V (increases with current)
- 1N5819 Schottky: 0.28V (lower Vf, better efficiency)
- Red LED: 1.8V (forward voltage depends on semiconductor bandgap)
- Blue LED: 3.1V (wider bandgap = higher voltage)
Expected Observation: Forward voltage increases with current due to semiconductor resistance. Schottky diodes have 0.4V lower drop than silicon, saving power. LEDs show color-dependent forward voltage related to photon energy.
Key Takeaway
Doping creates N-type and P-type semiconductors that, when combined into PN junctions, form diodes (one-way current flow) and transistors (electronically controlled switches). MOSFETs are preferred for most IoT applications because they are voltage-controlled with nearly zero gate current, offer lower power losses, and are simpler to drive from microcontroller GPIO pins.
11.7 See Also
Diode Applications:
- Flyback Diode Protection - Protect transistors from inductive spikes
- Voltage Regulators - Zener diode voltage references
- LED Driver Circuits - Current limiting for LEDs
Advanced Semiconductor Physics:
- Band Gap Theory - Why forward voltage varies by material
- Temperature Effects - Forward voltage decreases ~2mV/°C
- Transistor Selection Guide - Switching speed considerations for BJT vs MOSFET
11.8 Match the Concepts
11.9 Order the Steps
Common Pitfalls
1. Forgetting That Diode Forward Voltage Varies with Current and Temperature
A silicon diode’s forward voltage is approximately 0.6-0.7 V, but this varies: increasing current increases forward voltage; increasing temperature decreases forward voltage by approximately 2 mV/C. In precision rectifier or voltage reference applications, account for these variations. A diode used as a rough 0.7 V reference drifts significantly with temperature.
2. Using Silicon Diode for High-Frequency Switching Without Checking Recovery Time
Standard silicon rectifier diodes (1N4001-1N4007) have reverse recovery times of 1-4 microseconds. At high switching frequencies (>50 kHz), they remain partly conductive during the reverse transition, causing power loss and heating. Use Schottky diodes (nanosecond recovery) or ultrafast diodes for switching power supplies and high-frequency rectifier circuits.
3. Reverse Biasing an LED Beyond Its Maximum Reverse Voltage
LEDs have very low reverse breakdown voltage (typically 5-30 V). In AC circuits or H-bridge motor drivers, LEDs can be momentarily reverse-biased. Exceeding the reverse voltage instantly destroys the LED junction. Add a small signal diode in reverse parallel with the LED to clamp reverse voltage, or ensure the circuit never applies reverse voltage to the LED.
4. Assuming All Diodes Have the Same Forward Voltage
Forward voltage varies significantly by diode type: germanium 0.2-0.3 V, Schottky 0.2-0.4 V, silicon PN 0.6-0.7 V, LED 1.8-3.5 V depending on color. Using the generic 0.7 V value for a Schottky or LED in a circuit calculation introduces significant errors. Always look up the actual forward voltage for the specific diode type at the expected operating current.
11.10 What’s Next
| Direction | Chapter | Why Read It |
|---|---|---|
| Previous | Electricity Applications | Ohm’s Law and power calculations that underpin diode and transistor circuit design |
| Next | Transistor Selection Guide | Systematically choose BJT vs MOSFET for every IoT load-switching scenario |
| Related | Electricity Fundamentals | Voltage, current, and resistance basics that explain forward voltage and diode conduction |
| Applied | DC Motor Control | See flyback diodes and H-bridge transistor circuits in real actuator designs |