A bridge across a river with trees on the other side.

Bridge the Gap: Integrating Digital Filters into Your Analog LTspice Simulations: Part 2 of 3

Let’s bridge the gap and learn how to simulate analog circuitry and digital filters together. I will continue to explore digital filter models in LTspice by combining them with analog circuit elements, to demonstrate the value of adding a digital filter to the output of an analog signal chain in LTspice.

Picking up where I left off in the last blog post, let’s explore a couple of circuits using AC analysis. See Figure 1.  To follow along, open the FIR Filter – AC and Noise.asc file in the .zip file attached.  For LTspice to find all the necessary files, you will need to unzip the .zip file before opening the schematic file.

FIR Filter - AC and Noise.zip

 FIR Filter Circuit

Figure 1: FIR Filter Circuit (top) and RC Filter + FIR Filter Circuit (bottom)

Start with a Working .AC Simulation

When looking at the example schematic, any directives in blue are commented out.  Let’s start by examining the .AC simulation. Select Simulate -> Run/Pause from the menu to run the simulation specified in the schematic .AC directive.  Click the OUT1 node in the schematic to plot V(out1) (Figure 2, in green).  V(out1) shows the response of the FIR filter model. Refer to Incorporating Digital Filter Modeling in LTspice Simulations to review the details of this circuit and simulation results.  Right-click on the secondary axis to disable the phase plot, and right-click on the plot window to Add a Plot Pane Above or Below the existing plot pane.

Observe the Combined Analog + Digital Filter Response

The bottom circuit consists of an RC filter (R1 and C1) followed by the same FIR filter.  Add a plot pane and click on IN2 and OUT2 to observe the frequency response of the RC filter as well as the combined response of the RC filter + FIR filter (Figure 2, in blue and red).

 Plotting the Frequency Response of Digital and Analog Filters

Figure 2: Plotting the Frequency Response of Digital and Analog Filters

Add another plot pane and click on OUT1 and OUT2 to add both filter outputs to the bottom plot pane.  Right-click on the plot label V(out2) and modify the expression to plot V(out2)/V(in2). See Figure 3.  V(out2)/V(in2) is the frequency response of the FIR filter alone (without the influence of the RC filter), which is identical to V(out1) (Figure 2, in green and yellow).

 Plotting an Expression to Isolate the Response of the Digital Filter

Figure 3: Plotting an Expression to Isolate the Response of the Digital Filter

Examine the .NOISE Simulation Waveform

Now that we’ve verified the .AC simulation is working as expected, let’s switch to a .NOISE simulation. Refer to this blog post for a quick intro to .NOISE simulations.

Shift-click on the .AC directive to comment it out, and shift-click on the .NOISE directive immediately below it to make that directive active.  The active .NOISE directive should be

.noise V(OUT2) V2 dec 1000 10 {10*Fs/2}

where V2 is the input source, V(OUT2) is the output node, and the frequency sweep parameters are identical to the previous .AC directive parameters.  Close the waveform window (to reset the plots and number of panes) and run the simulation.  Click on OUT2 in the schematic to plot the noise results.  Ctrl-click on the waveform title V(onoise) to display the integrated RMS noise for the frequency range plotted (Figure 4). 

Recall from "Turning Up the Noise"  blog, the only source of noise in this circuit is R1.  The noise from R1 is being shaped by the RC filter formed by R1 and C1 combined with the digital filter.

 Plotting the Spectral Noise at OUT2, and Calculating the Integrated Noise

Figure 4: Plotting the Spectral Noise at OUT2, and Calculating the Integrated Noise

Conclusion

By modeling both analog and digital filtering circuitry in LTspice, you can easily observe the overall frequency response and noise of the combined circuit.  This allows easy analysis of expected performance and evaluation of possible design trade-offs.  Stay tuned as I explore this topic with more complex circuits in future blog posts!

Read all the blogs in LTspice Digital Filters series.

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.