ESP32 Web Oscilloscope

Oscilloscope fundamentals

The ideas behind every control of a digital oscilloscope: what it measures, how it turns a voltage into a picture, and where each of its limits comes from. Every idea is shown on this ESP32 Web Oscilloscope, most of them with real measurements from a test board. Version 1.11.2.

Who this page is for. Anyone who wants to understand what they see on a scope screen, including complete beginners. It assumes you know what a voltage is and roughly what a resistor and a capacitor do. Nothing else. Ideas come in order, and later chapters lean on earlier ones, so if you are new, read from the top. If you already know scopes, the contents on the left let you jump to any topic.

How this page fits with the others. This page explains why. The user guide says which button does what and how to wire things up. The technical reference has the exact formulas, algorithms, protocol and measured numbers. The verification guide is a set of experiments that check the scope on your own board. Each chapter here ends with links to the matching parts of those pages.

Following along

Every chapter can be tried on the scope. Two ways:

Figures whose caption begins Real data from the test board were measured for this page with this scope on one ESP32 (an ESP32-D0WD devkit, November 2026), using the wiring the caption gives; the others are calculated from the formulas they illustrate. Your board will give similar, not identical, numbers.

Boxes like this one suggest something to try:

Try it. Small experiments look like this. They take a minute or two.

and each chapter finishes with a short list of its key points, so you can check you have the important parts before moving on.

Units and prefixes used on this page

Scopes deal with tiny times and voltages, so you will see the metric prefixes everywhere. If they are new to you, this table is worth a minute: it is the same table you will use on every scope, meter and data sheet.

PrefixMeansTime exampleVoltage / frequency example
M (mega)× 1 000 0001 MHz = one million cycles per second
k (kilo)× 1 000250 kSa/s = 250 000 samples per second; 1 kΩ = 1 000 ohms
m (milli)÷ 1 0001 ms = a thousandth of a second500 mV = 0.5 V
µ (micro)÷ 1 000 0001 µs = a millionth of a second100 µA = 0.0001 A
n (nano)÷ 1 000 000 0001 ns = a billionth of a second (light travels 30 cm)100 nF = 0.1 µF
p (pico)÷ 1 000 000 000 00014 pF = 0.000 000 000 014 F

Two units appear constantly: Hz (hertz, "per second": how many times something happens each second) and Sa/s (samples per second: how many measurements the scope takes each second). A handy pair of facts: 1 kHz repeats every 1 ms, and 1 MHz repeats every 1 µs.

Part 1 · Signals and the screen

1. What an oscilloscope is for

Most people meet electronics measurement through a multimeter. Put its probes on a battery and it says "1.52 V". That single number is exactly what you want for a battery, because a battery's voltage does not change from one moment to the next.

Now put the same meter on a pin that is blinking an LED a thousand times per second. The LED is on half the time (3.3 V) and off the other half (0 V). The meter cannot follow that, so it shows something in between, perhaps "1.65 V", or a digit that keeps jumping. That number is not wrong, but it hides everything interesting: that the pin is switching at all, how often, how cleanly, whether it ever glitches. A voltage that changes over time is called a signal, and most of the voltages in a working circuit are signals, not steady levels.

An oscilloscope (scope for short) shows a signal as a graph of voltage against time. Time runs from left to right, voltage from bottom to top. The graph is drawn over and over, many times a second, so you see the signal "live", and it can freeze the picture so you can study it and measure it.

1.65 V multimeter one number, the average The same PWM pin… mean 1.65 V …on a scope: voltage against time 0 V and 3.3 V, switching 1 000 times per second time →
Figure 1. The same pin, switching between 0 and 3.3 V a thousand times per second. A multimeter averages it into one number; a scope shows what actually happens.

Three ways to think about what a scope does:

1.1 The questions a scope answers

Whatever the circuit, you usually come to a scope with one of a few questions:

The chapters of this page follow from these questions. Part 1 is about describing signals and reading the screen. Part 2 is about how a digital scope turns a voltage into numbers and what that costs. Part 3 is about the trigger, which makes a picture stand still. Part 4 is about how readings become a picture. Part 5 is about getting numbers out: measurements, cursors, maths and the frequency spectrum. Part 6 covers the signal sources and good habits.

1.2 This scope in one paragraph

The ESP32 Web Oscilloscope uses an ESP32 microcontroller as the measuring part and your web browser as the screen. The ESP32's built-in analogue-to-digital converter (ADC) measures up to four input pins, up to 250 000 times per second in total on the test board, with 12-bit resolution, over a range of about 0.14 to 3.15 V. The browser draws the picture and does everything a bench scope's screen and computer do: triggering details, measurements, statistics, maths channels, a spectrum display. It is slower and less accurate than a bench instrument, and it has no protection circuitry, but every idea in this page works on it exactly as on a bench scope, and its limits are a good way to learn why bench scopes are built the way they are.

Key points

  • A multimeter gives one number. A scope draws voltage against time.
  • Most voltages in a working circuit change with time: they are signals.
  • A scope answers "is it happening, what shape, how big, how fast, when, and what else".

Elsewhere: user guide, overview (what you need, the three ways to feed the scope) · reference, specifications.

2. Describing a signal

Before looking at how a scope works, it helps to have words for what it shows. Engineers describe signals with a small vocabulary that every scope, meter and data sheet uses. This chapter introduces it, slowly, with pictures. Every measurement the scope can make (chapter on measurements) is one of these words turned into a calculation.

2.1 Steady, changing, repeating

A voltage that does not change is called DC (direct current; the name comes from currents, but it is used for voltages too). A battery, the 3.3 V supply pin, the output of a voltage regulator: all DC, ideally. On a scope a DC voltage is a flat horizontal line.

A voltage that changes is called AC (alternating current) in the broad sense. Many signals are a mix: a DC level with something changing on top of it, like a 1.65 V bias with a small audio signal riding on it, or a 5 V supply with a little ripple. The DC part is often called the offset or DC level; the changing part is the AC part.

A signal that does the same thing over and over is periodic (or repetitive): a clock, a PWM output, the mains, a note held on a synthesiser. A signal that happens once is a single event (or transient): a button press, the power-up of a board, a spike when a motor starts. The difference matters a lot to a scope. A periodic signal can be measured again and again, and the scope can combine many measurements into one better picture (acquire modes, ETS). A single event must be caught the one time it happens (Single trigger mode).

2.2 Period and frequency

The period, written T, is the time one repetition takes: from a point on the wave to the same point one cycle later. The frequency, written f, is how many repetitions happen in one second. They are two ways of saying the same thing:

f = 1 / T T = 1 / f

Frequency is measured in hertz (Hz): 1 Hz is once per second. Some pairs worth remembering:

Period TFrequency fExample
1 s1 Hza slowly blinking LED
20 ms50 Hzmains electricity in India and Europe
1 ms1 kHza typical PWM or a test tone
50 µs20 kHzthe top of human hearing
1 µs1 MHzthe fastest square wave the generator makes
4 µs250 kHzthe time between two readings of this scope (its sample rate is 250 kSa/s)
Worked example

A square wave repeats every 2.5 ms. Its frequency is 1 ÷ 0.0025 s = 400 Hz. Going the other way, a 400 Hz signal has a period of 1 ÷ 400 = 0.0025 s = 2.5 ms. With prefixes the arithmetic gets easier: 1 ÷ 2.5 ms = 0.4 kHz = 400 Hz (dividing by milli gives kilo).

2.3 How big: peak, peak-to-peak, amplitude

Several numbers describe the size of a signal, and it is easy to mix them up. Figure figure 2 shows them on a sine wave sitting on a DC level:

mean (DC level) 1.62 V maximum 2.42 V minimum 0.82 V amplitude 0.8 V peak-to-peak 1.6 V one period T 0 V time →voltage
Figure 2. The size of a sine wave. The values are those of the ESP32 generator's sine at amplitude ±0.8 V.

The ESP32 sine from the generator is a good real example: it is centred near 1.62 V (mean), swings ±0.8 V (amplitude 0.8 V), so it goes from about 0.82 V (minimum) to about 2.42 V (maximum), and its peak-to-peak is 1.6 V. On the test board the scope read 1.593 V peak-to-peak.

2.4 RMS: the "heating" size

One more size measure needs a little more explanation because it is everywhere: RMS, root mean square. The question it answers is: what DC voltage would deliver the same power into a resistor? A heater, a lamp or a loudspeaker does not care about the shape of the voltage, only about how much energy it gets. Power in a resistor is V² ÷ R, so the "equivalent DC" voltage is found by averaging V² over time and taking the square root:

RMS = √( average of v² ) "square every value, average them, take the root"
A sine wave, amplitude 1 V… …squared: average 0.5, so RMS = √0.5 = 0.707 V average of v² = 0.5 RMS 0.707 V Square every value (negative halves become positive), average, take the square root. The result is the DC voltage that would heat a resistor just as much. For any sine: RMS = amplitude ÷ √2.
Figure 3. Where the RMS value comes from.

For a sine wave the result is the amplitude divided by √2 (about 0.707). That is why mains electricity is called "230 V": that is its RMS value; its peaks actually reach about ±325 V. For a square wave that switches between +A and −A, the RMS is simply A, because v² is A² all the time.

When a signal has a DC level, two RMS values are useful. The plain RMS includes the DC level. AC RMS first subtracts the mean, so it measures only the changing part: the ripple on a supply, the noise on a signal, or the size of an audio signal riding on a bias. The two are related by RMS² = mean² + (AC RMS)². For the ESP32 sine above: mean 1.62 V, AC RMS 0.8 ÷ √2 = 0.57 V, RMS √(1.62² + 0.57²) = 1.72 V.

2.5 Square waves, pulses and duty cycle

Digital circuits produce signals that jump between two levels: a square wave if it spends equal time at each, a pulse wave or PWM signal if not. Their vocabulary is shown in figure figure 4:

Top (high level) Base (low level) Max (overshoot) amplitude = Top − Base period T +width duty = +width ÷ T = 35 % 10 % 90 % ← rise time rising edge falling edge
Figure 4. The vocabulary of pulse and square waves. The rise time is measured from the 10 % to the 90 % line. The overshoot after each rising edge makes Max higher than Top.

Duty cycle and mean are linked in a way that is extremely useful in practice. A signal that is at Vhigh for a fraction d of the time and at 0 V otherwise has a mean of exactly d × Vhigh. That is how PWM dims an LED or controls a motor: the load responds to the average. On the test board, the generator at 25 %, 50 % and 75 % duty, smoothed by a resistor and capacitor, measured 0.822, 1.652 and 2.482 V, against 0.825, 1.650 and 2.475 V expected from d × 3.30 V.

2.6 A gallery of common shapes

A handful of shapes cover most of what you will see in hobby electronics. Learning to recognise them, and what usually causes each, is half of using a scope.

Square / PWM Sine Triangle Sawtooth RC curve Ripple on DC Noise Glitch
Figure 5. Common shapes. Each is explained in the table below.
ShapeWhere it comes fromWhat to look at
Square / PWMDigital outputs, clocks, the scope's generatorFrequency, duty, levels, edges, ringing
SineOscillators, mains, audio tones, the ESP32's DACFrequency, amplitude, distortion (flattened tops)
Triangle / sawtoothA capacitor charged by a constant current; integrators; 555 timer capacitor (roughly)Slopes (volts per second), peaks
RC curve ("shark fin")A capacitor charging through a resistor from a square waveThe time constant τ = R × C (section on RC)
RippleA power supply's output: DC with a small wave on topAC RMS or peak-to-peak of the ripple (use AC coupling)
NoiseEvery real measurement; switching circuits nearbyIts size (AC RMS), whether it is random or has a pattern
Glitch / spikeSwitching events, bad contacts, software bugsWhen it happens, how often (Peak detect, persistence, Single)

2.7 Noise

No real measurement is perfectly clean. Look closely at any flat line on any scope and it has a fine fuzz on it: noise. Some comes from the circuit you are measuring, some from the scope itself. On this scope the ADC's own noise is about 3 mV RMS: a perfectly steady 1.65 V reads as values scattered between about 1.64 and 1.66 V. Noise matters for three reasons:

  1. It sets the smallest detail you can see in a single reading.
  2. It makes single-sample measurements like maximum and minimum jump around (why Max jumps).
  3. Random noise can be reduced by averaging, which several of the scope's features do: Hi-Res, Average and the statistics.

Key points

  • f = 1 / T. 1 kHz ↔ 1 ms, 1 MHz ↔ 1 µs.
  • Peak-to-peak is the total height; amplitude is half of it for a sine, Top − Base for a square wave.
  • Mean is what a DC meter shows. RMS is the "same heating" DC value; for a sine it is amplitude ÷ √2. AC RMS ignores the DC level.
  • Rise time is measured from 10 % to 90 %. Duty cycle × high level = mean.
  • Periodic signals can be measured many times; single events must be caught once.

Elsewhere: exact definitions of every measurement in reference §4.

3. Reading the screen

A scope screen is a graph with a grid. Reading it well is a skill of its own, and the grid is the key: it is your ruler for both time and voltage.

3.1 The grid and its two scales

The screen is divided into 10 divisions across and 8 divisions up. Nearly every scope ever made uses this layout. Each division is one square of the grid. Two settings say what a square is worth:

1 division = time/div volts/div trigger level t = 0 (trigger point) ← the signal crosses the level going up here, every time time → (left: before the trigger, right: after it) voltage ↑
Figure 6. The screen is a graph of voltage (up) against time (across). Time/div and volts/div set the size of a grid square; the trigger fixes where t = 0 is.

A useful way to think of it: the signal exists independently of the screen, and the two scales are a window onto it. Changing time/div does not change the signal; it changes how much of it you see. A slower setting (more time per division) squeezes more periods in; a faster one stretches a single edge across the screen. Changing volts/div is like zooming a photo vertically.

3.2 The markers: where is 0 V, where is t = 0?

Two more things fix the window's position:

The trigger level marker at the right edge (◀T) shows the voltage the trigger is watching for. When the picture is triggered, the signal crosses that level exactly at t = 0.

3.3 Reading values off the grid

Everything you can measure with the automatic measurements, you can also read from the grid. It is worth practising, because it is how you check that an automatic number makes sense. The method is always the same: count divisions, multiply by the scale.

1 0 V 4 div = period 5 div = pk-pk 1 div H 200 µs/div CH1 500 mV/div Period: 4 div × 200 µs = 800 µs → frequency 1.25 kHz Pk-Pk: 5 div × 0.5 V = 2.5 V Base: 1 div above 0 V = 0.5 V Top: 6 div above 0 V = 3.0 V High for 1 of 4 div: duty 25 %
Figure 7. A worked example of reading the grid. The tag at the left (1) marks CH1's 0 V line.
Worked example: figure figure 7

