Black Box Electronics An Introduction to Applied Electronics for Physicists 5. Pushing the Limits With Spice University of Toronto Quantum Optics Group Alan Stummer, Research Lab Technologist June, 2005 Spice Programs • 5 Spice*: Free for non-commercial use with basic version, simple to use, effective, easy to add new models. www.5spice.com • Linear Technology – LTSpice et al: Free, heavy bias towards Linear Tech’s products, hard to add new models. www.linear.com • National Semiconductor – WebBench: Free, online only, exclusively National’s components. Limited circuits. www.national.com • Kemet: Free, exclusively Kemet’s capacitors in frequency domain only but very simple and useful. www.kemet.com • PSpice: Top price, most features, slightly bloated, need both models and symbols. * 5 Spice is used in this talk. 2 Common Simulations • DC Bias: Steady state V and I at t=-0. All capacitors ignored, all inductors shorted. No graphs, tabular results only. • DC: Same as “DC Bias” except one or more DC sources may be swept through a voltage range. • AC: Frequency domain. Sweep one or more AC sources through a frequency range. • Transient: Time domain. Between fixed times. Can also sweep components’ parameter(s). • Monte Carlo: Time or frequency domain with random selection of any or all component parameters within their specified tolerances. Not available on 5 Spice. 3 Spice Sequence 1. 2. 3. 4. 5. Draw schematic. Select type of simulation. Run simulation. Adjust component values. Repeat with other types of simulation. 4 Adding Components Move the mouse over the icon to select supplies, click on fixed DC. 5 Add DC Supply Wires Passives Actives Opamps etc. Supplies Test Points Text, nets Logic Drag and drop a Constant Voltage (AKA DC) symbol. Double click to give name and set voltage. 6 Connect Supply Add ground and supply net, rename net. Right click, move label field to more esthetic location. 7 Add Photodiode Model Add Current Source and capacitance to simulate a photodiode. 8 Add Generic Opamp From here… …add opamp subcircuit symbol. Mirror and rotate for standard orientation. 9 Select LM324 Double click symbol. Set “ref des”, select LM324 model. This is the model file. 10 Connect Opamp Add supply and ground. Connect to PD. Add RC feedback. 11 Add Test Point Monitor this node, call it “Monitor”. 12 DC Bias “Sanity” Check Select Analysis Dialog (F8), select DC Bias analysis. Run analysis. Read tabular results or with mouse over node. 13 Define Photodiode Double click Ipd symbol. Add the DC Analysis parameters. 14 Select DC Analysis Select New Analysis, add DC Analysis, can rename it. Enable Ipd source. 15 Select DC Analysis On Graph tab, select the Monitor test point and use left axis. Defaults to autoscaling. Hit Enter or Ok and then Run (F9). 16 Run DC Analysis Run the DC analysis. Move the cursor to read XY values. OOPS! Discontinuity at low power, poor saturation. 17 Try Another Opamp – AD8605 Double click and try another opamp, the AD8605. 18 DC Analysis With AD8605 Note good linearity at low levels and great output saturation. Keep the AD8605 opamp. 19 Add Second Stage Copy first stage, paste as second, change ref des on all parts. Rescale Ipd. Second stage voltage gain is +101. Add realistic load. 20 View DC Analysis Note slight tilt in second stage at low power and output saturation with the added 1KΩ load. This circuit is acceptable for DC performance! 21 Prepare Transient Analysis Double click Ipd. Select Transient analysis, Piecewise waveform, define the waveform. Note double 10Sec as 10- and 10+. 22 Transient Analysis Select Transient analysis. Enable the Ipd source, set start and finish times plus optional step interval time, enable the Helpers, setup the Graph. 23 Run Transient Analysis Works, but is very very slow, takes 10 seconds to be stable. Note manual scaling of both Y-axis. 24 Adjust Circuit Timing Change caps to 100 times smaller, adjust Ipd timing to 100 times faster. Do same to Analysis Dialog, now 0 to 200mS. 25 Final Transient Analysis Reasonable timing, reasonable gain. This circuit has been adequately simulated. 26 High Speed Crash Like before, component values changed for 100 times faster again. Note step of 1st stage at start, but hidden (damped) by 2nd stage. Too fast! 27 Extending the Model Add a voltage source to simulate a range of Vio (input offset voltage). This one is swept ±0.5mV in 25uV steps. 28 Extended Model Results Note how 2nd stage output crosses Y-axis below zero, and how Spice already added some Vio. May want to add an offset to always force above zero or can just ignore. 29 Trouble in Paradise No convergence! Spice is at fault, not the circuit. Try opening the Analysis Dialog (F8) and change setup until it works. Try the Project Dialog Wizard. Try minor changes to component values. Good luck! 30 Ω The End Ω Thanks for coming! And thanks for the loan of the laptop, Paul! 31