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.
- 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.
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:
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 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
- Every microcontroller — a digital CPU core surrounded by analog realities: power supply ripple, a crystal oscillator's analog resonance, and the ADC/DAC boundary to the outside world.
- Audio playback — a DAC converts digital audio samples into the analog voltage that actually drives a speaker.
- Sensor front-ends — a sensor's raw analog output feeds an ADC before any digital processing can happen — see Sensors and Data Converters.
- Level-shifter ICs — dedicated chips exist specifically to solve the mixed-voltage-logic problem safely, rather than connecting incompatible logic families directly.
Gotchas
- A floating (unconnected) digital input sits in the undefined zone and can read as HIGH, LOW, or oscillate unpredictably — always terminate unused digital inputs with a pull-up or pull-down resistor.
- Driving a 3.3 V-only input directly with true 5 V logic can exceed its absolute maximum rating and permanently damage it — always check level compatibility rather than assuming it.
- Long analog signal wires pick up noise proportional to their length and environment — keep analog paths short, or convert to digital as early as possible if a long run is unavoidable.
- "Digital" doesn't mean "immune to physics" — at high enough clock speeds, a digital signal's edges start behaving like an analog/RF signal on the wire (ringing, reflections), a real concern in high-speed digital design.