How to Make a Printed Circuit Board (PCB)

From APL
Revision as of 13:23, 31 January 2019 by Aplstudent (talk | contribs) (Eeschema)

Jump to: navigation, search

Using KiCAD

Youtube Tutorial

For an in depth example and walk through, DigiKey's youtube series on KiCad, found here, demonstrates how to use most of KiCad's essential features. This tutorial prepares PCB schematics which are intended to be printed by a third part and not in the lab, so the tutorial will not provide any information about cutting and etching the PCB. For these steps, refer to the sections below.

Installing and Opening KiCad

A working version (as of 1/28/19) of KiCad exists on the "Hank" computer in the APL lab next to the Lathe, but if you want to use KiCad on your personal computer the software is free and can be downloaded here. This software uses multiple internal programs for the different aspects of PCB creation. After initially opening KiCad all the different programs you'll need to work with can be found in the "Tools" dropdown menu.

Eeschema

The first program you'll want to use is called Eeschema this is where you'll make your circuit diagram and can be opened by clicking Tools -> Run Eeschema in the startup KiCad menu. Eeschema is a way to digitally draw the circuit diagram and is really only used to establish how your components will be connected. This means while using Eeschema we don't need to worry about how the components will physically be placed on our PCB and we should only focus on making a correct circuit diagram.

In Eeschema we'll want to place different components and connect them with wires. To place a new component go to the "Place" dropdown menu and select "Component" to place a component. Then double click somewhere on the schematic to bring up a list of possible components. Different components will be filtered based on your search; resistors are labeled as "R" and capacitors are "C", but more specific components can be labeled by their model number. Once you have all your components down (including Vcc and GND) you'll want to connect everything with wires. To place wires go to the "Place" dropdown menu and select wire. Connect all your components appropriately and save the file.

At this point you'll begin assigning footprints to components. To do this, you'll click the red and green icon in the middle of the top toolbar labeled "Run CvPcb to associate components and footprints". Each component needs a footprint associated with it (the footprint contains the information about the physical location of pins/connections on the component, which is necessary for drilling holes in and soldering on the PCB). At this point you'll likely need to switch back and forth between Eeschema and the PCB footprint editor. The PCB footprint editor becomes necessary when KiCad doesn't contain the footprint for a given component and you can learn about how to make your own footprint in the[Footprint Editor] section.

Once you have the "Run CvPcb to associate components and footprints" open you'll see three columns. The left column contains the different footprint libraries you can search. The middle column shows the different components which will all need to be associated. An unassociated component will look something like this:

1 P1 - CONN_01X02  :

while the associated component above will look like this:

1 P1 - CONN_01X02  : Pin_headers:Pin_Header_Straight_1x02

The component association is complete when every component in the middle column has the appropriate foot print assigned (as shown in the example above).

The right most column is where you can find the footprints to associate with the component. The selected component will be associated with a footprint by finding and double clicking the correct footprint on the right column. Finding the correct footprint can be difficult (especially because it might not exist in the current libraries), but there are a few tools which make this process easier. In the top toolbar the three most right icons (they are pictures of green and white components) that filter the results in the right column. The left most icon of the three filters the the list by keywords, the middle icon filters the list by pin count, and the right icon filters the list by the library selected. I find that the keyword filter is the most helpful. You can also bring up the footprint for any selected footprint in the right column by clicking the toolbar icon with a picture of a component under a magnifying glass (labeled as "View selected footprint"). This is very helpful to double check that you've selected the correct foot print.

After you double check that all the footprints associated to all the components are correct, save your footprint associations (File -> Save Edits), and you're ready to begin designing the physical layout of your PCB. You can close the "Run CvPcb to associate components and footprints" window by clicking File -> Close, this will bring you back to Eeschema.

Footprint Editor

This section describes how to make a custom footprint and is only necessary if the component you are using doesn't have a footprint in the preexisting KiCad footprint library, i.e. you cannot find the footprint in the right column of the "Run CvPcb to associate components and footprints" window.

While creating your own footprint isn't always necessary, often you can find the footprints online, it is generally useful to understand how to make your own footprints. To open the Footprint Editor, return to the KiCad startup window and click Tools -> Run Footprint Editor. First, you'll want to create a new footprint. Using the dropdown menu select File -> New Footprint and name you're footprint. There are specific footprint naming conventions established by the IPC which you can learn about here to create a consistent footprint library.

Footprint Libraries

