Affiliate links help support this site at no extra cost to you.
Introduction to PCB Design: From Rat’s Nest to Professional Board
By Day 31, you built a fully functional Smart Home Hub. It works brilliantly. The code is optimized, the network stack is robust, and the physics are sound.
But look at it.
It is a mess of jumper wires, dangling resistors, and a breadboard that could disconnect if you simply sneeze.
This is not a product. It is a prototype.
Today, we cross the most significant chasm in electronics engineering: The transition from Breadboard to Printed Circuit Board (PCB).
We will take the exact circuit from Day 31 and turn it into a permanent, compact, and reliable manufacturing file that you can order from a factory.
The Philosophy of PCB Design
Why do we design PCBs? It’s not just about aesthetics.
Signal Integrity: Wires on a breadboard act as antennas. They pick up 60Hz hum and Wi-Fi interference. On a PCB, traces are millimeters long and shielded by ground planes.
Mechanical Reliability: Solder joints do not vibrate loose.
Thermal Management: The copper on a board acts as a heatsink.
Reproducibility: You can assemble 100 boards in an hour. You cannot wire 100 breadboards in a week.
The Tool of Choice: EasyEDA
We choose EasyEDA for this guide because it is:
Web-Based: No installation required.
Integrated LCSC Library: You pick “real” parts (e.g., “10k Resistor 0805 Package”) immediately, ensuring availability.
Direct Manufacturing: One-click export to JLCPCB (industry standard for hobbyists).
Schematic Capture ( The Logical Map)
A PCB Design has two distinct files: the Schematic (Logic) and the Layout (Physical). You must start with the Schematic.
Placing the Components
Open EasyEDA Editor. We need to replicate our Day 31 Smart Home Hub.
Search for these specific LCSC Part Numbers or generic terms:
NodeMCU V3: Search “NodeMCU”.
Relay: Search “SRD-05VDC-SL-C” (The blue relay we know well).
Transistor: “2N2222” (TO-92 Package).
Diode: “1N4007” (DO-41 Package).
OLED: “SSD1306 I2C 4-Pin”.
Header Pins: “Female Header 2.54mm”.
Critical Engineering Rule:
Net Labels are King. Do not draw long messy wires across the page.
Place a NetPort (Ground) on every GND pin.
Place a NetPort (VCC) on every 5V pin.
Label data lines: SDA, SCL, RELAY_SIG.
Why? This keeps the schematic readable. If you connect a label SDA to the OLED and SDA to the ESP8266, the software knows they are connected.
Symbols vs Footprints: The #1 Rookie Mistake
In a schematic, a resistor is a squiggly line. In the real world, it can be a tiny 1mm chip (0402) or a big 5-watt ceramic block.
The Symbol: The logical representation (Pin 1 to Pin 2).
The Footprint: The physical land pattern (Copper pads on the board).
Critical: EasyEDA lets you pick a generic “Resistor” symbol. If you don’t assign a Footprint, you can’t build the board.
Best Practice: Always select parts from the “LCSC Library”. These come with a Symbol, a Footprint, AND a 3D Model linked together.
Verification: Press Space on a component to rotate it. Double-click to check its “Package” attribute. If it says None or AXIAL-0.4 when you wanted 0805, fix it now.
The “Netlist” and Electrical Rules Check (ERC)
When you finish drawing, the software generates a Netlist.
This is a text file that lists every connection:
NodeMCU.Pin.D1 <--> OLED.Pin.SCLNodeMCU.Pin.D2 <--> OLED.Pin.SDA
Run the ERC (Electrical Rules Check):
Before moving to layout, click Design -> Check DRC/ERC.
It catches errors like:
Floating Inputs: A pin that goes nowhere (bad for CMOS logic).
Short Circuits: Did you accidentally connect VCC to GND?
Rule: 0 Errors, 0 Warnings. Do not ignore warnings.
Converting to PCB (The Physical Map)
Click “Convert Project to PCB”.
You will see a black screen with a jumble of components connected by thin blue “Ratlines”.
These lines represent the connections you need to make.
Component Placement Strategy
This is an art form.
Place Connectors First: USB ports, screw terminals, and headers should be on the edge of the board.
Core Components Center: The NodeMCU goes in the middle.
Keep Paths Short: Rotate the OLED and Relay so their pins face the NodeMCU pins they connect to.
Bad: Relay pin facing North, ESP pin facing South (Trace has to loop around).
Select the “BoardOutLine” layer (Pink). Draw a rectangle around your components.
Constraint: Make it small to save money, but leave breathing room for screws.
Mounting Holes: Place four 3mm holes in the corners for M3 screws.
Routing (Drawing the Traces)
Now we replace the “Ratlines” with real Copper Traces.
Select “Route” -> “Track”.
Trace Width Physics (IPC-2221)
How wide should a line be? It’s physics.
Current flows through copper -> Copper has resistance -> Resistance creates heat (I2R).
Signal Traces (Data): 0.254mm (10 mil). These carry almost zero current (micro-amps). Thin is fine.
Power Traces (5V, GND, Relay Coil): 0.5mm - 1.0mm.
The Calculation:
1 Amp current.
1oz Copper (Standard thickness: 35 micrometers).
Allowed Temp Rise: 10°C.
Result: You need at least 0.3mm (12 mil). We use 0.5mm for safety.
Why? If you pull 1 Amp through a hair-thin trace (6 mil), it will heat up, delaminate from the fiberglass, and burn (Fusing Current).
Pro Tip: Use a Ground Plane (Copper Pour).
Instead of routing Ground wires, we pour copper over the entire unused space of the board and connect it to GND.
Select “Copper Area”.
Assign Net: GND.
Draw a box around the whole board.
Benefit 1:Low Impedance Return Path. Current wants to return to the source via the path of least impedance. A giant sheet of copper is near-zero impedance.
Benefit 2:EMI Shielding. The ground plane acts as a faraday cage, absorbing stray RF noise.
Benefit 3:Cooling. The entire board acts as a heatsink.
Vias: The Elevators
We have a 2-Layer board (Top and Bottom).
Sometimes tracks cross. You cannot cross two tracks on the same layer.
The Solution: A Via.
It is a drilled hole (typically 0.4mm diameter) plated with copper that connects the Top Layer to the Bottom Layer.
Rule of Thumb: Minimize vias. Each via adds adds impedance (inductance) and is a potential failure point.
High Current: If you need to pass 2 Amps through a via, use multiple vias or a larger one. One tiny via might act as a fuse.
The Return Path (Advanced)
For DC, current takes the path of least resistance.
For High Frequency (Wi-Fi 2.4GHz), current takes the path of Least Inductance.
This means the return current on the Ground Plane will hug directly underneath the signal trace on the top layer.
Critical Rule: Do not cut your Ground Plane!
If you run a long track on the bottom layer that slices the Ground Plane in half, the return current has to take a huge detour loop. This creates a Loop Antenna, radiating noise and ruining your Wi-Fi signal.
Keep your Ground Plane solid.
If you run a long track on the bottom layer that slices the Ground Plane in half, the return current has to take a huge detour loop. This creates a Loop Antenna, radiating noise and ruining your Wi-Fi signal.
Keep your Ground Plane solid.
Decoupling Capacitor Physics
You will see 100nF (0.1uF) capacitors next to every microchip power pin.
The Physics: digital chips switch millions of transistors instantly. This demands sudden gulps of current. The power supply is far away (relatively). Inductance in the traces prevents current from arriving instantly (V=L⋅di/dt). The voltage sags.
The Solution: A small “Bucket” of energy (Capacitor) placed right next to the pin provided instant power.
Placement Rule: You MUST route power through the capacitor pad before it hits the chip pin. Distance matters.
Crystal Routing (Differential Pairs)
If you design a standalone ESP8266, you have a 26MHz Crystal.
Length Matching: The two tracks (XTAL_IN, XTAL_OUT) must be exactly the same length.
Guard Ring: Surround these tracks with Ground Vias to shield them from noise.
Why? If the clock signal is jittery, your Wi-Fi will fail to connect.
Design Rule Check (DRC)
Before you manufacture, you must run the DRC.
This checks your board against the factory’s capabilities (JLCPCB rules).
Min Trace Width: 6 mil (0.15mm).
Min Clearance: 6 mil.
Min Drill Size: 0.3mm.
If you put two tracks 0.01mm apart, the factory cannot etch that. They will short circuit.
The DRC will flag this with a big red “X”. Fix every single error.
Manufacturing (The Anatomy of a PCB)
The factory doesn’t want your EasyEDA project file. They want Gerber Files.
A Gerber file is like a PDF for machines. It tells the laser diagram plotter exactly where to draw.
The Layers Explained
When you hold a PCB, you are looking at a sandwich:
Silkscreen (White): The text. SilkTop.gbr. Purely for humans.
Solder Mask (Green): The protective lacquer. MaskTop.gbr. It prevents solder bridges and protects copper from oxidation.
Copper (Shiny): The actual conductive path. TopLayer.gbr and BottomLayer.gbr.
Substrate (FR4): The yellow fiberglass body. Non-conductive.
Surface Finish: HASL vs ENIG
You will be asked to choose a finish.
HASL (Hot Air Solder Leveling): The board is dipped in molten solder and blown flat with hot air.
Pros: Cheap, robust.
Cons: Can be uneven (bad for tiny chips). Contains lead (unless you pick Lead-Free HASL).
ENIG (Electroless Nickel Immersion Gold): The pads are chemically plated with Gold.
Recommendation: For this project (Relays, THT parts), HASL is perfect.
Export Steps:
File -> Generate PCB Fabrication File (Gerber).
Download the ZIP.
Critical Step: Open a Gerber Viewer (like Reference 3D or the JLCPCB viewer) to visually inspect one last time.
Check: Do you have Solder Mask openings over your pads? (If not, you can’t solder them).
Check: Is the Silkscreen overlapping a drill hole? (The drill will obliterate the text).
The Bill of Materials (BOM)
You need the parts to solder onto the board.
EasyEDA exports a BOM (Bill of Materials).
This CSV file lists:
Reference: R1, R2, U1.
Value: 10k, NodeMCU.
Package: 0805, DIP-30.
Component
Package
Quantity
Purpose
NodeMCU Esp8266
DIP-30
1
Microcontroller
5V Relay (SRD-05VDC)
THT
1
High Voltage Switch
2N2222 Transistor
TO-92
1
Relay Driver
1N4007 Diode
DO-41
1
Flyback Protection
1k Resistor
0805
2
Base Current Limit
Screw Terminal (2-Pin)
5.08mm
2
Power & Load
Component Selection Strategy: 0805 vs 0603
When browsing LCSC, you see resistor sizes: 0402, 0603, 0805, 1206.
0402: Dust specs. Automaton assembly only. Too hard for humans.
0603: Standard. Solderable with practice, but easy to lose “carpet fuzz”.
0805 (Recommended): Perfect for beginners. Large enough to grab with tweezers, small enough to look professional.
1206: Huge. Good for high-power resistors (0.25W+).
Capacitor Voltage Rating:
Always choose a voltage rating 2x your operating voltage.
For a 5V circuit, do not buy a 6.3V capacitor. It will degrade. Buy at least 10V or 16V.
3D Visualization
One of the coolest features of modern EDA tools is the 3D View.
Click “3D View”. You will see a photorealistic render of your board.
Look closely at:
Component Height: Will the Relay block the USB port?
Silkscreen: Is the text “5V” readable, or is it under a resistor?
Physical Clash: Are the screw terminals facing outwards? (Common newbie mistake: Putting terminals facing inwards so you can’t put wires in).
The “Collision Check” Checklist
Before you order, perform this physical audit:
USB Port Clearance: Plug a real USB cable into your NodeMCU. Measure the plastic head width. Does it hit the Relay?
Screw Head Diameter: An M3 screw has a head diameter of ~5.5mm. Do you have copper traces too close to the mounting hole? The screw head will scrape the solder mask and short the trace to the case.
Tall Components: The Relay is 20mm tall. If you put this board in a 15mm slim case, the lid won’t close.
Ordering the Board
You go to a manufacturer (JLCPCB, PCBWay, OSHPark).
Upload the Gerber ZIP.
Select Settings:
Layers: 2.
Dimensions: (Auto-detected).
PCB Thickness: 1.6mm (Standard).
PCB Color: Green (Fastest), Black (Coolest, but harder to trace debug), Blue, Red.
Surface Finish: HASL (Solder) or ENIG (Gold - flatter, expensive). For DIY, HASL is fine.
Price: Usually $2 for 5 boards + Shipping.
Wait 1 Week.
When the package arrives, you have graduated. You hold in your hand a fiberglass/copper sandwich that you designed.
Troubleshooting Common PCB Mistakes
Even pros make mistakes. Here are the “Big Three” to avoid:
The Acid Trap
When two tracks meet at an acute angle (less than 90°), the etching acid gets trapped in the corner during manufacturing. It eats away the copper over time, causing an open circuit weeks later.
The Fix: Always route traces at 45° angles. Never 90°. Never acute.
Tombstoning (SMD Only)
If one pad of a resistor has a massive copper trace (heatsink) and the other has a tiny trace, the massive one heats up slower during reflow. The solder melts on the small pad first, pulling the component upright like a tombstone.
The Fix: Use “Thermal Relief” spokes on your Ground Pads. Don’t connect a pad directly to a solid plane.
The “Mirrored” IC
You place a connector on the bottom layer, but forget to mirror the pinout. Now VCC connects to GND.
The Fix: Print your PCB design on paper at 1:1 scale. Place your physical components on the paper. Does everything match?
Frequently Asked Questions (FAQ)
Q: Why not use KiCad?
A: KiCad is excellent and Open Source. However, for a beginner, the learning curve is steep. EasyEDA handles the Library and LCSC integration seamlessly, removing friction. Once you master PCB concepts, switching to KiCad is easy.
Q: Can I mill this on a CNC at home?
A: Yes, but it is messy (fiberglass dust is dangerous) and lacks Plated Through Holes (Vias). For $2, the factory quality is unbeatable.
Q: What is the “Silkscreen” limit?
A: Most cheap fabs can’t print text smaller than 0.8mm high. If you go smaller, it becomes a blurry blob.
Q: My board arrived and it doesn’t work. Why?
A: Did you run the DRC? Did you verify the Netlist? 99% of errors are in the Schematic. If the generic netlist says Pin 1 connects to Pin 2, the PCB software will force you to do it, even if it’s wrong electrically.
Conclusion & Next Steps
We have moved from “Does it work?” to “Is it manufacturable?”.
You now possess the skill to create custom hardware.
Next Steps:
SMD Soldering: We focused on Through-Hole (THT) mostly. Next, try Surface Mount Devices (SMD) like 0805 resistors. They are tiny but cheaper.
Custom Microcontrollers: Instead of a NodeMCU module, design the bare ESP8266-12F chip directly onto your board (requires 3.3V LDO, USB-UART bridge logic).
High Power: Designing traces for 220V AC (Creepage and Clearance rules becomes critical).
Your Assignment: Design a “Shield” for the NodeMCU that holds the relay and OLED, eliminating all wires. Order it. Build it.
AI usually requires a $1000 GPU. Not anymore. Learn how to train a TensorFlow Lite neural network and run it on a $3 ESP8266 microcontroller using TinyML. Edge computing demystified.