Week 6. Electronics design

Summary

This week we focused on learning how to design our own PCB following electrical rules, the use of different components and how to use KiCad software for making the PCBs.


Group assignment

Here is the group assignment to check more information about the topic electronics design.


1. Basic concepts

1.1 What is a PCB?

A PCB (Printed Circuit Board) is a board, usually made of insulating material, on which electronic components are placed and connected using conductive copper traces. These traces replace traditional wires and allow electrical signals and power to flow between the different components of the circuit.

1.1.1 Why is it useful?

They serve as mechanical support and a means of electrical connection, and are used in virtually all electronic devices, from computers and telephones to industrial systems.

1.1.2 Parts of the PCD and their function

1.2 What is the electronic design of PCBs?

Printed circuit board (PCB) design is the process of planning and creating the physical board on which the electronic components of a circuit are mounted and connected. This process includes creating the electrical schematic, which defines the connections between components, and the PCB layout, where the components are placed on the board and the copper traces that allow the flow of signals and power between them are designed. The goal is to obtain a functional, efficient, and manufacturable board, considering aspects such as size, component placement, electrical interference, heat dissipation, and compatibility with the manufacturing process.

1.3 Ohm law

Relationship between voltage, current, and resistance in an electrical circuit. It indicates that the current flowing through a conductor is proportional to the applied voltage and inversely proportional to the resistance.

1.4 What is KiCad?

KiCad is a open-source electronic design program used to create printed circuit boards (PCBs). It can be used to draw electronic schematics, design the PCB layout where the components are placed, generate manufacturing files (such as Gerber files) for sending the board to production and visualize the design in 3D before manufacturing.

For this week assignment I will use KiCad.

1.4.1 Other softwares

2. How to use KiCad

KiCad manages 3 types of files:

2.1 Download and install KiCad

First we will download their website, here is the link to go directly to KiCad download website.

2.2 Install the FabAcademy library

FabAcademy has its own library in which they include most of the components we will use, so we will install that library so we can use the components with his footprints and data to make some calculus and make the pcb.

This is the main menu of KiCad.

KiCad1_compressed
Fig 01. Main menu of KiCad

To add this library or others, we will select the "Plugin and Content Manager" box icon. Then we select the libraries option and search for Fablib.

KiCad2_compressed
Fig 02. Installing the library from FabLab

We install it and click on apply pending changes.

2.3 Create a folder for a new project

When creating a PCB, it consists of different files, so you need to create a folder for each PCB. To do this, go to File, New Project, which will create your folder to store the files.

Profile Vertical
Fig 03. Creating a new project

Once our project is created, we will open the sch file

2.4 Working on the schematic file

This is the first screen that greets us.

KiCad4_compressed
Fig 04. Schematic window

All our tools on the right side allow us to insert components into my drawing. The most important one is the triangle because it allows us to insert the components.

KiCad5_compressed
Fig 05. Component tab

Here we see our components; you just have to select them with a click.

The schematic shows us a drawing of the component with its pins, and the PCB shows us the footprint that our component will have (physically), we can change the type of footprint according to our needs.

KiCad6_compressed
Fig 06. How a component looks
2.4.1 Footprints

The footprints can start with D or Pmeans "Through hole"; these are components that pass through the board. S means components that are soldered on top.

To find the size, we can use the numbering of our component, ordered by width x height. Then we just need to check the scale, whether it's metric or imperial.

2.4.2 Connecting components

Fow wiring we can click on the end or tip of the component that we are using, as well as we can press W and we will start drawing a cable.

We can also use labels to connect the outputs and inputs; they simply need to have the same name, and when we switch to the PCB view, they will appear connected.

If we want to modify the name of a component, we double-click and change it.

KiCad7_compressed
Fig 07. Modifying the name of a component
2.4.3 How the simulation works

Spice elements must be inserted to perform the simulation. This elemnents are almost all components that we have on KiCad.

I will place a small circuit to simulate it.

KiCad8_compressed
Fig 08. Ciucuit that is going to be simulated

For any simulation, it's important to establish a zero reference point to determine how the measurement is being taken; this will normally be connected to the negative voltage terminal.