At this point, you'll want to create a new project library for footprints. This will essentially be a folder that holds all your footprints and is accessible by KiCad. To do this click File -> Save Footprint in New Library. In the popup menu make sure the "Path Base" leads to your KiCad project an name the library. This will now be a folder with a .pretty suffix. Now that you've created your footprint library you want to make this your "active Library". You can determine if you have selected an active library by the parenthetical statement in the top left corner of the screen, adjacent to "Footprint Editor". This will say Footprint Editor (no active library) if no library is selected. To set up your newly created library use the dropdown menu and select Preferences -> Footprint Libraries Manager, in the popup window select the "Append with Wizard" button. In the next popup window make sure "Files on my computer" is selected and click "Next". Then, find the library you just created with the .pretty suffix, this should look like ExampleFootprintLibrary.pretty and will likely be found in your project directory. Click "Next" and then confirm the changes to the library by clicking "Next" again. Now, you can decide to save the library to the KiCad global library or to just the current project. If you plan on using this library again for different projects you'll want to save the library globally but if you are using KiCad for one specific project and don't intend on using it again soon then saving "To the current project only" might be more appropriate.

Now, you should see your project library, ExampleFootprintLibrary.pretty, with the path under "Library Path". If you do not, something with "Append with Wizard" went wrong and the library will need to be appended again. Select "OK" and the window will close. Now, select File -> Set Active Library. Search for the library name you just created, select it, and press "OK". Now, the top left corner of the screen should read "Footprint Editor (active library: FootprintExampleLibrary). Now, you'll be able to save your footprint in your specific project library. This will also make things easier as all subsequent footprints for your current project can be saved in this library. This library will also be findable in Eeschema's footprint association section.

(Please Note: If any of these instructions were confusing or just too boring to read, a very similar video tutorial can be found here, specifically starting at 2:49)

Drawing Your Footprint

Now that your active library is set you'll be able to save your drawing to a accessible place. The footprint drawing process can be somewhat clunky but almost any action can be achieved by right clicking the thing you want to adjust. For example, the first thing you'll probably want to do is move your footprint name and the text that says "REF**" out of the center of the screen. Moving things can be done by right clicking but a faster way is to use your mouse to hover over the thing you want to move and click the "M" key. To release the thing you are moving just left click. There are many keyboard short cuts that make drawing and navigating the footprint editor easier and most of these can be found by right clicking something and reading the right side of the drop down menu.

