> For the complete documentation index, see [llms.txt](https://docs.anthriq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.anthriq.com/xbud/experiments/measure-cmrr.md).

# Measure CMRR

Common-mode rejection ratio (CMRR) is the figure that decides whether a biosignal amplifier is usable. Mains interference arrives on every electrode at once, as a common-mode signal, while the biopotential appears as a difference between electrodes. A differential amplifier amplifies the difference and rejects what is common. CMRR states how well.

This experiment measures it on the bench with a signal generator and no subject. It is the characterisation lab that explains every artefact seen in the other experiments.

Allow about 30 minutes.

> **Note:** No subject is involved. Nothing in this procedure connects to a person.

## Understand the measurement

CMRR is the ratio of differential gain to common-mode gain, expressed in decibels:

```
CMRR (dB) = 20 · log10( A_diff / A_cm )
```

Two properties of that definition do most of the teaching work.

**CMRR is a function of frequency, not a single number.** A datasheet quotes one value, usually at DC or at a low frequency, and a reader reasonably assumes it holds everywhere. It does not. Every element that is not perfectly matched between the two legs of the amplifier contributes a frequency-dependent error term, so the measured curve slopes.

**CMRR is a property of the amplifier&#x20;*****and its source*****.** The same front-end measures differently on a balanced source than on the mismatched impedances two real electrodes present. A number quoted without its source conditions is not reproducible.

## What you need

* xBud, its DAQ, and BXI Studio, wired as in [Get started with xBud](/xbud/technical-guide.md)
* A function generator
* Two matched resistors, nominally 51 kΩ, plus a few mismatched values for the last part
* Jumper leads to the xBud electrode inputs

## Set up the measurement

The naive approach, measuring the differential gain and then the common-mode gain and dividing, requires knowing the amplifier's gain accurately, because it enters both measurements and any error in it propagates into the result.

A **node-referenced** measurement avoids that. Tie the monitoring input into the same common node that drives the inputs under test, so the monitor sees the stimulus *through the same gain* as the channels do. The gain then appears in both the numerator and the denominator of the ratio and cancels exactly. No calibration constant enters the result, and the measurement does not depend on knowing the gain at all.

1. Tie the electrode inputs and REF to a common node.
2. Drive that node from the generator through the matched resistor pair.
3. Bring one channel into the same node as the monitor.
4. Record, and read the amplitude at the drive frequency from the **Fast Fourier Transform**.

> **Tip:** Keep the drive amplitude large enough that the rejected residual stays above the noise floor, and small enough that nothing in the chain clips. xBud's gain is fixed at 100×, so headroom is set by the drive level and the DAQ input range, not by a gain control.

## Sweep the frequency

Repeat the measurement across the band you care about rather than at one frequency. A dozen points spaced logarithmically from about 1 Hz to 100 Hz is enough to show the shape.

Record at each point:

| Quantity                        | Why it is needed                                     |
| ------------------------------- | ---------------------------------------------------- |
| Drive frequency                 | The x-axis; CMRR is a curve                          |
| Drive amplitude                 | Sets whether the residual is measurable              |
| Residual at the drive frequency | The measurement itself                               |
| Source impedances               | CMRR is a property of the amplifier *and* its source |
| DAQ and input range             | The chain bounds what can be measured                |

## Read the signal

Before computing anything, look at what the recording contains. Two passes at one frequency make the measurement legible.

**Differential pass.** Drive one input against REF. The trace is a clean sine at the drive frequency, and its amplitude divided by the drive amplitude is the differential gain. With xBud's fixed 100× gain, that ratio should land near 100, a check that the wiring and the input range are right before the rest of the measurement is worth taking.

**Common-mode pass.** Tie the inputs together and drive them as one node. The same sine now arrives on both legs at once, so the amplifier should reject it. What remains is the residual, and it is much smaller, often close to the noise floor.

In the **Fast Fourier Transform** both passes show a single narrow line at the drive frequency. The measurement is the difference in height between those two lines, in dB. Reading it in the spectrum rather than from the time-domain trace is what makes a small residual measurable: the narrow band rejects everything that is not at the drive frequency, including the noise the residual would otherwise be buried in.

> **Tip:** If the residual disappears into the noise floor, raise the drive amplitude rather than reaching for gain, which is fixed. Keep the differential pass at the same drive amplitude so the two passes stay comparable.

## Plot the sweep

Plotted against frequency, the measurement is a rising line rather than a flat one.

![Measured CMRR against frequency from about 1.5 to 100 Hz, rising from roughly 13 dB to 49 dB, with a model curve through the points.](https://2761951758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhtBZnSGOC4EMhU3nc5oM%2Fuploads%2Fgit-blob-bbea42252e95995ef6453d2b424ff7dff96856e6%2Fcmrr-vs-frequency.svg?alt=media)

> **Note:** The sweep above was measured on an Anthriq laboratory front-end, not on xBud. It is reproduced here because it shows the method and the shape of the result clearly. The mechanism generalises; the values belong to that board. xBud's own CMRR is marked `_To be measured_` in [Specifications](/xbud/specifications.md): measuring it is the point of this lab.

## Observe the result

Three things in that figure are worth reading carefully.

**CMRR rises with frequency, at about 6 dB per octave.** This is the opposite of the common intuition that rejection degrades as frequency rises. Here the worst rejection is at the *low* end: about 13 dB near 1.5 Hz against about 42 dB at 47 Hz.

**The line through the points has no fitted parameter.** It is the response implied by a difference in high-pass corner frequency between the reference leg and the signal leg, and both corners were measured independently beforehand. Nothing was tuned to make it fit; it tracks the measurement to about 2 dB rms across the whole sweep.

**The dominant error term is filter mismatch, not electrode imbalance.** That sweep was taken with no electrodes attached at all, so electrode impedance cannot explain it. Component tolerance between the two legs sets the in-band floor, and electrode imbalance adds to it.

## Show what the source contributes

The measurement above characterises the amplifier on a balanced source. Real electrodes are never matched, and the imbalance converts common-mode signal into a differential one that no amount of amplifier quality can reject.

Repeat the measurement with a deliberately mismatched pair, for example 5 kΩ against 50 kΩ in place of the matched 51 kΩ resistors. The residual grows and the effective CMRR falls below the balanced figure.

| Condition                    | Expected effect on CMRR                        |
| ---------------------------- | ---------------------------------------------- |
| Matched source impedances    | Best case; the amplifier's own figure          |
| Mismatched source impedances | Markedly degraded                              |
| One electrode poorly seated  | Equivalent to a large mismatch on that channel |

This is why a single poorly seated electrode degrades one channel while every other channel looks clean, and why contact checks come before recording.

## Draw the conclusion

A single CMRR number is not a description of an amplifier. The measurement is a curve, its worst point is at the low-frequency end rather than at mains, and its in-band limit here is set by component tolerance between the two legs rather than by anything at the electrodes. Electrode imbalance then adds to that floor rather than creating it.

Return to the other experiments with this result in hand.

* The low-frequency end of the curve is the worst-rejected region, which is where drift and movement artefact live. That is the practical argument for a high-pass filter in the viewing chain rather than a preference for tidy traces.
* Mains interference sits where rejection is comparatively good, which is why a 50 Hz band that survives is usually evidence of a contact problem rather than an amplifier limit.
* A CMRR figure measured through the DAQ bounds the result. The NI mioDAQ specifies 100 dB of its own, so a number approaching that is characterising the chain rather than xBud.

## Report the result

State the number with the conditions that produced it: the test frequency, the drive amplitude, the source impedances, the DAQ, and the input range. A CMRR quoted without them is a claim about nothing: the same amplifier measures differently on a different source, at a different frequency.

Report the sweep rather than a single point where you can. If one number is needed, give the frequency it was measured at alongside it.

## Take it further

**Match the legs deliberately.** If the in-band limit is filter mismatch, then hand-matching the components in the two legs should lift the curve at every frequency, including at mains. That is a sharp, falsifiable prediction and a good student project.

**Noise floor.** Short all inputs to REF, record a baseline, and compute the power spectral density. This gives the input-referred noise in µV RMS over a stated bandwidth, and pairs with the CMRR measurement as a complete characterisation of the front-end.

**Interference in practice.** With the inputs shorted, move a mains-powered device near the leads and watch the 50 Hz component rise. Then separate the leads and watch it fall.

## Next steps

* [Specifications](/xbud/specifications.md): the figures this lab measures
* [Choose a visualization](/xbud/technical-guide.md#choose-a-visualization): reading a narrow peak in the spectrum