Period. From one rising edge to the next is 4 divisions across. At 200 µs/div that is 4 × 200 µs = 800 µs, so the frequency is 1 ÷ 800 µs = 1.25 kHz.

Peak-to-peak. The wave spans 5 divisions up. At 500 mV/div that is 5 × 0.5 V = 2.5 V.

Levels. The bottom of the wave is 1 division above the channel's 0 V marker: 0.5 V. The top is 6 divisions above it: 3.0 V.

Duty cycle. The high part lasts 1 division of the 4-division period: 25 %.

The small minor tick marks on the centre lines divide each square into 5, so you can read to about a fifth of a division: here 40 µs and 100 mV.

3.4 Choosing good settings

Some habits that every experienced scope user has:

3.5 Zooming the screen does not add detail

One important difference between a digital scope and a photograph: the scope's settings decide what it measures, not just how it draws. When you change time/div, this scope changes its sample rate and the number of readings it takes (explained in chapter 9). So a faster time/div really does measure more finely in time, up to the ADC's limit of one reading every 4 µs.

Volts/div is different. The ADC always measures the full 0–3.3 V range with the same 4096 steps of about 0.8 mV (chapter on the ADC). Choosing 10 mV/div makes the trace taller on the screen, but it does not make each reading any more precise: at 10 mV/div you will simply see each 0.8 mV step and the noise much larger. Bench scopes have an amplifier in front of the ADC that really does increase the sensitivity at small volts/div settings; this scope does not. This is the reason for the advice in the user guide to keep small signals as large as possible at the pin.

3.6 DC and AC coupling

Each channel has a coupling setting. DC coupling shows the real voltage, DC level and all. AC coupling shows only the changing part: it removes the signal's average. On a bench scope this is done by a capacitor in series with the input; on this scope the browser subtracts the mean of the samples on screen, so the pin still sees, and the ADC still has to fit, the full voltage. Use AC coupling to look at a small ripple on a big DC level, or at an audio signal riding on a bias. The ripple can then be magnified with a small volts/div without the DC level pushing it off the screen.

Try it (Demo). Turn time/div with the mouse wheel over the screen and watch how many periods fit; the signal itself does not change. Count the divisions between two rising edges of CH2 and multiply by the time/div: you get the period. Compare with the automatic Frequency measurement under the screen. Then drag CH1's coloured 0 V tag up and down.

Key points

  • 10 divisions across, 8 up. Time/div and volts/div say what one square is worth.
  • Read voltages from the channel's own 0 V marker. t = 0 is the trigger point.
  • Count divisions × scale = value. Aim for 2–5 periods across and 4–6 divisions tall.
  • A smaller volts/div magnifies the picture but not the ADC's precision.

Elsewhere: every control on the screen, and the status bar, in the user guide §6; the order in which probe factor, coupling and other settings are applied in reference §2.

4. Inside a digital oscilloscope

To understand why a scope behaves the way it does, it helps to know its parts. They are the same in a 10 000-euro bench instrument and in this one; only their speed and quality differ.

4.1 Where the names come from

The first oscilloscopes were analogue. A beam of electrons in a glass tube (a cathode-ray tube, CRT) drew a glowing spot on a phosphor screen. A circuit swept the spot steadily from left to right, then snapped it back: the time base or sweep. The input voltage, amplified, pushed the spot up and down. So the spot drew voltage against time, live. To make a repeating signal stand still, each sweep had to start at the same point of the wave, so a circuit watched the signal and started the sweep when it crossed a chosen level: the trigger.

Modern scopes are digital (DSO, digital storage oscilloscope). Nothing sweeps any more, but the names stayed: time base, trigger, sweep, even the green colour of some screen themes. The big change is that a digital scope measures and stores the signal as numbers before drawing it. That brings huge advantages (freezing a picture, seeing what happened before the trigger, automatic measurements, maths) and some new pitfalls (sampling and aliasing, Part 2) that analogue scopes never had.

4.2 The parts of a digital scope

Input probe, protection attenuator / amp ADC voltage → number at the sample clock Memory stores samples (record length) Trigger chooses which moment is t = 0 Processing modes, volts, maths measurements Display draws the picture Every digital oscilloscope here: a pin + your resistor here: the ESP32 firmware here: your browser
Figure 8. The parts of every digital oscilloscope, and where each one lives in this scope.
  1. Input and front end. The connection to your circuit. In a bench scope this is a probe and a carefully designed circuit: protection, an attenuator and amplifier that set the volts/div range, coupling, and a filter. This scope has almost none of that: the input is an ESP32 pin with a resistor you add yourself (chapter 7).
  2. ADC (analogue-to-digital converter). Measures the voltage and turns it into a number, again and again at a steady rate set by the sample clock (chapter 5 and chapter 6).
  3. Acquisition memory. Stores the readings. Its size, the record length, decides how long a stretch of signal can be kept at a given sample rate (chapter 9).
  4. Trigger. Watches the readings and decides which moment becomes t = 0 (chapter 10).
  5. Processing. Turns readings into what you see: averaging or peak detection (chapter 12), scaling to volts, maths, measurements.
  6. Display. Draws it (chapter 14).

4.3 How this scope splits the work

In this scope the parts are spread over two devices, joined by the USB cable:

On the ESP32 (firmware) Your circuit 0 … 3.3 V only shared ground Pin + S/H sample & hold ≈ 14 pF to ground (GPIO34) ADC 12 bits 0 … 4095 4 µs per reading DMA memory up to 24 000 readings no CPU needed Trigger finds the first reading past the level USB cable: one capture = one frame (CRC-checked) In your browser (scope.html) Decode frame → codes Calibrate code → volts (board table + your 2 points) Align t = 0 exact crossing between two readings Process probe ×, invert math channels (ETS: fold here) Screen trace, cursors measurements statistics The browser also sends the settings back (CFG command: pins, sample rate, points, trigger) whenever you change a control.
Figure 9. The signal path of this scope. The ESP32 measures and triggers; the browser converts, aligns, computes and draws.

A bench scope does the same steps inside one box with faster chips. Thinking of it in these steps helps whenever something looks odd: is it the signal, the input, the sampling, the trigger, the processing, or the drawing?

4.4 What a bench scope has that this one lacks

Honesty about the limits is part of learning. Compared with an entry-level bench scope, this one has:

None of that changes the ideas. Everything on this page applies to every digital scope; the numbers just get bigger.

Key points

  • Input → ADC → memory → trigger → processing → display: the same chain in every digital scope.
  • Here the ESP32 measures, stores and triggers; the browser converts, computes and draws.
  • "Time base" and "trigger" are names from analogue scopes that drew with an electron beam.

Elsewhere: the processing steps in exact order in reference §2; the firmware in reference §7; the data format on the USB cable in reference §10.

Part 2 · From a voltage to numbers

5. Sampling: a scope takes snapshots

A real voltage changes smoothly and continuously. A digital scope cannot watch it continuously. Instead it measures it at regular instants, stores each measurement as a number, and draws the numbers. Each measurement is called a sample (this page also says reading; it means the same). Taking samples is called sampling.

5.1 Like the frames of a film

A film camera does exactly the same thing with pictures. It does not record motion; it records still frames, 24 per second, and your brain fills in the motion between them. That works well as long as nothing important happens between two frames. A hummingbird's wings, which beat 50 times per second, come out as a blur or, worse, seem to hover still. A scope has the same weakness, and most of Part 2 is about it.

The real voltage (smooth) and the readings What the scope knows and draws Δt = 1 / sample rate (250 kSa/s → 4 µs) Dots joined by straight lines. In between, it knows nothing.
Figure 10. Sampling: the scope measures at regular instants (dots) and joins them with straight lines.

Two numbers describe sampling:

The scope shows the current sample rate in the status bar above the screen (Sa), next to the number of points on the screen (Pts).

5.2 What the scope knows, and what it draws

Everything the scope knows about the signal is the list of samples: a value at each instant, and nothing in between. To make a readable picture, it normally joins neighbouring samples with straight lines. Those lines are a guess. They are a good guess when the samples are close together compared with how fast the signal changes, and a bad one otherwise.

The Display tab has a setting, Draw: Lines / Dots, that lets you see this directly. With Dots, only the real samples are drawn. Figure figure 11 shows the same real signal, a sine of about 2 kHz from the ESP32's generator, measured at three different sample rates and drawn both ways.

250 kSa/s 127.6 samples per period Draw: Lines Draw: Dots 25 kSa/s 12.8 samples per period Draw: Lines Draw: Dots 5 kSa/s 2.6 samples per period Draw: Lines Draw: Dots Generator: Sine, 2 000 Hz requested (1 959 Hz real), ±0.8 V. Normal mode; the three sample rates came from Memory 500 at 2 ms/div and 10 ms/div. 2 msof each capture shown.
Figure 11. Real data from the test board: the same sine (about 2 kHz) at three sample rates, each drawn with lines (top) and with dots (bottom). Only the sample rate changed.

Look at how the picture changes. At 250 kSa/s there are about 128 samples per period, the dots almost touch, and lines and dots look the same. At 25 kSa/s there are about 13 samples per period: the dots are clearly separate but the joined-up picture is still a convincing sine. At 5 kSa/s there are only 2.6 samples per period: the lines draw a jagged zigzag that looks nothing like a sine, even though every dot is a correct measurement. The signal was the same every time; only the sampling changed.

5.3 How many samples are enough?

That depends on what you want to know.

Translated to this scope at its full 250 kSa/s with one channel: shapes are trustworthy up to about 25 kHz, frequencies can be measured up to just below 125 kHz, and events shorter than 4 µs can fall between two samples. Repeating signals can be shown in much finer detail with equivalent-time sampling (chapter 13).

5.4 More channels share the converter

The ESP32 has one ADC, which can measure only one pin at a time. With two channels switched on, it measures CH1, then CH2, then CH1 again, and so on. So the total rate is shared: 250 kSa/s for one channel, 125 kSa/s each for two, 62.5 kSa/s each for four. Bench scopes usually have one converter per channel; on this scope, switch off channels you do not need when you want the highest rate.

Sharing has a second consequence: the channels are not measured at exactly the same instant. CH2's sample is taken one ADC interval (4 µs at full speed) after CH1's. The scope knows this and draws each channel shifted by the right amount, so timing between channels on the screen is correct. Maths channels, however, combine sample number n of each channel, which were taken a few microseconds apart. For slow signals this does not matter; for fast ones keep it in mind (reference §3.3, channel skew).

Try it. Generator: Sine, 2 000 Hz. Display tab → Draw: Dots. Acquire: Normal, Time/div 200 µs (Memory auto). Watch Sa in the status bar and how far apart the dots are. (Memory only offers 500 and up; to get the low rates of figure figure 11, choose Memory 500 and slow the time base to 2 ms/div and 10 ms/div.) Switch Draw back to Lines and see which pictures you would have believed.

Key points

  • A digital scope only knows its samples. The lines between them are a guess.
  • Sample interval = 1 ÷ sample rate: 250 kSa/s ↔ 4 µs.
  • About 10 samples per period to see a shape; more than 2 to measure a frequency.
  • Channels share the ADC: 250 / 125 / 62.5 kSa/s each for 1 / 2 / 4 channels.
  • Draw: Dots shows the real samples.

Elsewhere: how the sample rate is chosen for each time/div in reference §3.1; the DMA engine that makes 250 kSa/s possible in reference §3.6; Draw and Memory controls in the user guide.

6. The ADC: turning a voltage into a number

Each sample is made by the ADC, the analogue-to-digital converter. It looks at the voltage on a pin at one instant and answers with a whole number, called a code. Everything the scope shows comes from these codes, so the ADC's properties (its range, its step size, its accuracy and its noise) set the limits of every voltage reading.

6.1 Codes, bits and steps

The ESP32's ADC is a 12-bit converter: its answer is a number from 0 to 4095. (12 bits can count 212 = 4096 different values.) The lowest code means "the bottom of the range", the highest "the top", and every code in between stands for a small band of voltages. One step of the code is the resolution:

resolution ≈ range ÷ number of codes ≈ 3.3 V ÷ 4096 ≈ 0.8 mV per step

So the ADC works like a ruler with marks every 0.8 mV. A voltage between two marks is rounded to one of them. This rounding is called quantisation, and the small error it leaves (up to half a step) is the quantisation error. Plotting the code against a slowly rising input voltage gives a staircase instead of a smooth line:

What the ADC can read (test board) 0 V floor ≈ 0.14 V: below this everything reads 0.14 V 3.3 V clips at ≈ 3.155 V → CLIP useful range: 4096 codes Zoomed in: the reading moves in steps input voltage → One step ≈ 0.8 mV (3.3 V ÷ 4096, a little more on this board). Noise on the ESP32 ADC is a few mV, so the last 2–3 bits jitter: about 9–10 useful bits. Averaging (Hi-Res, Average, Statistics) brings back detail below one step. The firmware sends the board's own code → millivolt table at connect; your two-point calibration (Data tab) corrects what is left.
Figure 12. The ADC's range on the test board, and its steps of about 0.8 mV.

How the ESP32 finds the code is worth a sentence, because it explains why the ADC needs a moment for each reading. It is a SAR (successive-approximation) converter. It first asks "is the voltage above half the range?", then, depending on the answer, "above three quarters?" or "above a quarter?", and so on, halving the remaining range each time. Twelve yes/no questions give twelve bits, exactly like guessing a number between 0 and 4095 by asking "higher or lower?". Before asking, it takes a snapshot of the voltage on a tiny internal capacitor, so that the voltage does not change during the questions. That snapshot is the sample-and-hold, and it is the reason the pin behaves like a small capacitor (chapter 7).

BitsCodesStep over 3.3 VWhere you meet it
825612.9 mVMost bench scopes (their amplifier makes the range small, so the step is small in volts too); the ESP32's DAC
101 0243.2 mVArduino Uno's ADC
124 0960.81 mVThe ESP32's ADC, this scope
1665 5360.05 mVPrecision ADC chips

6.2 The range, and what happens outside it

The ESP32's ADC, set up as this scope uses it, measures from about 0.14 V to about 3.15 V (test board: 142 mV and 3.155 V). Outside that window it cannot tell voltages apart:

Neither problem is visible in the reading itself: a clipped value looks just like any other number. That is why the scope warns you, and the labels stay lit for a second after the last out-of-range sample so that a brief excursion is not missed. In practice: keep signals between about 0.15 and 3.0 V for trustworthy readings, and be careful with anything measured near 0 V (an RC curve that starts at 0 V seems to start at 0.14 V; several of the measurements in the verification guide had to allow for this).

