Week 6: Electronics Design

This week focuses on learning the fundamentals of electronic components, circuit principles, and PCB design workflows. I will study how components such as resistors, capacitors, diodes, transistors, connectors, and microcontrollers function within circuits, and review key electrical concepts like voltage, current, and power. I will also learn to use Electronic Design Automation (EDA) tools to create schematics, simulate circuits, and prepare PCB layouts while following proper design rules for fabrication.

Group assignment: Use the test equipment in our lab to observe the operation of an embedded microcontroller.

Individual assignment: Simulate a circuit and use an EDA tool to design an embedded microcontroller system using components from the lab inventory, and check the design rules for fabrication. (Extra credit: try another design workflow and/or design a case.)



Simple Layout
Reflection Image

Week’s foundational vocabulary

Saheen, our instructor, told us this week was going to be slow and boring. However, it was quite rushed and overwhelming for me due to my limited background in electronics. I found myself revisiting high school physics concepts and trying to understand their real-world applications. Even while preparing notes for documentation, I kept going back and forth to make things clearer to myself.

I eventually compiled the basic terms I was able to understand this week, as a foundation for further learning. I organized them in Canva because structuring and laying out information helps me think and understand better. That is why I put deliberate effort into creating these notes.



Understanding Microcontroller and Development Board




Simulation Introduction - Wokwi

Once we were given a basic briefing on the foundational terms, we were introduced to a simulation tool called Wokwi. Wokwi is an online, browser-based electronics simulator that supports platforms such as Arduino, ESP32, Raspberry Pi Pico, and STM32. It allows users to design circuits, write code, and test embedded and IoT projects without physical hardware. It includes common components such as LEDs, sensors, and displays, and provides tools for testing and debugging through simulation.



Exploring Featured Example Projects


