SIMULATOR TUTORIAL 1. Introduction: A circuit simulator is a software program used to get a good approximation of how the circuit will perform when constructed. This enables us to easily understand and design a circuit and to quickly know the effect of its parameters (e.g.: The effect of the value of a certain resistor on the gain). The circuit simulator used in this lab is an easy to use program written by Paul Falstad (http://www.falstad.com/). It is written in the java programming language and it is open source, which means that the source code of the simulator is available (at http://www.falstad.com/circuit/) for the public to change. The version which will be used in this lab is a slightly modified version from that provided by the author to be more suitable for use in making lab reports. The main advantages of this simulator are being open source, easy to use and being good at demonstrating circuits function (e.g.: It shows the current movement and changes the wires colors according to their voltages). In this tutorial, we will learn how to use the simulator to simulate the circuits we will learn in this year’s lab and any other circuits we need. To do this, we will follow a simple example of RC circuit. Now let’s try to characterize the RC circuit you have studied in E1. 159 2. Construct a new circuit: 1. Open the simulator folder. Double click “circuit.jar”. This will start the simulator with an already running example. 160 2. To build a new circuit. Choose “blank circuit” from Circuits menu. Hint: You can find many circuit examples in the Circuits library that you can use directly in your simulation. 3. Building the circuit: 1. Now we will start to add our components. Right click in an empty space in the window; a list of available components will appear. The list contains most of the useful components for example: Wires Resistors Passive components (ex: capacitor, potentiometer) Active components (ex: diodes, transistors, op-amps) Chips (ex: 555 timer) Inputs/Outputs (ex: ground, voltage sources (DC and A/C), current sources) 161 2. Select “add resistor”. Click and drag to draw the resistor. Hint: you may use shortcuts to draw different components; for example press ‘r’ for resistor, ‘c’ for capacitor. 162 3. Double click on the resistor and change its value to 1k then press “OK”. Hint : 1k= 1000 ohm. 1M= 106 ohm. 1G= 109 ohm. 4. Add a 150nF capacitor as described before. Hint : 1f= 10−15 ohm. 1n= 10−9 ohm. 1u= 10−6 ohm. 1m= 10−3 ohm. 163 5. Add input voltage source. You have two options: a- Select add A/C source (2-terminal) from Inputs/Outputs; here connect the circuit components using wires. (press ‘w’ for wires) 164 b- Select add A/C source (1-terminal) from Inputs/Outputs, here you must use ground to complete the current path. Notice that the yellow dots representing current are circulating. 6. Right click in an empty space and select “save screenshot” to take a picture of your circuit. 165 4. Starting the simulation: 1. Double click on the A/C voltage source. Change Max voltage to 1volt. Change frequency to 1kHz. Hint: you may change the waveform to sawtooth, triangular, Pulse, or square wave from the waveforms menu. 2. Draw a wire as shown in the figure. Right click on it and press “view in scope”. 166 3. From options menu, choose other options to change time step size to 100n. Hint: it is preferred to make the time step frequency. 167 1 10 of the sine wave 4. To fit the volt/division scale to the waveform, right click on the scope, and choose maximum scale. 168 5. If you want to see the input waveform right click on it and choose view on scope. Then you will find 2 scopes next to each other one represents input and the other represents the output. 6. To stack the input and output scopes right click on the scope and choose stack. 169 Hint: you can choose unstack again to view scopes next to each others. If you want remove the scope right click on it and choose “Remove”. Now we can remove the input scope. 7. Check “stopped” in the right panel to stop the simulation. Hint: If you want to resume the simulation again just uncheck “stopped”. You can also reset the simulation again by pressing “reset” in the right panel, and you can change simulation speed and current speed. 8. Right click on the scope and uncheck “show current”. 170 9. Right click on the scope and check “show peak value” to view the maximum amplitude of the sine wave. 10. Right click on the scope and choose “save screenshot”. 171 11. Open the saved screenshot. Calculate the sine wave amplitude. Amplitude = volt/division * no of divisons = 100mv * 7.3 = 730mV Or you can directly find it in the top left of the picture. 12. Then you can change frequency and measure the output amplitude each time, then you can draw output amplitude versus frequency. 13. To save the circuit; choose “export” from File menu. Type a name for the circuit and click “save”. To open it again you can choose “import” from “File” menu and double click on its name. 172