The range of the measurement is not the same as the range of what is safe. The pin itself must never see less than 0 V (minus 0.3 V absolute) or more than 3.3 V (3.6 V absolute). Outside that the ESP32 can be damaged. For larger signals, use a resistor divider (user guide §5.3); for signals that swing below 0 V, a bias circuit (§5.4).

6.3 Accuracy and calibration

Resolution (how finely the ADC divides its range) is not the same as accuracy (how close the reading is to the truth). A ruler with millimetre marks that has been printed 2 % too long has good resolution and poor accuracy. ADCs are like that. Every ESP32 chip's ADC is slightly different: its reference voltage, its gain (the slope of the staircase) and its offset (where the staircase starts) vary from chip to chip. Uncorrected, readings can be off by tens of millivolts or more.

The scope corrects this in two stages:

  1. Factory calibration. Espressif measures each chip at the factory and burns correction values into it (in "eFuses"). At connection, the firmware turns these into a table that converts every code to millivolts and sends it to the browser. On the test board, readings after this step were 17 to 39 mV high across the range.
  2. Your two-point calibration. With a multimeter you measure two voltages, one low and one high, and type in what the scope read and what the meter read (Data tab → ADC calibration). The browser fits a straight line through the two points and corrects every reading with it: a gain correction (slope) and an offset correction (shift). On the test board this brought the error down to a few millivolts, and a later check at 1.652 V agreed with the meter within 0.4 mV.
low point high point ideal: reading = true voltage uncorrected ADC true voltage (multimeter) → scope reading → Two points measured with a meter fix a straight line: its slope is the gain error, its height at 0 V the offset error. The test board (errors drawn 4× larger): low scope 399 mV, meter 384 mV high scope 2403 mV, meter 2363 mV → gain 1.0126 (1.26 % high), offset +10 mV The browser then corrects every reading: v = (reading − offset) ÷ gain.
Figure 13. How a two-point calibration works. The two measured points fix the straight line that relates the scope's readings to the truth.

The ESP32's ADC is also slightly non-linear: its staircase bends above about 2.5 V, where each code is worth more millivolts than below. The factory table already includes that bend. It is one reason why the most accurate range is roughly 0.15 to 2.45 V.

6.4 Noise, effective bits and averaging

Measure a perfectly steady voltage many times and the codes are not all the same: they scatter around the true value by a few steps. That scatter is the ADC's noise (plus some from the board's supply). On the test board it is about 3–4 mV RMS, roughly 4–6 codes: figure figure 14 shows a steady 1.652 V read 1 382 times. Two consequences:

A steady 1.652 V, 1382 readings (Normal) -5.0 ms 5.0 ms +24 mV −24 mV mean How often each value occurs (0.8 mV bins) σ (AC RMS) = 4.4 mV ≈ 6 ADC steps Normal, 1 ms/div, 139 kSa/s. Same voltage at 10 ms/div: Normal 2.7 mV, Hi-Res (25 readings per point) 0.6 mV.
Figure 14. Real data from the test board: a steady 1.652 V (the generator's 50 kHz PWM smoothed by 10 kΩ and 10 µF; a multimeter read 1.652 V) read 1 382 times. Most readings fall within a few millivolts of the true value, a few stray 10–20 mV away, and some codes turn up far more often than their neighbours (the ADC's uneven steps, DNL).

The figure shows two more things worth knowing. A few readings stray 10–20 mV from the rest: the ESP32's ADC produces such occasional outliers, which is one reason single-point measurements like Max jump around (section 15.5). And the histogram is spiky rather than smooth: some codes come up far more often than their neighbours, the uneven step widths described at the end of this section.

Random noise has a useful property: it averages out. If you average N readings of a steady voltage, the noise of the average is smaller by a factor of √N:

noise of an average of N readings = noise of one reading ÷ √N 4 readings → noise ÷ 2 16 → ÷ 4 100 → ÷ 10

Averaging even brings back detail finer than one step, because the noise makes the readings fall on neighbouring codes in proportions that depend on where between the steps the true voltage lies. The scope uses averaging in three places: Hi-Res averages the readings inside each point (section 12.3), Average averages whole captures (section 12.4), and Statistics average a measurement over many captures (section 15.5). On the same steady voltage as figure figure 14, Hi-Res with 25 readings per point brought the scatter from 2.7 mV down to 0.6 mV (√25 = 5 would predict 0.5 mV), and with Statistics the test board measured a steady 1.65 V with a spread of only 0.1–0.5 mV, less than one code.

One more imperfection shows up when you average: some codes are a little wider than others (differential non-linearity, DNL), so they turn up more often. It is visible in histograms of a noisy signal and as small steps in derivatives. It is normal for this kind of ADC.

Key points

  • 12 bits = 4096 codes ≈ 0.8 mV per step over 3.3 V. Resolution is not accuracy.
  • Readable range ≈ 0.14–3.15 V. floor and CLIP labels mean "this reading is not the real voltage".
  • Factory table plus your two-point calibration take accuracy from tens of mV to a few mV.
  • Noise ≈ 3 mV RMS: about 9–10 useful bits per reading. Averaging N readings divides random noise by √N.

Elsewhere: calibration controls in the user guide §6.11; how codes become volts in reference §2; the ADC's measured limits in reference §11; checking your own board: verification tests C1–C5.

7. The input: what your circuit sees

It would be lovely if a scope could measure a circuit without touching it. It cannot. Connecting any measuring instrument changes the circuit a little, and understanding how much is one of the most practical things you can learn about scopes. This chapter explains what the ESP32's input pin looks like to your circuit, and what that does to fast signals.

7.1 The pin is a small capacitor

Remember the sample-and-hold from chapter 6: to take a reading, the ADC connects a tiny internal capacitor to the pin and lets it charge to the pin's voltage. Add the capacitance of the pin itself, the chip's internal wiring and your jumper wires, and the input behaves, as far as your circuit is concerned, like a small capacitor from the pin to ground. On the test board we measured it: about 14 pF (14 trillionths of a farad).

That is tiny, but it matters, because your signal has to charge it through some resistance: the series resistor you should always put in front of the pin (1 kΩ is the standard here), plus whatever resistance the source itself has (the source impedance, or output resistance, of whatever drives the signal). A resistor feeding a capacitor is the most basic filter in electronics, the RC low-pass filter.

What the signal "sees" at the pin ~ your signal R series resistor + source resistance pin C ≈ 14 pF (pin, wiring and the ADC's sample-and-hold, measured) ADC A sharp step at the source arrives rounded τ = R·C (63 %) rise 10–90 % = 2.2 · R · C time → Measured on the test board. R = 1 kΩ: flat to at least 200 kHz; 10–90 % rise 27–32 ns (expected 2.2 × 1 kΩ × 14 pF = 31 ns; seen with ETS). R = 100 kΩ: loses 3 dB at ≈ 116 kHz, which is f = 1 / (2π · R · C), and −5.9 dB at 200 kHz.
Figure 15. Your source resistance and the pin's capacitance form an RC low-pass filter that rounds fast edges.

7.2 RC in the time domain: rounded edges

Imagine the source jumps instantly from 0 to 1 V. The capacitor cannot follow instantly: current flows through R to charge it, quickly at first and more slowly as the voltage across it approaches 1 V. The voltage at the pin follows a curve called an exponential:

v(t) = V · (1 − e−t/τ) with the time constant τ = R · C

The time constant τ ("tau") sets the speed. After one τ the capacitor has reached 63 % of the step, after 2τ 86 %, after 3τ 95 %, after 5τ more than 99 %. The rise time from 10 % to 90 % (the definition in section 2.5) works out at 2.2 τ:

rise time (10–90 %) = 2.2 · R · C

For the scope's input with 1 kΩ: τ = 1 000 Ω × 14 pF = 14 ns, rise time = 31 ns. A step at the source arrives at the ADC rounded over about 30 nanoseconds. Since the ADC takes a reading only every 4 µs, more than a hundred times slower, a 1 kΩ source is effectively perfect. We could actually see this 31 ns rounding on the test board with equivalent-time sampling (chapter 13): the edge measured 27–32 ns.

With 100 kΩ the time constant is 100 times longer, 1.4 µs, and the rise time 3 µs. That is comparable to the sample interval, and it rounds real signals noticeably.

Figure figure 16 shows this on the test board: the same fast edge from the generator, fed to the pin through 1 kΩ, 10 kΩ and 100 kΩ, and drawn with equivalent-time sampling so that nanoseconds are visible. The rise time is 26 ns, 236 ns and 2.55 µs: ten times the resistance, ten times the rise time, exactly as τ = R · C says.

Source 1 kΩ 1 µs/div · ETS 119 MSa/s ETS rise 26 ns = 2.2 × R × 11.7 pF Source 10 kΩ 1 µs/div · ETS 94.9 MSa/s ETS rise 236 ns = 2.2 × R × 10.7 pF Source 100 kΩ 1 µs/div · ETS 94.9 MSa/s ETS rise 2.55 µs = 2.2 × R × 11.6 pF
Figure 16. Real data from the test board: the generator's edge (30.9 kHz square) arriving at GPIO34 through three different resistors, drawn with ETS at the same 1 µs/div. Dashed lines: the 10 % and 90 % points. The rise time grows in proportion to R.

Look at the number each panel gives for C: about 11–12 pF, a little less than the 14 pF that the frequency measurement in the next section gives. Both are honest measurements of the same pin; they differ because the input is not a perfect capacitor. Part of it is the sample-and-hold capacitor, which is connected only while a sample is being taken, and the pin's capacitance changes a little with voltage. For working out what your circuit will see, "about 11–14 pF" is the right answer, and the rule below does not change.

7.3 RC in the frequency domain: bandwidth

The same filter can be described by what it does to sine waves of different frequencies, and this is how scope specifications describe it. A slow sine passes through unchanged. A fast sine does not have time to charge the capacitor fully on each swing, so it arrives smaller. The frequency at which its amplitude has dropped to 71 % (−3 dB) is the bandwidth or cut-off frequency:

fc = 1 / (2π · R · C)

These are two views of one thing: a filter that rounds edges in time is the same filter that attenuates high frequencies. A handy link between them: rise time ≈ 0.35 ÷ bandwidth. A scope's quoted bandwidth (say "100 MHz") tells you the fastest edge it can show (3.5 ns).

We measured this on the test board by feeding the ESP32's own sine generator into the input through two different resistors and measuring the amplitude at 24 frequencies up to 200 kHz:

0 25 50 75 100 125 150 175 200 50 % 60 % 70 % 80 % 90 % 100 % 71 % (−3 dB) 1 kΩ source 100 kΩ source frequency (kHz) amplitude, relative to 1 kHz Measured on the test board: the ESP32's sine generator → R → GPIO34, 24 frequencies. Dashed: an RC filter of 100 kΩ and 14 pF, f = 1 / (2π · R · C) = 114 kHz. With 1 kΩ the cut-off is ≈ 11 MHz: the curve stays flat (the dip at 200 kHz is the generator's own 8-bit staircase).
Figure 17. The input's frequency response, measured on the test board with two different source resistances.

With 1 kΩ the amplitude stays flat within 0.25 dB (3 %) all the way to 200 kHz: the cut-off, 1 ÷ (2π × 1 kΩ × 14 pF) ≈ 11 MHz, is far beyond anything the ADC can sample. With 100 kΩ the amplitude falls exactly like an RC filter: down to 71 % (−3 dB) near 116–120 kHz and to 51 % at 200 kHz. Fitting the curve gives C ≈ 14 pF, which is where that number comes from.

7.4 The practical rule

7.5 Loading: the scope changes the circuit

The 14 pF also acts on the circuit you are measuring, not just on the reading. If the point you probe is a high-resistance node, adding 14 pF (plus the series resistor) slows down the circuit itself while you watch. This effect is called loading, and every instrument has it. A good habit: if connecting the scope seems to change how the circuit behaves, suspect loading, and measure at a lower-impedance point or through a buffer.

7.6 Why bench scopes have ×10 probes

Bench scopes face the same problem, with a twist: their probe cable adds about 100 pF. A plain "×1" probe would load the circuit badly. So most measurements use a ×10 probe: it contains a 9 MΩ resistor that, together with the scope's 1 MΩ input, divides the signal by 10, and a small adjustable capacitor across that resistor. Adjusted correctly (that is what the little screw and the square-wave "probe comp" terminal on a bench scope are for), the divider works equally at all frequencies, and the circuit sees about 10 MΩ in parallel with roughly 10 pF instead of 1 MΩ and 100 pF. You trade a factor of 10 in signal size for a circuit that hardly notices the scope.

This scope has no probe and no cable worth mentioning; it relies on you keeping the source resistance low. A resistor divider made from two resistors (user guide §5.3) is this scope's version of an attenuating probe; set the channel's Probe factor so that the scope multiplies the readings back. Keep the divider's resistors moderate (10–100 kΩ): its output resistance feeds the 14 pF too.

7.7 Ground: the other half of every connection

A voltage is always between two points. The scope measures each input pin against the ESP32's ground (GND). So your circuit's ground must be connected to the ESP32's GND, or the readings are meaningless. And because the ESP32's GND is connected through the USB cable to your computer, which is often connected to mains earth, the scope's ground is not "floating": never connect it to a point in a circuit that is not at ground potential (for example the middle of a mains-powered circuit, or the negative side of something powered from a different supply that is not connected to the same ground). That would short that point to your computer's ground through the cable. Bench scopes have exactly the same rule, and it is the most common way people damage scopes and circuits.

Key points

  • The input behaves like about 14 pF to ground. With the source resistance R it forms an RC low-pass filter.
  • τ = R·C, rise time = 2.2·R·C, bandwidth = 1 / (2π·R·C). Rise time × bandwidth ≈ 0.35.
  • 1 kΩ: 31 ns rise, flat to well beyond 200 kHz (measured). 100 kΩ: −3 dB at ≈ 116 kHz (measured).
  • Keep the source resistance below ≈ 10 kΩ, or buffer it. A probe or divider is part of the circuit.
  • The scope's ground is the ESP32's ground, which is your computer's ground.

Elsewhere: wiring inputs, dividers, biased AC inputs and current shunts in the user guide §5; the bandwidth measurement in reference §11; check it yourself: verification test D6.

8. Too fast to sample: aliasing

chapter 5 ended with a warning: with fewer than two samples per period, a scope does not just show a rough picture, it shows a wrong one. This is called aliasing. It is the most important pitfall of digital scopes, because the wrong picture looks perfectly believable. This chapter explains it from several sides, with real measurements.

