Electronics From Zero Search/

Visual explainers · Intermediate

Two techniques you will use constantly

Switching a load with a transistor, and controlling power by switching quickly. Each explainer gives you the controls, a live picture, a plain-language explanation and the technical version.

More explainers: Op-amps: amplifiers and comparators

Explainer 1 · builds on Transistors

The transistor as an electronic switch

A microcontroller pin or a small sensor can only supply a little current. An NPN transistor lets that small current switch a much bigger load on and off. The design question is simple: is the base current big enough to turn the transistor fully on?

Bench · NPN low-side switch—
NPN transistor switch A control voltage drives the transistor base through a base resistor. The load sits between the supply and the collector; the emitter goes to ground.

Logarithmic: 100 Ω to 100 kΩ.

Logarithmic: 10 Ω to 10 kΩ. 90 Ω is roughly a small 9 V lamp.

β varies a lot between transistors, even of the same type.

Base IB—
Load IC—
VCE—
Transistor heat—
—
    Design rule of thumb

    In plain language

    Think of the transistor as a tap. The small base current is your hand on the handle; the collector current is the water. A little turn lets a little water through. Turn it all the way and the flow is limited only by the pipe, which here is the load.

    For a switch you want only two positions: fully closed (no base current) or fully open (plenty of base current). Halfway wastes energy as heat in the transistor.

    Technically

    With VBE ≈ 0.7 V, IB = (Vin − 0.7) ÷ RB. In the active region IC = β × IB and VCE = VCC − IC × RL.

    Once β × IB exceeds what the load allows, (VCC − VCE(sat)) ÷ RL, the transistor saturates: VCE falls to about 0.2 V and IC stops rising. Because β is uncertain, switches are designed with a “forced β” of about 10, giving far more base current than strictly needed.

    Model and its limits

    Fixed VBE = 0.7 V and VCE(sat) = 0.2 V, a constant β, a purely resistive load, and no temperature effects. Real values depend on the specific transistor and its operating current; check its datasheet for maximum collector current, voltage and power.

    Motors, relays and solenoids

    A coil stores energy in its magnetic field and resists sudden changes in current. When the transistor switches it off, the coil produces a voltage spike that can be many times the supply voltage and can destroy the transistor. Always fit a flyback diode across the coil, with its stripe (cathode) towards the positive supply.

    Quick check · 3 questions

    Explainer 2 · builds on AC and DC

    PWM: dimming by switching fast

    A microcontroller pin is either on or off. So how does it dim an LED or slow a motor? It switches on and off very quickly and varies the share of time it spends on. That share is the duty cycle, and the technique is pulse-width modulation (PWM).

    Bench · PWM signalSlowed down
    LED driven by this signal
    Average brightness (an illustration; eyes do not respond linearly)
    Average V—
    Period—
    On time—
    Off time—

    In plain language

    Flick a light switch on and off ten times a second and you see flashing. Do it hundreds of times a second and your eyes blend the flashes into a steady glow. Spend more of each cycle switched on and the glow looks brighter.

    Motors behave similarly: they are too heavy to respond to each pulse, so they settle at a speed set by the average.

    Technically

    For a square wave switching between 0 V and Vhigh with duty cycle D (0 to 1), the average voltage is D × Vhigh. The period is T = 1 ÷ f, with the signal high for D × T and low for (1 − D) × T.

    The load still sees the full voltage during each pulse. An LED with a resistor gets its full current during the on-time, so PWM changes the average power rather than the peak current. On an Arduino Uno, analogWrite(pin, value) sets the duty cycle with values from 0 to 255.

    About this simulation

    The frequency is slowed right down so you can watch individual pulses. The “500 Hz” mode shows a short window of a real-speed signal. The right-hand lamp shows the average power as brightness, but human brightness perception is not linear, so 50% duty usually looks brighter than “half”.

    Quick check · 3 questions