Let’s Get SPICE-y
Simulation Program with Integrated Circuit Emphasis (SPICE) is a universally-used engine used to run accurate analog circuit simulations. It mimics the circuit analysis you’d typically do by hand (e.g., node analysis, sinusoidal-steady-state) and does it through numerical calculations. SPICE is a really fast way of simulating a circuits function and can be easily scaled to very complex schematics.
There are many ECAD tools that are capable of running SPICE - in fact, both Altium and KiCad have built-in SPICE-solvers! However, for this lab, we’re going to utilize LTspice which is a very popular tool and conveniently contains the models of many components that we’d like to simulate.
LTspice Setup
Ensure you have LTspice installed, as you should have already done during the ECAD setup. Go ahead and open it up and create a new schematic.
The upper toolbar contains many of the functions you’ll need to use as you draw out a circuit. Luckily for us, LTspice comes with keyboard shortcuts that allow us to do those functions quickly and easily. Every power user of LTspice uses only the keyboard shortcuts
Some (if not all) Mac users may not have the top toolbar in LTspice, so using the keyboard shortcuts might be crucial to success in using the program. Below are the default shortcut maps for the Schematic and (as we’ll use it later) WaveForm views respectively
LTspice Schematic
Creating circuits in LTspice is much like doing so in KiCad or Altium: you place down your components, right-click on it to change the component’s value, and finally use nets/wires to connect parts together. An example of a complete circuit is shown below:
There are some important things to note when creating/simulating any SPICE circuit:
- Since SPICE does a sort of nodal analysis when computing DC voltages, there must always be a ground symbol connected in the circuit somewhere in order to denote the zero-volt reference.
- Components should all have values (unfortunately, no units are shown next to the values for components) and each have unique reference designators.
- A SPICE directive need be placed. These determine how the SPICE simulation will be run. They take the form of lines of text in the middle of the schematic, such as the
.tran 3m
shown in the previous photo.
After a simulation is run, you can click on any node to have the voltage plotted at that node plotted, or you can select any component to have the current flowing through that component plotted
SPICE Directives
SPICE directives determines how the circuit simulation will be done and what electrical measurements will be provided. This is exactly akin to how you might choose to do a nodal analysis on a circuits to find its branch currents
To add/change the SPICE directive in LTspice, simply go to Simulate->Edit Simulation Cmd
or right-click on any existing SPICE directive on the schematic.
There are many SPICE directives, below are some brief descriptions:
Transient Analysis
Transient is a time-domain simulation that shows how the circuit performs as time passes, which is great for analyzing circuits that have some specifc timing-related features or contain nonlinearities.
This directive is like creating a bunch of differential equations to model the circuit, then numerically determining and plotting their solutions.
To perform a transient simulation, select it in the Edit Simulation Command dialog box and enter a stop time. We recommend setting the stop time to about 5-10x the period of your signal. In the example below, a transient simulation is being performed for 1 us, which could be for the purposes of viewing a 10 MHz signal.
Running this transient analysis for an example RLC-circuit provides us with a time-domain signal (like viewing through an oscilloscope):
DC Analysis
DC Analysis is a steady-state simulation that determines all of the DC voltages and currents every node and branch, respectively, in the circuit. This is the same thing as manually applying the nodal method to solve out a DC circuit.
To perform a DC simulation, select “DC Sweep” in the Edit Simulation Command dialog box. Note that DC simulations are often done with a variable of voltage/current source being swept in value. In the example below, the voltage source V1
is kept at a constant 1 V.
Running this DC analysis for an example RLC-circuit provides us with a DC node analysis:
AC Analysis
AC Analysis is a frequency-domain simulation that also runs in steady-state. The simulation first performs a DC analysis to determine how circuit elements are biased. It then applies and measures the effect of inputting some high-frequency signal, utilizing the small-signal assumption in the process.
This is equivalent to conducting a nodal analysis to determine the bias levels of components in a circuit then performing a sinusoidal-steady-state analysis on the circuit. A transfer function is the result, which can be plotted to show how the input signal’s magnitude and phase is affected in the circuit.
To perform an AC simulation, select “AC Analysis” in the Edit Simulation Command dialog box. Then enter in the parameters for a frequency sweep.
For some signal frequency range of interest, say 20 kHz to 200 KHz, it is always a good idea to have the frequency sweep be an octave or so wider on both ends, say 10 kHz to 1 MHz. This is done in the example below over 100 points.
The result of an AC analysis will typically be a Bode plot showing the frequency response of our circuit, such as the one below for the example RLC-circuit (the solid line is magnitude and dashed line is phase):
Designing the Audio Amplifiers
In this lab, you’re going to utilize SPICE simulation to design the audio amplifiers for the FM radio.
Background
Outputted out of the FM radio receiver chip (the Si4844-B20
) is two independent audio signals that represent the left and right stereo sound paths. Each path has a maxmimum output voltage amplitude of 80 mVrms (or 113 mVp) and an ouput impedance of 10 kOhm. The speaker (the CMS-30204-18L250
) we’d like to use for the FM radio has an 8 ohm impedance, with a maximum input power of 1 W. Finally, the op amp (the AD8592
) we’re using has a maximum output current of 250 mA and is limited to a 5 V DC supply.
Amplifier Design
Your goal is to design a fixed-gain inverting opamp amplifier using the AD8592
that can amplify and convert the max signal amplitude voltage of 80 mVrms from a 10 kOhm source into a 200 mA peak signal amplitude current through an 8 Ohm speaker. The frequency range by that the amplifier should be capable of achieveing for should range from 500 Hz to 10 kHz.
We recommend you recreate the following testbench for the amplifier. As it is depicted, it will perform a transient simulation, inputting a 20 kHz sine wave into the amplifier over a 200 us duration.
Some important notes for regarding the testbench:
-
The left side with
V2
andR4
represent the Thevenin equivalent output of the FM radio receiver chip, whileC1
andL1
are used to provide DC-blocking and some low-pass filtering. -
The right side consists of
C2
, a DC-blocking capacitor, as well asR2
, which represents a speaker. -
The
SHDN
net should connect to the shutdown pin of theAD8592
(in order to turn it on) -
Use only the
VCC
net for all your 5 V power supply needs - that way you’re only using one ideal voltage source, which helps in quickly determining the total current draw from the power supply. -
The
inc AD8592.cir
SPICE directive is used to import the SPICE model file for theAD8592
, which it expects to be in the same folder/directory as the file for the LTspice schematic itself.
Op Amp Symbol/Model
Place both the symbol and model file into the same folder/directory as the LTspice schematic file. Then in the component selection window, you can use the top dropdown to view for symbols in the same folder/directory as the LTspice schematic itself. In doing so, the AD8592
should appear for you to use.
Implementing your Design
Once you feel happy about the performance of your amplifier you’ll need to put it into your FM radio schematic. Within the AudioAmplifier
sheet of your schematics, transfer over the audio amplifier you designed in LTspice. While doing so, please keep in mind the following notes:
- Having used the LTspice testbench mentioned previously, import the design exactly, except omitting the parts meant only for testing:
V2
,R4
, andR2
. - The global power net
5.0V
should used as the voltage supply for the amplifier. Change theVCC
net that was used in LTspice to this. - For KiCad users, you can use this symbol for the
AD8592
: AD8592 KiCad Symbol - Finally, connect the input and output of your amplifier to the
AUDIO_IN
andAUDIO_OUT
ports on the sheet, respectively.
After you’ve done this, you’re all finished! You just designed the audio amplifiers for your FM radio and implemented them into your PCB schematic. Save and upload your work (just PCB project files, LTspice files not needed) by:
-
Altium users: be sure to select
Save to Server
in the Projects Manager toolbar so that your work is uploaded to the course’s Altium workspace! -
KiCad users: be sure to save to commit to main and push to origin so that your local changes get saved to your GitHub repository!
Please do so by midnight so that course staff can grade your work.