Design a PCB for the Very First Time in KiCad

by taste_the_code in Circuits > LEDs

8707 Views, 25 Favorites, 0 Comments

Design a PCB for the Very First Time in KiCad

How easy it is to design a PCB for the very first time?
2021-08-25 06-16-43.00_00_02_07.Still002.jpg
2021-08-25 06-16-43.00_00_05_03.Still003.jpg

Hi Everyone,

Today I will show how I created my very first custom PCB using KiCad. I'll cover the entire process from creating the schematic, all the way to ordering the PCB from PCBWay.

As you might already know, PCBWay is a PCB manufacturing company in China, from where you can order PCBs for your projects. They've already sponsored a few of my videos but this will be my first time making a custom PCB and ordering from them so we will see how the process goes. PCBWay also offers sponsorships for students and hobbyists where you can get your projects built for free.

You can join the 4th PCB design contest of PCBWay on the link below:
https://www.pcbway.com/activity/4th-pcb-design-con...

Before we continue, keep in mind that I'm not a PCB designer. This will be my very first try at building something like this and I'm sharing this so I can encourage you to try it as well and demystify the process for beginners like me.

In the final design, I'll probably have a ton of mistakes that I might not even be aware of so please if you are a PCB designer or know more than me, use the comment section below to let me know of those mistakes.

That way we can all learn to be better and create better products.

Supplies

Components needed to assemble the board:

What to Build

2021-08-25 06-16-43.00_00_59_22.Still004.jpg
2021-08-25 06-16-43.00_01_07_23.Still005.jpg
2021-08-25 06-16-43.00_01_19_07.Still006.jpg

I was thinking for a long time about what to create for my first PCB project. I wanted something simple but at the same time, I wanted to make something that will be useful for an actual project.

Looking at my pending projects list, I remembered a project idea from a couple of years ago, to create RGB lighting for the stairs in my house. When I built the house, I installed cable that runs in the walls, with holes for the eventual fixtures that I will use.

I haven't bought the fixtures yet, but the idea is to use some of the recessed light fixtures and install a custom module with 3 addressable RGB LEDs in each light.

The idea is to then use a microcontroller to drive those LEDs from a movement sensor and also be able to light them with special effects for occasions like Christmas or birthday parties.

This will be an interesting one, so be sure to subscribe to the channel if you are not already!

Why KiCad?

2021-08-25 06-16-43.00_01_54_07.Still007.jpg

There are a lot of PCB design programs out there and they all have their strengths. KiCad is an open-source program and as such it is used by a lot of makers. It might not have all the bells and whistles that the big players have but it should still provide enough for a lot of projects and I wanted to give it a go.

https://www.kicad.org/

Creating the Schematic

2021-08-25 06-16-43.00_02_15_18.Still008.jpg
2021-08-25 06-16-43.00_03_56_15.Still009.jpg
2021-08-25 06-16-43.00_04_27_05.Still010.jpg
2021-08-25 06-16-43.00_04_58_17.Still011.jpg

When we first start KiCad, we need to create a new project and that will create two files inside.

The first file is the one containing the schematic of the project and the other one is the one containing the PCB. Since we need the schematic in order to create the PCB from it, I'm first opening the .SCH file and upon first open, KiCad asks to configure the global symbols library.

For anyone using the program for the first time, going with the default to import the default libraries is recommended and I went with that.

When the schematic is opened, we are greeted with a blank canvas and we can start adding our components to it.

To add a component or symbol as it is called inside KiCad, we select the "Place Symbol" tool from the toolbar on the right and after the initial load of the libraries, we get the "Choose Symbol" window.

In the top section of this window, we have a search bar from where we can find our components. In my case, I searched for the WS2812B RGB LEDs, also known as NeoPixel LEDs and by pressing on the OK button, the symbol is now selected and you can place it anywhere on the schematic canvas.

I repeated the procedure 2 more times to add a total of 3 LEDs and I also added symbols for the 5V and ground inputs as well.

To make connections between the components, I used the "Place Wire" tool from the right toolbar. You first need to click at the start pin and start moving the wire with the mouse to the next connection point. The connection is then confirmed with another click and when 3 or more wires are connected at a single point, a larger dot appears.