KiCad9_compressed
Fig 09. All connected

To simulate, go to the inspect tab, simulator and play.

KiCad10_compressed
Fig 10. Going to the simulation tab

They ask us what type of DC operation we will use in this case, but we can use any type; it will depend on what each person needs.

KiCad11_compressed
Fig 11. Setting the voltage

After configuring the voltage, we go to the schematic probe tool and click. With this tool, we can measure current and voltage anywhere in the circuit over time.

KiCad12_compressed
Fig 12. Schematic probe tab

By activating or deactivating options we can see the values ​​and their graph of other unknowns.

KiCad13_compressed
Fig 13. Activating options to see the behaviour
2.4.4 Connecting the components

If we don't know how to use a component, we can use the e command or double-click the component to open a datasheet that will show us its functions and typical applications.

In my case I use labels to connect the outputs and inputs of the Xiaomi pins.

KiCad14_compressed
Fig 14. Connecting with place power symbol

I used pin socket for analog inputs

KiCad15_compressed
Fig 15. Pin socket component and footprint

Pin header for digital inputs.

KiCad16_compressed
Fig 16. Pin header component and footprint
2.4.4.1 Create LED system

I will use surface mount components as they are the most suitable for PCBs. To maintain a balance between compactness and easy handling, we will be working with 1206 components, which are 3.20 x 1.60 mm.

The value that I chose for the resistor which after the LED was 1kΩ, this will limit the current to 1.3mA, which will keep the LED visible and maintainin power efficiency, while preventing the LED from burning from an excess of current.

Profile Vertical
Fig 17. LED configuration
2.4.4.2 Create button system

We will make a button in a pull-down configuration, which means that the default state of the input will be false. We insert the button, the resistor, the label, power and ground. We wire the power to the button and place the label on the other side, we then continue to the resistor and end at ground. The vaule that I chose for the pull-down reistor was 10kΩ, which is a standard value used in digital electronics because it pulls the pin LOW reliably without wasting power, ensuring stable, low power operation when the button is not pressed.

Profile Vertical
Fig 18. Button configuration
2.4.4.3 Create the voltage regulator

Will recieve electrical signals and turn them into 3.3V signals. If we don't know how to integrate them we can look for the datasheet of the component, and copy the intended applications. From the intended applications, we can copy the components and wiring that the system requires, which is precisely what we did to integrate the system into our schematic. The regulators output voltage is 3.3V, which is the voltage that the XIAO uses to operate, the value of the capacitors is of 10µF on the input side and 22µF on the output side. The input capacitor reduces voltage ripples from the power source and helps smooth sudden changes in current draw. The output capacitor keeps the 3.3V line stable when the circuit's current demand changes and prevents oscillations in the voltage regulator. The 10µF and 22µF values are recommended in most regulator datasheets, since larger caps handle power fluctuations better than smaller ones such as lµF, but too much capacitance can slow down response time, so 10µF and 22µF are a good balance.

Profile Vertical
Fig 19. Voltage regulator configuration
2.4.5 Add lines

We can add lines to our schematic to be better organized; these will not be visible on the PCB and are purely decorative. To do this, we press the I key and it will activate automatically.

KiCad20_compressed
Fig 20. Lines in the schematic

We can change the style of the lines with a double click.

KiCad21_compressed
Fig 21. Changing the line style

This is how our final area looks like

KiCad22_compressed
Fig 22. Final work area
2.4.6 Electrical Rules Checker

Once we are finished with the schematic, we have to use the Electrical Rules Checker or ERC to check for any errors in our design. It is located in the toolbar at the top.

KiCad23_compressed
Fig 23. ERC location

We then run the ERC, which will display all possible errors in our schematic.

KiCad24_compressed
Fig 24. ERC running result

Any unused pins will be classified as an error, delete this we will use the place no connect flags tools, denoted by a line and a cross. We will place one of these crosses on any unused pins. When we run the ERC again, these errors will disappear

FIG25_compressed
Fig 25. ERC with crosses tool

2.5 Working on the PCB file

