Individual assignment: Use an EDA tool to design an embedded microcontroller system#

For this assignment i used KiCad 9.0 to design a simple circuit with a Raspberry Pi Pico W and 3 LEDs connected through 220 ohm resistors. the idea is to use GPIO pins 2, 3 and 4 to drive three LEDs, which is basically the same traffic light concept from the wokwi simulation. I used the same circuit I had used for my embedded programming program from one of the earlier weeks.

the plan#

the circuit is pretty simple. each GPIO pin outputs 3.3V, so with a 220 ohm resistor the current through each LED would be around 5-7mA depending on the LED forward voltage. thats enough to light them up without burning anything out. i also added a push button switch because why not, might be useful for toggling modes or something

setting up kicad#

first thing was installing KiCad 9.0 and setting up the FabLab library. you go to the Plugin and Content Manager, search for “Fab” under the Libraries tab, and install the KiCad FabLib. this gives you all the components that are actually available in the fab lab inventory like the 1206 SMD resistors and LEDs

KiCad 9.0 home screen with all the tools

installing the KiCad FabLib from the plugin and content manager

then i created a new project called fabacademy-schematic. kicad automatically creates the .kicad_pro, .kicad_pcb and .kicad_sch files for you

project files created in kicad

schematic capture#

opened up the schematic editor which starts with a blank sheet. time to place some components

empty schematic editor

first i needed the Pico W. went to Place > Place Symbols and searched for RP2040. theres a bunch of options but the one i wanted was Module_RaspberryPi_PicoW_SocketTHT from the PCM_fab library since thats the through hole socket version we have in the lab

choosing the Pico W symbol from the fab library

pico w placed on the schematic

then i added the LEDs by searching “LED” and the resistors by searching “R”. also threw in a push button switch (SW_Push) for good measure

searching for LED component

searching for resistor component

after placing everything i had 3 LEDs (D1-D3), 3 resistors (R1-R3), the push button switch (SW1) and the Pico W (M1) all sitting on the schematic ready to be wired up

all components placed on the schematic before wiring

setting values and power#

set all three resistors to 220 ohm. you just double click and type the value

resistors R1 R2 R3 all set to 220 ohm

i also needed to add power symbols. placed a +3V3 symbol and connected it to the Pico’s 3V3_OUT pin, and added PWR_FLAG symbols on both the 3V3 and GND nets. kicad needs these PWR_FLAG markers otherwise the ERC complains that power pins arent being driven properly

+3V3 power symbol from the symbol chooser

PWR_FLAG placed near the GND pin of the pico

wiring it up#

the wiring is straightforward. for each LED: GPIO pin goes to the resistor, resistor goes to the LED anode, LED cathode goes to GND. i used the Draw Wires tool (W key) to connect everything. the pico has tons of GPIO pins so most of them are unused, which means we need to deal with that in the ERC later

running ERC (electrical rules check)#

went to Inspect > Electrical Rules Checker and hit Run ERC. first time around i got 35 violations which was a bit scary but most of them were just “pin not connected” errors for all the unused GPIO pins on the pico

first ERC run showing 35 violations

the fix for unused pins is to place No Connect flags on them. went to Place > Place No Connect Flags (shortcut Q) and clicked on every unused pin. the little X marks tell kicad “yes i know this pin isnt connected and thats intentional”

schematic with no connect flags on unused pins and all wiring done

ran ERC again and got it down to just 2 violations. both were about the GND pin not being properly connected with a PWR_FLAG

ERC down to 2 violations about power pins

fixed that by connecting the PWR_FLAG directly to the GND wire. ran ERC one more time and boom, 0 violations

ERC passing with 0 violations

assigning footprints#

next step is telling kicad what physical footprints to use for each component. went to Tools > Assign Footprints which opens this three pane window where you can see libraries on the left, your components in the middle, and available footprints on the right

assign footprints three pane window

for the resistors i filtered for R_1206 and picked PCM_fab:R_1206 which is the 1206 SMD package from the fab library

filtering for R_1206 footprint