That said, you'll want a basic understanding of the different layers of a PCB before you draw lines, holes, and pads, since you must select which layer you want your drawing to apply to. For a brief description of the different layers you can read this article. On the left of the footprint Editor you'll find the icons that will allow you to change the unit types and adjust the grid size for the screen. I suggest a grid size of something like 5 or 10 mils (if you're using inches). On the right side of the screen you can select between the different drawing tools, here you will find options for pads, lines, arcs, and text.

Footprint Orientation

The footprint orientation can be a bit confusing since you're dealing with the 2 dimension layout of a 3 dimension object, but the term footprint is appropriate. If you're unsure about the orientation of your footprint (it is easy to accidentally draw a mirror image of the footprint you're looking at the bottom of the component) imagine pushing your component pin side down into wet sand and then removing the component. The imprint left on the sand is the picture you'll be trying to draw, which is why footprint is a good term.

Pads

The pads tool, which has a green donut shaped icon on the right, is how you will draw the solder pads for the pins of your components. To place a pad select the "Add Pads" icon or select Place -> Pad, left click and to place a pad. Now, you'll want to edit your pad. Right click the pad and select "Edit Pad". This will allow you to make sure the pad is appropriately placed with respect to the origin and that the shape and size of the pad is correct for the component. Before you edit your pad you'll want to know if your component is a surface mount device (SMD) or requires through-holes. A SMD is a device that can be soldered directly on top of your PCB, whereas a through-hole device requires a hole to be drilled into your PCB for the pin of your component. If the component is a SMD you'll want to edit the "Drill" "Size X:" to a non-zero value, this will ensure there isn't an exposed copper layer where you want to drill your hole. If you're component is a SMD you'll want a value of zero for the drill "Size X:" since you won't need to drill a hole. The different specifications for the shape and size of your pads should be accessible through the component's data sheet. Now you can adjust the "Pad type", "Position X", "Position Y", "Size X", "Size Y", and "Technical Layers" as needed. Lastly, you'll want to change the "Pad number" according to the pins in your data sheet, i.e. if you're making a footprint for a chip you'll want to number the pins according to the chip's data sheet pinout.

Lines

While you may choose not to actually print a component outline if you don't plan on adding a silkscreen layer, a footprint with only pads makes the visualization of the component almost impossible; thus, making the outline of your part is highly recommended. To draw a line use find the "Add graphic line or polygon" icon on the right and select which layer you want your line to be drawn with. The different layers are listed on the right with names like F.SilkS, which means front silkscreen, and B.Cu, which means back copper. Choose the appropriate layer and draw the outline of the part. Make sure the lines are to scale with the physical size of your part, as this will be helpful when designing the layout of your board. Finally, you'll want to make a courtyard for your component. The courtyard indicates how much space your component needs, which ensures that footprints aren't placed too close together. To choose the courtyard layer select F.CrtYd or B.CrtYd. Now, draw a rectangle (or different shape) around the component, such that the physical component could fit inside that size shape. Now, if the footprint is to scale and looks accurate you're ready to save the file and use it with Eeschema's footprint association tool.

Using gEDA

Tutorial from the program creators can be found here. [1]


Open the program gEDA Schematic Editor. (gschem)


Choose Components and Build the Circuit

Using the Add component menu (looks like a 2 pronged power cable) select the various electronic components that will be on your board.

Prong.png

The filter option in this menu allows you to quickly type the part in order to find it rather than searching through the menus. (ie. ground or resistor)

Add COmponent.png

Move the parts around similar to how they will be constructed on the board. This wont be the final layout, but make sure all necessary connections can be made. Then connect components by clicking the blue add nets mode button next to the add components button.

To de-select a component or a wire right click the mouse.

If you need to rotate or flip components for any reason, click on the component and then press er to rotate or ei to flip.

You can change the name and what is visible about the component by double clicking on it and changing the visibility settings and its attributes.

After the circuit is constructed and all connections are made correctly its time to add footprints to the components.

Circuit.png

Assign Footprints

Footprints provide the information about the physical specifications of each part in the circuit such as size, number of pins, pin size... ect.

Most common circuit parts (resistors, caps,...) have pre-made footprints available, speciality parts need to have their footprints designed and saved. Once a footprint is made and saved it can be used in the future.

To assign a footprint to a commonly used part, double click on the component. Towards the bottom of the menu, below add attribute, select the name drop down menu. When the menu drops down, select footprint. In the value box, this is where you'll enter the code for the specific footprint needed. Common codes and naming conventions can be found at this website, [2]

Edit Footprints.png

After the value is entered, click add. Again keep in mind you can choose to make this footprint name not visible on the diagram. To assign the same footprint to multiple components, click on another component before closing the edit attributes menu, and again click add. This will add the previously chosen footprint to the newly selected component.

Custom Footprints

To build a custom footprint open the program pcb designer. The Via button in the lower left portion of the side bar menu corresponds to pins. Click and drag these vias where physical pins will. This requires measuring and planning on the physical component. There is mil measurements in the top right corner to tell where the cursor is so that you can be precise about where the vias are placed. Now you can highlight the entire footprint and then press (control x) this cuts the design to buffer. Then under the buffer menu, click convert buffer to element. This will place this element on the screen. Now, click and copy that element, and under the buffer menu, click save buffer to file. Save into a directory that can be accessed by gschem. In gschem for the footprint id, use whatever file name you save the custom footprint as.

Transferring to PCB Designer

When all components have a footprint and when all needed connections are made you are ready to send this blueprint to the pcb designer program. Save your file at this time(in the same directory that the custom footprints are saved to). Now in the command line use the command gsch2pcb. Make sure you are in the directory where the .sch file is. For example this is what your command line should resemble with different file names and in a directory where your file is saved. (gsch2pcb -d ~/pcb-mylib/ BridedTeePCB_preamp.sch).

When done successfully, the command line will give directions to continue. I have listed them below.

1. Run pcb on your file ie. BridedTeePCB_preamp.pcb

2. From within PCB, select File -> Load layout data to paste buffer and select BridedTeePCB_preamp.new.pcb (this will be you files name) to load the new footprints into your existing layout.

3. From within PCB, select File -> Load netlist file and select BridedTeePCB_preamp.net to load the updated netlist.

4. From within PCB, enter :ExecuteFile(BridedTeePCB_preamp.cmd) to update the pin names of all footprints.

PCB Designer

The last exercise should have transferred the information about all the needed components and connections to the PCB program. In this PCB program you will move the components by dragging and dropping them to where they will physically go on the board. The yellow rat lines connecting components show the needed connections. When you move multiple components press the o button to optimize and re-position the rats nest. Clicking on the ROT button in the bottom left menu bar allows you to click on components to rotate them. Once all components are placed where they are physically going to be on the board (allowing for the needed connections to be made) you are ready to begin drawing the copper lines. Note, if rat lines intersect that is okay, they simply show where connections need to be made. However when laying out components be aware that copper drawn in lines should not intersect unless they are meant to.

To begin drawing in copper lines first click on route styles in the bottom left corner. From there you can change the line width to you desired amount. (127 mm gives a characteristic impedance of 50 ohms). After this is selected you can zoom in and our using the mouse wheel hovering the mouse over where you would like to zoom. This is helpful where trying to see exactly where copper lines are being drawn. Next click on one of the signal tabs in the top left corner. it should highlight grey. Then click LINE in the bottom of this menu. Click to start drawing, each time clicking to change directions. When done drawing hit escape. Name another tab with GND and click on it so that it turns grey. Then with the RECT button in the bottom left, cover the entire board with a ground plane if one is needed. Then to connect components to ground, click on the THRM button in the bottom left and click the pins that will be grounded.PCB Program.png

Printing the Transparency

After you are satisfied with the circuit make sure to save it and then go to file---> export and choose export to postscript. This provides a nice way to view each layer of the circuit before printing. Check the parody of the circuit layers in the exported postscript. If they need to be changed you can go back into the pcb program and after exporting to postscript, check the mirror option. Note, for print out transparencies you almost always want mirror selected, this is because the transparency is flipped and laid over the pcb before developing. Once you are satisfied with the post script diagrams open gimp photo editor and in gimp open the needed pages of the postscript (pgs 2 and 3 are the top and bottom). Import at 600 dpi (resolution). Print a transparency of this on a high resolution printer.


Making the Board

Cutting the Board

Measure the dimensions of the printed transparency, and mark these off on the physical undeveloped PCB. With a heavy duty cardstock cutter line up the PCB such that the usable portion hangs to the left of the blade. This will minimize splintering of the board when it is being cut. When ready to cut, slice the board with force in one continuous motion. With a cut PCB, slightly larger than the transparency, you are now ready to develop the board.

Developing the Board

Exposure times for the PCB vary depending on the exposure method. For instance, if you're working with a single sided board and plan to develop using the overhead florescent lights I recommend about 15 minutes of exposure. Before peeling off the tape and exposing the PCB, make sure to have a flat plate of glass such that you can lay the transparency over the peeled board and then lay the glass over the transparency so that it is flat against the PCB. It is helpful to dim the lights during this step to minimize exposure until ready. Once exposure begins do not move the board.

If you are building a double sided board, it will be a good idea to use a uva light chamber so that you can expose evenly on both sides. If you do not have one here is a link to construct one using leds. [3] Another method to expose a double sided board without a light chamber is to secure the transparency on both sides of the board and then expose each side individually for the same amount of time.

Expose long enough such that all of the uncovered copper goes away but not so much such that the protected copper goes away. Note exposure times in a UVA chamber will be much less than 15 mins.

Once the board is necessarily exposed, develop the board by swishing the board around in a solution of NaOH. This should be done until the exposed portions (where light was able to hit the board) are clean copper. There should still be traces where the copper will be on the final product.


Etching the PCB

After the PCB has been developed wash it in a bath of copper chloride with a eye dropper worth of hydrochloric acid. Making sure to continuously swish the board around in order for the reaction to take effect. Wear gloves for this process. Continue until all of the unwanted copper washes away. All that should be left is the copper protected by the traces that were cured on from the transparency. Neutralize the board with a base to stop the reaction. When Finished, rinse the board in acetone to get rid of the trace ink. All that should be left on the board now is the wanted copper traces. Wash board in water and dry off after.

Populating the PCB

Before components can be soldered into the board, the necessary holes need to be drilled. The PCB program should have included where these holes need to be, or if you made a custom footprint you designed them with the via button. Place the PCB in a drill press. The chosen drill bit should be slightly larger than the components pin hole such that it can be soldered in. For most common electronic components use a #60 carbide drill bit. Make sure the drill bit is carbide tipped so that in doesn't break when cutting through the fibreglass PCB. Also make sure to wear goggles for this process as there will be fibreglass shards. Drill out necessary holes. Keep the fibreglass shavings in a pile and after drilling is complete, vacuum them up. The electronic components are now ready to be soldered in.