Let's click on the PCB button (the green one)

FIG26_compressed
Fig 26. PCB button

This is the screen that welcomes us

KiCad25_compressed
Fig 27. PCB window

Once we are in the PCB layout editor, we have to update the PCB from the schematic. We do this by clicking on the icon with half a schematic and half a PCB on the top tool bar of the screen and then on the update PCB button, this will import all of the components present on the schematic.

Profile Vertical
Fig 28. Update board from the schematic

The program inserts the components together and disconnected; we can arrange them as needed.

KiCad27_compressed
Fig 29. Adding the components

This is how it looks like

KiCad28_compressed
Fig 30. Adding the components
2.5.1 Calculate the width of our track and modifying them

Before wire the components together, we need to calculate the width of our trace. This is important because if the width is too small, it can affect the current flow, voltage drop, heat dissipation, or signal integrity (in fast signals).

To do this, we will open the calculator tool from the main menu.

KiCad29_compressed
Fig 31. Opening the calculator tool

Once open, we click on "Electrical spacing" and we can see which width is best for us to use.

KiCad30_compressed
Fig 32. Calculator tab

I will use the size of part B2 since my voltage will not be greater than 5. Then in "Track width" I write the maximum current and temperature values ​​that I expect, obtaining that my track width should be 0.3 mm.

KiCad31_compressed
Fig 33. Track width tab from calculator

We return to the PCB layout and configure the track width and we click on the board settings button

KiCad32_compressed
Fig 34. Track width tab from PCB layout

In the Requirements tab, we modify our track width and click OK.

KiCad33_compressed
Fig 35. Requirements tab from track width
2.5.2 Wiring the components

We have a button called "route" which, when selected, allows us to connect components. To connect them, you have to select the red side of one and the other side where it connects.

KiCad36_compressed
Fig 36. Routing button

KiCad itself helps us to do this tracing by making only this visible.

FIG37_compressed
Fig 37. Wiring two components

This is what our components look like once connected.

KiCad35_compressed
Fig 38. All components connected
2.5.3 Place cutting edges

We draw the borders with the Draw lines tool. To define the cuts on our PCB, we go to the layers tab and select edge.cut.

Profile Vertical
Fig 39. Edge.cut tab
KiCad37_compressed
Fig 40. Drawing our cuts
2.5.4 Design rules

We can do something similar to the ERC; DRC will tell us these possible errors. These warnings are related to text and the Silkscreen, so I can ignore them.

KiCad38_compressed
Fig 41. DRC result

2.6 3D view

With the 3D Viewer tool we can see the 3D model of our PCB, we just have to click on it.

KiCad39_compressed
Fig 42. 3D Viewer button

This is how my 3D model of the PCB look like.

KiCad40_compressed
Fig 43. 3D view of the PCB

To get this view without components, we deactivated SMD Models and hole model.

KiCad41_compressed
Fig 44. PCB without the components

3. Designing the case for our PCB

We take measurements using the Draw orthogonal dimensions tool.

Case1_compressed
Fig 45. Placing measures

Now we will open SolidWorks to sedign the case with the measurements that we just took. We create an sketch and put the measures.

Case2_compressed
Fig 46. PCB sketch

After extruding in a new sketch we make an exterior offset of the border to place the holes for the screws.

Case3_compressed
Fig 47. Base of the PCB

To make the lid, I will create a plane above which I will use convert entities and offset.

Case4_compressed
Fig 48. Making a new plane

In the new plane we use convert entities for copy paste the borders of the base to make the lid, and offset to make a hole so we can see the LED and oush our button.

Case5_compressed
Fig 49. Sketch of the lid

Here is the final look of the case, I designed so the holes can fit M3 screws.

Case6_compressed
Fig 50. Case of the PCB

4. Conclusions

In my experience, it's always best to have everything you'll use in the schematic before moving to the PCB layout, since adding new components can affect existing connections, requiring you to redraw your entire PCB design. If possible, have someone with more experience review your schematic to identify any errors or missing components.


5. Files created

Click on the "Download ZIP" to download all the files I made for this week assignment

Download ZIP