8.1 The wagon wheel

You have probably seen it in films: a car speeds up, and its wheels seem to slow down, stop, and turn backwards. The camera takes 24 frames per second. If a wheel's spokes move almost exactly one spoke spacing between frames, each frame shows the spokes almost where the previous frame had them, slightly behind, and your brain sees a wheel turning slowly backwards. Nothing about the individual frames is wrong; it is the interpretation of the frames that goes wrong, because many different motions produce the same frames.

A scope is in the same position. It sees a list of samples and joins them up in the simplest way. If the real signal changed a lot between samples, a slower wave can pass through exactly the same samples, and the scope draws that slower wave.

8.2 Watching it happen

Figure figure 18 samples a sine wave at a fixed rate while its frequency goes up. The grey curve is the real signal; the dots are the samples; the coloured line is what joining the dots draws.

10 samples per period good shape 4 samples per period rough shape, frequency right 2.2 samples per period odd shape, frequency right on average 2 samples per period can even look flat 1.25 samples per period false slow wave (alias) 1.1 samples per period false slow wave (alias)
Figure 18. The same sampling rate, faster and faster signals. Green: the frequency is still right. Pink: the samples draw something that is not there.

8.3 The rule: half the sample rate

The boundary is exactly two samples per period. Put the other way round: a sample rate fs can only represent frequencies below fs ÷ 2. This frequency is called the Nyquist frequency, after Harry Nyquist, who worked out the theory in the 1920s.

Nyquist frequency = fs / 2 (250 kSa/s → 125 kHz)

A signal above the Nyquist frequency appears at a false frequency. The false frequency is the distance from the real frequency to the nearest whole multiple of the sample rate:

apparent frequency = | f − k · fs | (k = the whole number that makes it smallest)

At 250 kSa/s, a 130 kHz signal appears at 250 − 130 = 120 kHz; a 200 kHz signal at 50 kHz; a 245 kHz signal at 5 kHz; and a 250 kHz signal at 0 Hz, a flat line, because every sample catches it at the same point of its cycle. The frequencies "fold" back and forth between 0 and fs/2 like a strip of paper folded into a zigzag. The bandwidth measurement of section 7.3 recorded exactly this: it fed the ESP32's sine at frequencies up to 200 kHz into the scope at 250 kSa/s, and above 125 kHz the scope measured the folded frequencies.

0 50 100 150 200 250 0 25 50 75 100 125 Nyquist: 125 kHz f = 250 kHz real frequency of the signal (kHz) frequency the scope sees (kHz) Dots: measured on the test board at 250 kSa/s (the ESP32 sine at 24 frequencies). Line: the theory, |f − k · 250 kHz|. Up to 125 kHz the scope sees the real frequency. Above it, the frequency folds back down: 130 kHz is seen as 120 kHz, 200 kHz as 50 kHz, 250 kHz as 0 (flat).
Figure 19. Frequency folding, measured. Every signal above 125 kHz showed up at a lower, false frequency.

8.4 The scope cannot tell

The uncomfortable truth: from the samples alone, there is no way to know whether a wave is real or an alias. In figure figure 18, the 1.25-samples-per-period samples are exactly the samples of the slow wave. A scope never complains. You have to protect yourself, and there are good habits for it:

  1. Know what to expect. If a circuit that should run at 100 kHz shows 3 kHz, be suspicious.
  2. Change the time base. A real signal keeps its frequency when you change time/div. An alias changes, because changing time/div changes the sample rate (when the scope is not already at its maximum, chapter 9). This is the single best test.
  3. Look at the sample rate. The status bar shows Sa. If half of it is not comfortably above the frequencies in your circuit, aliasing is possible.
  4. Use Hi-Res for slow time bases. Hi-Res averages all the readings inside each point, which removes fast signals instead of folding them (section 12.3).
Normal, 1 ms/div 100 kSa/s: 51 samples per period reads 1958 Hz Normal, 20 ms/div 2.5 kSa/s: 1.28 samples per period reads 542 Hz (real: 1 959 Hz) Normal, 50 ms/div 2 kSa/s: 1.02 samples per period reads 42 Hz (real: 1 959 Hz) Hi-Res, 50 ms/div 2 kSa/s, each point = 125 readings flat line at 1.63 V: the sine's average The same 1 959 Hz sine in every panel; about ten periods of what each capture shows are drawn (5, 20, 250 and 250 ms). Expected aliases: 2 500 − 1 959= 541 Hz and 2 000 − 1 959 = 41 Hz.
Figure 20. Real aliasing on the test board. The signal was the same in every panel; only the sample rate or the acquire mode changed.

8.5 How bench scopes defend themselves

The proper cure for aliasing is to remove frequencies above fs/2 before sampling, with an analogue low-pass filter, the anti-alias filter. Audio converters always have one. Bench scopes rely mostly on two other things: their front end's bandwidth is set well below half their maximum sample rate (a 100 MHz scope typically samples at 1 GSa/s), and their deep memory lets them keep a high sample rate even at slow time bases.

The ESP32 has no anti-alias filter, and its input passes frequencies far above 125 kHz (we measured it flat to 200 kHz, section 7.3). So this scope uses the other two defences: Normal mode keeps the sample rate as high as memory allows at every time base (deep memory, chapter 9), and Hi-Res averages away fast content at slow time bases. If you know your signal contains fast components you do not care about, a resistor and capacitor in front of the pin make a simple anti-alias filter of your own (user guide §5.4 shows one for audio).

8.6 Square waves alias too, in parts

A square wave contains much more than its basic frequency: its sharp edges are made of a series of higher frequencies called harmonics (at 3, 5, 7 … times the basic frequency; see chapter 18). Even when the basic frequency is well below the Nyquist frequency, those harmonics may be above it, and they alias. The visible effect is that the edges of a fast square wave wander or look uneven from capture to capture. It is one reason a square wave needs many more samples per period than a sine to look right.

8.7 Sample rate, bandwidth and seeing the shape: three different limits

People often confuse these, so here they are side by side for this scope (one channel, 250 kSa/s, 1 kΩ source):

LimitSet byValue hereWhat happens beyond it
Input bandwidthSource resistance × 14 pF (chapter 7)≈ 11 MHz with 1 kΩSignals get smaller and edges rounder
Nyquist frequencyHalf the sample rate125 kHzSignals appear at false frequencies (aliasing)
ShapeAbout 10 samples per period≈ 25 kHzThe shape is distorted (frequency still right)

On a bench scope the input bandwidth is the lowest of the three, by design. On this scope it is the highest, which is why aliasing deserves so much attention here. Equivalent-time sampling (chapter 13) gets around the shape limit for repeating signals, but not around the Nyquist limit.

Try it. Generator: Square, 1 000 Hz. Acquire: Normal, Memory: 1000; Horizontal: Y-T, Auto roll off (roll mode draws fast content as a band instead). Starting at 500 µs/div, slow the time base one step at a time and watch Sa and the Frequency reading. Somewhere below 2 kSa/s the picture becomes a slow false wave or a flat line at a wrong level. Change time/div by one step: the false wave changes. Switch to Hi-Res: it disappears. (This is verification test D5.)

Key points

  • A sample rate fs can only show frequencies below fs/2 (the Nyquist frequency).
  • Faster signals appear at false, slower frequencies: |f − k·fs|. The picture looks believable.
  • Test: change time/div. A real signal keeps its frequency; an alias does not.
  • This scope has no anti-alias filter. Deep memory and Hi-Res are its defences.
  • Bandwidth, Nyquist and "enough samples for the shape" are three different limits.

Elsewhere: "Sample rate is not bandwidth" in reference §11; the Hi-Res box-car filter in reference §3.2.

9. Memory, record length and the time base

A digital scope stores its samples before drawing them. How many it can store, and how fast it can send them on, shapes almost everything about how it behaves at different time bases: its sample rate, how often the picture updates, and whether it can catch fast details at slow settings. This chapter puts those pieces together.

9.1 Captures and record length

A capture (also called an acquisition or a record) is one block of samples taken at one fixed rate, the raw material for one picture. The number of samples in it is the record length, or memory depth. Three numbers are tied together:

record length (samples) = sample rate × time covered time covered = 10 divisions × time/div (the screen time)

So for a given screen time, a higher sample rate needs more memory. The ESP32 can hold up to 24 000 samples per capture (shared by the channels: 12 000 each for two). At the full 250 kSa/s that covers 24 000 × 4 µs = 96 ms. To fill a screen longer than 96 ms with samples, the scope must sample more slowly.

Worked example

At 5 ms/div the screen covers 50 ms. Sampling at 250 kSa/s would need 50 ms × 250 000 /s = 12 500 samples: that fits. At 50 ms/div the screen covers 500 ms, and at 250 kSa/s that would be 125 000 samples: it does not fit in 24 000. The most the memory allows is 24 000 ÷ 0.5 s = 48 kSa/s.

A bench scope has its screen built in. This scope sends every capture over USB to the browser first, at 921 600 baud, which carries about 92 000 bytes per second. Each sample is 2 bytes, so a full 24 000-sample capture takes about half a second to send. While a capture is being sent, the ESP32 is not measuring: that gap is called dead time, and every digital scope has some.

One update in block mode (ETS: 24 000 readings at 250 kSa/s) ESP32 USB Browser capture 96 ms send 48 kB at 921 600 baud ≈ 0.52 s fold + draw next capture 0 96 ms 0.62 s While a capture is being sent nothing is measured ("dead time"). Short captures update fast; long ones (ETS) about 2 times per second.
Figure 21. One update in block mode for the longest capture. While a capture is being sent over USB, nothing is measured.

Long captures therefore cost update speed. The scope's default, Memory: auto, balances the two: it keeps the sample rate as high as possible but limits each capture so that sending it takes no longer than half a screen time (and never less than 1 000 points). The result for one channel at 250 kSa/s:

1 k 10 k 100 k ADC maximum 250 kSa/s 5µ 10µ 20µ 50µ 100µ 200µ 500µ 1m 2m 5m 10m 20m 50m Normal (Memory auto) Hi-Res time/div (s) points per second (Sa) One channel, DMA engine, 921 600 baud. Fast time bases: the ADC's maximum. Slower: Normal keeps each capture short enough to send in half a screen time, Hi-Res always uses 1 000 points, each the average of several readings. From 100 ms/div: roll mode.
Figure 22. The point rate this scope chooses at each time base (one channel). It is computed from the scope's own rules.
Time/divScreenNormal: sample rateNormal: pointsWhat limits it
5 µs – 500 µs50 µs – 5 ms250 kSa/s20 – 1 250the ADC's maximum
1 ms10 ms138 kSa/s1 382the link (½ screen)
5 ms50 ms27.6 kSa/s1 382the link
10 – 50 ms100 – 500 ms23 kSa/s2 304 – 11 520the link
100 ms and slower1 s and more10 000 per screen(streaming)roll mode (below)

You can override the choice with a fixed Memory setting (500 to 16 000 points). A bigger number gives a higher sample rate at slow time bases (more detail, less aliasing) and slower updates; a smaller one gives faster updates and a lower sample rate. At fast time bases the ADC is already at its maximum, the screen holds only a few hundred samples, and the Memory setting makes no difference.

Why the sample rate changes when you turn time/div. This catches out many beginners on every digital scope. A scope has a maximum sample rate and a maximum memory. At fast time bases it samples at its maximum and the memory is barely used. At slow time bases the memory (or here, the link) runs out, and the scope must lower the sample rate to cover the whole screen. Keep an eye on Sa in the status bar: it tells you how finely the current picture was really sampled, and therefore whether a fast detail could have fallen between samples (chapter 5) or aliased (chapter 8).

9.3 How often the picture updates

Each new picture needs: the part of the screen before the trigger to be recorded, a trigger to happen, the part after it to be recorded, and the capture to be sent. So a picture can never update faster than once per screen time, and slow time bases update slowly:

Time/divScreen timeTypical updates per second
200 µs2 ms≈ 50–90
1 ms10 ms≈ 15–40
10 ms100 ms≈ 5–9
50 ms500 ms≈ 1.5–2

The status bar shows the actual rate at its right end (frames/s). A high update rate is more than a comfort: the more captures per second, the better your chance of seeing a rare event (a glitch that happens once in a thousand periods only shows up if the scope is looking at the right moment). Bench scopes advertise this as "waveforms per second".

9.4 Roll mode: for very slow signals

At 100 ms/div and slower, a screen takes a second or more to record, and waiting for a whole screen before showing anything would feel broken. So scopes switch to roll mode: instead of separate captures, samples stream continuously, and the trace scrolls across the screen from right to left like a chart recorder, with the newest sample at the right edge. There is no trigger in roll mode (nothing is waited for), and no dead time. The ESP32 sends samples in small chunks as it takes them, and the browser keeps up to about a million of them, so after pressing STOP you can drag back through the history.

Roll mode is ideal for slow things: a capacitor charging over seconds, a temperature sensor, a potentiometer turned by hand. The scope switches to it automatically from 100 ms/div (the Auto roll setting changes or disables that threshold), and you can choose it from 50 ms/div with Horizontal → Mode: Roll.

9.5 Text streams: someone else's samples

The scope can also display numbers printed by your own sketch (the ScopeProbe library, or any Serial.print of comma-separated values). Then the sketch decides when to take each sample, and sends a timestamp with each one. The scope just draws what arrives, in roll mode, and can trigger on it in the browser. The sample rate is whatever your sketch achieves: about 50 samples per second for the ScopeProbe example, up to a few thousand lines per second for a sketch that does nothing else. Everything in this page about sampling and aliasing applies: a sketch that reads a sensor 10 times per second cannot show anything faster than 5 Hz correctly.

Key points

  • Record length = sample rate × screen time. The ESP32 holds 24 000 samples (96 ms at 250 kSa/s).
  • Here the USB link also limits long captures; Memory: auto keeps the transfer within half a screen time.
  • So the sample rate falls at slow time bases. Always glance at Sa.
  • Pictures update at most once per screen time; long captures mean fewer updates.
  • Roll mode (100 ms/div and slower) streams and scrolls, without trigger or dead time.

Elsewhere: the exact planning rules in reference §3.1 and update rates in §3.4; the Memory, Mode and Auto roll controls in the user guide §6.2 and §6.5; text streams and the ScopeProbe library in the user guide §3.3–3.4.

Part 3 · A stable picture

10. The trigger: making the picture stand still

A scope redraws its picture many times per second. If each capture started at a random moment, a repeating signal would be drawn at a different position every time and you would see a blur. The trigger fixes that: it picks the same point of the signal, say "the moment it rises through 1.65 V", as the start of every picture. It is the single most important control on a scope, and the one that confuses beginners most, so this chapter goes slowly.

