“When learning circuit design, I don’t know if you have such a problem: I have learned a lot of hardware circuit theory and done some basic operation practices, but I still can’t design my ideal circuit. In the final analysis, what we lack is the idea of hardware circuit design, as well as the actual combat experience of the project.
When learning circuit design, I don’t know if you have such a problem: I have learned a lot of hardware circuit theory and done some basic operation practices, but I still can’t design my ideal circuit. In the final analysis, what we lack is the idea of hardware circuit design, as well as the actual combat experience of the project.
To design a hardware circuit, you must be familiar with the basic theories of components, such as the principle, selection and use of components, learn to draw schematic diagrams, and complete PCB design through software, master the skills of tools, and learn how to optimize and debug circuits, etc. . How to design a set of hardware circuit design completely, let me share some personal experiences for you:
To design hardware circuits, the big frame and architecture must be clarified, but it is really not easy to do this. For some big frameworks, maybe your boss or teacher has already thought about it, and you just realize the idea in detail; but for some you need to design the framework yourself, you have to figure out what functions to achieve, and then find out if you can achieve the same or similar functions. The reference circuit board (to know how to use the results of others as much as possible, the more experienced engineers will know how to learn from the results of others).
2) Understand the circuit
If you found the reference design, congratulations, you can save a lot of time (including pre-design and post-debugging). Copy right away? NO, let’s understand it first. On the one hand, it can improve our circuit understanding ability, and it can avoid errors in the design.
3) Find the reference design
Before starting the hardware design, according to your own project requirements, you can look for the hardware functional design, there are many related reference designs. could not find it? It doesn’t matter. First determine the big IC chip, look for the datasheet to see whether its key parameters meet your requirements, which are the key parameters you need, and whether you can understand these key parameters are all manifestations of the ability of hardware engineers. It also needs to accumulate slowly over a long period of time. During this period, be good at asking questions, because people often wake you up with a single sentence for things you don’t understand, especially hardware design.
4) Three parts of hardware circuit design: schematic diagram, PCB and bill of materials (BOM) table
Schematic design, in fact, is to transform the previous ideas into circuit schematics, which are very similar to the circuit diagrams in our textbooks. PCB refers to the actual circuit board. It is a netlist converted from the schematic diagram (the netlist is a bridge between the schematic diagram and the PCB), and the package (layout) of the specific components is placed on the circuit board. Then connect its electrical signal (wiring) according to the flying wire (also called pre-pull wire). After completing the PCB layout, which components should be used should be summarized, so we will use the BOM table.
5) Choose PCB design tools
Protel, that is, Altium (most of the children’s shoes for beginners now use AD) are easy to learn, and the online learning tutorial materials are also very comprehensive, and they are also popular in China. It is sufficient for general work and suitable for beginners.
The major links of hardware circuit design are indispensable, mainly through the following processes:
1) Schematic design
2) PCB design
3) Make BOM
Now let’s talk about the specific design steps
Schematic creation + netlist generation
1. Schematic library is established. To place a new component on the schematic, we must create a library of modified components. The library mainly defines the pin definition and attributes of the new component, and it is represented in a specific graphical form (what we often see is a rectangle (representing its IC BODY) with many short lines around (representing IC pins)) . Protel is very simple to create libraries, and because there are many people who use it, many components can find ready-made libraries, which is extremely convenient for users. The difference between ic body, ic pins, input pin, output pin, analog pin, digital pin, power pin, etc. should be clarified.
2. After you have enough libraries, you can draw on the schematic diagram, and connect the relevant components through wire in accordance with the requirements of the datasheet and system design. Add line and text comments where relevant. The difference between wire and line is that the former has electrical properties, while the latter does not. Wire is suitable for connecting the same network, and line is suitable for annotation graphics. At this time, some basic concepts should be clarified, such as: wire, line, bus, part, footprint, etc.
3. After finishing this step, we can generate netlist, this netlist is the bridge between schematic and pcb. The schematic diagram is a form that we can recognize. If the computer wants to convert it into pcb, it must convert the schematic diagram into the form it recognizes, netlist, and then process and convert it into pcb.
4. Get the netlist and draw the pcb right away? Don’t worry, do ERC first. ERC is an abbreviation for Electrical Regulation Inspection. It can troubleshoot some basic design errors in schematics, such as connecting multiple outputs together. (But you must carefully check your schematics, and you can’t rely too much on the tools. After all, the tools cannot understand your system. It is purely based on some basic rules.)
5. Did you get a pcb from netlist, a bunch of densely packed components, and countless flying leads? Haha, don’t worry, take your time.
6. Determine the size of the board frame. Draw a board frame in the keepout area (or mechanic area), which will limit your wiring area. You need to consider the board length and board width according to your needs (sometimes, you have to consider the board thickness). Of course, stacking must also be considered. (Layering means that there are several layers of the board, how to use it, such as a total of 4 layers of the board, the top layer is used for signals, the first layer in the middle is laid for power, the second layer is laid for ground, and the bottom layer is used for signals).
First explain the previous terminology. Post-command, for example, if we want to copy an object (component), we must first select the object, then press ctrl+C, and then press ctrl+V (the copy command occurs after the object is selected). This kind of operation is adopted by both windows and protel. But concept is another way, we call it pre-command. Similarly, we want to copy an object, first press ctrl+C, then select the object, and then click outside (the copy command occurs before the object is selected).
1. After determining the board frame, the component layout (placement) is very important. It often determines the difficulty of later wiring. Which components should be placed on the front and which components should be placed on the back must be considered. But these are all questions where the benevolent sees the benevolent, and the wise sees wisdom; the placement can be different from different perspectives. In fact, I drew the schematic diagram myself, understood all the component functions, and naturally had a clear understanding of the component placement (if someone who did not draw the schematic diagram is allowed to place the components, the result will often surprise you. For the beginners, pay attention. Isolation of analog components, digital components, and the placement of mechanical positions, while paying attention to the topology of the power supply.
2. The next step is wiring. This is often interactive with the layout. Experienced people can often see where the wiring can be successful at the beginning. If some places are difficult to route, the layout needs to be changed. For FPGA design, the schematic diagram is often changed to make the wiring smoother. There are many factors involved in wiring and layout issues. For high-speed digital parts, they are complicated by signal integrity issues, but these issues are often difficult to quantify or even to calculate. Therefore, when the signal frequency is not very high, routing should be the first principle.
3. OK? Don’t worry, use DRC to check first, this must be checked. DRC will mark the completion coverage of wiring and the places where the rules are violated. Follow this one-by-one investigation and correction.
4. Some pcbs need to be coated with copper (which may increase the cost), and the outlet part will be made into teardrops (the factory may add it for you). The final pcb file is converted into a gerber file and then delivered to pcb production. (Some of them can also be directly given to pcb, the factory will help you transfer gerber).
5. To assemble the pcb, prepare the bom table, which can generally be directly derived from the schematic diagram. But it should be noted that which parts of the components in the schematic diagram should be mounted and which parts should not be mounted, and we must have a good sense of mind. For small batches or research boards, it is convenient to use excel to manage them yourself (large companies often need professional software to manage them). For novices, the first version is not recommended to be directly handed over to the assembly factory or welding factory to solder all the bom materials, which is not convenient for troubleshooting. The best way is to prepare the components yourself according to the bom table. After the board comes, install the components and debug step by step.
1. What to do in the first step after getting the board, don’t rush the power supply to see the functions, the hardware debugging cannot be completed in one step. First take a multimeter to see if there is any abnormality in the critical network, mainly to see if there is a short circuit between the power supply and the ground (although the manufacturer has done the test for you, you still have to check this step by yourself, sometimes it seems that there are some steps Quite cumbersome, but it can save you a lot of time later!) In fact, short circuit is not only related to pcb, it may cause this problem in any link of production, IO short circuit generally does not cause catastrophic consequences, but power short circuit… …
2. Is the power network not short-circuited? So good, then see if the power output is your ideal value. For beginners, it is best to use ICs on each chip when debugging, and the first thing to be on is the power chip.
3. Is the power network short-circuited? This is more troublesome, but you have to carefully check whether this is possible in your schematic diagram. At the same time, combine the secant method to find out what is short-circuited step by step. It is a PCB problem (usually bad PCB factories may appear In this case), it is still a problem of assembly, or a problem of self-design. There are some tips about checking short circuits, which will be posted in the future…
4. There is no output from the power chip? Check whether the input of your power chip is normal, and there are enable signals, voltage divider resistors, feedback networks in places that need to be checked…
5. The output value of the power supply chip is not in the expected range? If it exceeds that is outrageous, such as 10%, then look at the voltage divider resistance first. The two voltage divider resistances generally use 1% accuracy. Have you achieved this, and look at it at the same time Look at the feedback network, this will also affect the range of your output power.
6. The power output is normal. Don’t be happy. If possible, take a look at the oscilloscope to see if the power output jumps normally. That is, grab the moment when the power is turned on, and see the situation of the power supply from scratch (As for why you should watch this, hehe…professionals still need to watch it~)
Undoubtedly, power supply design is the most important part of the entire circuit board. The power supply is unstable, don’t talk about anything else. I don’t think balabala is needed to talk about how important it is.
The most frequently used occasion in power supply design is to obtain a stable “low” voltage from a stable “high” voltage. This is also referred to as DC/DC. Among them, there are two kinds of power supply regulator chips that are most used, one is called LDO (low dropout linear regulator, the linear regulated power supply we will talk about later also refers to it), and the other One is called PWM (pulse width modulation switching power supply, we also call it switching power supply in this article). We often hear that the efficiency of PWM is high, but the response of LDO is fast. Why? Don’t worry, let’s take a look at their principles first.
1. The working principle of linear regulated power supply
The figure is a simple schematic diagram of the internal structure of the linear regulated power supply. Our goal is to obtain a low voltage Vo from a high voltage Vs. In the figure, Vo is divided by two resistors to obtain V+. V+ is sent to the positive terminal of the amplifier (we call this amplifier the error amplifier), and the negative terminal Vref of the amplifier is the internal reference level of the power supply (this reference The level is constant). The output Va of the amplifier is connected to the gate of the MOSFET to control the impedance of the MOSFET. When Va becomes larger, the impedance of the MOSFET becomes larger; when Va becomes smaller, the impedance of the MOSFET becomes smaller. The voltage drop across the MOSFET will be Vs-Vo.
Now let’s look at how Vo is stable. Assuming that Vo becomes smaller, V+ will become smaller and the output Va of the amplifier will also become smaller. This will cause the impedance of the MOSFET to become smaller. In this way, the voltage difference of the MOSFET will be reduced by the same current. It becomes smaller, so the Vo is lifted up to restrain the Vo from getting smaller. In the same way, Vo becomes larger, V+ becomes larger, Va becomes larger, and the impedance of the MOSFET becomes larger. After the same current, the voltage difference of the MOSFET becomes larger, thus suppressing Vo from becoming larger.
As shown in the figure above, in order to obtain Vo from the high voltage Vs, the switching power supply uses a square wave Vg1 and Vg2 with a certain duty cycle to drive the upper and lower MOS tubes. Vg1 and Vg2 are inverted, Vg1 is high, and Vg2 is low; the upper MOS tube When it is turned on, the lower MOS tube is turned off; when the lower MOS tube is turned on, the upper MOS tube is turned off. As a result, a square wave voltage with a certain duty cycle is formed at the left end of L. The inductance L and the capacitor C can be regarded as a low-pass filter. Therefore, after the square wave voltage is filtered, the filtered stable voltage Vo is obtained. Vo is divided by R1 and R2 and then sent to the negative terminal V+ of the first amplifier (error amplifier). The output Va of the error amplifier is used as the positive terminal of the second amplifier (PWM amplifier). The output Vpwm of the PWM amplifier is a A square wave with a certain duty cycle is processed by a gate logic circuit to obtain two inverted square waves Vg1 and Vg2 to control the switching of the MOSFET.
The positive terminal Vref of the error amplifier is a constant voltage, and the negative terminal Vt of the PWM amplifier is a triangle wave signal. Once Va is larger than the triangle wave, Vpwm is high; Va is smaller than the triangle wave, and Vpwm is low, so the relationship between Va and the triangle wave , Determines the duty cycle of the square wave signal Vpwm; when Va is high, the duty cycle is low, and when Va is low, the duty cycle is high. After processing, Vg1 and Vpwm are in phase, and Vg2 and Vpwm are in reverse phase; finally, the square wave voltage Vp at the left end of L is the same as Vg1.As shown below
When Vo rises, V+ will rise, Va fall, and the Vpwm duty cycle will decrease. After our logic, the duty cycle of Vg1 will decrease, the duty cycle of Vg2 will increase, and the duty cycle of Vp will decrease, which in turn causes Vo to decrease, so The rise of Vo will be suppressed. vice versa.
3. Comparison of linear stabilized power supply and switching power supply
After understanding the working principle of linear stabilized power supply and switching power supply, we can understand why the linear stabilized power supply has smaller noise and faster transient response, but the efficiency is poor; while the switching power supply has higher noise and transient response Slower, but more efficient.
The internal structure of the linear regulated power supply is simple, the feedback loop is short, so the noise is small, and the transient response is fast (when the output voltage changes, the compensation is fast). But because the voltage difference between input and output falls on the MOSFET, its efficiency is low. Therefore, linear voltage stabilization is generally used in small current applications that require high voltage accuracy.
However, the internal structure of the switching power supply is complex, there are many factors that affect the output voltage noise performance, and its feedback loop is long, so its noise performance is lower than that of a linear regulated power supply, and its transient response is slow. However, according to the structure of the switching power supply, the MOSFET is in two states, fully on and completely off. Except for the energy consumed by driving the MOSFET and the internal resistance of the MOSFET, all other energy is used in the output (theoretically, L and C are not consumed. Energy, although it is not the case, but the energy consumption is very small).