There is nothing more exciting than holding in your hands a piece of hardware that you personally designed, whether an electronic circuit board or a robotic mechanical joint. In this final chapter, we quickly go through the main steps required to produce electronics and mechanical components for a robot (or any other machine, for that matter) using widely available CAD software.
PCB Design
At this point, you have probably completed the schematic of an electronic circuit based on the designs described in the previous chapters. It is now time to turn it into a real printed circuit board (PCB) and make a final product out of it.
Component selection: This is a lengthy step where you need to choose each electronic component for the board and compile the bill of materials (BOM).
Layout design: You use a dedicated software to place all the electronic components of your circuit on a canvas and connect them with each other to generate the final design of the board.
Board manufacturing: You send your layout files to a professional manufacturer, who will build the board for you in a couple of days.
Components assembly: You send your BOM to the manufacturer, who typically purchases the components for you and solders them on the board.
Some hobbyists like to manufacture and/or assemble the board by themselves; however, outsourcing those tasks to a professional manufacturer is much easier, faster, and cheaper. If you plan to produce high-quality boards in high volumes, you practically have no other choice.
The first step consists in selecting the right components for the board. You might have six N-channel MOSFETs in that motor driving bridge you just designed, but once you actually go purchase those switches, you will literally find hundreds of different options from several manufacturers. Besides looking at the obvious electrical characteristics (e.g., rated voltage, current, resistance, etc.), you also need to filter the available options according to more practical factors: price (because your product needs to be affordable), inventory (because basing a production on rare components is risky), size (in case you have specific space limitations), mounting type (surface mount devices are much cheaper to solder than through hole components but are less resistant to mechanical stress), tolerance (tight tolerances against temperature variations are expensive but required in some cases: e.g., current sensing resistors), and operating temperature (e.g., some power boards are expected to work at much higher temperatures than simple logic boards).
In general, it is always a good idea to select two or three compatible options, so that if your main choice becomes unavailable at a later stage, you can quickly switch to another component without the need of redesigning the entire board. Components can be bought either directly from the original manufacturers (best when in large batches) or from large distributors (e.g., Digikey, LSCS, Mouser, etc.). The most convenient option is to have the PCB manufacturer purchase all the components for you and assemble them directly after fabrication.
Once you have chosen the components, the next step you need to accomplish is to produce a good layout design of your board. There are a number of software packages that you can use to turn a schematic circuit into a PCB layout. Some are free, while others are very expensive but probably offer more features and support. Some are web-based, while others need to be installed on your computer and come with a large number of libraries. A few common examples to choose from are Altium, Eagle, EasyEDA, KiCad, etc., the last one being my personal favorite.
Depending on the size and complexity of a board, traces can run on different layers across the board. The simplest boards only have two layers: one in the front and one in the back. The example shown in Figure 19-1, being a very small board with only a few components, only requires two copper layers: the top shown in red and the bottom in green.
The thickness of each copper layer can also be adjusted depending on the application. The standard size is 35μm, which works fine for low-power signals. However, if the traces are carrying large currents (e.g., to the motor windings), then a thicker copper layer is desirable to prevent overheating and damage to the board. Thicknesses of 70μm, 105μm, and more are common, although increasingly expensive. Given the chosen thickness, a simple trace calculator program can be used to determine the minimum required trace width to allow a certain maximum current to flow.
Smart layout: Avoid placing too many components that generate heat next to each other. A higher density makes the board more compact but also more difficult to keep cool.
Copper areas: Place large copper areas around and/or below critical components to allow the heat to sink away.
Thermal vias: Electrical connectivity between layers is not the only purpose of vias. Thermal conduction is also a strategic function, especially when the vias are placed directly under the component’s body (in-pad vias, shown in Figure 19-4). In that case, the vias are typically filled to avoid the solder paste flowing away during assembly. During operation, the heat generated by the component is quickly drawn away by the vias and dissipated through the other layers.
- Metal substrate: Power electronic boards are commonly built on a metal substrate, as shown in Figure 19-5, typically aluminum, although copper alloys are also possible. The resulting thermal conductivity is greatly enhanced if compared to standard boards built on fiberglass substrate. The metal board is also mechanically much more robust and can withstand stronger vibrations without bending or braking. The metal substrate can be mounted directly on the machine’s body for further heat sinking capability.
Besides heat management, another important aspect of designing a PCB is electromagnetic compatibility (EMC). This is a complex topic with strict regulations for products to be released on the market. The goal is to prevent electromagnetic interference between our electronic circuit board and other devices operating nearby.
A PCB can emit radiation intentionally (e.g., from Wi-Fi or Bluetooth transmitters) but also unintentionally (e.g., from the high-frequency switching transistors of the servo drive). Also, high-speed signals (e.g., SPI communication lines) propagating through long traces with sharp bends generate electromagnetic waves. A general suggestion to minimize unwanted radiation is to keep the conductive traces as short as possible and their bending as smooth as possible. Long traces typically act as stray inductances and have the tendency to emit radiations and also pick up electromagnetic noise from external sources, which can cause interference. High-speed logic signals traveling through traces with sharp angles can easily reflect off the edges also generating significant interferences.
Adding large areas of copper to the PCB design strongly helps shielding against electromagnetic fields. Sometimes entire layers of the board are dedicated to that purpose (ground layers); incidentally, they help with heat dissipation as well.
The footprints for each component must carefully match the physical size and pin pattern specified on the datasheet. Some manufacturers provide footprints; most do not. You can quickly draw them out yourself and build your own library of favorite components. Alternatively, you can search on third-party libraries (e.g., Ultra Librarian, SnapEDA, etc.), though you should carefully double-check the footprints you download because some of them are incorrect. A mistake found during the design phase is much cheaper and quicker to fix than when it is found after the board is manufactured.
The last step is assembly, i.e., soldering the components on the board. This is something many hobbyists like to do on their own, but again, nothing beats the convenience, speed, and accuracy of having the board manufacturer take care of the assembly phase for you. When dealing with large production batches and tiny BGA (ball grid array) components, then automatic assembly is a must.
Electronic components are placed on the board by a high-speed CNC machine and soldered together using a process called reflow soldering. First, solder paste (a mixture of powdered solder and flux) is applied to the board using a mask so that only the pads are exposed; then the components are placed on the board where they held in place by the paste; finally, the board is heated up to melt the solder and ensure permanent connection between the components and the pads.
When you receive the board (see Figure 19-9), you should carefully check the most important connections with a multimeter, and when you are ready to apply power, do so with a current-limited supply to prevent nasty surprises. It goes without saying that all the hardware and software functions must be thoroughly tested before using the product in a real application setting.
Mechanics
We have focused throughout this book on the control of robots with the perspective of an automation engineer, who is typically more involved in the mathematical modeling, programming, and electronics design. The mechanics of a robot are usually designed and built by machine constructors and provided to the automation department as finished parts.
However, it is always interesting to be able to work interdisciplinary and at least have a sense of what is involved in the design and fabrication of mechanical parts. Whether you want to play with a hobby robotic arm, or test a simple prototype for research purposes, or even design an entirely new product for your startup, you will need to get your hands dirty and build something by yourself.
The first step is choosing appropriate materials, depending on the complexity of the design, the requirements of the final product, and the skills you have available. Over time, I have built several hobby robots using a number of different materials: in my beginner years, I started with simple wood or even LEGO blocks, since they are easy to work with and do not require any complex or costly manufacturing processes. Their flexibility, however, is quite limited. Later, I evolved to more advanced materials, plastic, aluminum, and steel, using a combination of CNC machining and 3D printing manufacturing processes.
Aluminum is cheap and easy to machine, arguably offers the best strength to weight ratio, and looks very attractive indeed when anodized. Steel is more expensive but much stronger. The most common stainless steel is type 304. For some critical parts, where mechanical stress is expected to be particularly high, you can consider using steel type 45, which is reinforced with additional carbon and offers increased strength. In general, a combination of different materials can be used for different parts, according to their needs, always keeping in mind the optimization of weight and cost. As for plastics, nylon is a black, good-looking material, which I typically use for the outside cover of machines and for electronic cases.
Most manufacturers provide a convenient online interface to select detailed parameters about the process: material, tolerances, surface finishing, and color, plus many other customized requirements (often at extra cost).
Plastic processing is usually either 3D additive manufacturing (i.e., 3D printing) or injection molding. The first works best for prototyping and small batches, while the second becomes convenient with very large production volumes due to the cost of the mold.
When designing mechanical components, special attentions is required to optimize their physical characteristics (least material use, lowest weight and cost) within the strength and torsion constraints imposed by the application. The optimization algorithm often takes a reinforced learning approach (see Machine Learning Section in Chapter 12) to generate parts with complex shapes, curved surfaces, and several holes to achieve massive weight reductions. For example, the component shown in Figure 19-11 on the right side was produced using this optimization technique (known as generative design) and then 3D printed.
Robotic arms can take great advantage from generative design, because weight reduction on the links allows for better movement speed and accuracy and possibly for smaller and cheaper motors.
Summary
The final step of a product generating process is the transformation of an abstract design into a tangible object. In robotics, we mainly deal with the fabrication of electronic boards and mechanical parts. In this chapter, we described the steps required to design a PCB, from its electronic layout to its actual manufacturing process, with attention to practical tips to optimize stability and performance of the board. Also, we briefly introduced some possible materials you can use to build the physical robot, from plastic to metal.
With this final chapter we conclude the book. I hope you have learned a few basic concepts and some helpful tricks on how to design, program, and build your own robotics controller. Good luck and have fun!