10.1 The problem it solves

Figure figure 23 shows six real captures of the same 1 kHz sine from the test board, drawn on top of each other. On the left the trigger level was set above the signal, so the scope never triggered and simply captured whenever it was ready. On the right the level was inside the signal.

Untriggered: six captures overlaid level 3.0 V (above the signal), Auto: each capture starts anywhere Triggered: the same six-capture overlay t = 0 level 1.65 V, rising: every capture crosses it at t = 0
Figure 23. Real captures from the test board, overlaid. The trigger is what turns the left picture into the right one.

Untriggered, every capture shows the sine shifted by a random amount, and the six together are a meaningless tangle. Triggered, all six lie exactly on top of each other: the sine crosses the level, rising, at t = 0 in every one. That is what "a stable picture" means.

10.2 A trigger is a rule

The basic trigger, used by almost everyone almost all the time, is the edge trigger. You give it three things:

"Trigger on CH1, rising, 1.65 V" means: "make t = 0 the moment CH1 goes up through 1.65 V". The level is shown as a marker (◀T) at the right edge of the screen, and you can drag it. The 50% button puts it halfway between the signal's lowest and highest values, which is almost always a good place to start.

The level must be somewhere the signal actually crosses. A level above a signal's top, or below its bottom, never fires. A level near the top or bottom of a slow, noisy wave fires in uncertain places. The middle is safest.

10.3 How the scope finds the trigger

The ESP32 records continuously into its memory, round and round like a loop of tape: when the memory is full, the newest sample overwrites the oldest. All the while, it compares every new reading of the source channel with the level. When it sees the signal go past the level in the right direction, it marks that sample, records the rest of the screen, and stops to send the capture.

The memory records round and round; the trigger decides where the picture ends memory (a loop) newest overwrites oldest pre-trigger: already in memory post-trigger: recorded after t = 0: the trigger Position moves t = 0 left or right: more of the past, or more of the future.
Figure 24. The memory works like a loop of tape. When the trigger comes, the part before it is already recorded.

Because the memory was already full of samples when the trigger came, the samples before the trigger are available too. That is pre-trigger: you can see what happened leading up to an event, which an analogue scope could never do. By default the scope puts t = 0 in the middle of the screen, so half the picture is before the trigger and half after. The horizontal position moves it: drag the trigger triangle at the top of the screen to the right to see more of the past, to the left to see more of the future.

The firmware checks every conversion of the source channel, even those that are not kept as points (in Hi-Res and Peak modes, and when decimating at slow time bases, chapter 11), just as a bench scope's trigger circuit watches the signal itself rather than the stored points.

10.4 Placing t = 0 between two samples

The trigger moment almost never falls exactly on a sample: the signal crosses the level somewhere between two of them. If the scope simply put t = 0 on the first sample past the level, the picture would jitter left and right by up to one sample interval from capture to capture. So the browser looks at the sample before the crossing and the one after, works out where between them the straight line joining them crosses the level, and puts t = 0 exactly there.

level t = 0, placed between the samples first sample past the level the one before one sample interval The straight line between the two samples either side of the level crosses it here. Putting t = 0 at that point, rather than on a sample, stops the picture jittering by up to one sample interval.
Figure 25. Trigger interpolation. t = 0 goes where the straight line between two samples crosses the level.

This trigger interpolation is why the scope's triggered pictures are steady to a small fraction of a sample interval, and why, if you stop the scope and put a cursor at t = 0, it reads the trigger level almost exactly (verification test E1 found it within 1 mV at three levels on both edges).

10.5 Noise and hysteresis

A slow edge with noise on it does not cross the level once: it wiggles back and forth across it several times. A naive trigger would fire on any of those crossings, and the picture would jump. So triggers use hysteresis: after firing on a rising edge, the trigger is only allowed to fire again once the signal has gone back below the level by a small margin. Small wiggles near the level are ignored.

A slow, noisy edge crosses the level several times level level − hysteresis fires here, once The trigger only re-arms after the signal has gone below the shaded band, so noise wiggles around the level cannot fire it again. Noise reject makes the band wider.
Figure 26. Hysteresis: the trigger fires once per edge, even when noise makes the signal cross the level several times.

This scope's margin is 12 mV at the pin. If a noisy signal still triggers unsteadily, the Noise reject setting widens it to 60 mV. Bench scopes have the same option under names like "noise reject" or "HF reject".

10.6 Auto, Normal and Single

The trigger mode answers a different question: what should the scope do when no trigger comes?

10.7 Holdoff, both edges and a hidden source

10.8 When the picture is not stable

What you seeLikely causeWhat to do
Picture drifts sideways, status AutoLevel outside the signal, or wrong sourcePress 50%, check the source channel
Nothing updates, status WaitNormal mode and no crossingMove the level into the signal, or press FORCE to look
Picture jumps between two positionsTwo different places in the period cross the level the same way (complex waveform), or Both edgesMove the level to a part of the wave that crosses it only once per period; use a single edge
Small random jitter on a slow edgeNoise near the levelNoise reject; a steeper part of the wave; Hi-Res
Slow signal (a few Hz) mostly untriggered in AutoIt repeats more slowly than the Auto waitNormal mode