Based on their datasheet, the LEDs I'm using require a capacitor of at least 100nF next to each of them for voltage stability so I added them as well, and connected them between the 5V and ground lines.

With all of the components in place on the schematic, there is one more important step that we need to take before we can jump into creating the PCB. KiCad comes with a tool called "Electrical Rules Checker" or ERC for short that can check your board for missing or invalid connections, or any other problems in terms of the set of rules defined for electrical connectivity.

I wasn't aware of this tool until I already started making the PCB and when I run it, it gave me two issues with my circuit regarding the symbols that I've used for the power input.

Since I did not have a power source defined on the circuit, the checker complained with a message of "Pin connected to other pins, but not driven by any pin". Based on the message alone, I wasn't sure of what I needed to do so after some googling, I found out that I need to add some special connection to the 5V and ground lines called "power flags" that will indicate to KiCad that the power to the circuit will come from an external source.

I had to jump few more times between working on the schematic and the PCB until I had everything right but I'll tell you more about it later on as we progress.

Creating the PCB

2021-08-25 06-16-43.00_05_51_14.Still012.jpg
2021-08-25 06-16-43.00_07_08_10.Still013.jpg
2021-08-25 06-16-43.00_08_46_21.Still014.jpg

I now had the full schematic ready, so I immediately jumped to convert it to PCB by using the tool in the top toolbar. However, I was reminded by KiCad that I'm missing footprints for some of the components.

A footprint definition specifies the physical appearance of a component in the final PCB. Since a lot of the components can exist in multiple sizes, we must tell KiCad which one to use for each. In my case, the LEDs were already defined but the capacitors were not.

In the "Assign Footprints" window, we get a list of all our components and the current footprint defined for that component.

To view the appearance of the footprint defined for a component we can double click on it and a new window with its preview will appear.

In my case, the current value for the capacitors was empty so I found the Capacitors library on the left and I chose the 1206 size SMD footprint for it. The size that you pick depends on the size of your final board but it also depends on the way that you plan to solder it.

I plan to solder these boards by hand using a regular soldering iron so I chose something that will be big enough for that.

With all of the footprints defined, our next step is to create a so-called netlist for the circuit. Based on Wikipedia, a netlist is a description of the connectivity of an electronic circuit. It defines the different components and the connections between them so the PCB tool can know what to show and what connections we need to make so that it works as defined on the schematic.

The netlist is easily created and once defined, we need to import it into the PCB editor of KiCad. When the list is imported, all of the components from the schematic are now added to the PCB with small white lines indicating the connection that needs to be made between each of the component pins.

With the components now in the editor, you can start preparing the layout of them but since my PCB will have a special shape, I wanted to first define the shape and work out of that.

I want the PCB to be circular, so by using the Circle tool and selecting the Edge cut layer on the right, I drew a circle with a diameter of 4cm but I later updated it to 3cm.

To achieve a precise dimension, you can customize the grid spacing by right-clicking with the mouse and selecting new spacing from the grid menu.

With any board, you will probably need to add some mounting holes so it can be secured in place in the final project so, for that, I've added a single 3.5mm hole in the center of the board.

The hole can be added by selecting the Add Footprints option from the toolbar and you can search for mounting holes in the dialog that appears.

Now, with the outline and the mounting hole defined, our next step is to position the components on the board and we can do this by selecting the component and dragging it around to its new place. We can also rotate any component at any time and create the layout that we want.

Since I have 3 LEDs in my design, I arranged them in a way so that they are equally distributed on the board and 120 degrees apart from each other. The appropriate capacitors are placed right next to the LEDs to provide the voltage smoothing as quickly as possible.

By default, the boards that you will create will have two copper layers, and depending on the components you can choose to add them on either one side or both sides. In my case, all of the components are on the front side, but I will have some solder pads on the bottom side.

To switch between the layers, you can select the layer that you want in the panel on the right and after that, anything that you will place on the board will be added to that layer.

