Appendix A: Brief Tutorials of KiCad Schematic with SPICE I believe that if you show people the problems and you show them the solutions, they will be moved to act.—Bill Gates, founder of Microsoft A Simple DC Circuit Simulation 1. Open the KiCad software in your lab computer. (Note that this procedure is written based on KiCad version 5.1.2 on a Windows 7 64-bit computer. You might notice discrepancies otherwise.) 2. For SPICE simulation, we will use Eeschema (aka Schematic Layout Editor). Click on this icon. A new blank Eeschema win- dow will open. 3. Click File -> Save Current Sheet As..., browse to your user folder (Instructor will indicate where you can to store this file), enter a File Name (e.g., Lab5.sch), and click Save. Also, periodically save your work as you progress. 4. To put a component in your schematic (e.g., resistor, capacitor, induc- tor, power supply, switch, etc.), click the Place Symbol icon on the right-hand side toolbar that looks like an op-amp (a triangle with a + and a - symbol). 5. Click in the middle of your schematic. A Choose Symbol window will show up. Note: It might take a little while for the first time to populate this library. 6. In the “Filter” field, type “r,” and select device->R from the list for resistor. (Note: Type “l” and select device->L to insert inductor, and type “c” and select device->C to insert capacitor.) 7. Click OK, and click in the middle of your schematic to place it. Note: You can press shortcut key “r” to rotate the component 90 degrees. 8. You can zoom in or out using the zoom icons on top toolbar. You can also use the mouse scroll bar to zoom in and out. To zoom fit, select the icon of © Springer Nature Switzerland AG 2021 201 B. I. Morshed, Embedded Systems – A Hardware-Software Co-Design Approach, https://doi.org/10.1007/978-3-030-66808-2 202 Appendix A: Brief Tutorials of KiCad Schematic with SPICE magnifying glass with a shaded square on its top right, and drag an area around the resistor. 9. You can put value of the component by right clicking on it, select Properties -> Edit Value...(Shortcut key: V) 10. In the field “Text,” enter 1k. (Note: Use k for Kilo, M for Mega, G for Giga, m for Milli, u for Micro, n for Nano, p for Pico). Use the “esc” button of the keyboard to get rid of current selection (mouse will change to cursor). 11. Using the same procedure (Steps 4–10), insert another resistor below this first resistor, and put value of 500. (Note: You do not need to put unit name, Spice uses the standard units based on com- ponents, e.g., Ω for resistors.) 12. Insert a power supply by clicking on the left hand side of the resis- tors, and type “vsource” in the Filter field, and select “pspice -> VSOURCE.” 13. Click OK and place the power supply to the left of the resistors. (as shown beside) 14. To set a voltage, right click on the VSOURCE component, and select Properties -> Edit Value. 15. In the text field, put “10” to apply 10 V DC. 16. To complete the circuit with wires, click green line on the right-side toolbar of Place Wire icon (shortcut key: w). Then click on a starting node for the wire, and click on the ending node for that wire. The software will automat- ically select the best way to draw the wire. If you want to route manually, click at each corner as you intend. Try to mimic the figure beside to route the wire. 17. For any SPICE simulation, we MUST add a ground (0 node). To do that, click on the icon showing the ground symbol. 18. In the Choose Power Symbol window, type “0” in the Filter, and select “pspice -> 0.” Click OK. A triangular ground symbol will be selected. 19. Place this at the bottom of the schematic. Use a wire to connect the 0 node of the ground to the bottom wire of the schematic. Appendix A: Brief Tutorials of KiCad Schematic with SPICE 203 20. Your final schematic show look like this: 21. After your schematic drawing is complete, the next step is to Annotate Sche- matic Symbols. On the top toolbar, click the icon with a pen on a paper (Annotate Schematic Symbols). 22. The default selection is sufficient. Just click “Annotate.” Then click “Close.” 23. You will notice all your components are now numbered (e.g., R1, R2, etc.), i.e., annotated. 24. You can also click the Electrical Rule Check (ERC) button that looks like a ladybug. 25. Click Run. The error list will show if there is any error in the schematic. 26. For our current simulation, it will show an error: Pin 1 (Power input) of component #GND01 is not driven (Net 2). Ignore this error for now. 27. Close the ERC window. 28. To simulate the schematic, click Tools -> Simulator. A new simulation window will open. 29. Click on Settings first, then select Transient tab. For this simulation, we will use Time step: 1m, and Final time: 100m. Click OK. 30. Next click Run/Stop Simulation (Green play button). 204 Appendix A: Brief Tutorials of KiCad Schematic with SPICE 31. Next click on Add Signals, then in the pop-up menu, select the two voltage signals (hold the Control key to select multiple signals). Click OK. 32. The plot will show two horizontal lines, one at 10 V (supply) and the other at 3.33 V (output of the voltage divider). 33. If you want to check the exact value of a trace, right click on the corresponding signal in the Signals pane, then select “Show Cursor.” You can move the cursor at different time, and see the exact value of the trace in the “Cursors” pane. 34. To observe the current waveforms, click File -> New Plot. Then use Add Signals to plot all three current signals. 35. To zoom in the current waveform, draw a narrow rectangle to zoom the current waveform like this: Appendix A: Brief Tutorials of KiCad Schematic with SPICE 205 36. Note that I(R1) and I(R2) are exactly the same (overlapped) at 6.67 mA, and these currents are exact opposite of I(V1) at À6.67 mA. A Simple AC Circuit Simulation 1. Open the KiCad software in your lab computer. (Note that this procedure is written based on KiCad version 5.1.2 on a Windows 7 64-bit computer. You might notice discrepancies otherwise.) 2. For SPICE simulation, we will use Eeschema (aka Schematic Layout Editor). Click on this icon. A new blank Eeschema window will open. 3. Click File -> Save Current Sheet As..., browse to your user folder (Instructor will indicate where you can to store this file), enter a File Name (e.g., Lab6.sch), and click Save. Also, periodically save your work as you progress. 4. To put a component in your schematic (e.g., resistor, capacitor, trans- former, power supply, etc.), click the Place Symbol icon on the right- hand side toolbar that looks like an op-amp (a triangle with a + and a - symbol). 5. Click in the middle of your schematic. A Choose Symbol window will show up. Note: It might take a little while for the first time to populate this library. 6. In the “Filter” field, type “transformer,” and select Device-> Transformer_1P_1S from the list. 206 Appendix A: Brief Tutorials of KiCad Schematic with SPICE 7. Unfortunately, this built-in transformer symbol does not contain any SPICE model. So we have to add our own. Here we will do it by writing a small SPICE code for transformer sub-circuit. 8. Using a text editor (e.g., Notepad), type the following sub-circuit code. .subckt transformer 1 2 3 4 RP 1 11 50 L1 11 2 2000 RS 4 44 10 L2 44 3 20 K L1 L2 0.99 .ends transformer 9. Save this file with name “transmodel.sub” in the same project folder. While saving in Notepad, make sure “Save as type” is selected as “All Files (*.*).” Otherwise Notepad will add .txt extension. To verify that the proper file extension is saved, ensure “Hide File Extension” is turned OFF in the Windows File Explorer. 10. After saving this sub-circuit file, we will need to associate this SPICE model to the transformer symbol on your schematic. To do this, right click on the transformer symbol, and select Properties -> Edit Properties (shortcut key: E). 11. In the Symbol properties window, click Edit Spice Model...button. 12. In the Spice Model Editor window, click the Model tab. Using the Select File button of the Library, browse to the project folder, and select “transmodel.sub.” You will need to change file type to “All files (*.*)” in the browsing window to see this .sub file. 13. Select the transformer model, and you will see your sub-circuit model in this window. This transformer model is a step down transformer of 10:1 ratio. Click OK -> OK to confirm. (Note: This is a read-only interface, if you want to make any change, you will need to edit the .sub file with Notepad.) 14. Now we will add an AC source of 120 V. For this, insert the pspice-> VSOURCE symbol. Then right click to select Properties->Edit properties... 15. Click Edit Spice Model, then go to Source tab of the Spice Model Editor. 16. Select the Sinusoidal tab, then set these values: DC offset: 0; Amplitude: 120; and Frequency: 60.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages61 Page
-
File Size-