Try it (Demo or board). Drag the ◀T marker up and down. Inside the signal the picture is still (Trig'd). Drag it above the signal: in Auto the picture starts to drift; switch the mode to Normal and it freezes on the last picture (Wait). Switch the edge between ↑ and ↓ and watch which slope sits at t = 0. Then drag the trigger triangle at the top of the screen to the right edge: the whole screen is now the time before the trigger.

Key points

  • The trigger makes t = 0 the same point of the signal in every capture: source, level, edge.
  • The memory records continuously, so the time before the trigger can be shown (pre-trigger).
  • t = 0 is placed exactly between two samples by interpolation.
  • Hysteresis stops noise from re-triggering. Noise reject widens it.
  • Normal: only triggered pictures. Auto: shows something even without a trigger. Single: one capture, then stop.

Elsewhere: trigger controls and the status chips in the user guide §6.4 and §6.1; exact rules (hysteresis values, Auto timeout, interpolation) in reference §3.3; check it yourself: verification stage E.

Part 4 · From readings to a picture

11. More readings than points: decimation

This short chapter explains one idea that the next chapter depends on completely. Without it, acquire modes such as Peak detect make no sense: how can a scope show a spike "between two points" if all it has is the points? The answer is that at most time bases, it has much more than the points.

11.1 Two different rates

So far this page has talked about "the sample rate" as if there were only one. In fact there are two:

At fast time bases they are the same: the ADC runs at its maximum, 250 kSa/s, and every conversion becomes a point. But at slow time bases the scope needs fewer points per second than the ADC can deliver (chapter 9: memory and the link limit the record length). At 50 ms/div with Memory set to 500, for example, the screen covers 500 ms with 500 points: one point per millisecond, 1 kSa/s. The ADC, however, does not have to slow down to 1 kSa/s. It can keep converting much faster: the firmware runs it at 40 kSa/s or more. Then there are 40 or more conversions for every point the scope keeps.

Reducing many conversions to fewer points is called decimation. The number of conversions per point is written D here. The question is simply: when there are D readings for each point, which value should the point get?

point 1 point 2 point 3 point 4 point 5 point 6 The ADC converts D = 8 times for every point the scope keeps (the dots are ADC readings) Normal: keep the first Peak: keep lowest and highest Hi-Res: keep the average Normal missed the spike in point 4 (it fell on readings that were thrown away). Peak shows it as a tall band. Hi-Res shows it only as a small bump, but its other points are the least noisy.
Figure 27. Decimation. The same readings give three different pictures, depending on what is kept for each point.

11.2 Three possible answers

There are three sensible answers, and each is one of the scope's acquire modes:

This is exactly the sentence that sums up acquire modes on every digital scope: the acquire mode decides what the scope stores for each point when it takes more ADC readings than it has points to show. The fourth classic mode, Average, is different: it averages whole captures over time, not readings within a point. The next chapter takes each mode in turn.

11.3 When there is nothing to decimate

At fast time bases (on this scope roughly 500 µs/div and faster with one channel) the ADC is already at its maximum and every conversion is a point: D = 1. Then there is nothing to choose between, and Normal, Peak and Hi-Res all give the same picture. The modes only differ where D is larger than 1. The Acquire box in the Trig/Acq tab shows what the board is doing, including the ADC rate and, in Hi-Res, how many readings each point averages (for example "×25 avg/pt").

Time/div (one channel)Point rate (Sa)ADC rateD, readings per point
5 µs – 200 µs, any mode250 kSa/s250 kSa/s1
Hi-Res, 1 ms100 kSa/s200 kSa/s2
Hi-Res, 10 ms10 kSa/s250 kSa/s25
Normal, 10–50 ms (Memory auto)23 kSa/s161 kSa/s7 (one kept)
Peak, Memory 500 at 50 ms1 kSa/s250 kSa/s250 (min and max kept)

Key points

  • At slow time bases the ADC converts faster than the scope keeps points: D readings per point.
  • Normal keeps one, Peak keeps the lowest and highest, Hi-Res keeps the average.
  • At fast time bases D = 1 and those three modes are identical.

Elsewhere: how the firmware chooses the ADC rate and D for each mode in reference §3.6, "From conversions to points".

12. Acquire modes

With decimation understood (chapter 11), each acquire mode is easy to explain. This chapter takes them one at a time: what each does, what it is good for, what it hides, and what it looks like on real signals. The last section is a guide to choosing.

12.1 Normal

What it does: each point is one real reading, the first of its group of D. The picture is the signal as sampled at the point rate, noise and all.

Good for: seeing the raw truth. Normal never invents anything and never hides noise. It also keeps the highest point rate at slow time bases (deep memory), which keeps aliasing away as long as possible.

Watch out: when D is large, Normal throws most readings away. Anything that happens between two kept readings is invisible, and a signal faster than half the point rate aliases (chapter 8). Figure figure 29 (left) shows how badly that can go.

12.2 Peak detect

What it does: for each point, the firmware looks at every one of the D readings and keeps two values: the lowest and the highest. The scope draws the band between them. The centre of the band, (min + max) ÷ 2, is used for measurements and maths.

Normal: one reading per point can miss a spike Peak: lowest and highest of every reading in between The 0.2-wide spike falls between two readings and is invisible. The spike shows up in its interval as a tall band.
Figure 28. Peak detect in principle: a short spike between two points is invisible in Normal mode and caught by Peak.

So the answer to "how can Peak show a spike between two points" is: the spike is not between two readings. It is between two points, and the ADC took many readings in that gap. Peak mode looked at all of them, and the spike's reading became the "highest" of its group. The spike is then drawn as a tall band in the point where it happened.

Figure figure 29 is a real example from the test board. The generator made a 20 Hz pulse wave with 1 % duty: a 0.5 ms pulse every 50 ms. The time base was 50 ms/div with Memory 500, so one point per millisecond. In Normal mode each point is one reading taken every 1 ms; a 0.5 ms pulse lasts half of that interval, so whether it is caught depends on luck. In Peak mode the ADC ran at 250 kSa/s, 250 readings per point, and every pulse was caught at full height in every capture.

Normal: pulses missed Normal: this capture caught 0 of 10 pulses Peak detect: every pulse caught Peak: 10 of 10, every capture (250 readings per point) Generator: Square, 20 Hz, duty 1 %. 50 ms/div, Memory 500 (1 kSa/s). Pulses caught in 8 successive Normal captures: 10, 10, 10, 10, 10, 10, 10, 0.
Figure 29. Real data from the test board: 0.5 ms pulses every 50 ms, sampled with one point per millisecond.

Notice the strange way Normal failed on the test board: whole captures showed either all ten pulses or none, never some. That is because the generator and the ADC run from the same crystal: the pulses repeat every 50 kept readings exactly, so the kept readings keep the same position relative to the pulses for the whole capture. With a signal from an independent source, missed pulses would be scattered randomly instead. Either way: if a short glitch might matter, use Peak detect (or a faster time base).

Watch out: Peak shows noise as a thick band, since the highest and lowest of many noisy readings are always far apart. It uses twice the memory per point. And it has no effect when the ADC is already at its maximum rate and D = 1.

12.3 Hi-Res

What it does: each point is the average of all D readings in its interval. (It is the default mode of this scope.) Averaging does two separate useful things:

  1. Less noise, more resolution. Averaging D readings divides random noise by √D (section 6.4). At 10 ms/div with one channel, each point averages 25 readings, so the noise drops about 5 times, and steps finer than one ADC code become visible. That is where the name "high resolution" comes from: the averaged points effectively have more bits than the 12-bit ADC.
  2. No aliasing of fast signals. An average over a whole point interval cancels anything that wiggles faster than that interval. A signal far above the point rate, which would alias in Normal mode, simply averages to its mean in Hi-Res. This kind of averaging is called a box-car filter, and it is a digital stand-in for the anti-alias filter this scope does not have (section 8.5).
Normal Normal, 27.6 kSa/s: noise 4.4 mV RMS Hi-Res Hi-Res, 20 kSa/s, 10 readings per point: 1.9 mV RMS Generator: Sine, 300 Hz requested (261 Hz real), ±0.2 V. Captured at 5 ms/div; the middle 20 ms shown, at 62.5 mV per grid line.
Figure 30. Real data from the test board: a small, slow sine. Hi-Res averages the readings inside each point and removes most of the noise.

On the test board (figure figure 30), the noise on a small sine fell from 4.4 mV RMS in Normal to 1.9 mV in Hi-Res with 10 readings per point. Theory says √10 ≈ 3.2 times less; the rest is the DAC's own 8-bit steps, which are part of the signal and do not average away.

Good for: slow and medium time bases in general; clean traces of slowly changing signals; measuring small changes; anything you want to take the derivative of (maths, chapter 17), because derivatives magnify noise.

Watch out: Hi-Res hides everything shorter than one point interval. A short spike is averaged into a small bump or vanishes; a fast signal becomes a flat line at its average. If you suspect something fast is going on, compare with Normal or Peak. Like Peak, Hi-Res makes no difference when D = 1 (fast time bases, or when several channels already use the full ADC rate).

12.4 Average

What it does: something different from the three modes above. Instead of combining readings inside one capture, it combines whole captures over time. Each new triggered capture is averaged, point by point, with the previous ones. You choose how many (2 to 64): with 16, the picture is the average of the last 16 captures (more exactly, each new capture counts 1/16 once the first 16 have been collected).

Because the trigger puts the signal at the same position in every capture, the signal itself is the same in all of them and survives averaging unchanged. The noise is different in every capture, so it averages away: 16 captures, noise ÷ 4. Unlike Hi-Res, this works even at fast time bases where D = 1, and it does not smooth fast details of the signal, because each point is still a single instant of the waveform.

Normal, triggered noise 5.0 mV RMS Average 16, triggered noise 2.5 mV RMS Average 16, untriggered the sine has averaged away: Pk-Pk 21 mV Generator: Sine, 2 000 Hz requested (1959 Hz real), ±0.2 V, 200 µs/div, 250 kSa/s (one reading per point, so Hi-Res could not help here).
Figure 31. Real data from the test board. Average removes noise from a triggered signal (middle) but turns an untriggered one into a flat line (right).

Watch out: Average needs two things. First, a repeating signal: anything that happens once is diluted 16 times. Second, a stable trigger: if captures start at random moments, each shows the wave at a different position, and averaging them blends the wave into a flat line at its mean (figure figure 31, right). The picture then shows a shape that does not exist. Never use Average on an untriggered picture.

On the test board, Average 16 halved the noise on the sine of figure figure 31 (5.0 → 2.5 mV RMS), and lowered it from 2.9 to 1.8 mV on a flat part of an RC curve (verification test F2). Neither reached the full ÷ 4: the sine's own frequency drifts slightly between captures, and the "flat" part was still creeping up by 5 mV. Whatever differs between captures is not noise to Average, and it blurs instead of averaging out.

12.5 ETS

The fifth mode, equivalent-time sampling, also combines many periods of a repeating signal, but for a different purpose: to place readings between the ADC's sample instants and draw edges far finer than 4 µs. It has its own chapter, chapter 13.

12.6 Choosing a mode

ModeEach point isNoiseShort spikesFast signalsNeeds
Normalone readingas iscan be missedaliasnothing
Peaklowest and highest of D readingsshown as a bandalways caughtshown as a bandD > 1
Hi-Resaverage of D readings÷ √Daveraged awayaveraged to their meanD > 1
Averageaverage of N captures÷ √Nkept if repeatingkeptrepeating signal, stable trigger
ETSaverage of readings at one position in the periodreducedonly if repeatingdetail down to tens of nsrepeating signal, DMA engine

Try it. Generator: Square, 20 Hz, Duty 1 %. Time/div 50 ms, Memory 500, Draw: Lines. Switch between Normal and Peak, and count the pulses. Then Generator: Sine, 300 Hz, Amplitude ±0.2 V; CH1 at 50 mV/div with the trace centred; time/div 5 ms; switch between Normal and Hi-Res and watch the fuzz.

Key points

  • Peak keeps the min and max of every reading in a point interval, so nothing escapes between points.
  • Hi-Res averages them: less noise (÷ √D), more resolution, no aliasing, but short events vanish.
  • Average combines whole captures: needs a repeating signal and a stable trigger.
  • Normal, Peak and Hi-Res are identical when the ADC is already at full speed (D = 1).

Elsewhere: the Acquire controls in the user guide §6.5; exact algorithms in reference §3.2; check it yourself: verification tests F1 and F2.

13. Equivalent-time sampling (ETS)

The ESP32 takes one reading every 4 µs at best. Many things worth seeing are far quicker: the edge of a digital signal takes tens of nanoseconds, a hundred times less than the gap between two readings. A single capture cannot show it. Equivalent-time sampling is a way around that limit, for one important kind of signal: signals that repeat.

The edge is much shorter than the gap between two readings Grey: the real signal. Blue: one capture. With 4 µs between readings, a 30 ns edge is never caught "in the act": each capture only says "low here, high at the next reading".
Figure 32. One capture of a repeating signal with fast edges. The edges happen between readings.

13.1 The idea: many periods, one picture

If a signal repeats exactly (a clock, a PWM output, a square wave from a generator), then every period is the same. You do not need to see one period in fine detail: you can take a few readings from each of many periods, each reading falling at a slightly different point of the wave, and put them all together into one period. That is equivalent-time sampling. Sampling scopes have used the trick since the 1960s to show gigahertz signals with slow converters.

Three ways to picture it.

  • A stroboscope flashing at nearly, but not exactly, the speed of a spinning fan shows the fan turning slowly. Each flash sees the blade a little further on; together the flashes show one turn in slow motion.
  • A flip book drawn by many people: each person draws only a few frames, at scattered moments, but if everyone writes down exactly when their frame belongs, the frames can be sorted into one smooth animation.
  • In video games, temporal anti-aliasing shifts the camera by a fraction of a pixel each frame and blends many frames into one sharp image: sharp when the scene is still, smeared when it moves. ETS is sharp for a steady repeating signal, and blurred when the signal changes or jitters.

13.2 Folding

① Five periods of a repeating signal, readings at fixed times (the clock does not care where the period starts) period 1 period 2 period 3 period 4 period 5 ② Put every reading at its position inside one period ("fold"): the gaps fill in Here one period is 3.37 reading intervals, so each period starts 0.37 of an interval "later" relative to the clock and its readings land in new places (colours = periods). With 24 000 readings over ~2000 periods, the period fills with points a few ns apart.
Figure 33. Folding. Readings from many periods (colours) are placed at their position inside one period. Real captures use about 2 000 periods.

The trick works because the signal's period is not a whole number of reading intervals. Take a 20 011 Hz square wave: its period is 49.975 µs, which is 12.494 reading intervals of 4 µs. Reading number 13 therefore lands 0.506 of an interval later in its period than reading 0 did in the first period, reading 26 another 0.506 later, and so on. Over a 96 ms capture (24 000 readings, about 1 900 periods) the readings visit every part of the period. Sorting them by "where in the period was I taken?" gives one period drawn with thousands of points instead of 12.

In maths: reading number k is taken at time k × Δt. Its position inside the period T is

position = fractional part of ( k · Δt / T ) (0 = start of the period, 1 = its end)

and its value is drawn at time position × T. Placing every reading this way is called folding the record at the period T, because it is like cutting a long paper strip into period-length pieces and stacking them.

13.3 Measuring the period very precisely

Folding only works if the period is known extremely precisely: to about one part in a million. An error of only 0.001 % would shift the last of 1 900 periods by 2 % of a period, and the stacked pieces would no longer line up. So the scope measures the period from the capture itself:

  1. It finds every crossing of the trigger level (about 2 000 in a capture), each placed between two readings by interpolation.
  2. It fits a straight line through "crossing time against period number": the slope of that line is the period.
  3. It then tries periods very close to that one and keeps the one that makes the folded curve thinnest.
Folded with a period 0.1 % too long: a cloud Folded with the right period: a thin line The scope first estimates the period from the trigger-level crossings (a straight line through ~2000 crossing times), then tries periods around it and keeps the one that makes the folded curve thinnest. It needs about 1 part per million.
Figure 34. The same 900 readings folded at a slightly wrong period (left) and at the right one (right). The scope searches for the thinnest fold.

On the test board the period found this way agrees from capture to capture to about 0.2 parts per million.

13.4 What the dots are, and why their density changes

After folding, the scope has 24 000 readings scattered over one period. It divides the period into equal slots, called bins, averages the readings that fall into each bin, and draws one point per bin. With Display → Draw: Dots you see these points directly, and they behave in a way that surprises people at first: the dots get denser when you switch to ETS, and denser again as you choose faster time bases. Figure figure 35 shows it on the test board with a 30.9 kHz square wave: 12 real dots at 5 µs/div in Normal; in ETS 2 001 dots 25 ns apart at 5 µs/div, 1 187 dots 8.4 ns apart at 1 µs/div, and 185 dots 5.4 ns apart at 100 ns/div, where the 6 000-bin limit was reached.

Normal, 5 µs/div 250 kSa/s · 12 points on screen dots 4 µs apart (real readings) ETS, 5 µs/div 40.0 MSa/s ETS · 2001 points on screen dots 25.0 ns apart ETS, 1 µs/div 119 MSa/s ETS · 1187 points on screen dots 8.43 ns apart ETS, 100 ns/div 185 MSa/s ETS · 185 points on screen dots 5.39 ns apart Generator: Square, 30 901 Hz. ETS draws about 2 000 dots per screen until the slots reach the finest the readings allow (6 000 per period, 5.4 nshere); after that the dots spread apart.
Figure 35. Real data from the test board, drawn as dots: a 30.9 kHz square wave in Normal mode, then in ETS at three time bases. Each ETS dot is the average of the readings that fell into one thin slot of the period.

Here is why:

A detail of the drawing: once there are more points than pixel columns on your screen, the scope draws only the lowest and highest dot of each column (section 14.1), so dense ETS dots merge into a line one or two dots thick. Zoom in (a faster time base) and the individual dots separate again.

Each dot being an average also means ETS pictures are less noisy than a single Normal capture: the 24 000 readings are shared among the bins of one period (never more than 6 000), so each dot averages at least 4 readings, and often a few dozen.

One more thing you may notice: the picture updates only once or twice a second. Each ETS picture needs a full 24 000-reading capture, which takes half a second to send over USB (section 9.2).

13.5 Locking: when ETS cannot help

If the period is a whole number of reading intervals, every period is read at exactly the same places, and folding adds nothing.

Exactly 5 readings per period: always the same 5 places 5.013 readings per period: the places slide Left: 50 kHz with a 250 kSa/s clock. 200 readings, but only 5 different positions: ETS can add nothing ("locked"). Right: the same signal 0.26 % slower (50.13 kHz). The scope tells you when a signal is locked; shift its frequency a little.
Figure 36. Locking. A period of exactly 5 reading intervals is always read at the same 5 places; a slightly different period lets the readings slide.

This happens easily with the ESP32's own generator, because the generator and the ADC run from the same crystal. 10 000 Hz is exactly 25 readings at 250 kSa/s; 50 000 Hz is exactly 5. It also happens near simple fractions: 21 737 Hz came out as 21 739 Hz on the board, which is exactly 11.5 readings per period, so only 23 different positions. The scope detects this and shows ETS: locked, little gain. The cure is to shift the frequency slightly (10 013 Hz instead of 10 000 Hz). A signal from another circuit, with its own clock, is almost never locked.

How fine the steps get depends on how evenly the readings spread over the period, which depends on the frequency. On the test board, 30 901 Hz filled steps down to 5.4 ns (the 6 000-bin limit), while 20 011 Hz only reached 25 ns: it is close to 2/25 of the sample rate, so its readings bunch together.

13.6 Sources that drift

Folding assumes the period stays the same for the whole 96 ms capture. A crystal-controlled signal does. A signal from a cheaper oscillator may not. The ESP32's sine generator is an example: its timing comes from a small RC oscillator inside the chip, and during one capture its frequency wandered by 100 to 290 parts per million on the test board. That sounds tiny, but folding needs about 1 ppm, and a drift of 200 ppm moves the end of the capture by about 1 µs, which is 18° of a 50 kHz sine. Folded with one period, the sine came out smeared (figure figure 37, left).

One period for the whole record 0 one period Each reading placed by its own cycle 0 one period Zoom on the DAC glitch (0.5 µs/div) -2.5 µs 2.5 µs Real data from the test board: a 49.9 kHz sine from the ESP32 DAC, 3 000 of the 24 000 readings (every 8th). Left: the generator drifted by about 100 ppm during the 96 ms record, so one fixed period smears the sine (spread 35 mV). Middle: the same readings placed by the nearby level crossings: a clean sine (spread 7 mV). Right: the clean picture shows a narrow dip the DAC makes on every falling half-cycle (smeared away on the left).
Figure 37. Real readings of a drifting sine, folded with one period (left) and following the drift (middle). The clean fold shows the DAC's glitch (right).

So the scope can follow the drift. Instead of one period for all 24 000 readings, it looks at the trigger-level crossings near each reading: a reading that lies 30 % of the way between two crossings is placed 30 % into that cycle (the crossing times are first smoothed over about 13 neighbours, which removes the noise of single crossings). This works for smooth signals like a sine. It does not work for fast-edged square waves, because an edge faster than the reading interval does not tell you where between two readings it crossed the level. The scope tries both methods on every capture and keeps whichever folds thinner; a steady square wave therefore always uses the single period. When drift following is used, the Acquire box says "follows the source's drift".

A bonus: with the drift removed, the folded sine showed a narrow dip on its falling half, 0.2–0.3 V deep and about 0.4 µs wide (figure figure 37, right). That is a real defect of the ESP32's DAC: a glitch when its 8-bit number passes the middle of its range, because its internal switches do not all change at exactly the same instant. It is invisible in Normal mode, being a hundred times narrower than the reading interval.

13.7 Limits: read these before trusting an ETS picture

Try it. Generator: Square, 30 901 Hz. CH1 only, trigger CH1 ↑ 1.65 V. Acquire Normal, 5 µs/div, Draw: Dots, add the measurement Rise. Then Acquire: ETS. Watch the dots fill in, then step the time base down to 100 ns/div and watch Sa climb and the edge appear (Rise ≈ 30 ns instead of "3.2 µs"). Set the generator to exactly 10 000 Hz and read the trigger status (the second badge above the screen). Then try Generator: Sine, 50 000 Hz in Normal and ETS.

Key points

  • ETS builds one period of a repeating signal from readings of many periods ("folding").
  • It needs the period to about 1 ppm, and measures it from the capture.
  • Each ETS dot is the average of the readings in one thin slot of the period; the scope aims for about 2 000 dots per screen, down to the finest step the readings can fill.
  • It fails when the signal is locked to the sample clock, does not repeat, or is above half the sample rate.
  • It adds points, not bandwidth.

Elsewhere: the ETS controls and status messages in the user guide §6.5; the exact algorithm and all measured numbers in reference §3.7; check it yourself: verification tests F3 and F4.

14. Drawing the picture

The last step from readings to picture is the drawing itself. It sounds trivial, but the way points are drawn changes what you notice, and a few display features reveal things that a single picture cannot.

14.1 Lines or dots

With Lines (the default) the scope joins neighbouring points with straight lines. That makes signals easy to read, but the lines are not measurements: they are the simplest possible guess about what happened between two points (section 5.2). With Dots only the points are drawn, and you see exactly what was measured and how far apart the measurements are.

Use Dots whenever the number of points per period is small, whenever an edge looks suspiciously straight, and whenever you want to know whether a detail is real. Some bench scopes draw a smooth curve through the points instead of straight lines (a mathematical method called sin(x)/x interpolation). It looks nicer for sine waves but can invent wiggles next to sharp edges; this scope keeps to straight lines, so what you see is never more than what was measured.

At slow time bases there may be more points than screen pixels. The scope then draws, for each pixel column, a vertical line from the lowest to the highest point in it (with Dots: just the lowest and the highest dot), so that no extreme is lost by drawing. That is why a noisy signal at a slow time base looks like a band.

14.2 Persistence: many pictures at once

Normally each new capture replaces the previous one. With persistence on, older captures stay on the screen and fade slowly (Short: about a quarter of a second, Long: about 1.5 seconds), or never fade (∞). This imitates the glow of an analogue scope's phosphor, and it shows things a single picture cannot:

One capture Persistence: 60 captures the falling edge wanders: jitter a rare glitch looks perfect
Figure 38. Persistence. A single capture hides timing jitter and rare events; many overlaid captures show them.

14.3 Layouts and labels

All traces can share one grid (Single), the maths traces can get a grid of their own below the channels (Split), or every trace can have its own grid (Stack). This is purely about readability: with several signals on one grid they can overlap and hide each other. Each grid can show its own volt labels, so you can read values without counting divisions from a 0 V marker.

14.4 X-Y mode: one signal against another

Normally the horizontal axis is time. In X-Y mode one channel drives the horizontal axis and another the vertical, and time disappears from the picture: each point is drawn at (voltage of X, voltage of Y). This is how scopes show the relationship between two signals:

In phase 45° apart 90° apart Frequencies 1 : 2 Frequencies 2 : 3 Horizontal: one sine (X). Vertical: another (Y). Time does not appear; the shape shows how the two are related.
Figure 39. X-Y mode. Two sines of the same frequency draw a line, ellipse or circle depending on their phase; different frequencies draw Lissajous figures.

Key points

  • Lines are a guess between points; Dots show the real measurements.
  • Persistence overlays many captures: it reveals jitter, rare glitches and the envelope of a varying signal.
  • X-Y mode plots one channel against another: phase, frequency ratios, component curves.

Elsewhere: Display and X-Y controls in the user guide §6.9 and §6.2; drawing and persistence details in reference §6.

Part 5 · Getting numbers

15. Automatic measurements

Reading values off the grid (section 3.3) is a good skill, but slow and only as precise as your eye. Every digital scope can compute the common values from its samples. This chapter explains how those calculations work, because knowing how a number is made tells you when to trust it.

15.1 What a measurement looks at

Every automatic measurement uses the points that are on the screen, as displayed (after calibration, probe factor, coupling and so on). Two consequences that matter all the time:

15.2 Level measurements

Max (a spike: one point) Top (most common high level) Base (most common low level) Min Amplitude Pk-Pk histogram
Figure 40. Level measurements. Top and Base come from the histogram of all points (left), so a spike or the overshoot hardly affects them; Max and Min are single points.

15.3 Time measurements

Time measurements are built from edges. The scope finds the middle level (halfway between Base and Top) and every place the signal crosses it, using a little hysteresis so that noise does not create false crossings. Each crossing time is interpolated between the two points either side, just like the trigger point (section 10.4), so it is much more precise than one sample interval.

middle level 10 % 90 % period: rising crossing to rising crossing +width rise time 10 → 90 %
Figure 41. Time measurements use crossings of the middle level, each interpolated between two points; rise time uses the 10 % and 90 % levels.

15.4 How precise can a measurement be?

A measurement can never be better than the samples behind it:

15.5 Statistics, and why Max jumps

Turn on Statistics and every measurement is repeated on every capture, and the scope shows, besides the latest value:

Statistics restart by themselves whenever you change a setting that changes the numbers.

Turn on Statistics and add Max and Top on a square wave, and you will see that Max jumps around while Top barely moves. Max is a single point: the most extreme reading in the capture. Every capture has different noise, so the most extreme reading changes every time, by several millivolts on this scope. Top is the most common level, built from hundreds of points, so noise averages out. That is not a fault; bench scopes do exactly the same. The lesson:

Worked example from the test board

A PWM signal at 50 % duty was smoothed by 10 kΩ and 10 µF to a nearly steady voltage, and its Mean measured with Statistics over 45 seconds: μ = 1.6524 V, σ = 0.48 mV. A multimeter read 1.652 V. A single capture's Mean scatters by about half a millivolt; the average of a hundred captures agrees with the meter within 0.4 mV, less than one ADC step.

Key points

  • Measurements use the points on screen: show whole periods, at least two for frequency.
  • Top/Base use the most common levels and ignore spikes; Max/Min are single noisy points.
  • Time measurements interpolate crossings at the middle level.
  • A rise time of one or two sample intervals means "faster than this scope can see".
  • Statistics: read μ for a steady number; σ is the scatter of single readings.

Elsewhere: the Measure controls in the user guide §6.6; exact formulas in reference §4.1, statistics in §4.2.

16. Cursors: measuring by hand

Automatic measurements cover the common cases. For everything else, there are cursors: lines you place on the screen yourself, with the scope telling you exactly where they are.

16.1 Time cursors and level cursors

You drag them with the mouse. They work on a stopped picture too, which is usually the easiest way: press STOP, then measure at leisure.

16.2 When cursors beat automatic measurements

Worked example: an RC time constant

A capacitor charges through a resistor after a step (section 7.2). After one time constant τ it has reached 63 % of the step. With the Demo (10 kΩ and 100 nF, so τ should be 1 ms): set the generator to 50 Hz so the capacitor charges fully, press STOP, put time cursor A where the curve starts rising and drag B until the cursor readout shows the curve at 63 % of its full step (for the Demo's 0 → 3.3 V step, 2.08 V). ΔT is τ: about 1 ms. The same method on real hardware is verification test G1.

Key points

  • Time cursors give ΔT and 1/ΔT, and every trace's value at each cursor. Level cursors give Δ volts.
  • Use them for delays, one-off events, and anything the automatic list does not cover, and to check automatic numbers.

Elsewhere: cursor controls in the user guide §6.7; exactly what the readout computes in reference §6.

17. Maths channels: calculating with signals

A scope measures voltages. But often the quantity you care about is something else: a current, a power, a charge, a rate of change. Maths channels (M1 to M4) compute a new trace from the measured ones, point by point, with a formula you write. This chapter explains the ideas behind the most useful formulas, including the two pieces of calculus that describe capacitors and inductors: the derivative and the integral.

17.1 Point by point

A maths channel takes, for each point in time, the values of the channels at that point and puts them through your formula. v1 means "CH1's voltage at this point", v2 CH2's, and so on. v2 - v1 is the voltage between the two points the channels are connected to. (v2 - v1) / R, with a constant R = 10e3 (10 kΩ), is the current through a resistor between those two points, by Ohm's law (I = V ÷ R). Add a unit (A) and the scope shows it in amperes with the right prefix (µA, mA).

This is how a scope measures current: it cannot measure current directly, but it can measure the voltage across a known resistor. A small resistor placed in the current path for this purpose is called a shunt.

17.2 The derivative: how fast it changes

The derivative of a signal, written dv/dt, is its rate of change: how many volts per second it is rising or falling at each moment. On the screen it is the slope of the trace. Where the trace climbs steeply the derivative is large and positive; where it is flat, zero; where it falls, negative.

Capacitor voltage v (an RC charge and discharge) steep: large slope flat: slope ≈ 0 Its derivative dv/dt: the slope at each moment (× C = the current) Where v rises fastest, dv/dt is largest: the capacitor takes the most current. Where v is flat, dv/dt is zero: no current, whatever the voltage. Discharging, v falls: dv/dt is negative, the current flows out.
Figure 42. The derivative is the slope. For a capacitor, current = C × dv/dt.

Why care? Because capacitors work by it. A capacitor's current is proportional to how fast its voltage changes:

i = C · dv/dt

When a capacitor's voltage rises quickly, a big current is flowing into it; when its voltage is steady, no current flows, whatever the voltage. (An inductor is the mirror image: v = L · di/dt.) So the maths channel C * dv1, with C set to the capacitor's value, shows the capacitor's current, computed from nothing but its voltage.

On the test board both methods were compared on the same capacitor (verification test G2): the current computed from the voltage across a 10 kΩ resistor, (v2 − v1) ÷ R, peaked at 102 µA, and the current computed as C · dv1/dt from the capacitor's voltage alone peaked at 98–99 µA. Two completely different calculations, the same answer within 4 % (a second run, with app 1.10.2: 100.7 µA and 99.3 µA). figure 43 shows that run.

ADC floor 0.14 V Measured on the test board: A (generator side) and B (capacitor), 50 Hz, Hi-Res B A 0.0 V 0.5 V 1.0 V 1.5 V Capacitor current two ways: M1 = (v2 − v1) ÷ R and M2 = C · dv1/dt -100 µA 0 µA 100 µA M1 M2 -10 ms -5 ms 0 ms 5 ms 10 ms M1 (from Ohm’s law) and M2 (from the slope of B alone) lie on top of each other: peaks 101 µA and 99 µA. While B sits on the ADC floor (left), both read 0 A although B is still falling below 0.14 V: the scope cannot see it. That is why the peak is ≈ 101 µA, not the ideal 1.65 V ÷ 15 kΩ ≈ 110 µA.
Figure 43. The same calculation on the test board (verification test G2): the capacitor current from the resistor and from the slope agree.

17.3 Derivatives magnify noise

There is a catch. The derivative of a noisy signal is very noisy, because noise consists of small, quick wiggles, and quick wiggles have steep slopes. Taking the slope between two neighbouring points 4 µs apart, 3 mV of noise becomes a slope of up to 750 V/s. To control this, the scope does not take the slope between two neighbours. It fits a straight line through several points on each side (the d/dt window, 3 points on each side by default) and uses its slope. A wider window averages away more noise, but it also smooths the derivative of fast changes, rounding sharp corners.

window ±1 point window ±3 (default) window ±12 The derivative of a sine with 4 mV of noise (grey: the true derivative). Two-point slopes turn tiny noise into large spikes; fitting a line over more points averages them away, at the cost of smoothing fast changes.
Figure 44. Derivatives magnify noise. A wider d/dt window averages it away.

Practical advice: before taking a derivative, reduce the noise. Use Hi-Res mode (section 12.3), a wider d/dt window, or a slower time base where each point averages more readings. Keep the window shorter than about a tenth of the fastest period you care about.

17.4 The integral: adding up over time

The integral, written ∫ v dt, is the opposite of the derivative: it adds up the signal over time, which on the screen is the area under the trace from the left edge up to each point. A constant voltage integrates into a steadily rising line; a square wave integrates into a triangle (the slope of each side equals the voltage), a positive pulse into a step.

It is useful because charge is the integral of current:

q = ∫ i dt and for a capacitor: q = C · ΔV

Integrating a capacitor's charging current over a charge cycle gives the charge it took in. On the test board (test G3) the Area of the current came to 204 nC, against C × ΔV = 115 nF × 1.67 V = 192 nC: within 6.5 % (a second run: 195.9 nC against 189.1 nC, +3.6 %), with the difference explained by the ADC's floor (the voltage started at 0 V, below the 0.14 V the ADC can read).

The integral has the opposite character to the derivative: it smooths noise away (random wiggles add up to almost nothing), but it is sensitive to any offset. A constant error of 10 mV integrates into a steady upward slope of 10 mV·s every second. AC coupling removes the mean before integrating, which removes that drift (along with any real DC part).

17.5 Using the scope's own measurements in a formula

So far a maths channel has worked point by point: at each sample it looks at the voltages at that instant and computes one number. But the scope also produces numbers that describe the whole picture: the frequency, the peak-to-peak size, the mean, the rise time, and the rest of the Measure list (chapter 15). These are live readings, and a formula can use them by name. That closes a loop. Measure turns a picture into numbers; a maths channel turns numbers back into a picture; with live readings, the numbers of the first step feed the second.

A good way to see why this is useful is to build something that needs both kinds of information. Suppose you want a copy of a sine on CH1, shifted in phase by 60°. A sine is completely described by three numbers:

v(t) = mean + A · sin(2π · f · t + φ)

Written as a formula for a maths channel, this is mean1 + pp1 / 2 * sin(2 * pi * freq1 * t + 1.047). There is no sample of CH1 in it: nothing is copied. The channel calculates a brand-new sine from the three readings, and because the readings are live, it follows CH1 if its size or frequency changes.

CH1 (measured) M1 = mean1 + pp1/2 · sin(2π · freq1 · t + 1), rebuilt from the readings mean1 pp1 one period T = 1 / freq1 shift Three numbers describe a sine: its level (mean1), its size(pp1 ÷ 2) and its speed (freq1). Thescope measures all three; you onlychoose the phase. M1 is CH1 moved left byφ ÷ (2π · freq1) seconds, which isCH1 advanced by φ radians (here 1rad ≈ 57°). A negative φ delays it.
Figure 45. Using live readings: the scope measures level, size and frequency of the sine on CH1, and a maths channel rebuilds it with a phase shift of your choice.

Read the figure (figure 45) from the left. The measured sine (CH1) is drawn first; next to it are the three readings, as the arrows show: the dashed middle line is mean1, the vertical arrow is pp1 (half of it is the amplitude), and the horizontal arrow is one period, which is 1 ÷ freq1. The second curve is the formula. A positive φ moves the whole wave to the left, because the sine reaches each value sooner; a negative φ delays it. The shift in time is φ ÷ (2π · freq1) seconds, which for 1 radian at 1.3 kHz is about 122 µs.

Where does t start? At the trigger point. The rebuilt sine therefore has phase φ relative to the trigger, not relative to CH1 itself. The two lie exactly on top of each other (for φ = 0) only when the trigger fires at the moment CH1 crosses its mean while rising; if the trigger level is elsewhere, the rebuilt wave starts with a fixed offset. For the phase to be the same as CH1's, set the trigger level to the mean reading and the slope to Rise.

Some facts about live readings that are worth knowing, because they decide how far you can trust the result:

The same idea works for other jobs. v1 / pp1 scales a signal so that its peak-to-peak size is always exactly 1, whatever the input; v1 - mean1 subtracts the DC level (compare AC coupling, which does the same with the mean of the screen); freq1 / freq2 is the ratio of two frequencies, which is 1 when two signals are locked together. Names, and which readings exist for which channel, are in the reference §5.8.

17.6 More useful formulas

Power in a resistor (v² ÷ R), energy stored in a capacitor (½ C v²), a theoretical curve drawn over the measured one (for example the RC charge curve 3.3 · (1 − e−t/τ), to check a value of τ by eye), gain in decibels between two signals: the user guide §6.8 has a table of them, and the reference §5 describes the whole formula language.

Pitfall: the ADC floor. Maths uses the values as measured. If a signal goes below about 0.14 V, the ADC reads 0.14 V (section 6.2), and every formula built on it inherits the error. On the test board this made the computed peak current about 14 µA low (102 instead of 116 µA), because the capacitor voltage at the start of charging was really 0 V. Keep signals inside the ADC's range when you want accurate maths.

Key points

  • Maths channels compute a trace point by point: (v2 − v1)/R is a current by Ohm's law.
  • The derivative is the slope: i = C·dv/dt gives a capacitor's current from its voltage. Derivatives magnify noise: use Hi-Res or a wider window.
  • The integral is the area: charge q = ∫ i dt = C·ΔV. Integrals smooth noise but accumulate offsets.
  • Live readings (freq1, pp1, mean1 …) bring the Measure numbers into a formula: a sine is rebuilt from its level, size and frequency, with a phase you choose.

Elsewhere: maths controls and useful formulas in the user guide §6.8; the formula language, the names of the live readings and exactly how d/dt and ∫ are computed in reference §5; on real hardware: verification tests G2–G3.

18. The spectrum: signals as frequencies

Everything so far has looked at signals in the time domain: voltage against time. There is a second, equally valid way to look at any signal: as a mixture of sine waves of different frequencies, each with its own size. Plotting size against frequency gives the spectrum, the frequency domain view. The scope computes it with the FFT (fast Fourier transform), a method for finding those sine waves in a list of samples.

18.1 Any signal is a sum of sines

A pure sine wave is one frequency, so its spectrum is a single line. Anything else is several sines added together. A square wave, surprisingly, is a sine at its basic frequency (the fundamental) plus sines at 3, 5, 7, 9 … times that frequency (the odd harmonics), with sizes 1/3, 1/5, 1/7 … of the fundamental. Add enough of them and the corners get sharper and sharper.

Adding odd harmonics builds a square wave fundamental only + 3rd + 3rd + 5th up to the 15th 1 3 5 7 9 11 13 15 Its spectrum: sizes 1, 1/3, 1/5, 1/7 … harmonic number (× fundamental)
Figure 46. A square wave is a sum of sines at odd multiples of its frequency.

Seen this way, several earlier ideas connect. A sharp edge needs high harmonics, so a filter that removes high frequencies (the input's RC, chapter 7) rounds the edge. A square wave's harmonics can lie above the Nyquist frequency even when its fundamental is far below it, and alias (section 8.6). Ripple, noise, mains hum: each shows up as its own line or hump in the spectrum.

18.2 Reading the spectrum display

Turn on FFT in the Display tab and the scope shows the spectrum of the on-screen samples of one trace:

-100 -80 -60 -40 -20 0 Sine, 5 kHz requested 12 500 samples at 250 kSa/s, bins 15 Hz apart 4959 Hz: -5.2 dBV 2×: -62 dB 3×: -48 dB kHz dBV -100 -80 -60 -40 -20 0 Square, 2 kHz, 50 % 12 500 samples at 250 kSa/s, bins 15 Hz apart 1999 Hz: 2.5 dBV 3× fundamental: -9.7 dB (theory -9.5) 5× fundamental: -14.4 dB (theory -14.0) 7× fundamental: -17.7 dB (theory -16.9) kHz dBV
Figure 47. Real spectra from the test board, computed the same way as the scope's FFT display (Hann window, dBV).

Figure figure 47 shows real spectra from the test board. The sine from the ESP32's DAC is one tall line, with much smaller lines at its harmonics (its distortion) and a floor of noise far below. The square wave from the generator shows the odd harmonics stepping down as 1/3, 1/5, 1/7 … : measured −9.7, −14.4 and −17.7 dB below the fundamental against −9.5, −14.0 and −16.9 dB in theory. The even harmonics are almost absent (the 2nd is 38 dB down) because the duty cycle is exactly 50 %.

18.3 Resolution and windows

18.4 When the spectrum misleads

The FFT does its arithmetic exactly; what can go wrong is what it is given. On this scope:

18.5 What the spectrum is good for

How far below the main signal you can see depends on the noise and on the bin width (narrower bins collect less noise each). On the test board, with 15 Hz bins, the noise floor of figure figure 47 lay about 70 dB below the sine, and the DAC sine's largest harmonic (its 3rd) 48 dB below it. That is good enough to see the shape of a signal's spectrum, hum and ripple, but it is not a precision audio analyser.

Key points

  • Any signal is a sum of sines; the spectrum shows their sizes against frequency.
  • A square wave = fundamental + odd harmonics at 1/3, 1/5, 1/7 … of its size.
  • dBV: 0 dBV = 1 V RMS; every 20 dB is a factor of 10.
  • Resolution = sample rate ÷ number of samples. The FFT shows only up to the Nyquist frequency.

Elsewhere: FFT controls in the user guide §6.9; exactly how the spectrum is computed in reference §6.

Part 6 · Signal sources and good habits

19. The built-in signal generator

A scope needs something to look at. Bench labs have a separate signal generator; this scope's firmware turns one ESP32 pin into a simple one. Knowing how it makes its signals explains several effects met earlier: the frequencies it cannot hit exactly, why its square wave locks to the sampling, and why its sine drifts.

19.1 Square waves from a clock divider

The Square mode uses the ESP32's LED-PWM hardware (LEDC), which makes a square wave by counting the chip's 80 MHz clock: high for so many counts, low for so many. Two consequences:

19.2 Sine waves from the DAC

The ESP32 also has a DAC (digital-to-analogue converter: the opposite of the ADC, it turns a number into a voltage) on GPIO25 and GPIO26, fed by a built-in cosine generator. The Sine mode uses it (130.6 Hz to 200 kHz; below one frequency step, about 130 Hz, the generator gives no output). It is a very different kind of source:

19.3 Using it safely

The generator pin swings between 0 and 3.3 V and can supply only a few milliamps. Always connect it through a series resistor (330 Ω at the very least; 1 kΩ is the standard here), and never connect it to anything that has its own power supply. The output is switched off (high impedance) every time the scope connects.

Key points

  • Square: crystal-derived, frequencies in steps, shares the ADC's clock (steady pictures, but locking effects).
  • Sine: DAC with an internal RC oscillator: frequency in ≈ 130.6 Hz steps, ±5 %, drifts, 8-bit steps, one small glitch per cycle.
  • Always through a series resistor.

Elsewhere: generator controls in the user guide §6.10 and §5.6; the GEN command and measured frequencies in reference §7.1.

20. Good habits and common mistakes

This chapter collects the practical lessons of the whole page into a checklist. Most wrong measurements, on any scope, come from one of these.

20.1 Before connecting

20.2 While measuring

20.3 Before believing a number

20.4 Common mistakes and what they look like

What you seeCommon causeChapter
A slow wave, or a flat line, where a fast signal should beAliasing: sample rate too lowchapter 8
Picture drifts sidewaysTrigger level outside the signal, or wrong sourcechapter 10
A signal that should start at 0 V starts at 0.14 VThe ADC's floorchapter 6
Flat tops at about 3.15 VClipping: signal above the ADC's rangechapter 6
Edges rounder than expected, amplitude lower at high frequenciesHigh source resistance with the input's 14 pFchapter 7
A narrow pulse appears in some captures, not othersNormal mode at a low sample ratechapter 12
A smooth "shape" that changes as soon as the trigger changesAverage on an untriggered signalchapter 12
Rise time reads exactly one or two sample intervalsThe edge is faster than the samplingchapter 15
A very jagged derivativeNoise magnified by d/dtchapter 17
Random values on an unconnected inputNothing is connected: a floating pin picks up anything—

Elsewhere: symptoms and fixes for the software and connection in the user guide §8; safety rules in the user guide §2.

21. Glossary

Every technical word used on this page and in the other documents, with the chapter that explains it.

AC couplingShowing only the changing part of a signal by removing its average. section 3.6
AC RMSThe RMS value after subtracting the mean: the size of the changing part, or the noise on a flat line. section 2.4
Acquire modeWhat the scope keeps for each point when it has more readings than points (Normal, Peak, Hi-Res), or how it combines captures (Average, ETS). chapter 12
ADCAnalogue-to-digital converter: measures a voltage and answers with a number (a code). chapter 6
Alias, aliasingA false, slower wave produced by sampling a signal at less than twice its frequency. chapter 8
AmplitudeFor a sine, half its peak-to-peak; for a pulse or square wave, Top − Base. section 2.3
Anti-alias filterA low-pass filter before the ADC that removes frequencies above half the sample rate. This scope has none. section 8.5
Auto (trigger mode)Captures even without a trigger after a short wait, so something is always shown. section 10.6
Autoset (AUTO key)Finds a repeating signal and sets time/div, volts/div and trigger level. section 3.4
Average (acquire mode)Averages successive triggered captures; reduces noise on repeating signals. section 12.4
BandwidthThe frequency at which the input's response has dropped to 71 % (−3 dB). section 7.3
BinA small slot of time (in ETS) or of frequency (in the FFT) into which samples are collected. section 13.4, section 18.3
BitA binary digit. A 12-bit ADC gives 212 = 4096 different codes. section 6.1
Box-car filterAveraging over a fixed time window; what Hi-Res does inside each point interval. section 12.3
Capture (acquisition, record)One block of samples taken at one fixed rate, the raw material for one picture. section 9.1
CLIPLabel shown when the signal went above the ADC's top (≈ 3.15 V): readings there are not the real voltage. section 6.2
CodeThe ADC's output number, 0 to 4095. section 6.1
CursorA line you place on the screen to read times and voltages by hand. chapter 16
DACDigital-to-analogue converter: turns a number into a voltage. The generator's sine uses it. section 19.2
dBVDecibels relative to 1 V RMS. Every 20 dB is a factor of 10 in voltage. section 18.2
DCA steady voltage, or the steady part (mean) of a signal. section 2.1
Dead timeTime between captures when nothing is measured. section 9.2
DecimationReducing many ADC readings to fewer points. chapter 11
Derivative (d/dt)The rate of change of a signal: the slope of the trace. section 17.2
DivisionOne square of the screen grid. 10 across, 8 up. section 3.1
DMADirect memory access: hardware that moves ADC readings into memory without the processor, which allows 250 kSa/s. section 4.3
DNLDifferential non-linearity: some ADC codes are wider than others. section 6.4
Duty cycleThe fraction of the period a pulse signal is high. section 2.5
EdgeA transition from low to high (rising) or high to low (falling). section 2.5
ENOBEffective number of bits: how many bits of a reading are above the noise. About 9–10 here. section 6.4
ETSEquivalent-time sampling: rebuilding one period of a repeating signal from readings of many periods. chapter 13
FFTFast Fourier transform: computes the spectrum of a list of samples. chapter 18
floorLabel shown when the signal went below the ADC's bottom (≈ 0.14 V). section 6.2
FoldingPlacing every reading at its position inside the period. section 13.2
FrameOne capture as sent over USB, with a checksum. section 4.3
Frequency (f)Repetitions per second, in hertz. f = 1 / T. section 2.2
Fundamental, harmonicsThe basic frequency of a repeating signal, and the whole multiples of it that make up its shape. section 18.1
GlitchA short, unwanted spike or dip. section 2.6
Hi-ResAcquire mode that averages all readings inside each point. section 12.3
HoldoffA time after a trigger during which new triggers are ignored. section 10.7
HysteresisA margin the signal must go back past before the trigger can fire again; stops noise re-triggering. section 10.5
Integral (∫ v dt)The running area under the trace. section 17.4
InterpolationEstimating a value between two samples (here with a straight line). section 10.4
JitterSmall random variation in the timing of an edge from period to period. section 14.2
Live readingA number of the Measure list (freq1, pp1 …) used by name inside a maths-channel formula. section 17.5
LoadingThe change a measuring instrument causes in the circuit it is connected to. section 7.5
Locked (ETS)A period that is a whole number or simple fraction of reading intervals, so the readings fall on the same few places in every period. section 13.5
MeanThe average voltage; what a DC meter shows. section 2.3
Memory depth, record lengthThe number of samples in one capture. section 9.1
NoiseRandom unwanted variation on a signal. section 2.7
Normal (acquire mode)One reading per point. section 12.1
Normal (trigger mode)Draws only triggered captures; waits otherwise. section 10.6
Nyquist frequencyHalf the sample rate: the highest frequency the samples can represent. section 8.3
Peak detectAcquire mode that keeps the lowest and highest reading of each point interval. section 12.2
Peak-to-peak (Pk-Pk)Maximum minus minimum. section 2.3
Period (T)The time of one repetition. section 2.2
PersistenceKeeping older captures on screen, fading slowly. section 14.2
ppmParts per million: 100 ppm = 0.01 %. Used for tiny frequency differences. section 13.6
Pre-triggerThe part of a capture recorded before the trigger point. section 10.3
Probe factorThe factor by which a divider reduces the signal; the scope multiplies readings by it. section 7.6
QuantisationRounding a voltage to the nearest ADC step. section 6.1
RC low-pass filterA resistor feeding a capacitor: rounds edges, attenuates high frequencies. section 7.2
ResolutionThe smallest step a measurement can show (≈ 0.8 mV for the ADC). Not the same as accuracy. section 6.1
Rise time, fall timeTime taken from 10 % to 90 % of an edge (or back). section 2.5
RMSRoot mean square: the DC voltage that would give the same power. Sine: amplitude ÷ √2. section 2.4
Roll modeContinuous streaming at slow time bases; the trace scrolls, no trigger. section 9.4
Sample, readingOne measurement of the voltage at one instant. chapter 5
Sample-and-holdThe tiny capacitor inside the ADC that holds the pin voltage still while it is converted. section 7.1
Sample rate (Sa/s)Samples per second. 250 kSa/s = one every 4 µs. section 5.1
SARSuccessive-approximation register: an ADC that finds its code by halving the range bit by bit. section 6.1
ShuntA small resistor used to measure current from the voltage across it. section 17.1
SingleWait for one trigger, capture, stop. section 10.6
Skew (channel)The time between the readings of two channels that share one ADC. section 5.4
Source impedanceThe resistance of whatever drives the signal; with the input's capacitance it sets the bandwidth. section 7.1
SpectrumThe sizes of the sine waves that make up a signal, against frequency. chapter 18
Statistics (μ, σ)Average and spread of a measurement over many captures. section 15.5
Time constant (τ)R × C: the time an RC circuit takes to reach 63 % of a step. section 7.2
Time/div, volts/divThe horizontal and vertical value of one grid square. section 3.1
Top, BaseThe two flat levels of a pulse or square wave (most common levels). section 15.2
TriggerThe rule (source, level, edge) that decides where t = 0 is, so captures line up. chapter 10
X-Y modeOne channel plotted against another instead of against time. section 14.4