To check your progress and appearance of the board, KiCad offers the ability to preview your board in 3D by pressing on Alt+3 or by selecting the 3D Viewer from the view menu.

The 3d model of the board will contain all of the components and their defined shapes, as well as all of the tracks that are added and any graphics or text as well. I'll be switching to the 3D view occasionally to make sure that I'm on the right track and that I like the output.

Updating the Schematic and PCB

2021-08-25 06-16-43.00_10_28_02.Still015.jpg

Once I've placed the LEDs and their capacitors on the board, I've noticed that I do not have any footprints on the board that is defined for the power inputs as well as for the data input and output lines.

These boards will be chained together to create one very large strip, so I need to have those pads on the back of each board with positions for 5V and ground and a third one for the control signals.

I'm not sure that this is the right way to do it, but in order for them to appear, I went back to the schematic and added a connector connected to the 5V rail, the ground rail, and both DIN and DOUT pins on the first and last LED.

As footprints for these connectors, I've selected to only have solder pads as my plan is to solder the wires directly to reduce the overall thickness of the final assembly.

To propagate the changes from the schematic to the PCB, I first had to update the generated netlist with the new changes and then inside the PCB editor, I selected to Update the PCB from the schematic.

This reads the changes in the netlist and places any new component on the board. Since I had selected solder pads for the added connectors, those solder pads were added to the board and they were now properly connected to the right pins.

The added footprints were 1x2mm in size and that looked kind of small so by selecting the footprint and accessing its properties window from the right-click menu, I was able to increase the size of the pad to 3mm in length so I can later on solder the wires more easily.

Each pad and component on the board has a label based on the schematic, but you can easily replace those by double-clicking on it and updating the text in the popup window.

This text will then be printed on the board silkscreen so it is easily recognizable to work with later on.

Routing

2021-08-25 06-16-43.00_12_08_20.Still016.jpg
2021-08-25 06-16-43.00_12_48_29.Still017.jpg
2021-08-25 06-16-43.00_13_07_15.Still018.jpg
2021-08-25 06-16-43.00_13_34_13.Still019.jpg

Once we are happy with the layout of the board, our next step is to create the routes on the board so the components can be electrically connected.

This is done with the "Route tracks" tool on the right-hand side toolbar but before we can use it, we need to define the correct track size that we want.

With the route tracks tool selected, there is a dropdown in the top left part of the program from where we can select the track width. In my case, by default, there was only one option available for a 0.25mm track but since I don't have a lot of components on the board, I wanted something bigger.

By selecting the bottom option to Edit the predefined sizes, I was able to define a new track width of 1mm that should work better when boards are chained later on.

To lay a track, you first start by clicking on one of the pads or connection points for a component and you can then drag the mouse to the next pad that you want to be connected to. The available pads that connect to the same signal line are highlighted so it is easy to see where you can connect.

Since the components are all placed on the top side, I've created most of the tracks on it as well but some of them need to connect to the pads that I've placed on the bottom layer, and in some cases, the tracks don't have enough space to be routed all on one side.

On such occasions, we can use the so-called "vias" that are copper plated through holes that can connect the two layers of the board together.

With this vias, we can start laying the track on one side of the board, select to add via from the right-click menu, and after adding it, continue the track on the other side of the board.

Once we are happy with our routing, the final step that we need to do is to create a ground plane.

A ground plane is an area of the circuit board that is almost entirely covered in copper and is connected to the ground lines in the circuit.

This plane has several uses but its most important role in the PCB is to reduce electrical noise and provide a better return path for the current and signals that travel to the board.

To add a ground plane, we use the "Add filled zone" tool from the toolbar and we click outside of the board outline. This will now open the "Copper zone properties" window where we need to select the ground reference net.

Next, we need to create a shape that completely covers the board and once we close it by double-clicking, the copper layer is created and connected to all of the ground connected pins and pads.

Adding Graphics and Text

2021-08-25 06-16-43.00_14_39_28.Still020.jpg
2021-08-25 06-16-43.00_16_00_23.Still021.jpg

Our board is now functionally complete but in order for it to look cool, we can add some graphics and text to the board that will then be printed on the silkscreen layers both on the top and bottom of the board.

