Documentation

Differential input filter

Compare differential-signal gain and common-mode rejection in an RC input filter.

Analog

Run the transient view first, then compare the Differential-mode gain and Common-mode gain views.

Editor showing the Differential input filter SPICE example as an unsaved schematic.
Differential input filter opens as an editable, unsaved schematic.

Open and run

  1. Open Examples from the Home ribbon.
  2. Choose Differential input filter.
  3. Open Simulate and choose Setup to review the analyses.
  4. Choose Run for one analysis or Run All for the complete configured set.
  5. Select a matching Scope view after the run. Use Save as sheet to keep the example or Discard to close it.

Sheets, analyses, and Scope

Differential input filter

#

Setup: Transient and CM/DM gain

AnalysisConfiguration
Transient
  • Step 1u
  • Stop 3m
  • Initial conditions Disabled
Differential-mode gainAC
  • Sweep dec
  • Points 100
  • Start 10
  • Stop 10Meg
Common-mode gainAC
  • Sweep dec
  • Points 100
  • Start 10
  • Stop 10Meg

Scope views and expected results

Differential-filter response

Analysis: Transient

Differential inputs
  • V(inp)
  • V(inn)
Filter and amplifier outputs
  • V(fp)
  • V(fn)
  • V(vout)
  • V(vadc)
Readouts
  • ADC input averageAverageV(vadc)
  • ADC input ripplePk-PkV(vadc)
  • Filter output fp swingPk-PkV(fp)
  • Filter output fn swingPk-PkV(fn)
Differential-mode gain
AC Response
Differential-mode gain
  • DM gainV(vout)/(V(inp)-V(inn))
Common-mode gain
AC Response
Common-mode gain
  • CM gainV(vout)/((V(inp)+V(inn))/2)

Python scripts

These scripts are included with the example. Review trusted project code before choosing Run.

CM DM sweep.py

Default sheet: Differential input filter

# Sweep the filter's differential (DM) and common-mode (CM) response.
sheet = get_sheet("Differential input filter")
dm_sheet = sheet.override(V1=ac_source(0.5), V2=ac_source(0.5, phase=180))
cm_sheet = sheet.override(V1=ac_source(1), V2=ac_source(1))
dm = dm_sheet.ac("10", "10Meg", save="V(vout)")
cm = cm_sheet.ac("10", "10Meg", save="V(vout)")

fig, (mag, ph) = subplots(2, 1, title="Differential filter CM/DM response", sharex=True)
mag.set(title="Magnitude", ylabel="|vout| (dB)", xscale="log")
ph.set(title="Phase", xlabel="Frequency (Hz)", ylabel="Phase (deg)", xscale="log")
mag.plot(dm.v("vout").db, label="DM gain")
mag.plot(cm.v("vout").db, label="CM gain")
ph.plot(dm.v("vout").phase, label="DM")
ph.plot(cm.v("vout").phase, label="CM")
fig.show()
Tran + AC sweep.py

Default sheet: Differential input filter

# One script, two analyses: transient as drawn, then a differential AC drive.
sheet = get_sheet("Differential input filter")
tran_run = sheet.tran("3m", step="1u", save=["V(inp)", "V(inn)", "V(vout)"])
ac_sheet = sheet.override(V1=ac_source(0.5), V2=ac_source(0.5, phase=180))
ac_run = ac_sheet.ac("10", "10Meg", save="V(vout)")

fig, (t_ax, f_ax) = subplots(2, 1, title="Differential filter tran + AC")
t_ax.set(title="Transient", xlabel="Time", xformat="time", ylabel="Voltage (V)")
f_ax.set(title="DM frequency response", xlabel="Frequency (Hz)", ylabel="|vout| (dB)", xscale="log")
t_ax.plot(tran_run.v("inp") - tran_run.v("inn"), label="inp-inn")
t_ax.plot(tran_run.v("vout"), label="vout")
f_ax.plot(ac_run.v("vout").db, label="DM gain")
fig.show()