设计并组装我的第一块 PCB
Designing and assembling my first PCB

原始链接: https://vilkeliskis.com/b/2026/0711.html

在近期使用 Arduino Nano ESP32 和现成模块进行实验后,作者决定从面包板原型开发转向设计定制硬件。尽管缺乏正规的电子专业背景,他们仍着手从零开始复刻一个 BME280 传感器模块。 通过使用 KiCad,作者学会了如何解读元器件数据手册、选择合适的贴片(SMD)封装,并设计了带有适当铺铜的定制 PCB 布局。在从 DigiKey 采购元件并将传感器本体从现有模块上拆下后,他们向嘉立创(JLCPCB)订购了定制的 PCB。 借助烙铁和热风返修台,作者使用锡膏完成了电路板的手动组装。尽管担心微型传感器隐藏的连接焊盘难以处理,但这个定制模块在第一次尝试时就完美运行,并与原有设置保持了完全的 I2C 兼容性。这次从原理图设计到组装的端到端项目非常成功,让作者有信心在未来挑战更复杂、集成度更高的电路板设计。

这段讨论反映了现代定制电子产品制造的普及性。虽然一些评论者怀念过去手工腐蚀电路板的日子,但大家一致认为,行业已经进入了一个定制印制电路板(PCB)价格极其低廉且质量上乘的“黄金时代”。 主要观点如下: * **成本与便利性:** 像 JLCPCB 这样的制造商让用户能以几美元的价格订购专业级的小批量电路板,使得手工制作已基本成为过去。 * **服务扩展:** 除了 PCB,用户现在还可以通过 SendCutSend 和 Oshcut 等服务轻松订购 3D 打印、CNC 金属铣削和钣金件。一些供应商甚至提供组装服务,使得原型制造比单独购买零件更便宜。 * **“本地与全球”的权衡:** 虽然海外制造商在价格上占优势,但许多创客表示希望有更多的区域性选择以缩短运输时间和减少全球物流成本。他们指出,对于愿意支付溢价的人来说,本土公司(如 OSH Park)提供了更有价值、更快捷的替代方案。 总的来说,评论者一致认为这些服务改变了电子爱好者的格局,让大众都能通过专业级的硬件设计与制造来实现创意。
相关文章

原文

The beginning

About a couple months ago I purchased an Arduino Nano ESP32 dev board. I had this sudden itch and I wanted to play around with hardware. I don't really have much experience in this space, besides working on firmware for an IoT company over a decade ago, but I've written tons of software over the years. I was very surprised how quickly I was able to get the built-in LEDs to blink with Arduino IDE and some help from LLMs. After that I moved on to figure out how to build and flash firmware directly from the command line without having to deal with all these custom abstractions. I like operating from CLI. That was also somewhat easy and gave me confidence that I can go back to my normal tools (nvim) for working with code.

The devboard itself does not have much going on. Next was getting some peripherals so I ordered a small LCD and BME280 temperature/humidity sensor breakout boards. Both of these I was able to wire up to the ESP32 chip and get them to talk over the I2C protocol.

Playing around with Arduino Nano and random things attached to it via breadboard
Figure 1: Playing around with Arduino Nano and random things attached to it via breadboard.

Naturally, we cannot continue assembling pre-existing modules for a variety of reasons. I think they are great for prototyping, but I like getting out of the prototyping phase as soon as possible and getting into a more "release" or "production" workflow. I was thinking maybe I should recreate the Arduino board with all these components hardwired so I can ditch the breadboard. That sounded great, but it felt a little bit ambitious. There's lots of components and it would make it hard for me to test everything. Instead, I decided to create the BME280 sensor module. This would let me get a feel for what it takes to design something starting with schematics and ending up with a custom PCB. In the picture above you can see the small brown board that I got from Amazon, that's a BME280 sensor board which only has a handful of components. If everything goes as planned I should be able to swap-in my custom board and everything should continue working as before. That was the plan.

Schematic and PCB design

There seem to be several tools available for schematic/pcb design. I needed something that's free and runs on Mac OS. Some people praise EasyEDA, others like KiCad. I didn't do much research on this topic, it seemed like either of them would fit the bill, but I picked KiCad since it's free GPL licensed software.

All sensors, chips and components come with what's called a datasheet. A datasheet is a technical document made available by the manufacturer describing how the component functions, at what temperatures it can operate, reflow (soldering) temperature curves, size and exact dimensions, example wiring and many other things depending on the component.

For my sensor module, I needed to wire the BME280 for an I2C interface to make it plug-and-play. The module that I purchased from Amazon actually supports both I2C and SPI. So what I'm doing is not an exact copy, but actually a more narrow implementation. The BME280 datasheet has pin-out and connection diagrams starting on page 38. It actually provides examples for both SPI and I2C connections. I took the provided I2C connection diagram and transferred it to KiCad.

Schematic design of my sensor module
Figure 2: Schematic design of my sensor module.

I wouldn't call KiCad the most intuitive application for first-time users. However, I was able to draw up the exact schematic as was shown on the datasheet.

To transfer a schematic to a PCB you need to select what's called a footprint for each component. For example, there's only one type of BME280 sensor and it really has only one shape/size (aka footprint) available. That's not the case for other types of general use components such as resistors or capacitors. What footprints you pick will dictate the size of your board, how easy it is to assemble and most likely many other factors that I'm not aware of (such as heat dispersion).

