Electronics

Analog vs. Digital Electronics

Every electronic system draws a line somewhere between analog (continuously variable) and digital (a small number of discrete states) — and almost every real device straddles that line, with components like comparators, ADCs and DACs doing the crossing at specific, deliberate points.

Quick reference
What it is
The two fundamental signal domains: analog (any value in a continuous range) and digital (usually just two states, HIGH and LOW).
Mental model
Analog is a dimmer switch — any position between off and full carries meaning. Digital is a light switch — only fully on or fully off counts, and anything else is treated as noise.
Key numbers
Digital logic levels have defined HIGH and LOW voltage bands with a noise margin between them; analog signals have no such safety margin at all.
Reach for it when
Deciding whether a signal or circuit block should be analog or digital, or understanding why a "digital" system still has real analog behavior (rise times, noise, power rails) underneath it.

Analog signals

An analog signal can sit at any value within a continuous range — a microphone's output voltage, a temperature sensor's voltage, the position of a volume knob. It carries information directly, with resolution limited only by real-world noise, not by any discrete step imposed on it. That same property is also its weakness: any noise picked up along the way — electrical interference, resistance drops, temperature drift — permanently blends into the signal, and there's no way to separate noise from signal after the fact.

Digital signals and logic levels

A digital signal only takes a small number of discrete states — almost always two: HIGH and LOW, conventionally 1 and 0. A receiver only has to decide "is this closer to HIGH or LOW," not reproduce an exact value — which is exactly why digital signals tolerate real-world noise so much better than analog ones.

An analog waveform varies smoothly and continuously; a digital waveform only ever sits at one of two discrete levels analog — any voltage carries meaning digital — only HIGH or LOW carries meaning HIGH LOW
The analog trace's exact height matters everywhere; the digital trace only ever needs to be read as one of two things, no matter how imperfect its edges look up close.

That tolerance is formalized as a noise margin: real logic families define an input HIGH threshold (VIH) and an input LOW threshold (VIL), with a gap between them that no valid signal should ever rest in:

A voltage axis divided into a valid HIGH band at the top, an undefined forbidden zone in the middle, and a valid LOW band at the bottom HIGH valid "1" undefined a signal should never rest here LOW valid "0" Vcc V_IH V_IL 0V
The gap between V_IL and V_IH is the noise margin — real noise can push a signal around within its own valid band without ever being misread as the other state.

Why digital wins for computation

Noise immunity, plus the ability to build arbitrarily complex logic out of simple, cheap, mass-producible transistor switches (see Semiconductors) stacked into gates, then flip-flops, then entire CPUs, is why nearly all computation happens digitally today — even though the transistors themselves are fundamentally analog devices, deliberately operated in a hard on/off (saturated) mode rather than their more delicate linear region.

Why analog still matters

The physical world — light, sound, temperature, pressure, radio waves — is inherently continuous, not discrete. Every sensor produces an analog signal at its output, every speaker or motor needs an analog drive signal to do anything useful, and every power supply rail is an analog quantity that has to stay within tolerance for the digital logic riding on top of it to work at all. A real embedded system is an analog system with a digital brain bolted on — never a purely digital system end to end.

The boundary: comparators

The simplest possible analog-to-digital device asks exactly one question: is this signal bigger than that reference? A comparator does nothing else — no resolution, no quantization levels, just a single-bit yes/no answer, output as a clean digital HIGH or LOW:

A comparator takes an analog signal and a reference voltage and outputs a digital high or low depending on which input is larger Signal Reference V_ref + − Digital out HIGH if signal > V_ref
No in-between: the output swings hard to one rail or the other the instant the signal crosses the reference, with no intermediate value ever produced.

A full ADC is, in a sense, many comparators working together to pin a signal down to one of many levels instead of just two — the comparator is the primitive building block, the ADC is the fully-resolved instrument built from it.

Logic families: why 3.3 V and 5 V don't just mix

Different logic families define different HIGH/LOW voltage thresholds — classic TTL, CMOS, and modern 3.3 V, 5 V, and 1.8 V logic all disagree on exactly where VIH and VIL sit. Connecting devices from different families directly, without a level shifter, is a genuinely common embedded mistake: a 3.3 V microcontroller's "HIGH" might not reliably register as HIGH to a 5 V-only input, and driving a 3.3 V-only input directly with true 5 V logic can exceed its absolute maximum rating and damage it outright.

Real-world applications

Gotchas

Field notes