PCB Programming Solutions Guide
This Solutions Guide is a companion to the PCB Programming Full Course. It provides
module-by-module summaries, key takeaways, and simple Arduino/ESP32 sketches to help
reinforce your understanding with practical examples.
Module 1: Introduction to PCB & Embedded
Systems
**Summary** - PCB = Printed Circuit Board with copper traces. - Embedded = Hardware (PCB) +
Firmware (software). - Microcontrollers (Arduino, ESP32, STM32, PIC). **Practice Task** Draw a
block diagram: Sensor → Microcontroller → Output (LED/Motor).
Module 2: Electronics Basics for PCB
Programming
**Summary** - Key components: resistors, capacitors, diodes, transistors. - Ohm’s Law (V = IR). -
Digital logic basics: 0s and 1s. **Practice** Calculate current if a 5V supply drives a 1kΩ resistor.
Answer: I = V/R = 5/1000 = 5mA.
Module 3: PCB Design Workflow
**Summary** - Steps: schematic design → component selection → PCB layout →
fabrication/assembly. **Practice** Try drawing a schematic in KiCad or EasyEDA for an LED +
resistor circuit.
Module 4: Embedded Programming Foundations
**Summary** - Languages: C, C++, Python, Assembly. - Concepts: variables, loops, functions, I/O.
- IDEs: Arduino IDE, PlatformIO, STM32CubeIDE.
Example Sketch:
int buttonPin = 2; int ledPin = 13; void setup() { pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT); } void loop() { if (digitalRead(buttonPin) == HIGH) {
digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } }
Module 5: Microcontroller Programming
**Summary** - GPIO for input/output. - Timers, interrupts, ADC, PWM.
Example Sketch:
int potPin = A0; int ledPin = 9; int value = 0; void setup() { pinMode(ledPin,
OUTPUT); [Link](9600); } void loop() { value = analogRead(potPin);
[Link](value); analogWrite(ledPin, value / 4); // scale 0–1023 to 0–255
delay(100); }
Module 6: Communication Protocols
**Summary** - UART, I²C, SPI, CAN, USB, Wi-Fi, Bluetooth.
Example Sketch:
#include #include #include Adafruit_SSD1306 display(128, 64, &Wire;); void setup() {
[Link](SSD1306_SWITCHCAPVCC, 0x3C); [Link]();
[Link](1); [Link](SSD1306_WHITE); [Link](0,0);
[Link]("Hello I2C!"); [Link](); } void loop() {}
Module 7: Arduino & ESP32 Practical Examples
**Summary** - Arduino: simple, great for beginners. - ESP32: adds Wi-Fi and Bluetooth.
Example Sketch:
#include const char* ssid = "YourWiFi"; const char* password = "YourPassword"; void
setup() { [Link](115200); [Link](ssid, password); while ([Link]() !=
WL_CONNECTED) { delay(500); [Link]("."); } [Link]("Connected!"); }
void loop() { [Link]("Sensor data: 25C"); delay(2000); }
Module 8: Debugging & Testing
**Summary** - Tools: Multimeter, Oscilloscope, Logic Analyzer. - Debugging: Serial prints,
JTAG/SWD.
Module 9: Advanced Topics
**Summary** - RTOS, Low-power design, Bootloaders, OTA, FPGA.
Module 10: Projects & Exercises
**Summary** - Projects: IoT Weather Station, Smart Home Relay, Robot Car, Industrial Controller.
Example Sketch:
int relayPin = 7; void setup() { pinMode(relayPin, OUTPUT); } void loop() {
digitalWrite(relayPin, HIGH); // Turn ON device delay(2000); digitalWrite(relayPin,
LOW); // Turn OFF device delay(2000); }