How to design a PCB board: a LED flasher
We will be building our first project, the most known circuit, which is a two transistor LED flasher.
It is a circuit with two LEDs that will blink/flash in turn.
This will get you started in designing a PCB from start to finish step-by-step.
We will be creating the schematic, components with their footprints and 3D models.
We will then route the board, assign board rules and finally, create output in gerber file format with the purpose of manufacturing, and what to take into account when sending your board for manufacturing.
Some usage for this circuit:
- Signal by flashing that a battery level is low or high
- Replacer of a LED or relay with this circuit to indicate a condition: you need to water plants, someone is in your house, etc
Picture with the finished schematic
Picture with the routed board
Picture with the board in 3D preview
So, let’s create a project: open Modern PCB Designer Studio, click on ‘New Project’, choose the ‘Board’ as project type, type the name for the project, then click OK.
Picture creating the new project
In the ‘Solution’ tool window, notice the tree structure. At the root we have the solution. A solution is the collection of your projects, your architecture that you create for your product or widget.
Picture with solution tool window
In our project, today, we will be working with one single project. Although you will usually use external libraries for components, we will create components, footprints, symbols, and models right in the same board project, just for the purpose to demonstrate this feature.
So, in our project, let’s create a few folders to stay organized. Create the following folders, by right-clicking on the project in ‘Solution’ tool window and choose Add-> New Folder from context menu: Symbols, Footprints, Models, Components, Schematics, Boards. You don’t really have to create these folders, you may choose not to create them, and the folder name is not important. You may name any folder whatever you want.
We will be creating one component, so that this article wouldn’t become boring, because tasks are quite repetitive. We choose a resistor, so that would be short and easy to understand.
So, first let’s design the symbol. In the ‘Solution’ tool window, select the ‘Symbols’ folder and right-click and choose Add-> Symbol..., in the window that appears choose the name for the symbol: ‘Resistor’ and click OK.
Having the symbol you created open, you can see the canvas where you can design your symbol. The canvas I am describing is similar for either a footprint, a schematic or a board.
On the top, there is the toolbar where you can change the grid size and units (mil or mm). On the left you will find the toolbox where you find primitives that will create your symbol. You can zoom by using the mouse wheel, you can pan by moving the mouse while clicking and holding the middle mouse button.
Creating the resistor symbol
So, let’s create our symbol. In the toolbox on the left click on ‘Pin’. A pin will be shown that will move while you are moving the mouse. You may click the <SPACE> to rotate the pin, then click anywhere on canvas to place it. Place the second pin. Click on ‘Line’ in the toolbar, and click multiple times on the canvas to define the lines that will make up the resistor symbol. Right-click to exit the placing mode. You may need to right-click multiple times.
I am in Europe, so I will draw a rectangle for this, you may choose to draw the US symbol instead. When you have a symbol open you should have two more tool windows open: ‘Overview’ and ‘Properties’. ‘Overview’ shows primitives and pins from this symbol document. When you select a primitive in ‘Overview’, it will be selected in the canvas as well; it also works the other way: when you select a primitive in the canvas, by clicking on it, or dragging a rectangle around it, it will be also selected in ‘Overview’. When a primitive is selected, its properties will be shown in ‘Properties’ tool window. When multiple items are selected, in ‘Properties’ will show the common properties of these selected items so that you can change all selected items at once. For example, you choose to select all the lines you created previously and change their color.
One more check: make sure the pins that are defined have ‘Number’ property different: 1 and 2; you may use ‘Overview’ for this and you should see two pins: ‘Pin 1’ and ‘Pin 2’.
Save the symbol. You may close this document if you wish, we’re finished here.
Picture with the finished resistor symbol
Creating the resistor footprint
First, let’s create the footprint document: right click on the folder ‘Footprints’ and choose Add -> Footprint from the context menu. In our case, we will create the footprint for a resistor that has the size 0805, which is a SMD package.
Here is what you should consider when you design any footprint:
- Use the internet for the most common sizes; in our case we will google for ‘0805 res footprint size’, or something similar.
- Use a similar footprint that was designed previously. This could be from another project that was made either by you or somebody else
- Use the datasheet of the part you want to use. In the datasheet you will find a section that reads something like ‘Recommended landing pattern’ or similar. If not, estimate some pad sizes that you will take from the dimensions that are describing the part, print the board on the paper (see below at 4.) and check the fitting, and repeat as needed.
- Now, no matter what source you’ve taken to create the footprint remember the following rule: ALWAYS verify your footprint. If you’ve taken for granted the footprint sizes, it will most likely not fit for you; for example you won’t be able to solder the part, or the part will just not fit on the footprint. You can do this verification even from early stages when you created the board, by just printing on paper this board that contains these parts, and then physically take out the part from your parts bin or from the cut-tape and check if it fits on this printed paper, and if you can solder it, if your soldering iron can reach the pads, and so on.
Now, onto our footprint. In the toolbox on the left click Smd, to create a SMD pad and then click on the canvas to position and create two smd pads. Select the two pads and set Width and Height properties for both pads at the same time. Now position every pad by changing X and Y properties. X and Y properties for a smd pad represents the center of the rectangle that defines the pad. You can also drag the pads to move them, but changing properties in ‘Properties’ tool window is more precise.
Now, in the ‘Layers’ window choose ‘Top Silkscreen’ layer. In the toolbox, click on ‘Line’ and click multiple times to define the placement outline for our resistor. To define the outline, take into account the mechanical dimensions of the resistor from the datasheet, or having the part in your hand (or on the desk), use a calliper and measure it.
One final check: make sure you have two pads that are numbered differently: ‘Pad 1‘ and ‘Pad 2’; you may check this in ‘Overview’.
Save the footprint. Keep this document open, because you will need it to associate a 3D model.
Picture with the finished resistor footprint
Creating the resistor 3D model
In Modern PCB Designer Studio you can create your own 3D model. Currently you can use simpler objects such as boxes, cylinders, spheres, etc, to compose them into a more complex model by joining them together. You can also import multiple meshes from other file types, and also join all these together. For all this, you need to create a separate file that represents a new mesh model.
So, to create a new 3D model you do it like you did previously: in ‘Solution’ tool window, right-click ‘Models’ folder and choose Add->Model... from context menu. In the window that appears, type the name for the model and then click OK.
In the document model that appears, in the toolbox on the left click on ‘Box’ and place three boxes. Two of them will represent the pads and the third, the body of the resistor.
Select the ‘pads’ and choose the silver or gray color for both. Also change the color for the body to black. Select every box and change the ‘Width’, ‘Height’ and ‘Length’ properties to represent the dimensions that will make up the resistor. Use mechanical sizes from the datasheet of the part you intend to use, or, having the part in your hand or your desk, take a caliper and measure its dimensions. You are interested in lead/pad dimensions of the resistor and the body dimensions. Now position the pads and the body so that they would align nicely. Consider an idea that the pads will go easily inside the body.
Here is a feature of Modern PCB Designer Studio: you can define the pad numbers in this model and the model will self-align when you associate it in the footprint. Here is how you do this: select one ‘pad’, the gray box, and change the ‘Number’ property to 1. Select the other pad and change the ‘Number’ property to 2. That’s it.
Save the model. You may close this document if you choose to.
Picture with the finished resistor 3D model
Associate the 3D model to the footprint
It is time to set our model to the footprint we defined previously.
Open the footprint, go into 3D mode, by clicking the ‘3D preview’ button from the bar on top. Now, click on ‘Associate model…’, in the dialog that appears, choose the model, then click OK. At this moment, the model should be self-aligned on the pads if you defined the pad numbers on the boxes in the model as described previously. If it is not, then select the model, and change X, Y, Z properties for the center position, and RotationX, RotationY, RotationZ properties for the orientation of the model.
Save the footprint. You may close the footprint document, as we no longer need it.
Picture with the asociated model footprint in 3D preview
Creating the resistor component
Next, we will create the component for the resistor. This will be the actual part that will be on the schematic and, ultimately, on board. A component links pins from the symbol with pads from the footprint; here you can also define the prefix, custom properties, and BOM data.
So, let’s create the component by right-clicking in ‘Solution’ tool window on Components folder then Add->Component… from context menu, choose the name for the component and click OK.
On the left we have the area where we add symbols as gates. You can add multiple symbols that will make up the gates for that component.
To explain what a gate is, think about a quad opamp that has four opamp gates (quad) and other pins for power of the device. In defining such a device you would add maybe five symbols (gates): four for every opamp gate, and another for V+ and V-.
So, in order to add a gate we need to click ‘Add symbol’, then select the resistor symbol you defined previously from the dialog that appears then click OK.
Now, we add a footprint. Click on ‘Add footprint’ and select the resistor footprint you defined earlier from the dialog window and click OK.
Under the footprint, notice there is a grid that specifies what pin from the symbol connects with what pad from the footprint. In our case for our resistor it is not important, just check that is not specified the same pin for two different pads.
That was the fun part, but now comes the part with some metadata. Click on ‘Properties’ and specify a prefix, in our case type ‘R’, and specify some properties for this component, for example you can specify the value, power, tolerance and others.
You can save the component and close it.
Picture with the completely defined resistor component - definition
Picture with the Properties for resistor component
Creating other resistor components
You just created a resistor component that could be used in a generic way, so that is considered a generic resistor. Now, Modern PCB Designer Studio is targeted for hobbyists and non-professional designers, but here is a professional advice from me: create a component for any physical part that has a different manufacturing number (MFN). This might seem like it makes you do more work, but it helps a lot when you will be deciding to change that particular component with another one, when you will do a re-design to your schematic and so on.
So, let’s say we want to define another component, in our case a resistor, that has a different value, other properties, so this is another part on your board. You will have to buy another part, another resistor for this.
So, you add another component like you did previously, you add the same resistor symbol, the same footprint. In this way you reuse the same symbol and footprint.
Next, define the properties, the prefix, save, and you’re done.
Creating the rest of the components
Creating the rest of the components is left as an exercise for you. It will be a little work, but you will do the same things when you created the resistor.
You can first define the symbol, then the footprint and its 3D model, and then the component, where you add the symbol and footprint you defined for this component.
Remember, for this project we chose not to use any libraries, but you could have used symbols, footprints and 3D models from other libraries, so reusing stuff will save you a lot of work.
Creating the schematic
It is time to define our schematic for our project. We have now defined all the components (parts) that we need, so let’s define our schematic.
Placing components in the schematic
We have to place our components. So in the toolbox, click on ‘Place part’, choose the part you want to place, rotate the part with <SPACE>, mirror it on X-axis using <X> from keyboard, or mirror on Y-axis using <Y> key.
Place all the parts and position them.
Wiring the schematic
Next, we wire our schematic. In the toolbox, click on ‘Net’, then click on a pin to start a net, press <SPACE> to change wiring modes, then click on the other pin to end it. Keep wiring the entire schematic.
Naming nets in the schematic
You can name a net in the schematic. I recommend you to name any net that is important. For example, VCC, GND, but also any net that goes to the RESET pin of your microcontroller or any feedback pin in your power supply.
Named nets are used for assigning them to net classes and also to be easier to view them on the board.
So, you name a net using a label, and for this, you click on ‘Net label’ in the toolbox on the left and then you place this label on the net wire. Then, you select this label and from ‘Properties’ tool window type a new name for the net.
Defining classes in the schematic
A net class is in fact a group for a net to mark it with. You must define a net class first. You go in the schematic properties by clicking ‘Properties’ in the bar from the top. Click on ‘Net classes’ and you will have an empty tree on the left. Here you can manage the net classes by adding, editing and removing them. You can also create net groups and add net classes to these groups.
On the right, there is a list with all the named nets from the schematic. Only the named nets will be in this list; if you are interested in a particular net that you want to assign it to a class, you have to go into the schematic and give it a name.
Use the arrow buttons to assign and remove nets to and from the selected class.
Click on ‘Show schematic’ when you’re done.
Adding some text in your schematic
You might want to add some final touches. For example add a comment for the parts; you may add the value of the resistors, power and tolerance; you might also add the color of the LEDs.
You may insert some text in your schematic; for example, add a title, add some text notes on how the circuit works, or for a larger schematic, you would mark some modules with some text.
Creating the board
Until this moment, we have a schematic. Now it’s time to create our board. It will be a 2 layer board and will look similar to a breakout board. Breakout boards are usually used for testing a circuit or for fast prototyping.
So, in ‘Solution’ tool window, right click on Boards folder and then choose Add-> Board… from context menu. Give the board a name in the dialog that appears and then click OK.
Reference the schematic for your board
We must link our board to a schematic, and for this reason, on the top side, we will have a button that says ‘Set reference schematic’, click on that, and select the schematic in the dialog that appears. It should be just one schematic. After this, click OK.
You will see the parts that belongs to our circuit that we will be wiring, or routing them together.
Creating the board outline
We need to create the board outline that will define the actual shape of the board. In the Layers window, there is a layer called ‘Board Outline’. Select this layer. There are some lines that already define a default board outline. Delete all these lines. We will draw our own outline.
Just place on this layer ‘Board Outline’ lines and arcs only so that it will form a close loop. It is important to have a closed loop. When you finished, click on ‘Update board outline’ from the top bar. The shape of the board must update with the new one; just in case it doesn’t, check that you have items that start in the same point of another item that ends. Also, check to have the closed loop.
I would recommend placing any mounting holes that would be needed, now, before placing the components. If you place the holes later, you will have to move the components and maybe redo some routing. This could be a pain.
Placing components on the board
You can place the components on the board by simply selecting them and dragging them where you want them to. You can rotate them with <SPACE> key.
To see the relation of one pad with another, you can press <SHIFT> and select a pad. This will highlight the entire net with all the pads that must be connected, and the board will get dimmed.
You can move the components and the net will stay highlighted during this time.
If you are interested in a particular net, or in particular components, remember that there is this cool feature of cross-highlight and cross-select between schematic and the board. In your schematic, you may select a part and you may highlight a net (by SHIFT and select a pin, for example). This will also select the part in the board and will also highlight the net; now you may position the parts on the board easier. Use this, it is very powerful and cool!
Creating rules for your board
Now we will create the rules that will define our board.
We will have something simple, some clearance and some minimum width for our traces.
Click on ‘Properties’ in the top bar and then on ‘Rules’. Notice that there are already some rules defined. In general, you add a rule by using the toolbox from the left. There is a button for every rule type that is supported. You can also group all these rules.
We will explain all these rules in more depth in another article, but for now define these rules: Electrical clearance, and Trace width. Set 10 mil as clearance and 10 mil as min trace width.
When you finished, click on ‘Show Board’
Routing your board
Routing the board is the process of making all the connections between the pads.
In the board, you do this by clicking on the ‘Trace’ in the toolbox from the left side.
Click on the pad from where you want to start. Now you have some options to change the style of the routing (direct, horizontal-diagonal, or diagonal-horizontal) by pressing <SPACEBAR> key. This refers to the orientation of the lines that will go from the last point you clicked and the position of the mouse. You can also control the routing mode with <TAB>. This is about how the router will behave in relation with the obstacles.
Currently, we have the following routing modes:
- Ignore obstacles: this will go right through anything it encounters (pads, vias, other traces).
- Stop at first obstacle
- Walk around obstacles - will try to create a trace so that it will avoid and get around obstacles
Finally, click on the second pad to finish the routing of that trace. You can also change the layer by selecting another layer in the ‘Layers’ tool window. We will have also a key binding that cycles through layers (insert here). Repeat until you finish routing the board.
Final touches, polygons, more text
Try to arrange the traces, place some polygons if you want, and insert more text that describes the connector, the pins. Insert some text about min and max voltage for the device, current draw, your name, maybe the title of the project, etc. Here is what I did:
Picture with final board - with text
Picture finished in 3D preview
Creating Gerber output for your board
Gerber files are the files that you send to a board house to manufacture boards.
In Modern PCB Designer Studio, you need to do a single setup once, you select what layers you want to output, and also NC Drill files. In the future, every time you will want to output the gerber files you will have to right-click in ‘Solution’ tool window on either the solution node (the root) or the project node and choose ‘Build’ from context menu.
To make this setup, click on ‘Board properties’ then on ‘Output’, select any layers from the grid that you want to create the gerber files for. You might have them selected already. Also, click on ‘Drill files’ and make changes, or leave them all default.
Now build the project or solution using ‘Solution’ tool window. After it finishes, in the project folder, you will find a folder called ‘!Output’. In this folder you will find all the gerber files and drill files that you’ll need to zip them and send them for manufacture.
Viewing Gerber files
The board editor is an WYSIWYG (What You See Is What You Get) editor, but ultimately, there are those gerber files that will create your board and you must make sure that they are correct, meaning, you must ensure that the gerber files will draw the same as in the board editor.
Currently, Modern PCB Designer Studio does not come with a gerber viewer, but you can find a lot of results by searching on google for ‘gerber viewer’; you will find both desktop applications and online viewers, even your PCB manufacturer might have one.
So, check the gerber files that were generated and compare them with the board editor. Check this well before sending your boards to the board house.
Sending your board for manufacture
At this moment, we have the gerber and drill files, and we created a zip archive with these.
Next, you will choose a board house, a PCB manufacturer, that will create our physical board and deliver it to our door. I recommend you choose someone that is next to you, that delivers relatively fast, has a somewhat low price, and decent quality of their delivered boards. Ask for recommendations around in forums, your friends, etc.
Most board houses will require to specify for them some details of the board such as: board dimensions, copper finish, soldermask color, and others.
You will have to upload the zip archive mentioned earlier, or, sometimes, send it by mail, you will get a quotation for a price (some have online calculators) and after some time (check this with manufacturer) you will get your PCB at home, ready for it to solder the parts.