I began by signing into Wokwi and navigating to the Raspberry Pi Pico Simulator section. I explored featured example projects such as Traffic Light and Keypad and LEDs to understand how circuits and code interact within the simulation environment. The interface is divided into two main areas:

  • Left: Code editor
  • Right: Circuit simulation


  • Figure: Wokwi interface code editor and circuit simulation.

    I experimented by modifying the delay values in the sample code and observed the changes directly in the simulation. This helped me understand how timing in code affects physical outputs such as LED blinking.



    Recreating the Blink Program in Simulation

    We were then asked to recreate the blink program that had previously been executed using the Arduino IDE. I copied my blink code from the Arduino IDE and pasted it into a new Wokwi project. I built a simple circuit consisting of:

  • One red LED
  • One resistor
  • Raspberry Pi Pico board
  • These components were added using the “+ Add Component” button in the simulation panel.


    Figure: Adding components in Wokwi using the component library.

    Circuit Connections

    The circuit was connected as follows:

  • GPIO pin 0 → LED
  • LED → Resistor
  • Resistor → GND
  • This completes the circuit, allowing the microcontroller to control the LED safely through the resistor.


    Figure: Blink circuit created in Wokwi using Raspberry Pi Pico, LED, and resistor.

    Blink Code Used:

    #define USER_LED_R 0 void setup() { pinMode(USER_LED_R, OUTPUT); } void loop() { digitalWrite(USER_LED_R, HIGH); delay(100); digitalWrite(USER_LED_R, LOW); delay(300); }


    Simulation Result

    After completing the circuit and uploading the code, I pressed the Play button to start the simulation. The LED blinked according to the programmed delay values, confirming that the circuit and code were functioning correctly.


    Successful blink simulation running in Wokwi.



    Installing the Wokwi Extension for VS Code

    After using Wokwi in the browser, we proceeded to install the Wokwi extension for Visual Studio Code (VS Code) by following the official setup guide. The installation process involved:


  • Installing the Wokwi for VS Code extension from the Extensions panel.
  • Opening the Command Palette (F1) and selecting “Wokwi: Request a new License.”
  • Confirming the prompt to open the Wokwi website in the browser.
  • Clicking “Get Your License” and signing into a Wokwi account.



  • Confirming the request to send the license back to VS Code.
  • After completing these steps, VS Code displayed a confirmation message indicating that the license had been successfully activated.


    Figure: Activating the Wokwi license through the VS Code extension.

    Configuring Projects in VS Code

    After installing and activating the Wokwi extension in VS Code, the simulator required project configuration files to run correctly. According to the documentation, two files must be present in the project root folder:

  • wokwi.toml - a configuration file that tells Wokwi how to run your project.
  • diagram.json - a diagram file that describes the circuit.


  • Adding Firmware Files from Arduino IDE

    Since I had already created and tested a blink program using the Arduino IDE, I used the compiled firmware from that project. The Raspberry Pi Pico uses compiled firmware files such as:

  • .uf2 — firmware format used by Raspberry Pi Pico
  • .elf — executable and linkable format used for simulation and debugging
  • I copied both the .uf2 and .elf files generated by the Arduino IDE into the same project folder containing the Wokwi configuration files.




    Blink simulation running successfully inside VS Code using Wokwi extension.

    Chase LED with Button Control | Wokwi Simulation Documentation

    Objective: Create a four-LED chase sequence that runs only when a push button is pressed. When the button is not pressed, all LEDs remain off. This demonstrates:

  • Digital output control
  • Digital input reading
  • Internal pull-down resistor usage
  • Conditional logic (if / else)
  • Function modularization
  • Sequential timing using delay()
  • Hardware Components

  • Microcontroller (Raspberry Pi Pico in Wokwi)
  • 4 LEDs
  • Yellow Blue White Red
  • 4 current-limiting resistors
  • 1 push button
  • Connecting wires
  • Wokwi Work Interface

    Wokwi work interface showing code on left side and assembled components on right.

    Code:

    #define YELLOW 0 #define BLUE 1 #define WHITE 2 #define RED 3 #define BUTTON 28 #define time 100 // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(YELLOW, OUTPUT); pinMode(WHITE, OUTPUT); pinMode(BLUE, OUTPUT); pinMode(RED, OUTPUT); pinMode(BUTTON, INPUT_PULLDOWN); } // the loop function runs over and over again forever void loop() { if (digitalRead(BUTTON)==HIGH) { chase_4(); //Made a separate function chase_4 to better organize //To set the condition: if pulldown is used, set the condition to high. if pullup is used, set it to low } else { digitalWrite(YELLOW, LOW); // turn the LED on (HIGH is the voltage level) digitalWrite(BLUE, LOW); // turn the LED off by making the voltage LOW digitalWrite(WHITE, LOW); // turn the LED on (HIGH is the voltage level) digitalWrite(RED, LOW); // turn the LED on (HIGH is the voltage level) } } // to run the leds as a ring void chase_4() { digitalWrite(YELLOW, HIGH); digitalWrite(BLUE, LOW); digitalWrite(WHITE, LOW); digitalWrite(RED, LOW); delay(time); digitalWrite(YELLOW, LOW); digitalWrite(BLUE, HIGH); digitalWrite(WHITE, LOW); digitalWrite(RED, LOW); delay(time); digitalWrite(BLUE, LOW); digitalWrite(WHITE, HIGH); digitalWrite(YELLOW, LOW); digitalWrite(RED, LOW); delay(time); digitalWrite(WHITE, LOW); digitalWrite(RED, HIGH); digitalWrite(BLUE, LOW); digitalWrite(YELLOW, LOW); delay(time); }


    Chase Simulation on Wokwi



    Installing KiCad

    I first installed KiCad on macOS. KiCad is a free and open-source Electronic Design Automation (EDA) software suite used for creating schematic diagrams and designing printed circuit boards (PCBs). It provides a complete professional workflow without licensing restrictions, making it suitable for both learning and production-level PCB design.

    Understanding the KiCad Workflow

    We were introduced to KiCad’s main workflow through its different editors:

  • Schematic Editor: used to create the logical circuit using symbols
  • PCB Editor: used to design the physical PCB layout and routing
  • 3D Viewer: used to preview the final board in three dimensions

  • These tools together allow the transition from conceptual circuit design to manufacturable PCB files.


    image:KiCad project window showing Schematic Editor and PCB Editor.

    Creating the Circuit in the Schematic Editor

    For the class exercise, we began by opening the Schematic Editor, which provides access to the symbol libraries used to place electronic components.


    image:Schematic Editor interface.

    We installed the Fab Academy KiCad library from: KiCAD Library.



    After installing and configuring the library, components from this collection appeared with the prefix “fab” in the search results. These libraries contain footprints and symbols specifically prepared for digital fabrication workflows.


    image: Component search results showing Fab library symbols.




    Recreating and Modifying the ATtiny412 Circuit

    As a reference, we used Neil’s ATtiny412 blink board from the embedded programming week. Following the reference diagram, we recreated the circuit using components from the Fab library. During this process, we:

  • Placed the required components from the symbol library
  • Renamed components where necessary
  • Added an additional push button to extend the circuit
  • Organized the schematic for clarity


  • image: Schematic recreated based on the ATtiny412 reference design.

    Using Global Labels for Clean Connections

    To avoid excessive wire crossings and improve readability, we used the Place Global Label tool. Labels allow connections between components without drawing long physical wires, making the schematic cleaner and easier to understand.


    image: Using global labels to simplify schematic wiring.

    Transferring the Design to the PCB Editor

    Once the schematic was complete, we opened the PCB Editor and imported the schematic into the layout environment. This generated the updated schematic and placed all components. In the PCB Editor, we performed the following tasks:

  • Positioned components in an optimal arrangement
  • Drew copper traces to connect components electrically
  • Ensured trace paths were clean and manufacturable
  • Checked spacing and clearances

  • This stage defines the physical structure of the PCB.





    Customizing Board Setup



    image: PCB Editor showing component placement and routing.

    Running Design Rule Checks and Viewing in 3D

    Before finalizing the design, we ran the Design Rules Checker (DRC) to ensure there were no electrical or manufacturing errors. After resolving all issues and achieving zero errors, we used the 3D Viewer to inspect the final board visually. This step helps confirm the physical feasibility of the design.


    image: design rule checker

    image: 3D view of the completed PCB design.

    Generating Gerber Files for Fabrication

    To prepare the design for manufacturing, we exported the files by navigating to: File → Fabrication Outputs → Gerber Files Gerber files (.gbr) are the standard format used in PCB fabrication. They define all layers of the board, including:

  • Copper traces
  • Board outline
  • Drill holes
  • Silkscreen layers
  • Solder mask

  • These files act as the blueprint used by PCB milling machines or fabrication services.


    image: Gerber file export window in KiCad.

    Viewing the Gerber Files

    To verify the exported files, we used the online Gerber viewer: pcbway and gerber2png This allowed us to visualize each PCB layer and confirm that the traces, pads, and board outline were correct before fabrication.


    image: Gerber files viewed using an online Gerber viewer.



    Custom PCB Design - Individual Assignment

    For this assignment, I designed a custom PCB using the Seeed Studio XIAO RP2040 as the microcontroller. The overall workflow followed the same KiCad process used during the guided class exercise
    (schematic → ERC → footprint assignment → PCB layout → DRC → 3D inspection).
    Therefore, instead of repeating the entire workflow, this documentation focuses on board-specific decisions, references, and checks performed during the design process.

    Pin Mapping and Reference Material



    Before creating the schematic, I referred to the XIAO RP2040 pinout diagram and the Grove I2C connector pin configuration. The Grove I2C connector uses a 4-pin layout:

  • GND
  • VCC (3.3V / 5V)
  • SDA
  • SCL

  • Using these references, I mapped the pins in the schematic as follows:
  • SDA → D4
  • SCL → D5
  • TX → D6
  • RX → D7

  • These references ensured that the connector layout and microcontroller pins matched the intended communication interfaces.


    Electrical Rules Check (ERC)



    While running the Electrical Rules Checker (ERC), KiCad initially reported the error:
    Input power pin not driven by any output power pins
    This occurs when KiCad cannot identify the source of a power net. To resolve this, I placed a PWR_FLAG on the power line. This tells KiCad that the net is intentionally powered. After adding the flag and re-running ERC, the error was resolved


    Schematic Organization

    The schematic was organized into functional sections to make the design easier to read and debug:

  • Microcontroller block – XIAO RP2040 module
  • Power section – 3.3V and 5V connections
  • Input section – push button with pull-down resistor
  • Output section – LEDs with current-limiting resistors
  • Communication connectors – I2C and UART headers
  • Decoupling capacitor – between power and ground

  • Separating the circuit into blocks helped maintain clarity as more components were added.



    Notes:

    What's a UART Connector?
    A UART connector exposes the serial communication interface of a microcontroller so that external devices can communicate with it. UART stands for Universal Asynchronous Receiver–Transmitter. It is one of the simplest communication protocols used in embedded systems.

    Core Signals

    Typical UART connections include:
  • Pin Function
  • TX Transmit data from the microcontroller
  • RX Receive data to the microcontroller
  • GND Common ground reference
  • VCC (optional) Power for external modules

  • Data is transmitted bit-by-bit over two lines (TX and RX), without a shared clock signal. In my board and schematic:
  • TX → D6
  • RX → D7

  • The connector labeled J3 exposes these pins so that the board can communicate with:
  • another microcontroller
  • a USB-to-serial adapter
  • sensors or modules with UART interfaces
  • a computer for debugging

  • This connector essentially acts as a serial communication port for the PCB.

    Summary: A UART connector was added to expose the TX and RX pins of the XIAO RP2040, enabling serial communication with external devices such as computers or other microcontrollers. A decoupling capacitor was placed between the 3.3V and GND lines to stabilize the power supply and reduce electrical noise near the microcontroller.

    A decoupling capacitor is not a different component type. It is simply a capacitor used for a specific purpose in a circuit. The difference lies in function and placement, not in the physical device.

    All decoupling capacitors are capacitors, but not all capacitors are decoupling capacitors. The term decoupling describes the function in the circuit, not a different device.


    Setting PCB Constraints


    Before starting the routing process, I configured the board constraints in KiCad. These constraints define the minimum manufacturing limits that the PCB must follow during routing. The settings were configured in Board Setup → Design Rules → Constraints.
    Key parameters included:

  • Minimum track width: 0.4 mm
  • Minimum clearance: 0.4 mm
  • Minimum via diameter: 0.4 mm

  • These values were chosen to ensure that the traces could be reliably fabricated using the available PCB milling process. Setting these constraints beforehand helps prevent routing traces that are too thin or too close together, which could cause manufacturing issues.

    PCB Layout and Routing


    After assigning footprints, I moved to the PCB editor and began arranging the components on the board. Component placement was done first to minimize trace crossings and keep related elements close to each other. Some placement considerations included:

  • The XIAO RP2040 module was positioned centrally to allow balanced routing to surrounding components.
  • Connectors were placed near the edges of the board for easier access.
  • LEDs were positioned so they remain visible when the board is assembled.
  • The push button was placed where it can be easily pressed during use.

  • Once the components were placed, I began routing the traces. During routing, I prioritized certain signal connections before others. The communication lines were routed first to ensure clear and direct paths.



    Priority was given to:

  • RX and TX (UART communication)
  • SDA and SCL (I²C communication)

  • These signals are important communication interfaces and routing them first helps avoid unnecessary bends, crossings, or long paths that might introduce noise or complicate the layout. After completing these connections, the remaining traces such as:

  • LED connections
  • button connections
  • power lines


  • were routed around the existing signal paths. All traces were routed using a 0.4 mm track width, maintaining the spacing defined in the board constraints.



    Design Rule Check (DRC)





    After routing, I ran the Design Rule Check (DRC) to verify the physical layout. Some warnings and errors appeared, including:

  • Annular width violations
  • Board edge clearance issues
  • Silkscreen text size warnings

  • These were resolved by adjusting trace placement, clearances, and text parameters until the board passed the checks.







    Final PCB Design


    3D Preview

    Finally, I inspected the board in KiCad’s 3D Viewer. This helped confirm:

  • Component orientation
  • Connector placement
  • Board outline and clearances

  • The 3D preview provides a useful sanity check before exporting fabrication files.

    Hero Shot






    Downloading Symbols and Adding Them to KiCad Library

    Find and download the component CAD files

    Open SnapMagic (or similar CAD library site) and search for the component using its exact part number (example: S4B-PH-SM4-TB).


    Steps:

  • Search for the component using the part number.
  • Open the component page.
  • Click Download Symbol and Footprint.
  • Select KiCad as the format.
  • Download and extract the ZIP file.

  • You will typically get files such as:
  • .kicad_sym → schematic symbol
  • .pretty folder → footprint library
  • .kicad_mod → footprint file
  • .step → 3D model (optional)



  • Add the symbol library to KiCad

    Open KiCad main window: Preferences → Manage Symbol Libraries

    Steps:

  • Click Preferences → Manage Symbol Libraries

  • Select:
  • Project Specific Libraries → recommended for individual projects

  • Click + (Add Library)
  • Browse and select the downloaded .kicad_sym file
  • Click Open
  • Click OK

  • The symbol is now available in the schematic editor.


    Add the footprint library to KiCad

    Open: Preferences → Manage Footprint Libraries

    Steps:

  • Click Preferences → Manage Footprint Libraries
  • Choose Project Specific
  • Click +
  • Select the downloaded .pretty folder (not the individual .kicad_mod)
  • Click Open
  • Click OK
  • Use the symbol in schematic editor

    Steps:

  • Press A (Place Symbol)
  • Search the component name
  • Select it
  • Click to place in schematic



  • Adding a STEP File to a Symbol in KiCad

    In KiCad, a STEP file is not added to the symbol library. A STEP file is a 3D model, and it is attached to the footprint, not the symbol. The correct flow is: Symbol → Footprint → 3D Model (STEP)

    Open Footprint Editor

  • Open KiCad.
  • Go to Footprint Editor.
  • Open the footprint you want to modify
  • (either from your project or a custom library).

    Open Footprint Properties

  • Select the footprint.
  • Press E or Right-click → Properties → Footprint Properties
  • Add the STEP File

  • Go to the 3D Models tab.
  • Click Add 3D Shape.
  • Click Browse.
  • Select your .step or .stp file.
  • Click OK.
  • Adjust Model Alignment (Important) After adding:

  • Use Offset X/Y/Z to position the model.
  • Use Rotation X/Y/Z if orientation is incorrect.
  • Use Scale only if absolutely necessary (normally keep at 1.0).
  • Use the 3D Viewer (Alt + 3) to check alignment.

  • Save to Library
  • Click File → Save Footprint in Library
  • If modifying a default library footprint, save it into your own custom library instead.






    Reflection


    This week felt a-maze-ingly overwhelming, beginning with brushing up on electronics concepts I had not revisited since school, and continuing through the process of drawing copper traces between the XIAO and the various components on the board. At times it felt like being stuck in a never-ending loop with no light at the end of the tunnel.

    Although we were told that there is an option to auto-route the traces, I am apparently the kind of person who finds meaning in suffering and chose to route everything manually. The process often felt like being trapped in one of those SpongeBob “eternity” moments, wandering through traces and clearances with a mild sense of hopelessness while trying to avoid crossings and maintain the design constraints.

    In the end, the effort was worth the trouble. The process of designing, routing, and validating the PCB helped me learn a number of new concepts and gave me a much better understanding of how electronic circuits translate into a physical board.




    Design Files

  • Wokwi Chase

  • ATtiny412pro
  • ATtiny412sche
  • ATtiny412pcb

  • Gerber files

  • xiaorp2040 pro
  • xiaorp2040 sch
  • xiaorp2040 pcb