Analog Electronics: Introduction
A thermocouple produces per kelvin. A microphone gives a few millivolts. A battery-powered sensor node must run for years on a coin cell, and a USB charger must turn a lumpy rectified voltage into a clean . None of these signals can go straight into a microcontroller's ADC. Something has to rectify, regulate, amplify, filter and buffer them first, and that something is an analog circuit built from diodes, transistors and op-amps.
Circuit theory (Circuit Theory & Network Analysis) taught you to analyse networks of linear elements. This course adds the nonlinear devices that make electronics useful, and the main idea that keeps them tractable: bias a device at a DC operating point, then treat small signals around that point as linear. By the end you will be able to design, simulate and test a complete amplifier, filter, oscillator or regulator from a written requirement.
The map
| Section | You will be able to | Labs and tools |
|---|---|---|
| Getting started | explain carriers, doping and the PN junction well enough to use device models | figures, Python |
| Diodes and diode circuits | choose a diode model, solve diode circuits, design rectifiers, clippers, Zener regulators and LED drivers | ee-netlist (linearised), Python, ngspice |
| Bipolar junction transistors | bias a BJT robustly, use it as a switch, build CE, CC and CB amplifiers from the hybrid- model | ee-transistor-curves, ee-netlist, ngspice |
| Field-effect transistors | bias MOSFETs and JFETs, build CS, CD and CG stages | ee-transistor-curves, ee-netlist, ngspice |
| Analog building blocks | combine stages, design current mirrors, differential pairs and class A, B and AB output stages | Python, ngspice |
| Frequency response and feedback | find an amplifier's bandwidth, use the Miller effect, predict what feedback does, compensate a loop | ee-bode-plot, ee-netlist, control, ngspice |
| Operational amplifiers | design with ideal op-amps, then account for offset, bias currents, GBW, slew rate and CMRR | ee-op-amp, ee-netlist, ngspice macro-models |
| Active filters and oscillators | design Sallen-Key and MFB filters, pick a Butterworth, Bessel or Chebyshev response, make oscillators start and settle | ee-bode-plot, ee-rlc-resonance, SciPy, ngspice |
| References and regulators | design Zener-follower and LDO regulators, size a heatsink, understand when a switcher is better | ee-buck-boost, Python, ngspice |
| Analog design practice | estimate noise, lay out and ground a board, read datasheets and design for tolerances | Python, ngspice |
Units, components, bench instruments and safety are in EE Foundations; nodal analysis, Thevenin, transients, phasors and Bode plots in Circuit Theory. This course links to those lessons instead of repeating them. It uses only as much semiconductor physics as a circuit designer needs; the device physics in depth (band diagrams, fabrication, FinFETs) belongs to the planned chip-design courses of the Embedded Systems & Chip Design track.
How analog design is done
- Model. Replace each device with the simplest model that answers the question: an ideal diode for a rough rectifier estimate, a drop for a bias point, the exponential Shockley law or the hybrid- model when the numbers matter.
- Hand calculation. Solve the model by hand or in a few lines of Python. A hand result tells you why the circuit works and which component sets which property.
- Simulate. Check the hand result in SPICE with fuller device models, then explore what the hand model ignored: temperature, tolerances, large signals, frequency limits.
- Measure. Build it, measure it, and compare within the measurement uncertainty (Accuracy, Precision and Measurement Uncertainty). A disagreement means the model missed something, and finding what is how you learn.
Conventions used in this course
- Symbols. DC quantities in capitals with capital subscripts (, ), small-signal quantities in lower case (, ), total instantaneous values in lower case with capital subscripts (). Voltage is ; school physics books often write . The imaginary unit is .
- Thermal voltage. at , the value ngspice uses at its default .
- Units upright, with a space: , , .
- Worked examples use Given / Find / Solve / Check.
- SPICE. Decks run in ngspice 42. Device models are written in each deck for this course (a generic small-signal silicon diode
DSIG, a rectifierDREC, an NPNQN, an n-MOSFETMN, and so on); they are not vendor models. SPICE reports a source's current flowing into its terminal, so a source delivering power shows a negative current. - The
ee-netlistlab solves linear circuits only. It has no diode or transistor elements, so the course uses it with linearised models: a diode as a voltage source plus a resistor, a transistor as its small-signal model with a controlled source, an op-amp as a voltage-controlled voltage source. - Safety. Hands-on work uses a bench supply set to at most DC with its current limit on, batteries, function generators and USB-powered boards. Anything connected to the mains (transformer primaries, off-line rectifiers, mains-powered supplies) is taught by calculation and simulation only.
A first example, three ways
Given: a supply, and a small silicon diode in series (the figure).
Find: the current and the diode voltage with three diode models.
Solve: KVL around the loop gives .
The third model cannot be solved by algebra alone, so let Python find the root:
import numpy as np
from scipy.optimize import brentq
VS, R = 5.0, 1e3
IS, N, RS, VT = 2.52e-9, 1.752, 0.568, 0.02585
def kvl(i): # supply minus the drops around the loop
vd = N * VT * np.log(i / IS + 1) + RS * i
return VS - R * i - vd
i_ideal = VS / R
i_drop = (VS - 0.7) / R
i_exp = brentq(kvl, 1e-12, VS / R)
vd = VS - R * i_exp
print(f"ideal switch : I = {i_ideal*1e3:.3f} mA, VD = 0.000 V")
print(f"0.7 V drop : I = {i_drop*1e3:.3f} mA, VD = 0.700 V")
print(f"Shockley + Rs: I = {i_exp*1e3:.3f} mA, VD = {vd:.3f} V")
print(f"error of the 0.7 V model: {100*(i_drop-i_exp)/i_exp:+.2f} %")ideal switch : I = 5.000 mA, VD = 0.000 V
0.7 V drop : I = 4.300 mA, VD = 0.700 V
Shockley + Rs: I = 4.347 mA, VD = 0.653 V
error of the 0.7 V model: -1.08 %
And in SPICE, with the same diode model written in the deck:
cat > d.cir <<'EOF'
* 5 V, 1 k and a small-signal silicon diode (model written for this course)
.model DSIG D(Is=2.52n N=1.752 Rs=0.568 Cjo=4p M=0.4 Tt=20n BV=100 IBV=0.1u)
V1 in 0 5
R1 in a 1k
D1 a 0 DSIG
.control
op
print v(a) i(V1)
.endc
.end
EOF
ngspice -b d.cir 2>&1 | grep -E '^(v\(|i\()'v(a) = 6.532286e-01
i(v1) = -4.34677e-03
Check: SPICE and the Python root agree to four digits (, ), and the negative i(v1) is the SPICE sign convention for a source that delivers power. The constant-drop model is only 1 % off here because the resistor takes of the : when the supply is much larger than the diode drop, the exact drop hardly matters. From a cell the same 0.7 V guess would be badly off, which is the first design lesson of the course: know which model a question needs (Diode Models).
Guided lab: the first measurement
Hand calculation. , (the model above).
Simulation. The Python root and the SPICE operating point.
What you would measure. Set a bench supply to with a current limit, wire a 1 % resistor and a small-signal silicon diode (a 1N4148-class part) on a breadboard, anode towards the resistor. A handheld multimeter on its DC volts range should read between about and (diodes of one type vary by a few tens of millivolts, and falls by about per kelvin as the room warms). The voltage across the resistor, divided by its measured value, gives within about 1 %. Reverse the diode: the current falls to nanoamperes and the meter shows the full across the diode.
Hazards and safe setup. Low voltage and a current limit; the only hazard is a hot resistor or a dead diode if the supply is set wrongly. Check the setting before connecting the circuit.
Pitfalls
- Using one model for every question. "0.7 V" is a model, not a law. It breaks at low supply voltages, at very small or very large currents and away from room temperature.
- Forgetting the operating point. Every amplifier in this course is analysed in two steps: DC bias first, then small signals around it.
- Trusting a simulation you could not estimate. A SPICE result you cannot predict within a factor of two by hand usually hides a wiring or model mistake.
Practice
- Repeat the worked example with . By what percentage is the constant-drop current wrong now?
- Why does the ideal-diode model overestimate the current in every diode-resistor circuit?
Answer
- The Shockley solution is at ; the constant-drop model gives , about 13 % low. The smaller the supply compared with the drop, the more the drop model matters.
- It sets the diode voltage to zero, so the whole supply is across ; any real forward drop leaves less voltage for the resistor and therefore less current.
Test yourself
In the worked example (, , silicon diode) the constant-drop model gives…
Which order does this course follow when designing a circuit?
- simulate, build, then calculate
- model, hand calculation, simulation, measurement
- measure, then fit a model
- build, then simulate
Why does the course use ee-netlist only with linearised device models?
- it cannot do AC analysis
- it has no diode or transistor elements, only R, L, C, sources and controlled sources
- it is limited to 5 elements
- it only runs transients
What is at ?