EEE 118 1s2425 Module 2: Simulation and Prototyping PDF

Document Details

Uploaded by Deleted User

University of the Philippines Diliman

Tags

circuit topology circuit simulation electrical engineering LTSpice

Summary

This document is a module on basic circuit topology, simulation, and prototyping for electrical engineering students at the University of the Philippines Diliman. It covers topics like circuit diagrams, circuit elements, series and parallel configurations, and the use of LTSpice for circuit simulation.

Full Transcript

Module 2: Basic Circuit Topology, Simulation and Prototyping Introduction We previously learned about circuit elements and basic prototyping. We now tackle some basic configuration of these elements along with some circuit-level principles. Complex circuitry is only a combination of basic topologi...

Module 2: Basic Circuit Topology, Simulation and Prototyping Introduction We previously learned about circuit elements and basic prototyping. We now tackle some basic configuration of these elements along with some circuit-level principles. Complex circuitry is only a combination of basic topologies and can be simplified to a certain degree for ease of analysis and design. To help us analyze circuits, drawing and simulating circuits is an essential part of the circuit design process. In this module you will learn how to draw and simulate circuits in LTSpice. LTspice is a high performance SPICE simulation software, schematic capture and waveform viewer with enhancements and models for easing the simulation of analog circuits. Included in the download of LTspice are macromodels for a majority of Analog Devices switching regulators, amplifiers, as well as a library of devices for general circuit simulation. Learning Outcomes This module is divided into two parts: Circuit Topology and Circuit Simulation. After completing this module, you should be able to: Part I: Circuit Topology 1. Understand schematic diagrams of circuits 2. Identify different elements in a circuit including nodes, branches and loops 3. Identify and differentiate series and parallel configurations in a circuit 4. Interpret and convert wye and delta configurations in a circuit 5. Create equivalent circuits of simple resistive circuits Part II: Circuit Simulation 6. Draw circuits in LTSpice 7. Run different types of simulation in LTSpice 8. Analyze and interpret LTSpice simulation output 1 University of the Philippines EEE 118 1s2425 1 Module 2 Part 1: Circuit Topology 1.1 Circuit Schematic Diagram A circuit schematic diagram can be called several names such as a circuit schematic, circuit diagram, electronic schematic, or electrical diagram. Basically, it is a graphical representation of an electrical circuit. Not to be confused by simple images, a circuit schematic is composed of simplified standard symbols for electronic components, which was discussed in the previous module. It is a very useful tool for visualizing and analyzing electronic circuits. Engineers use this to design the circuits before creating the actual circuits. Figure 1: Voltage divider circuit. 1.2 Circuit Structure A circuit is a collection of circuit elements connected together to form a structure that allows current to pass through. This structure has its own parts that can be described by the following terms as shown in Figure 2. 2 University of the Philippines EEE 118 1s2425 Figure 2: Circuit elements. 3 University of the Philippines EEE 118 1s2425 1.3 Principle of Equivalence Two electrical circuits are equivalent if the two circuits have the same electrical characteristics with respect to a pair of terminals. We can simplify this by just looking at the voltage across the terminals, and the currents through terminals. In Figure 3:, if V1 = V2 and I1 = I2 , then Circuit 1 and Circuit 2 are equivalent. This also means that a simpler circuit may be used to replace a bigger circuit as long as they are equivalent. Figure 3: Principle of Equivalence. 1.4 Connection of Circuit Elements Series Connection of Circuit Elements Two or more circuit elements are said to be connected in series if the currents passing through each of them are the same. If several resistors are connected in series, they can be replaced by one resistor that has a value equal to the summation of the resistances in series as shown in Equation 1. Figure 4: Resistors in Series. Rseries,eq = R1 + R2 + · · · + Rn (1) Parallel Connection of Circuit Elements Two or more circuit elements are said to be connected in parallel if the voltage across each of them are the same. Parallel resistors can be replaced by a single equivalent resistor–the recipro- cal of the equivalent resistance is equal to the sum of the reciprocals of the parallel resistances as shown in Equation 2. 4 University of the Philippines EEE 118 1s2425 Figure 5: Resistors in Parallel. 1 1 1 1 = + + ··· + (2) Rparallel,eq R1 R2 Rn Wye - Delta Connection of Circuit Elements The names Delta and Wye come from the shape of the schematics, which resemble letters or characters. The transformation allows you to replace three resistors in a ∆ configuration by three resistors in a Y configuration, and the other way around. The resistor values will change in this transformation but the two circuits are equivalent. Figure 6: Resistors in delta (left) and wye (right) configurations. R1 R2 + R2 R3 + R3 R1 Ra = R1 R1 R2 + R2 R3 + R3 R1 Rb = R2 R1 R2 + R2 R3 + R3 R1 Rc = R3 (3) Rb Rc R1 = Ra + Rb + Rc Ra Rc R2 = Ra + Rb + Rc Ra Rb R3 = Ra + Rb + Rc 5 University of the Philippines EEE 118 1s2425 The ∆-Y drawing style emphasizes these are 3-terminal configurations. Something to notice is the different number of nodes in the two configurations. ∆ has three nodes, while Y has four nodes (one extra in the center). The configurations can be redrawn to square up the resistors. This is called a π-T configuration which is a more conventional drawing you would find in a typical schematic. The transformation equations developed next apply to π-T as well. Figure 7: Resistors in π (left) and T (right) configurations. 1.5 Source Transformation This is a circuit analysis technique for simplifying a complex circuit. You can convert a voltage source in series with a resistor to an equivalent circuit containing a current source in parallel to the same resistor (Rs = Rp), and vice versa. The value of the voltage and current sources follows Ohm’s Law. This method allows us to put certain resistors in series or in parallel so that it would be easier to simplify. Note that replacing Rload with any circuit network, no matter the complexity and as long as the circuit is still complete, this source transformation should hold true (i.e. replacing Vs in series with resistor R with current source Is in parallel with resistor R will not affect the behavior of the rest of the circuit. Vs = Is R (4) Figure 8: (Left) Voltage Source (Vs ) in series with Rs. (Right) Current Source (Is ) in parallel with Rp. 6 University of the Philippines EEE 118 1s2425 Optional (recommended): Watch these videos which discuss how to solve series and parallel circuits. Techniques for simplification may vary but you should still arrive at the same result. Resistor Circuits by Khan Academy(https://www.khanacademy.org/science/electrical-eng ineering/ee-circuit-analysis-topic/ee-resistor-circuits/v/ee-series-resistors) How to Solve Any Series and Parallel Circuit Problem by Jesse Mason (https://youtu.be /-PiB2Xd3P94) 7 University of the Philippines EEE 118 1s2425 2 Module 2 Part 2: Circuit Simulation Why simulate a circuit? Drawing and simulating circuits is an essential part of the circuit design process. Simulating the circuit allows us to have a better understanding of the behavior of the circuit and its components. Prototyping and fabrication of the actual circuit is expensive and may take a lot of time to create. Validating your design via simulation is a lot more practical and allows you to modify your design as needed before the actual building of your circuit. In this module you will learn how to draw and simulate circuits in LTSpice. LTSpice LTSpice is a high performance SPICE-based simulation software, schematic capture and wave- form viewer with enhancements and models for easing the simulation of analog circuits. Included in LTspice are macromodels for a majority of Analog Devices switching regulators, amplifiers, as well as a library of devices for general circuit simulation. Voltage Divider Circuit Figure 1 shows a voltage divider circuit with two resistors, R1 and R2. The voltage from source V1 is proportionally divided between those two resistors. The voltage for R1 and R2 are described in equations 5. R1 VR1 = V1 R1 + R2 (5) R2 VR2 = V1 R1 + R2 The voltage divider with n number of resistors can be generalized in figure 9. The voltage for the nth resistor is given by equation 6. The idea is the bigger resistor gets the bigger share of the voltage. 8 University of the Philippines EEE 118 1s2425 Figure 9: General voltage divider circuit. Rn VRn = V1 (6) R1 + R2 + · · · + Rn 2.1 LTSpice Interface The LTSpice Interface is shown in Figure 10. The keyboard shortcuts are shown in Figure 11. Familiarize yourself with both the interface and the keyboard shortcuts for ease of use of the simulator. Figure 10: LTSpice Interface 9 University of the Philippines EEE 118 1s2425 Figure 11: LTSpice keyboard shortcuts. 10 University of the Philippines EEE 118 1s2425 TUTORIAL 1: Drawing a Circuit in LTSpice 1. Use the components bar to add components to your schematic. For practice, draw the voltage divider in Figure 1. 2. Add a resistor by clicking on the resistor button (or press R). Rotate the resistor by pressing Ctrl+R. Then click it anywhere on the schematic. Add a 2nd resistor using the same method. 3. Add a voltage source by clicking on the voltage source on the toolbar or by simply pressing V. You can also rotate it if necessary using Ctrl+R. 4. Connect the components using wires. Press the Wire button on the toolbar or simply press F3 to enter “Draw Wire Mode”. Connect the components by clicking the terminal of a com- ponent and then drawing a path towards the component it should be connected to. 5. Add a GND node at the negative terminal of the voltage source. Press the GND button on the toolbar or press G, then place it on the schematic. 6. If you accidentally added a wrong component or wire, press Del to enter “delete mode”, then click on the wrong components. 7. If you have other components that are not available in the toolbar, press the op-amp symbol in the toolbar or press F2. The “Select Component Symbol” window will appear. Type the component name you need then press OK. Figure 12: Select Component Symbol. 11 University of the Philippines EEE 118 1s2425 8. Your window should look like Figure 13. Figure 13: Tutorial 1 result. TUTORIAL 2: Adding/changing values to the components 1. To add/change values, right click on the component and a window will appear. Type the value of the component and press OK. For the voltage source, you can go to “Advanced” if you want to have a different waveform (e.g. sinusoid, pulse wave, triangular wave). (a) Change resistor value. (b) Change voltage value. Figure 14: Changing component values. 2. To change the names of the components, right click on the component name and a window will appear. Type the name of the component and press OK. 12 University of the Philippines EEE 118 1s2425 (a) Change resistor name. (b) Change voltage name. Figure 15: Changing component values. 3. Use R1 = 100, R2 = 200, V1 = 3V. Your window should look like Figure 16. Figure 16: Tutorial 2 result. TUTORIAL 3: Simulating a Circuit in LTSpice 1. Press the Run button and a window for simulation settings will appear. Pick the type of simulation you want to run and enter the settings. For this practice exercise, we will only perform DC Operating Point Analysis (.op) and Transient (.tran). If you are not getting this window, go to Simulate>Edit Simulation Cmd. 13 University of the Philippines EEE 118 1s2425 Figure 17: Edit Simulation Command. 2. To perform DC op, go to the last tab of the simulation window then press OK. 3. You should now see the simulation command ".op" at the bottom of your circuit as seen in Figure 18a. Right clicking on this will also show you the "Edit Simulation Command" window if you need to change the settings. 4. Press the simulate button again to perform the simulation. It should show the voltage of all the nodes, and the currents through all the components. A window with the simulation results will appear as shown in Figure ??. (a) Tutorial 3 Circuit. (b) DC op results. Figure 18: DC op simulation. For MacOS users, you may have to perform a few extra steps to show this window. Right click on the workspace then go to View>SPICE Error Log. You can refer to this video: https://youtu.be/p-8qgdbN1_k. 5. However, the voltages are not very intuitive due to the naming scheme being used. To change the node names, press the Label Net button or press F4. Write the node name then place it on your desired node. 14 University of the Philippines EEE 118 1s2425 Figure 19: Adding node labels. 6. Label the node above R2 as “load” and the node above V1 as “source”. Then re-run the simulation. You should get the new results below with the labeled nodes. Figure 20: Final DC op results. TUTORIAL 4: Simulating Transient 1. To perform transient simulation, go back to the simulation window by going to Simulate>Edit Simulation Cmd. This time go to the transient tab (See Figure 19). 2. Input the desired simulation settings. The stop time determines how long the simulation will be. The “time to start saving data” is the time that the LTSpice will log the simulation. Note that LTSpice will always start simulating at t=0. The maximum timestep determines how granular the simulation data would be. We’ll leave the timestep as blank for now. 3. Use stop time=1, and start time =0. Press OK then run the simulation again. You should see a window similar to Figure 21. 15 University of the Philippines EEE 118 1s2425 Figure 21: Transient Analysis #1. 4. To get the data, we need to “probe” the components. To probe, just hover on the compo- nents you need data from then press. Notice that your mouse icon changes depending on the type of data (See Table 1. Table 1: Probing Components. probing the component for While pressing alt, probe the probing a node for the volt- the current through it (note component for the power age the direction shown) dissipated by the component 5. Every time you click to probe, a new waveform should show up in the other window. Note that there will be different y-axes depending on the type of value you have selected (e.g. voltage, current, power). As practice, check the values that you got previously using DC operating point and compare them with the values you are getting using transient. They should correspond to the same value since we only have a voltage source. 16 University of the Philippines EEE 118 1s2425 Figure 22: Transient Analysis #1. Probing voltage, current, and power. 6. For a more interesting transient response, let us replace the R2 with a 1m capacitor. We also change the transient simulation setting in Figure 23. Figure 23: Transient Analysis #2. Setting up. 7. Probe the capacitor voltage, current, and power. You should get something similar to Figure 24. 17 University of the Philippines EEE 118 1s2425 Figure 24: Transient Analysis #2. Capacitor transient. TUTORIAL 5: Analyzing Results 1. There would be times that we would need to analyze data from our circuits using other programs such as MATLAB, MS Excel or Google Sheets. 2. To export the data, right click on the graph and select File>Export data as text. Then select the waveform you need. 18 University of the Philippines EEE 118 1s2425 (a) Exporting data from transient waveform. (b) Select V(load) waveform. Figure 25: Exporting data from LTSpice. 3. Copy and paste the data on an empty google sheet (or any spreadsheet software). Make sure that the time is on the A column, and the V(load) data is on the B column. 4. Add a third column to compute for the theoretical value of the capacitor voltage. For our −t circuit, we can solve it using this equation: Vcap = Vinput e RC. For googlesheets, it should look something like this: =3*(1-EXP(-A2/(100*0.001))) 5. Create a chart using the data and compare the waveform from the LTSpice data and the theoretical data. You should see that the two waveforms coincide. 19 University of the Philippines EEE 118 1s2425 Learning Activities 1: Simulation Follow the exercise and provide what is being asked. When asked for the simulation output, pro- vide a screenshot of the window that pops up after running the simulation. For DC operating point, provide the window shown in Figure 20 in Tutorial 3. For transient, make sure the wave- form shown is clearly visible and labeled properly similar to Figure 24 in Tutorial 4: Simulating Transient. Zoom in or out whenever necessary. Use your best judgment on what simulation mode you need (e.g..op vs.tran, stop time, timestep). Simulation Activity 1: DC Operating Point 1 Draw the voltage divider circuit in Figure 26. Use the following values: R1=68k, R2=33k, V1=5V. Figure 26: Activity 1 Voltage Divider. 1. Without using LTSpice, compute the theoretical values for the voltages across, currents through, and power dissipated by R1 and R2. 2. Simulate the circuit in LTSpice. What are voltages across, currents through, and power dissipated by R1 and R2? Include a screenshot of the circuit used and your output window from LTSpice showing all voltages and currents in that operating point. Ensure you have labeled all your nodes properly such that they are identifiable with the output screenshot. 3. Add another resistor R3 parallel to R2 (see Figure 27), compute the theoretical values for the voltages across, currents through, and power dissipated by R1, R2, and R3. 20 University of the Philippines EEE 118 1s2425 Figure 27: Resistor Circuit. 4. Simulate this resistor circuit in LTSpice. What are voltages across, currents through, and power dissipated by R1, R2, and R3? Include a screenshot of the circuit used and your output window from LTSpice showing all voltages and currents in that operating point. En- sure you have labeled all your nodes properly such that they are identifiable with the output screenshot. 5. Compare the theoretical values and the simulation values. Are they similar or different? Why or why not? Simulation Activity 2: DC Operating Point 2 1. Draw the circuit below in LTSpice. Make sure you have the correct node names. Figure 28: More Complex Resistor Circuit. 21 University of the Philippines EEE 118 1s2425 2. Simulate the circuit in LTSpice. Include a screenshot of the circuit and the output window in LTSpice. Get the following values: Current through, voltage across, and the power delivered by the voltage source. Current through, voltage across, and the power dissipated by each of the resistors. Simulation Activity 3: Transient Analysis 1. Draw the RC circuit shown in Figure 29. For the voltage source V1, use a 0-5V square wave with frequency of 1kHz. Figure 29: RC Circuit. 2. Plot the the following waveforms: Input Voltage V1 Voltage across R1 Voltage across C1 Simulation Activity 4: More Complex Circuits Practice your LTSpice drawing and simulation with more complicated circuits. Make sure you use the correct components including the model for the diodes and op-amps. Note: Use transient simulation. Change the simulation settings (including stop time) such that the waveforms are clearly seen. Zoom in or out when necessary. 1. Draw the Cascade of Diode Circuits below. For the simulation settings, use ".tran 20m". Show the voltage waveforms of V1, Vclamp, Vrec, and Vsmooth. Put the screenshots of the waveforms in your answer sheet. 22 University of the Philippines EEE 118 1s2425 Figure 30: Diode Circuit. 2. Draw this non-inverting summing op-amp circuit. Use the same values shown below. For V1, use a sine function with amplitude of 2 and frequency of 500Hz. For V2, use a pulse function with amplitude of 2, Trise and Tf all of 1n, Ton of 0.5m, and period of 1m. Set the stop time of your simulation such that it shows at least 5 cycles. Show the waveforms of V1, V2, and Vout. Put the screenshots of the waveforms in your answer sheet. Figure 31: Op-Amp Circuit. 23 University of the Philippines EEE 118 1s2425 3 Module 2 Part 3: Circuit Prototyping 3.1 Basic Circuit Elements Now that you know what the basic electrical quantities are from the last module, let’s identify what are the basic circuit elements. An electric circuit basically consists of a voltage source, a load, and a path for current between the source and the load. In this section, these elements will be discussed. A compilation of common schematic elements are shown in Figure 32. Figure 32: Standard Symbols for Common Electrical Components. 24 University of the Philippines EEE 118 1s2425 3.1.1 Ideal Sources Ideal sources (often called active sources) supply energy or power into a circuit. We have two ideal sources: a voltage source and a current source. An ideal voltage source (also called a power supply) is an active device that supplies a constant voltage across its two terminals, regardless of the current through it. The symbol for a voltage source is in Figure Figure 32f. In some cases, they are also drawn as a cell in 1g, with the longer side as the positive terminal, and the shorter side as the negative terminal. More often, it is drawn as three cells together, constituting a battery (Figure 32h). In contrast, an ideal current source delivers a constant current regardless of the voltage across it. Its symbol is shown in Figure 32i. 3.1.2 Loads A load is an electrical component on which work is done by the current through it. The electrical energy is converted into another form of energy and dissipates power. For example, a battery (voltage source) is connected to a light bulb (load). The light bulb converts electrical energy into light energy. They are also called passive devices, because they don’t generate energy but can store or dissipate it. Examples of these passives are resistors, capacitors (Figure 32k), and inductors (Figure 32l). In this module, we’ll only focus on resistors. In an electric circuit, a resistor can also be used as a load. A resistor is a two-terminal device that is designed to have a certain amount of resistance. It does not store, but dissipates energy. You can draw resistors as a zigzag (Figure 32d), or as a box (Figure 32e). Potentiometer A potentiometer is a manually adjustable variable resistor with 3 terminals. Two of the terminals are connected to the opposite ends of a resistive element, and the third terminal connects to a sliding contact, called a wiper, moving over the resistive element. The potentiometer essentially functions as a variable resistance divider. The resistive element can be seen as two resistors in series (the total potentiometer resistance), where the wiper position determines the resistance ratio of the first resistor to the second resistor. 25 University of the Philippines EEE 118 1s2425 Figure 33: Left: Potentiometer Physical Image (taken from: https://teachwithict.com) Right: Po- tentiometer Circuit Symbol 3.1.3 Wires Wires are electrical elements that connect electrical components such as resistors and voltage sources. Ideally, wires have zero resistance. In circuit diagrams, wires are modeled to be simple lines (Figure 1a). When we add more components to a circuit, we oftentimes need to draw wires on top of other wires which may result in confusion as to which components are connected. To avoid this, we use the symbols in Figure 32b and 32c. An electric circuit can be represented by what we call a schematic. 3.2 Introduction to DC Power Sources A DC power supply can be configured as either a voltage or a current source by turning the knobs or by inputting the desired voltage or current in the case of the programmable DC power supply. Most DC power supplies have two modes: 3.2.1 Constant Voltage Mode The constant voltage (CV) mode is a mode that provides a constant voltage even if the load condition changes. This mode makes the power supply act like a voltage source. To operate the power supply in constant voltage (CV) mode, simply set the desired voltage in the power supply and set a current value higher than your expected current from the power supply. 26 University of the Philippines EEE 118 1s2425 3.2.2 Constant Current Mode The constant current (CC) mode is a mode that provides a constant current even if the load condition changes. This mode makes the power supply act like a current source.To operate the power supply in constant current (CC) mode, simply set the desired current in the power supply and set a voltage value higher than your expected voltage from the power supply. Learning Activities 2: Hardware Prototyping Before proceeding, please also review topics from the previous module which include but are not limited to resistor and resistor color code, breadboard connections, and proper handling of equipment such as DC power supplies, signal generators, oscilloscopes, and multimeters. Hardware Activity 1: Constant Current and Constant Voltage This activity will show you the difference between the two modes of the power supply. Figure 34: Test Circuit. 1. Before you connect the circuit, set the power supply voltage to 3V and the power supply current to 3mA. 2. Calculate the following: Current going to the resistor when the power supply acts like a voltage source. Use the given voltage to compute the current. Voltage across the resistor when the power supply acts like a current source. Use the given current to compute the voltage. 3. Connect the power supply with the setting defined to the circuit. Measure the voltage and current of the resistor. Comparing the actual measurements and the calculations in Exercise 3, what is the function of the power supply? 27 University of the Philippines EEE 118 1s2425 4. Now, we try configure the power supply with another setting. Remove the power supply and set the power supply voltage to 3V and the power supply current to 1mA. 5. Calculate the following: Current going to the resistor when the power supply acts like a voltage source. Use the given voltage to compute the current. Voltage across the resistor when the power supply acts like a current source. Use the given current to compute the voltage. 6. Like earlier, connect the power supply with the setting defined to the circuit. Measure the voltage and current of the resistor. Comparing the actual measurements and the calcula- tions in Exercise 4, what is the function of the power supply? Hardware Activity 2: Resistor Circuits 1. Build the resistor circuit from Simulation Activity 2 (Figure 28). 2. Measure the following: Voltage across and current through each resistor. You may use Ohm’s law. Compute the power dissipated by each resistor 3. Compare the values you got here and the values from the simulation. Are there any dis- crepancies? Why or why not? Hardware Activity 3: RC Circuits 1. Build the RC circuit from Simulation Activity 3 (Figure 29). 2. Sketch or take a photo of the specified voltage waveforms by probing them with the oscil- loscope. Show at least 2-3 cycles for all waveforms. Voltage across V1 Voltage across R1 Voltage across C1 3. Compare the waveforms you got here and the ones from the simulation. Are there any discrepancies? Why or why not? 28 University of the Philippines EEE 118 1s2425 Summary The first part of this module discussed circuit topology and circuit diagrams. We discussed how to identify different elements in a circuit such as nodes, branches, and loops. We also learned to identify and differentiate series and parallel configurations. We also discussed equivalent circuits. The second part discusses circuit simulation in LTSpice. We learned how to run different types of simulations and how to perform measurements on the circuit. We also learned how to analyze and interpret the results of our simulations. The last part discusses a bit more about the actual hardware implementation of a circuit. References McAllister, W. Delta-Wye resistor networks. Resistor circuits. Available online at https: //www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/e e-resistor-circuits/a/ee-delta-wye-resistor-networks Mason, J. [Jesse Mason]. (2015 March 31). How to Solve Any Series and Parallel Circuit Problem. Youtube. https://www.youtube.com/watch?v=-PiB2Xd3P94 Khan Academy. Accessed August 2021. https://www.khanacademy.org. Analog.com. 2020. Ltspice | Design Center | Analog Devices. [online] Available at: https: //www.analog.com/en/design-center/design-tools-and-calculators/ltspice-simulator.h tml. Accessed 8 September 2020. 29

Use Quizgecko on...
Browser
Browser