same thing for the LEDs, filtered LED_1206 and picked PCM_fab:LED_1206

filtering for LED_1206 footprint

the pico already had its footprint assigned from the library (PCM_fab:RaspberryPi_PicoW_SocketTHT). heres the final footprint assignment list showing everything mapped correctly

final footprint assignments for all components

the completed schematic#

heres the full schematic zoomed out. you can see all the wiring, the no connect flags on unused pins, the power symbols and the PWR_FLAGs

complete schematic zoomed out showing all connections

PCB layout#

hit Tools > Update PCB from Schematic to push everything into the PCB editor. all the components show up as footprints with ratsnest lines (thin lines showing what needs to be connected)

PCB editor with components imported showing ratsnest lines

arranged the components so the LEDs and resistors are on the left side next to the Pico’s GPIO pins. tried to keep the signal flow logical: GPIO pin on the pico, then resistor, then LED, then GND

components arranged neatly with LEDs and resistors next to the pico

then started routing traces using Route > Route Single Track (shortcut X). set the trace width to 0.5mm and started connecting pads following the ratsnest lines. you click the source pad, route toward the destination, click to place corners, and click the destination pad to finish

routing the first trace from resistor to pico

after a while got all the traces routed. the red lines are the copper traces on the front layer

all traces routed on the PCB

heres a closeup of one of the LED footprints showing the 1206 SMD pads with the GND trace coming in

closeup of LED D1 footprint with trace

board outline#

switched to the Edge.Cuts layer and used Place > Draw Rectangles to draw the board outline around all the components. left about 2-3mm margin around everything

board outline drawn on Edge.Cuts layer

design rules check (DRC)#

before running DRC i checked the board setup constraints under File > Board Setup > Design Rules > Constraints. the defaults were set to 0mm minimum clearance and 0mm minimum track width which seemed too loose, but i left them for now to see what the DRC would catch

board setup showing design rule constraints

ran the DRC from Inspect > Design Rules Checker and got 13 violations and 7 unconnected items. most of the violations were board edge clearance issues where traces were too close to the Edge.Cuts outline. the unconnected items were from the push button switch which i hadnt fully routed yet

DRC results showing 13 violations and 7 unconnected items

to fix these id need to move the board outline further out or pull the traces and components away from the edges. the unconnected items just need more routing. this is something ill clean up when i actually go to fabricate the board

resistor value calculation#

quick math on the resistor values:

  • GPIO output voltage: 3.3V
  • typical LED forward voltage: ~2.0V (red/yellow) or ~3.0V (blue/white)
  • voltage across resistor: 3.3V - 2.0V = 1.3V
  • current with 220 ohm: 1.3V / 220 = ~5.9mA
  • for blue/white LEDs: (3.3V - 3.0V) / 220 = ~1.4mA

5-6mA is plenty bright for indicator LEDs and well within the pico’s GPIO current limit of 12mA per pin. 220 ohm is a safe general purpose value

BOM (bill of materials)#

refcomponentvaluefootprintqty
M1Raspberry Pi Pico W-PCM_fab:RaspberryPi_PicoW_SocketTHT1
D1-D3LED1206 SMDPCM_fab:LED_12063
R1-R3Resistor220 ohmPCM_fab:R_12063
SW1Push Button--1

reflections#

kicad is a pretty powerful tool once you get the hang of it. the learning curve is real though, especially figuring out where everything is in the menus. the ERC was super helpful for catching mistakes, going from 35 violations to 0 felt like a real achievement. the no connect flags thing tripped me up at first because i didnt realize you had to explicitly mark unused pins.

the PCB layout part was actually kind of fun, almost like a puzzle trying to route all the traces without crossing them. the DRC still has some violations to fix but the core design is solid. next step would be to clean up the edge clearances and actually send this to fabrication.

biggest takeaway is that designing a PCB is way more involved than just wiring things up on a breadboard. you have to think about physical footprints, trace widths, clearances, board outlines and a bunch of stuff that doesnt matter when youre just prototyping. but its also really satisfying to see your circuit go from a schematic to a physical board layout