The way that KiCad works, any text or graphic is actually added to the board as any other component so for any custom graphics, we need to create a component footprint.

Luckily, there is a dedicated tool for this called "Bitmap to Component Converter" and we can use it to create a component out of any image.

Once we open the program, we can load the image that we want to use and we can then adjust the threshold for its conversion to a black and white image.

Since we can't resize components on the board, while converting the image we need to keep track of the output resolution in the top part so we can adjust the image size that way. The finished size is written in the top info panel and once we are happy with everything we can export the component.

This creates a custom library that contains our component so to add it in the PCB editor we go to "Preferences → Manage Footprint Libraries" and inside the project section, we can import the library that we just created.

The library can be renamed, so once we choose to add it, we select the add footprint tool and in the choose footprint window we can search for the one we created. In my case I named it Taste The Code and after selecting it, I placed the symbol in the bottom part of the PCB to add the branding.

Similarly, you can also add text to the board and this time that text can either be etched out of copper or added as a silkscreen.

For that, we use the text tool, and in the "Text Properties" window we can add the text that we want on the board and also select the layer that we want that text to appear on.

In my design, I've added two texts. I've added the board version to the front layer in copper and also added my website and the board name to the back layer on the silkscreen.

Again we can use the 3D Viewer to make sure that we are happy with the board and we can now proceed to have it manufactured.

Order the Board

2021-08-25 06-16-43.00_17_13_13.Still022.jpg
2021-08-25 06-16-43.00_17_49_24.Still023.jpg
2021-08-25 06-16-43.00_18_40_06.Still024.jpg
2021-08-25 06-16-43.00_19_02_14.Still025.jpg

To manufacture the board, I will be using the services of PCBWay, which is also the sponsor of this Instructable.

In order for PCBWay to know what we need to be manufactured, we need to extract the design that we just made into Gerber format.

To do that in KiCad, we use the "Plot" option in the top toolbar and we basically go with the defaults that are presented in the Plot window. The only thing we need to be specified here is the output folder where the files need to be saved and hit the Plot button.

While we are here, we also need to generate the drill files so PCBWay can know where to drill any holes that we have on our board design.

To create the PCB order we first need to go to the PCBWay website and follow the steps for their standard PCB. In my case, the PCB dimension is very small so I went with the paneling option that they offer where you provide the design for just a single board and they create the panel in a way that best suits them and also costs less in the end.

I've tried different options for the number of boards and I settled on just 5 for now as I only need 40 lights for my stairs project and by getting 9 boards on each panel, I'll get a total of 45 with just 5 panels.

When I clicked to add the order to the cart, a popup appeared that asked me about the Gerber files that we just exported so I created a zip file with all of the files that we exported and selected that zip file in the upload.

The estimated cost at this moment for the order was $15 but keep in mind that this price is subject to change once PCBWay reviews the order and creates the panel. Since my board is circular, it requires extra handling in the paneling process so the end result after the order was reviewed was revised to $30.

This is a significant increase in terms of price, which is now double but instead of just 5 or 10 boards I'll be getting 45 of them and that equals to just 66 cents per board. Now that is extremely cheap.

Once I confirmed the order they started the manufacturing process and after about 24 hours, I got a mail that said that the order was completed and that the boards will be sent out with the selected shipping method.

Conclusion

2021-08-25 06-16-43.00_19_33_11.Still026.jpg

And now, we wait.

Hopefully, the boards arrive soon so we can inspect them and start soldering some LEDs to them to test them out.

I hope that I didn't screw anything up and that they'll be usable so I can finally finish the stairs lights in my house and share that project with you as well.

Additionally, I really hope that this video helped you to get over the initial fear of working with KiCad as much as it helped me and that armed with this knowledge we can now go on to create more advanced projects in the future.

If you are up for that, then please subscribe, it means a lot and it does make a difference, especially for a small channel like mine.

The Gerber files for the boards can be downloaded from the project page at PCBWay:

https://www.pcbway.com/project/shareproject/WS2812...

Thank you for reading and I'll see you in the next one!