Greetings! During the discussion of the article by comrade KSVl, the need for a small manual on printed circuit board design was voiced. Very often on Habré I see articles in the style of “5 rules for coding” or “5 steps to a successful project,” that is, very convenient collections of abstracts on a specific topic. Unfortunately, there are few such articles on electronics development and this is bad... I promised the KSVl user and some other readers an article with the basic principles of printed circuit board (PCB) design, I also invite all fans of soldering over a cup of coffee to read it!
Prologue
All the rules described in the article are the most basic and are aimed exclusively at completely novice developers for whom electronics is just a hobby.
I would like to note right away that this article does not claim to be the absolute truth and all explanations are given in free form. Surely there will be people who will say: “Yes, it works that way, why change anything?” And here, alas, I am not ready to waste energy and convince you. Some want to do everything well, efficiently and reliably, while others are unable to understand this desire.
Sources of information on which the rules described in the article are based:
- Course of general physics and electrical engineering. All within the 1st year of university
- Books by Howard Jones: Designing High-Speed Digital Devices: A Primer in Black Magic and High-Speed Digital Data Transmission: A Primer in Black Magic
- IPC standards, such as IPC-2221A. There is a translation in Russian (old version) and the original version of the latest versions in English
- Own experience
Rule #1 - Conductor Width
Mistake
- very often novice developers use the default width of conductors (tracks) in the CAD software they are using. In the previously mentioned article, the author used EasyEDA and there the basic width value is 6 mils, that is, about 0.15 mm. This width of conductors is used almost everywhere and this is bad, because it leads to a number of problems.
Problem #1
- voltage drop. We all remember Ohm's law, from which it follows that the smaller the cross-sectional area of the conductor, the greater its resistance. The greater the resistance of the conductor, the more the voltage across it will drop.
Problem #2
- heating of the conductor. It’s the same Ohm’s law, the power released on the conductor is proportional to its resistance, that is, the greater the resistance, the more heat released on the conductor. A current of 5-10A will easily evaporate a 0.15 mm road.
Problem #3
- parasitic inductance. This point is hardly a basic one, but you need to know about it. The smaller the cross-section of the conductor, the greater its inductance. That is, any conductor is actually not just a “piece of copper”, it is a composite component of active resistance, inductance and parasitic capacitance. If these parameters are too high, then they begin to negatively affect the operation of the circuit. More often they appear at frequencies above 10 MHz, for example, when working with SPI.
Problem #4
- low mechanical strength. I think there is no need to explain that a 2 mm wide track is more firmly attached to the textolite base than a 0.15 mm track. Just for fun, take a factory waste board and dig into it.
Solution
— use the maximum possible width of conductors. If the conductor can be routed with a width of 0.6 mm, then this is better than conducting it with a width of 0.15 mm.
Example:
1) Bad
2) Ok
Rigid Flex PCBs
Flex-Rigid PCB
Rigid flex printed circuit boards are a hybrid version of rigid printed circuit boards and flexible printed circuit boards.
They are designed with both flexible and rigid parts, giving them the characteristics of both rigid and flex PCBs.
They are widely used in applications where the circuit requires a robust assembly, but flexible connections are required between circuit segments.
The design of rigid-flex PCBs is no different from rigid and flex PCBs.
The flexible part is made the same as flexible circuit boards, and the structure of the rigid part is made like rigid circuit boards.
However, the relationship between both parts is complex; they are connected by through holes.
The most significant advantage of rigid-flex PCBs is their ability to both flex and ensure reliable assembly of components.
They are widely used in sensitive electronic devices. Rigid and flex PCBs can perform the functions of both rigid and flex PCBs.
However, because rigid-flex PCBs are made up of both flexible and rigid parts, they are more difficult to manufacture than rigid PCBs and flex PCBs.
Rule No. 2 - Connection to terminals
By pins we mean the component pad (pad), vias and other objects that we connect on the board using conductors (tracks).
Error
- there are two extremes. In one, the developer makes a mistake from rule No. 1 and connects a 0.15 mm track to the output of the smd resistor 1206. In the other case, on the contrary, he uses a conductor whose width is equal to the width of the contact pad. Both options are bad.
Problem #1
- low mechanical strength. With several attempts to resolder a component, the pad or track will simply peel off from the textolite base of the printed circuit board.
Problem #2
— technological problems with board installation. Although this will become a problem if you start ordering not only boards, but also assembly from China. Of course, they will collect it for you, but the percentage of defects increases.
Solution
— the width of the conductor connected to the contact pad should be approximately 80% of the width of this pad.
Example:
1) Bad
2) Ok
The size of the capacitor pad 1206 in this case is 1.6 x 1 mm
. Accordingly, to supply the signal from below, a track equal to 80% of the width of the area is used, that is, 0.8 mm (80% of 1 mm). To supply the signal on the right, a 1.2 mm thick track is used (approximately 80% of 1.6 mm). The pad width of the microcircuit in the SOIC-8 package is 0.6 mm, so the signal needs to be supplied using a track of about 0.5 mm.
It is worth understanding that this option is ideal. You probably won't like the transition from 1.2 mm to 0.5 mm - unnecessary fuss. It can be avoided. To do this, they usually take the width of the track relative to the minimum pad, that is, in this case you can do it like this:
As you can see, I chose the width of the conductor according to the minimum area, that is, according to the output area of the microcircuit in the SOIC-8 package. This simplification is acceptable, but should be used wisely.
Types of printed circuit boards
There are several types of printed circuit boards, all made from unique materials.
Most manufacturers classify single-layer, double-layer, and multi-layer PCBs by PCB type.
But it is important to understand that single-layer, double-layer and multi-layer only correspond to the number of layers; they are present in almost all types of boards.
For example, there are single-layer, double-layer and multi-layer flexible boards.
However, for ease of understanding, single-layer, double-layer, and multi-layer categories are often classified as independent types.
Similarly, high frequency PCBs can be any type of PCB such as rigid or flex; the only difference is the PCB development and design processes.
Now let's take a closer look at all types of PCBs.
Rule #3 - Power Circuits
Now let's consider a case where simplification in relation to rule No. 2 is simply unacceptable, namely, the design of power circuits.
This rule is based on the previous two and is a particular, but perhaps the most critical case. Error
— neglect of rules No. 1 and No. 2 when designing power circuits.
Problem #1
- the output of your voltage stabilizer is strictly +3.3V. You turn on the device and observe that the microcircuit behaves inappropriately, the ADC does not measure accurately and periodically turns off. You measure the voltage at the legs of the consumer (microcircuit) and find instead of +3.3V only +2.6V.
Problem #2
- your DC-DC converter does not start or has large ripples at the output.
Problem #3
- in an attempt to find a fault, you place the oscilloscope probe on the +3.3V line and find there, instead of a constant voltage, some terrible ripples and interference.
Solution
— we observe rules No. 1 and No. 2 especially strictly and fanatically. The paths are as wide as possible. Power must be supplied to the microcircuit through a ceramic capacitor, which, if possible, is placed closer to the terminal of this microcircuit.
Example:
1) Bad
2) Ok
What I did to make it better:
1) Power supply VCC3V3
Now it fits not bypassing the capacitor, but through it. That is, first to the capacitor, and then to the output of the microcircuit
2) I used a transition hole (via) with a size of 1.2/0.6 mm. Yes, according to the requirements for accuracy class 4 (standard), I can use a via hole measuring 0.7/0.3 mm, but I did not do this and used a larger transition. This made it possible to reduce its resistance and allow more current to pass through.
3) The power bus that comes from the stabilizer is now not 0.3 mm, but 2 mm! Don't be afraid to make wide conductors. This approach will minimize the voltage drop in the circuit and reduce the inductance of the conductor
↑ Preparation of tools, materials and devices
Preparation is a very important part of the procedure.
Here we must not forget that the good quality of the tool determines, in general, the quality of the manufactured product. Set aside a place for tools, devices and chemicals so that household members do not trip over them. So, we will need:
1
- Foil textolite;
2
— Cutting tool (metal hacksaw, scissors, guillotine, etc., whoever has what’s at hand);
3
— File (for processing the edges of the workpiece);
4
- Sandpaper (“zero”);
5
- Dish sponge (which has a hard coating on one side, sold everywhere);
6
- Dish cleaning agent (Pemolux type powder);
7
— Laser printer (better HP or Canon, tested);
8
— Transparent film for laser printing, double-sided (film has become increasingly difficult to find lately, but office equipment stores always have it. Why double-sided? So that you don’t have to wonder which side to put in the printer. I use
LOMOND
Copier Film or
Profiline
) ;
9
— Photoresist roll
PF-VShch-50
(Negative, we just sell it everywhere in Novosibirsk);
10
— Narrow tape (needed for etching);
11
— A4 format laminator (for applying photoresist to textolite. Here I must say that the laminator must be selected according to the thickness of the package being laminated, and this is at least 2 mm. The popular and inexpensive
PD230-1
);
12
- A sheet of paper, clean, white;
13
— Cutting knife, stationery;
14
— The roller is long, of medium softness (I use a soft charge transfer shaft from an old laser printer, although you can use a shaft from a stove. The main thing is that there is rubber or dense foam on the steel rod of the shaft - for rolling photoresist);
15
— Installation with ultraviolet lamps (later I will go into more detail on this);
16
- A plate or bath, maybe like a photo cuvette;
17
- Soda ash (sold in hardware stores, very cheap. That’s exactly what it’s called);
18
- Narrow paint brush (we cut off two-thirds of the bristles with scissors and get an excellent brush for developing photoresist. Although you can use an old toothbrush);
19
- Solvent or acetone;
20
- Ferric chloride;
21
— Capacity for etching;
22
- Drill for drilling holes.
I have this machine: 23
- Drills of the required diameter (0.6-1.0 mm).
Many people will wonder if the list is too long? BIG is not the right word. I came to this all on my own. At the same time, I just dreamed that someone would chew everything over for me in such detail. The list is compiled approximately like this if I were offered to organize a workplace for an experienced design bureau. So I provided the list necessary for the work.
Rule #4 - Earth
One can talk forever about the influence of the quality of the design of the ground bus (GND), but any conversation comes down to a simple essence: the stability and performance of the device depends to the greatest extent on the design of the ground
. This problem is very voluminous and requires in-depth study, so I will give the most basic recommendations.
Error
— tracing the GND (ground) circuit using a regular conductor, and even a minimum width. It's just a c-c-c-combo!
Problem #1
— instability of the device and strong interference in circuits, especially in power circuits.
Problem #2
- heating and often breakage of a thin conductor, because it carries a large current.
Solution
- use a polygon for routing the GND circuit, and ideally a separate layer that is completely dedicated to this circuit, for example, the bottom layer.
Example:
1) Bad
2) Good
As you can see, instead of a regular wire, I used a solid polygon fill. This solution provided me with a huge cross-sectional area, because a polygon is simply a very large conductor. Only sometimes this solution has a disadvantage, for example, when the installation density is high and other conductors break the solid polygon, as here the LED1..3
break the shortest path between the pin of the microcircuit and the capacitor (GND):
The previously mentioned separate GND layer will help us here. In a two-layer board, ideally, select the bottom layer for it, and in a multilayer board, one of the inner layers:
Thus, we restored the shortest path for the current through the GND circuit, and in this case, the bottom layer (blue color), which is completely an earthen polygon, helped. Via holes near the pads provided them with the shortest possible connection to the bottom layer of the ground.
Of course, this is an ideal case and sometimes it will not be possible to implement it without increasing the cost of the fee, so the decision is yours. Sometimes “super” reliability is not needed; here it is important to find the golden mean between cost and quality for your task.
Flexible printed circuit boards
Flexible PCB
Flexible printed circuit boards are nothing short of innovative. They have made it possible to develop flexible circuits that can be bent and even folded 360 degrees.
Like other types of printed circuit boards, flex circuit boards also consist of a substrate and conductive layers.
But in this case, the substrate is a flexible material with a relatively smaller thickness.
Flexible PCBs are lighter in weight and take up less space than rigid PCBs.
This is because they are designed and placed in three-dimensional planes and their material weighs less.
Although flex circuit boards look very sensitive, they are durable and very functional.
They are commonly used in gadgets, sensors and robot parts, and moving parts of electronics.
Flexible printed circuit boards are also used in equipment that does not move at all, but the design has certain curves or requires flexible circuit assembly that can fit in small spaces.
In addition, flexible printed circuit boards are used in devices that operate in tuff environments, especially those that are subject to mechanical stress.
The only drawback of flexible printed circuit boards is the high cost of their development.
Unlike rigid PCBs, flexible PCBs are expensive to develop unless they are developed in large quantities.
In addition, flexible printed circuit boards are not easy to manufacture; this is only possible with modern equipment.
Rule #5 - Gap Width
The minimum value of the gap between copper conductors on a printed circuit board is dictated by technological requirements.
For class 4 (standard) the value is 0.15/0.15 mm or 6/6 mils. The maximum width is limited only by your imagination, board dimensions and common sense. Error
- the gap is not large enough, usually leave the default value of about 0.15 mm.
Problem #1
- electrical breakdown.
A short circuit occurs when 2 conductors with different potentials are shorted, for example, by a metal object and the current increases sharply. Unfortunately, there are no ideal dielectric materials, and at some point any material begins to conduct current. An example of this is insulators on power lines; sometimes they even break through. This phenomenon occurs when the critical breakdown voltage
. For the same reason, fiberglass, which is the basis of most printed circuit boards, at some point may begin to pass current.
Solution
- increasing the distance between conductors.
The breakdown voltage depends on the type of material and the thickness/width of the insulator. In the case of printed circuit boards, the distance (gap) between the conductors is precisely the parameter that affects the critical value of the breakdown voltage. The greater the distance between the conductors, the greater the voltage required to break through it
.
I would also like to say that breakdown of fiberglass laminate is not always the most pressing problem. The air that surrounds the board is also a dielectric, but under certain conditions it becomes a conductor, remember a thunderstorm. Airborne electrical breakdown is a big problem in electronics, especially considering that the air can be dry or have a humidity of 90-100%, for example, in the tropics or in the North.
Example:
Let's agree that in this example there are 3 conductors: the rectified mains voltage +310V, the low-voltage power line for the microcontroller +3.3V and the ground bus (GND).
1) Bad
2) Good
Why 0.3 mm is bad, but 0.8 mm is good, you ask, and I will give you 2 sources as an answer:
1) Ordinary physics and electrical engineering. The data in them varies due to different measurement techniques and other things, but the most realistic figure is for dry air
is
2 kV/mm
.
Here many people will be afraid of the numbers and think: “I don’t have such tensions” and this will be a mistake. This value is typical only for dry air, which is rarely encountered in real conditions. And here the numbers are much more modest, for example, at 100% humidity, the breakdown voltage of the air is only 250 V/mm
! The value of the breakdown voltage is also affected by the dust content of the air and the board, as well as atmospheric pressure (Paschen curve and law).
2) IPC-2221 standard, to which I gave a link at the beginning. We are interested in table 6-1, which looks like this:
As you can see in the table for a large number of values, even for our specific case 301-500V
.
If we look, we will see a value of 0.25 mm for closed conductors on the inner layers, that is, in “ideal” conditions without access to dust, dirt and moisture. If the device will operate somewhere in the mountains and the conductor is located on the outer layers (all conductors in the case of a 2-layer board) at an altitude of up to 3000 meters, then the minimum gap there is already 2.5 mm, that is, 10 times larger. If we operate the device at a higher altitude, then the gap is already required at 12.5 mm! It is worth making a note - such a large gap is required if our board is not covered with protective compounds, for example, varnish or compound. As soon as the protective coating appears, we see more adequate values: 0.8
and
1.5
mm.
Therefore, in a “good” example, in addition to ensuring a gap of 0.8 mm, it is also necessary to cover the board with a protective compound, for example, varnish, after completing installation of the device, washing and drying it. Otherwise, the gap must be increased!
Rigid PCBs
Rigid printed circuit boards are the most commonly used type in electronics.
They are rigid and do not bend easily, which is why they are called rigid PCBs.
As already explained, single, double and multilayer are just the number of layers and can be present in all types of PCBs; Rigid PCBs can be single-layer, double-layer or multi-layer.
Single-layer rigid printed circuit boards are widely used in small-sized electronic devices whose circuits are simple and do not require much space.
The rigidity of these PCBs comes from their substrate.
Fiberglass and resin substrates are widely used for the development of rigid printed circuit boards.
Their rigidity gives them excellent strength for holding heavy components.
Moreover, rigid PCBs are more suitable for assembling through-hole components than flexible PCBs.
However, rigid PCBs have their limitations; their rigid behavior can cause the board to break under load; They should not be used in products subject to strong vibration.
Additionally, rigid PCBs cannot flex, so they cannot be used in product enclosures that require the PCB to bend along curves.
Rule No. 6 - Galvanic gap
The mistake
is equating the dielectric gap with the galvanic gap. In essence, they are very similar, but the requirements are increasingly strict when it comes to galvanic isolation. A striking case is the decoupling of the control circuit and the power part using a relay or optocoupler, when the gap between the decoupled sides is also chosen to be 0.8 or 1.5 mm.
Problem #1
— insulation breakdown, failure of the control system and other expensive equipment.
Solution
— increase in the threshold of electrical breakdown. Standard values are usually 1.5 kV, 2.5 kV and 4 kV. If your device operates with mains voltage, but a person does not directly interact with it, then an isolation voltage of 1.5 kV will be sufficient. If human interaction with the device is expected, for example, through buttons and other controls, then I recommend using insulation with a voltage of 2.5 kV or more.
Example:
1) Bad
What's wrong, you ask, because there are gaps on the board, they can be made 1.5 mm. The fact is that even if you make a gap of 2 mm, this will not be enough to ensure insulation. The “weakest” point should be the distance between the relay control terminals (1-2) and the power terminals (3-8). It is also necessary to take into account that a breakdown can occur not only between conductors on the same layer, but also on different ones - right through the board through fiberglass.
2) Good
What has been done to improve the situation:
a) A clear boundary has appeared between the low-voltage and high-voltage parts. Now the +3.3V conductor does not pass into the high-voltage +310V region, the GND polygon does not go beyond the low-voltage part, and accordingly there will be no breakdown. Also, there should be nothing at all in the galvanic isolation zone/border.
b) The insulating zone is freed from the solder mask. The mask is also a weak point and, depending on the quality, will pierce it earlier than fiberglass. This is not necessary in the general case, but if people interact with the device, I highly recommend it.
c) As I wrote above, the weak point is the distance between the control and power terminals of the relay. Everywhere I was able to make an insulating zone of 4 mm, but here only 2.5 mm. We cleaned the mask, the conductors too, and the only thing that could cause a breakdown on the board is fiberglass. Therefore, we remove it too, I made a 2.5 mm wide cutout for the relay and removed the textolite between the terminals. This operation is also not necessary, but it significantly increases the reliability and safety of your device.
Basic Input/Output System (BIOS)
BIOS stands for Basic Input Output System . It is a piece of read-only, non-volatile memory that contains the low-level software that controls all the hardware and acts as a link between it and the operating system.
All motherboards include a small block of memory that is used to initialize the hardware at boot time and to control the hardware while the operating system is running. The BIOS contains all the necessary code to control the keyboard, screen, disks, and data ports. All BIOS programs are stored in non-volatile memory.
Rule #7 - Vias
Error
- very often I see a picture when on a 2-layer printed circuit board, in order to connect 2 contact pads, I use 3..4... or even 5 vias.
Problem #1
— there are too many vias on the board and this limits the space for conductors, which leads to lengthening of the circuits, and consequently to an increase in their resistance. Reduces the resistance of circuits and signals to interference.
Solution
- use a minimum number of vias: if you need to connect 2 contacts on different layers, then do not use more than 1 via. If 2 pins are on the same layer and you cannot connect them directly, then use a maximum of 2 vias. If you need more transitions for the connection, then you are doing something wrong - train the logic and re-route the section of the board that led to the problem.
Example:
1) Bad
2) Ok
The connection uses a minimum number of vias, which provides more free space for other conductors and ensures minimal parasitic parameters of the conductor.
Double Layer PCBs
Double-layer PCBs can contain circuitry on both sides, making them more useful in complex circuits.
The main difference in the design of single-layer and double-layer PCBs is the number of layers on the board.
There is only one substrate layer, but two conductive layers, electronic components can be assembled on both sides.
This allows complex circuits to be designed on a smaller PCB area.
Moreover, the connection between the two sides of the PCB connects the components on both sides without any jumps.
Since double-layer PCBs can contain large circuits, they are also widely used.
Similar to single-layer PCBs, double-layer PCBs also support both through-hole and surface mounting of devices.
Because double-layer PCBs offer twice the space of single-layer PCBs of the same size, the overall weight is less than single-layer PCBs.
This is because two single-layer PCBs carry two layers of substrate and two layers of copper, whereas a two-layer PCB carries two layers of copper but only one layer of substrate.
In addition, the manufacturing process of a double-layer PCB also takes less time.
The only drawback of double-layer printed circuit boards is their difficulty in handling.
Some general tips
- Don't use autorouters! In their “raw”, untuned form, they produce a terrible result that will turn even the brightest idea into guano. In order for the autorouter to work well, it needs to write down certain rules that will tell it that the road needs to be 1 mm, not 0.15, and so on. For an adequate result, even on simple boards you have to write a hundred, or even two, of these rules. In Altium Designer, a whole section is dedicated to them, for example. If you are an amateur and you don’t have the task of designing your own board for a laptop, then build the board by hand - it will come out faster and the quality will be high
- Don't be lazy to remake the board. It often happens that you have completed the board by 90%, but then everything becomes difficult and you begin to break the “rules” and create guano. Roll back, sometimes you have to roll back to the very beginning, do the job efficiently and at the stage of debugging the device you will save a lot of time and nerves
- Before you start designing a board, look at several open source projects, for example, on Habré or hackaday. The main thing is not to copy other people’s obvious mistakes from there.
- If you know electronics developers, even if they are also amateurs, let them check it out. A fresh look at your project will help you avoid a lot of mistakes
Cache memory
Cache memory is a small block of high-speed, volatile memory that speeds up your computer by pre-caching data from slower RAM. The data is then sent to the processor very quickly when needed.
Typically processors have a built-in cache chip called a Level 1 or L1 cache, but it can also be supplemented with a Level 2 cache, L2. In modern processors, the L1 and L2 caches are built into the processor, and the third level cache is implemented as an external cache.