WEEK 8

TASK
MONDAY
WEDNESDAY
FRIDAY
MONDAY

✦ PCB Manufacturing

This week focused on transforming a digital PCB design into a functional physical board. Starting from the refinement of my previous design, it was also necessary to prepare the files for fabrication, mill the PCB using the Roland SRM-20, and assemble it through soldering. Finally, the board was programmed to verify its functionality, completing the transition from design to working electronics. For this, I consulted our Group Assignment.

◆ Schematic Review & Adjustments

Before fabrication, I reviewed my PCB design from Week 6 to confirm it was ready for production. While the board was already functional, I made a few key adjustments: I enabled additional pins on the Seeed Studio XIAO RP2040 to support future I2C and UART communication, and I repositioned the push button to ensure proper clearance for the USB-C cable, improving both usability and assembly.

Pinout Diagram

✦ Updated Schematic

The design includes ten LEDs grouped in pairs, each with 220Ω resistors. The previous button was replaced with a Switch Tactile CNK, and a capacitor was added for power stabilization. Power distribution is defined through 3V3 and GND labels with PWR_FLAG symbols. Additionally, pin headers for I2C (SDA, SCL with 4.7kΩ pull-up resistors) and UART (TX/RX) were included for future expansion.

◆ What I will be using?

✦ PCB Design

Once the schematic was completed and verified, the design was transferred to the PCB editor in KiCad. Since this board was based on a previous development, the PCB layout was reused and adjusted to the new components.

Pinout Diagram

✦ Board Setup

The layout was also developed following a star-shaped outline, and the outline of the board was defined with a thickness of 2 mm. On the other hand, the routing was carried out using 0.8 mm minimum track width and a 0.7 mm minimum track clearance; ensuring suitable connections for the milling process.

Pinout Diagram

✦ Gerber Files

Once the PCB design was completed, the files were prepared for fabrication. For this I exported my files to Gerber, which is used to define each layer of the PCB and its corresponding traces. For this, I went to the option File → Fabrication Outputs → Gerber Files. A configuration window appeared and then click on Plot.

After completing the export process, the program creates a folder containing all the generated Gerber files, which I will be using for the next fabrication steps.

✦ Conversion of Geber Files to PNG Images

For this step I will be using the gerber2png. I selected all my Gerber Files and uploaded them to the page. Once the files were uploaded, the platform displayed the available layers, such as Top Trace, Top Drill and Top Cut. I clicked on Generate All to produce the corresponding images, then click on “generate PNG”.

✦ Configuration in Mods

For the cutting process I will be using the Roland SM-20 Milling Machine , and to set up its parameters I used modsproject.org, a platform that allows the adjustment of key settings required for the fabrication process.

✦ Roland SRM-20 Setup

Machine preparation and calibration process for PCB milling, including tool installation, origin setting, and material alignment before fabrication.

✦ Milling Process

PCB fabrication process on the Roland SRM-20, including traces, drilling, and outline cutting operations.

✦ Soldering Process

Process of placing and soldering the electronic components onto the PCB after the milling process.

✦ Programming

Uploading and testing the code used to control and verify the functionality of the PCB.

✦ Code

This is the code used in the PCB.

    


// Pin Definitions
const int leds[] = {D1, D2, D3, D8, D9};
const int numLeds = 5;
const int btnPin = D10;

int mode = 0; // 0: Off, 1: Steady, 2: Blink, 3: Alternate
bool lastBtnState = HIGH;

void setup() {
  for (int i = 0; i < numLeds; i++) pinMode(leds[i], OUTPUT);
  pinMode(btnPin, INPUT_PULLUP); // Internal pull-up resistor
}

void loop() {
  bool currentBtnState = digitalRead(btnPin);

  // Button press detection 
  if (currentBtnState == LOW && lastBtnState == HIGH) {
    delay(50); // Debounce
    mode = (mode + 1) % 4; // Cycle through 0-3
    setAll(LOW); 
  }
  lastBtnState = currentBtnState;

  // Mode Selector
  switch (mode) {
    case 1: setAll(HIGH); break;           // STEADY ON
    case 2: blink(200); break;             // BLINK
    case 3: alternateEffect(); break;      // ALTERNATE
    default: setAll(LOW); break;           // OFF
  }
}

// --- Helper Functions ---

void setAll(int state) {
  for (int i = 0; i < numLeds; i++) digitalWrite(leds[i], state);
}

void blink(int speed) {
  setAll(HIGH); delay(speed);
  setAll(LOW);  delay(speed);
}

void alternateEffect() {
  for (int i = 0; i < numLeds; i++) {
    digitalWrite(leds[i], (i % 2 == 0)); // Pattern: ON, OFF, ON...
  }
  delay(300);
  for (int i = 0; i < numLeds; i++) {
    digitalWrite(leds[i], (i % 2 != 0)); // Pattern: OFF, ON, OFF...
  }
  delay(300);
}
    
Command
Description
pinMode
Configures the GPIO as Input or Output.
digitalRead
Polls the sensor/button state.
digitalWrite
Controls the logic level (HIGH/LOW) of the LEDs.
switch (mode)
Executes specific functions based on the current active state.
lastBtnState
Remembers whether the button was pressed before.
Modulo Operator (%)
A circular counter that resets to zero automatically, cycling through the 4 light states.
setAll(state)
Turns all LEDs on or off at once.
blink(speed)
Turns them on and off at a set time interval.
alternateEffect()
Alternates even and odd LEDs creating a wave effect.

✦ Final Result

Here is the final result of my PCB.

✦ Debugging Process

During the process, I noticed that one of the LEDs wasn't turning on correctly. After inspecting the board with a multimeter, I discovered that the LED polarity was inverted and the solder joint wasn't making proper contact. The LED was re-soldered with the correct orientation, which solved the hardware issue. Additionally, during programming, some LEDs were still not responding as expected. After reviewing the RP2350 pin configuration and the code initialization section, I realized that a few pins had not been declared correctly at the beginning of the program. Updating the pin declarations fixed the issue and allowed all LEDs to function properly.

✦ Download Here!

In this section, you can find the downloadable source files developed during this week.

STL

OnShape

Download File
STL

EinScan-SE

Download File