KiCad Example Schematic (2010-05-05) Wien Bridge Oscillator University of Hartford College of Engineering, Technology, and Architecture The following tutorial in that it walks you through steps to use KiCad to produce the schematic for a Wien Bridge type oscillator. This is also one of several documents that together provide a complete end to end example use of KiCad. This document makes use of the KiCad Schematic Symbol Editor document, please have that document on hand as you proceed with this one. These tutorials are written in a way to provide you with a quick start in using KiCad, assuming that KiCad is already installed on your computer. This document is not comprehensive, as providing an excess of details would be distracting the mission of this document. With regard to being comprehensive, the reader is referred to the help documentation installed with KiCad which serves as a better example. This document corresponds to KiCad version (2010-05-05 BZR 2356)-stable. Please review the at the end of this document the author information, copyright notice, and version date. Preparing for the Layout It important to prepare for a layout. Be sure to set aside space for all the data sheets that you will collect. Having all the data sheets on hand will save you much stress later on. The point of breadboarding is to construct a circuit quickly, with little or modest effort. There are numerous reasons for breadboarding. While it can be used to verify that an experimental circuit works, the Wien Bridge oscillator show below, that we will produce a layout for, is well known. Example of the Wien Bridge Oscillator Rather, here we are interested in the layout, the actual components, and the correct behavior. Analog electronics in particular is well known to be sensitive to layout, so much so that chip manufacturers often provide recommended patterns for layout. With all the data sheets and actual experience with the
components you are bound to produce a better layout. The following lists the components used in the schematic. The actual part designators may vary. C1, C2 0.1uF ceramic disk capacitor C3, C4 1uF electrolytic capacitor D1, D2 1N914 small signal diode K1 CONN_3 P1 CONN_2 R1, R3 1.6K ¼ Watt carbon film resistor R2 1K ¼ Watt carbon film resistor R4 2.2K ¼ Watt carbon film resistor R5 6.2K ¼ Watt carbon film resistor U1 MC33171 single low power operational amplifier in DIP package The connectors selected are familiar parts and with only a modest risk, can be omitted from the breadboard circuit. This circuit can work with the +3V and 3V power supplies, or higher but is otherwise limited by the capability of the operational amplifier. The capacitor Voltage rating is not critical to the design. Figure 1: Breadboard with Wien Bridge oscillator circuit In the figure, the tubular components above the breadboard are capacitors C3 and C4. The green wire between the capacitors connects to ground. The black wire leading to the left is negative power. The red wire leading to the right is the positive power. Finally, the white wire leading to the right is the signal output. The figure below shows an oscilloscope with the resulting waveform. The vertical axis is 0.2 Volts per division or 0.04 Volts per tick, so that the amplitude is approximatley 0.76 Volts peak, or 1.52 Volts peak to peak. The horizontal axis is 0.2 msec per division so that the period is approximately 1ms, which corresponds with a frequency of 1kHz.
Oscilloscope display of resulting waveform Be sure to notes to summarize your observations. Your instructor may have homework exercises to help you in this regard. Also consider the size and shape of a PC board that would be appropriate as well as changes that would be needed for a smaller PC board. Let's get started with KiCad. Start KiCad and Create a New Project Start up KiCad. If you are using a Windows operating system, go to the start menus: Start => Programs => KiCad => KiCad Next, create a new project. In the KiCad project window use the mouse to select the following File => New I am using a memory stick mounted as the D: drive on my laptop computer. With regards to disk use, KiCad is fairly light and works well with a memory stick. At one time KiCad required the project folder name to be the same as the project file. Regardless, we follow this tradition. In the 'Create new Project' window, navigate and click the 'New Folder' icon. Create a folder named 'KiCad', containing a folder named 'wbridge'. Navigate inside the sub-folder and in the 'File name field', enter the name 'wbridge.pro' and click 'Save'. The following path should now be visible in the title bar: D:\KiCad\wbridge\wbridge.pro Create the Root Schematic In the KiCad project manager window, left click the EESchema icon to start the schematic capture tool. Floating the cursor above a button will cause a pop-up hint to appear. 'EESchema' icon Click-p (that is click the button under your pointer finger ) on the schematic capture tool button and a few moments later the schematic capture tool reports that the corresponding schematic wasn't found,
which is correct. Click-p (under pointer finger) on 'OK'. Note that KiCad has already named the new schematic wbridge.sch. This new schematic is referred to as the 'root' schematic as it will represent the top of the hierarchy. Before anything else happens, save the new schematic. File => Save Whole Schematic Project Next, it is a good idea to set the page size. Click the Page Settings icon 'Page Settings' icon Do the following in the 'Page Settings' popup window Select 'Size A' which is a good choice for such a smallish schematic In the 'Title' field enter 'Wien Bridge Oscillator' In the 'Company' field enter your name. Click-p on 'OK'. Finally save your work. In the schematic capture window select: File => Save Whole Schematic Project Symbol Editor KiCad projects tend to make use of the symbol editor, either to tweak a symbol or make a new symbol. While the use such a tool may seem uncalled for, you will quickly find the symbol editor to be practical and useful with your projects. This tutorial considers for two custom symbols. The X suffix is used as most likely KiCad does not already have these component installed. Polarized capacitor (CPX) Low power operational amplifier (MC33171X) Custom CPX symbol Custom MC33171X symbol
Symbol Library Browser To examine the contents of the libraries, in the schematic capture tool click-p (click the button under your pointer finger) on the 'Library browser' button (upper middle left). If you leave the cursor hovering above a button, a text 'hint' appears. Choices can also be made with the pull-down menus or with hot-key combinations that you can learn as you get to know KiCad. 'Library browser' button In the 'Library Browswer' left pane, click-p on 'device' to refer to the device library and in the middle pane click-p on 'C' so the corresponding symbol appears in the right pane, as in the following: Library Browser displaying the non-polarized capacitor symbol Take a moment to select other components and other libraries as well and look about. The CP symbol in the component library is the polarized capacitor included in the KiCad installation. To close the Library Browser, either click the 'X' symbol to the upper right of the window or click the window icon in the upper left and in the pop-up menu then click-p on 'close'. Opening a Symbol Library Component To produce the CPX symbol, we will modify the C symbol shown above. Start by using the symbol editor to open the C symbol from the component library. Starting in the schematic capture tool, click-p on the 'Library editor' button 'Library editor' button In the 'Component Library Editor' window, click-p on the 'Select working library' button and in the 'Select Library' pop-up window click-p on 'Device' and click-p on 'OK'. 'Select working library' button
In the 'Component Library Editor' window, click-p on the 'Select component to edit' button and in the 'Select Component' window, click-p on 'C' and click-p on 'OK'. 'Select component to edit' button Double click-p on the lower 'C' and in the 'Edit field' pop-up window change the 'Component name/ Value' entry from 'C' to 'CPX' and click 'OK'. Saving the Symbol in a New Library At this point the new CPX component is open in the symbol editor, having just changed it's symbol name to CPX. Next, decide where to save this new symbol. While saving to the 'device' library may be simple enough, there are reasons why it's better to save to a project library, that is a library file located in your project folder, rather than into a library stored in the installation directory. Perhaps you are experimenting or practicing with KiCad. Such extra symbols are distracting. Adding new symbols to a project library, which only involves the current project, will not clog the the installed libraries. Perhaps you want to test your new symbol and don't want the symbol to be permanent in an installed library. This is solved by saving the symbol in such a project library. Perhaps you use KiCad with multiple computers and cannot update the installed libraries on all the computers. A project library stays with the project. Perhaps your are concerned with maintenance when you upgrade to a newer version of KiCad. Having custom components mixed in with installed components such maintenance a nightmare. Until you become a KiCad master, it is better to use custom project libraries. In the component library editor, click the 'Save current component to new library' button and in the pop-up folder browser enter a name such as 'custom.lib' and click 'Save'. A pop-up 'Info' window appears stating that the new library will not be available until it is loaded into the schematic capture tool, EESchema. Click-p on 'OK'. 'Save current component in new library' button Click-p on the schematic capture toolbar and then click to open the library preferences window. Preferences => Library In the library preferences window do the following: In the Current Selection Path list, click-p to select the path to the current project D:\KiCad\wbridge
To the right of the 'Component library files' pane Click-p the 'Add' button In the navigation window click-p on 'custom' and click-p on 'Open' At the bottom of the library preferences window click, 'OK' In the 'Save Project Settings' window, click-p on 'Save'. Finally, back in the symbol editor window, click the 'Select working library' button and select the 'custom' library. 'Select working library' button The symbol editor title bar will now refer to the new library, 'custom.lib'. At this point you have saved a component to a new project library, loaded the new library, and then switched the working library. To use the custom library in an entirely new project just copy the custom.lib file into the project folder and add the library to the project as you did above. The next step is modifying the rest of the new symbol and updating the new library. Modifying the Rest of the New Symbol If you haven't already changed the component name to CPX, made a new project library, and switched the working library, go back a page or two and then come back here. There are three types of objects in a symbol: Attributes provide KiCad with important information about the symbol. Given that this symbol is copied from a similar one, all the needed attributes such as the reference designator and symbol name are already present. Pins provide a means for KiCad to connect wires to a symbol. As with the attributes, all the needed pins are already present. Artwork is what you otherwise see, that makes the symbol recognizable to us. We will be changing the artwork. Other than the pins, symbol artwork looks better in a 10.0 mil grid. So while it is helpful to change the grid size, remember the following WARNING: It is important that pins remain on the 50.0 mil grid. Hence, before saving a finished symbol, be sure to switch back to a 50.0 mil grid and examine the pins to make sure they are on grid. In the symbol editor click-r (button under ring finger) and in the pop-up menu click-p (button under pointer finger) on 'Grid Select' and then click on the desired grid spacing. Okay now, change to the 10.0 mil grid and make a mental note to not move the pins and check later to make sure that the pins remain on grid.
In the symbol editor, do the following: Point the cursor at the lower horizontal line in the symbol and press the delete key on your keyboard to delete the line. Click-r on the 'Add arc' button Move the cursor to the spot below the left end of the upper line that is also four grids below the top of the lower pin and click-p. Move the cursor to the corresponding spot below the right end of the upper line. Now the cursor acts like the center of the arc rotation, so move the cursor down the lower pin until the top of the arc touches the top of the pin and click-r. To make the arc thicker, either press the escape key or click the 'Deselect current tool' button and then double click-p on the arc. In the pop-up window change the width to 0.010. 'Deselect current tool' button If you are not satisfied with the artwork, just click the undo button and try again. 'Undo last command' button The '+' symbol can be drawn with two lines. Click-p on the 'Add lines and polygons' button and just above the upper line and to the left of the pin, click-p to start each line, then click-r and select 'line-end' to end each line. To reduce the thickness of a line, first deselect the tool, point at the line, double click-p, and reduce the extra width value to 0.000. Add lines and polygons' button Check the Pins and Save Your Work As before, change the grid size, but this time back to 50.0 mil spacing and look at the pin ends. The small circle end of each pin should be on a grid dot. Having the pin ends on-grid will make it easier to use your new symbol in an actual schematic, so be sure to move the pins if they are not on-grid. And finally, do the following: Click-p on the 'Update current component in current library' button and in the confirmation window 'Yes'. 'Update current component in current library' button Click-p on the 'Save current library to disk' button and in the confirmation window, click 'Yes'. 'Save current library to disk' button At this moment you have a new symbol that is stored in a new project library. Follow these steps to make the MC33171X symbol by modifying the LM741 symbol in the linear library. This time it is only necessary to change the name to make the new symbol. Next, change the working library to
custom.lib and save the new symbol by updating the component in the library and then writing the library to disk. Inserting Components KiCad works with several so-called modes, each of which has a unique cursor shape and provides unique functionality. If you have been experimenting, you may no longer be in the normal mode. Pressing the escape key usually returns KiCad to the normal mode, but you can also press the arrow icon, which is in the upper right corner of the schematic editor window. Arrow icon In the following you will insert gates in a manner like the the following figure. Schematic with parts To insert the components, start by clicking the 'Place a component' 'Place a component' icon In the 'component selection' window, click 'Select by Browser'. In the 'Library Browser' left pane, click to select 'custom' and in the device pane scroll and select the MC33171 device. The library browser will show the corresponding symbol. Click the 'Insert component in schematic' button and move the cursor position the component symbol then click left to actually place the component. Insert component in schematic
Repeat the above process to insert a resistor R symbol from the 'device' library. Once a component symbol is placed in the schematic the symbol placement can be adjusted. To rotate, copy, or move a component, use the cursor to point at a component and press the corresponding 'Hot-Key' on the keyboard. R rotate clockwise by ninety degrees C copy, attaches a new copy to the cursor. Click left to place the component. M move, attaches the component to the cursor. Click left to place the component. For a larger list of choices, use the cursor to point at a component and right click for a pop-up menu. Also note that when you place the next component, the 'select component' dialog window keeps a list of the prior components that were inserted, making it easy to insert the component again. The remaining components are in the corresponding libraries C capacitor 'device' library CPX polarized capacitor 'custom' library, otherwise use the CP symbol in the device libary DIODE diode 'device' library CONN_2 two pin connector 'conn' library CONN_3 three pin connector 'conn' library Power, Ground, No-Connect, and Wiring the Components The next step is inserting power, ground, and no-connect symbols along with wires to connect the components. Starting with the operational amplifier, this part will look similar to the following. Operational amplifier with other symbols Click the 'Place a power port' icon; this is a short-cut to the 'power' library. Next, left click in the schematic editor window to open the 'Component selection' window. Click left on 'List All', scroll to find and select 'VCC', click 'OK' and as before, in the schematic editor window place the new symbol above the operational amplifier. Likewise, place a 'VDD' symbol below the operational amplifier and then rotate the symbol twice. Once done, press escape to return to the normal mode. To insert a first wire, point the cursor at the lowest part of the VCC symbol, press the 'W' key on the keyboard, move the cursor to the tip of pin 7 on the operational amplifier, and click left to end the wire.
Likewise, insert a wire from the VDD symbol to pin 4. The no-connect symbol informs the rules checker that the corresponding pins will intentionally left unconnected. To place the no-connect symbols, click the 'Place no-connect flag' icon and in the editor window click left at the end of pins 1 and 5. 'Place no-connect flag' icon Continuing with the three pin connector, this part of the schematic will look like the following. The rules checker needs to be informed which networks carry power. One approach involves changing the properties of the connector to indicate the pins that convey power. However, here we use PWR_FLAG symbols to indicate that the connected networks carry power. Three pin connector with other symbols and capacitors The PWR_FLAG and GND symbol are with the other power related symbols. To assign the capacitor values, either double click on the CPX name and change the value or double click on a component and use the component editor window. Add wires as you did before. Completing the Schematic Use the complete schematic below to assign part values and insert the remaining wires. Note that to perform further processing, each component much be assigned a designator or part number. Even if you assign part numbers as you go along, you will probably have to use the annotation tool. Left click the 'Annotate Schematic' icon. 'Annotate Schematic' icon In the pop-up window, click the 'Annotation' button, click 'OK' and then click 'Close.' To perform a rules check, click on the 'Schematic Electric Rules Check' button, and in the pop-up window click the 'Test Erc' button. 'Schematic rules check' icon
If an error should appear, double click on the error report item to find the corresponding area in the actual schematic. Note that you may need to run the Annotate Schematic tool even if you manually assign all the part designators. Typically an error indicates that an unnamed component needs to be assigned a part designator. If you see this error, run the Annotate Schematic tool. Complete Wien Bridge oscillator schematic The following lists all the components used in this schematic. The actual part designators may vary. C1, C2 0.1uF C3, C4 1uF D1, D2 1N914 K1 CONN_3 P1 CONN_2 R1, R3 1.6K R2 1K R4 2.2K R5 6.2K U1 MC33171X At this point you have completed the schematic for the Wien Bridge oscillator. Be sure to save the schematic project File => Save whole schematic project The file menu also has selections for printing out your schematic as well. If you performed this as a class assignment, before printing out your work, make sure that you have entered you name and project name into the page settings. The next two documents outline how to select component footprints, produce a layout, and how to use a milling machine to produce an actual PC board.
Author Information Dr. Jonathan Hill (jmhill at hartford dot edu) is an associate professor in Electrical and Computer Engineering at the University of Hartford College of Engineering, Technology, and Architecture. His interests involve embedded microprocessor based systems. This document was written in haste so please help with constructive criticism and/or send a thank-you for the effort. Copyright Notice Copyright (C) 2010, by Jonathan Hill Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. Modified versions of this document will include the current version date and all the prior version dates on which the document is based, immediately following the copyright notice. A copy of the license is available from the GNU project website at the following URL. http://www.gnu.org/licenses/fdl.html Publication Date: Jan 17, 2011 by Jonathan Hill Previous Version: There is no pior published version of this document