Through my research I discovered that most commonly you're going to encounter SMD and THT components. THT or through-hole components are more old-school looking tech (though it's not old), generally larger in size and they get installed by pushing component legs through the holes in the PCB and soldering the legs to the board after. This can be done in most cases with a regular soldering iron.

SMD stands for surface mounted devices and are what you'd find in almost all modern electronic devices. They are much smaller in size, and as the size gets smaller, they will require more specialized equipment for installation. When I started looking at the footprint library in KiCad I got very confused because it wasn't immediately clear to me whether I needed to find a footprint for the exact component brand that I was planning to use or not. Lots of general SMD components have standardized footprints, I discovered. They follow standard codes like 1206, 0805, 0603, etc which translate to dimensions 0.12" by 0.06" or (3.2mm x 1.55mm) for a 1206 component. I went with the 0805 size as this seemed to be suitable for hand soldering, though it's pushing the limits.

After you assign a footprint for each component you can then import them into the PCB editor and layout your PCB.

My sensor module in KiCad PCB editor
Figure 3: My sensor module in KiCad PCB editor.
Module 3D preview
Figure 4: Module 3D preview.

The layout process did not seem too complicated, however, you need to be aware of how you are routing the connections, or they could otherwise prevent other ones from getting to their destination. I was able to layout everything on the front layer of the board. The only thing I did special (maybe that is not so special) was ground filling empty space on the front and back and then connecting front to back using via. This seems to be a common pattern used in the PCB design. Otherwise, it can get really tricky to route the connections without blocking other ones, even for a small simple board like the one I'm making here.

Sourcing components and ordering PCB

The component search was somewhat interesting too. I purchased my components from DigiKey. Although, it's probably best to have accounts with several electronics shops, just in case there's a limited inventory. I was able to find all components on DigiKey except for the BME280 sensor itself. The BME280 sensor was out of stock on several sites and it looked like it would take several months to get the backorder processed. I skipped the BME280 and decided to rip it off from the Amazon module I purchased earlier. The resistors and capacitors were somewhat easy to find, I just had to be careful picking the correct footprint and configuration (resistance etc).

KiCad also lets you generate a bill of materials (BOM). It's just a list of components and their configuration and where they need to be placed. The PCB manufacturers can sometimes perform the assembly for you if you provide them with the BOM. I did not do that, I wanted to hand assemble to get a feel for it.

BOM
Figure 5: BOM.

To order a PCB you need to export gerber and drill files. The gerber files define trace layout and the drill file is for the CNC machining. I exported both of these with default settings and packaged them into a zip file which I then provided to JLCPCB. From there you finish the order form. I did not make many changes and used defaults. JLCPCB is a Chinese company, order to door took about 2-3 weeks and cost me under $10 dollars. There are faster options, but they would break the bank on delivery costs.

My tools and assembly

As part of my current homelab, I only have two soldering tools plus a multimeter.

Hakko FX888DX-010BY

Hakko FX888DX-010BY soldering iron
Figure 6: Hakko FX888DX-010BY soldering iron.

I purchased this iron because it lets you control the temperature and it has pretty good reviews. It heats up really fast. I usually run my iron at 650F. However, temperature adjustment is critical so you know exactly what temperature you're getting so you don't damage the components.

Quick 861DW

Quick 861DW hot air station
Figure 7: Quick 861DW hot air station.

This device is called a hot air station, sometimes reflow or rework station. It is used heavily in electronics repair shops to replace components. You also can use it to solder SMD components. Once you go below 1206, using a soldering iron gets tricky. The way SMDs get soldered is by spreading solder paste over connections, placing the components on top and then microwaving the board using a hot plate or hot air gun to melt the solder. The hot air gun is the most versatile tool and it's good for smaller assembly.

I picked up a Quick 861DW because it's considered a pro entry-level device (according to LLMs at least). The most important part for a device like this is airflow control. I run this device on airflow setting 15 (which is very low volume) and 250C. SMDs are tiny and very light devices, anything that does not give you good air control will blow away the components.

The assembly

It took me about 15 minutes to assemble the board. That involved desoldering the BME280 sensor from the Amazon board, applying solder paste and laying out the components and soldering everything up. The only thing I struggled with was the sensor. The sensor is tiny and it has 8 connection pads underneath it so I wasn't sure if I would short any of the connections by accident because I couldn't see what was going on under the chip. I kept the area for the sensor clean and made sure there was flux on it and I left the rest to the surface tension gods.

My board vs board from Amazon
Figure 8: My board vs board from Amazon.

The results

I was giving this whole thing a 50/50 chance of working on the first try. I wasn't even sure if I routed everything correctly on the PCB. The "via" and grounding were a bit confusing. Then, soldering the sensor was slightly tricky and I wasn't sure if I shorted connections anywhere. However, to my surprise, the board I designed and assembled was plug-and-play on the first try!

My sensor board is working
Figure 9: My sensor board is working.

I did not have to modify the firmware, I did not have to put anything in between the board. It was literally a plug-and-play experience because I exposed the same I2C interface that I used originally.

This experience gave me confidence that I can produce custom and working PCBs. This, of course, was a very simple project, but it took me through the whole process end-to-end. It gave me a better understanding of the steps I may need to take for more complex designs. I was thinking maybe for the next one I should place the LCD, ESP32 and BME280 on a single board, hardwired. This one sounds a bit more complex. How do you flash the chip? How do you supply power? What is necessary and what is not? For example, the Arduino Nano dev board has lots of components on it. Are all of them needed? I have no idea. I will see what I'll do next, but I enjoyed this experience.

联系我们 contact @ memedata.com