Industrial FABLAB UCuenca

Week 04 – Embedded Programming

Toolchains, Development Workflows and Microcontroller Programming

Group Assignment – Embedded Programming

Objective:

Demonstrate and compare the toolchains and development workflows for available embedded architectures.

Microcontrollers Analyzed:

Arduino Download Page

Embedded Architectures Comparison

Feature ESP32-S2 XIAO ESP32-C3 Arduino Nano
ArchitectureXtensa LX7 (32-bit)RISC-V (32-bit)AVR (8-bit)
Clock SpeedUp to 240 MHz160 MHz16 MHz
Flash Memory4MB4MB32 KB
RAM320 KB400 KB2 KB
WirelessWiFiWiFi + BLENone
Debug InterfaceUSB CDC / JTAGUSB CDCUART Serial
Arduino Download Page Arduino Download Page

Toolchains and Development Workflows Comparison

Criteria Arduino IDE PlatformIO ESP-IDF
Ease of UseHighMediumLow
FlexibilityMediumHighVery High
Compilation ControlLimitedAdvancedFull Control
Debugging CapabilitiesBasic SerialIntegrated DebuggerProfessional JTAG Debugging
Best ForRapid PrototypingIntermediate/AdvancedIndustrial/Advanced IoT

The ESP32 family allows advanced debugging using JTAG and FreeRTOS integration, while the Arduino Nano workflow is simpler but more limited in professional debugging tools.

Individual Assignment

Browsing the Datasheet

The datasheet of the ATmega328P (Arduino Nano) and ESP32-S2 was reviewed. Key sections analyzed:

Understanding the datasheet allowed correct configuration of registers, communication interfaces, and peripheral usage.

Write and Test a Program (Input/Output Interaction)

A program was developed to:


const int buttonPin = 4;
const int ledPin = 2;

void setup() {
  pinMode(buttonPin, INPUT_PULLUP);
  pinMode(ledPin, OUTPUT);
  Serial.begin(115200);
}

void loop() {
  int buttonState = digitalRead(buttonPin);

  if (buttonState == LOW) {
    digitalWrite(ledPin, HIGH);
    Serial.println("Button Pressed - LED ON");
  } else {
    digitalWrite(ledPin, LOW);
    Serial.println("Button Released - LED OFF");
  }

  delay(200);
}

The system successfully interacted with physical input (button), controlled an output (LED), and communicated through USB serial.

Communication Test (Wireless – ESP32)

Using ESP32 WiFi libraries, the board connected to a local network and transmitted status messages via TCP.

This demonstrates wireless embedded communication capability, which is not available on the Arduino Nano without additional modules.

Microcontroller: XIAO ESP32-C3


1. Installation of Arduino IDE (Step-by-Step)

Step 1 – Download Arduino IDE

Go to the official Arduino website and download the latest version for your operating system.

Arduino Download Page

Step 2 – Install Arduino IDE

Run the installer and follow the installation wizard:

Arduino Installation Process

Step 3 – Install ESP32 Board Package

  1. Open Arduino IDE
  2. Go to File → Preferences
  3. In “Additional Board Manager URLs” paste:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
  1. Go to Tools → Board → Boards Manager
  2. Search for ESP32
  3. Install "esp32 by Espressif Systems"
ESP32 Board Installation

Step 4 – Select Board

Tools → Board → ESP32 Arduino → Select "XIAO_ESP32C3"

Board Selection

2. Simulation in Wokwi

Step 1 – Create Project

Go to wokwi.com and create a new ESP32-C3 project.

Wokwi New Project

Step 2 – Add Components

Component Quantity
LED Red 1
LED Yellow 1
LED Green 1
Resistors (220Ω) 3

3. Program Uploaded to XIAO ESP32-C3

Console Output + LED Control Code


    void setup() {
    Serial.begin(115200);
    pinMode(D8, OUTPUT);
    pinMode(D9, OUTPUT);
    pinMode(D10, OUTPUT);

    Serial.println("");
    Serial.println("Hello, XIAO ESP32-C3!");
    Serial.println("Welcome to Wokwi :-)");
    }

    void loop() {
    Serial.println("Red");
    digitalWrite(D8, HIGH);
    delay(300);
    digitalWrite(D8, LOW);

    Serial.println("Green");
    digitalWrite(D9, HIGH);
    delay(300);
    digitalWrite(D9, LOW);

    Serial.println("Blue");
    digitalWrite(D10, HIGH);
    delay(600);
    digitalWrite(D10, LOW);
    }
    
    

4. Serial Monitor Output


5. Final Physical Assembly on Protoboard

Hardware Components Used

Component Description
XIAO ESP32-C3 Main microcontroller
LEDs Red (D8), Yellow (D9), Green (D10)
Resistors 220Ω current limiting resistors
Protoboard Assembly platform
Jumper Wires Connections
Protoboard Assembly Top View

6. Final Demonstration Video

Insert final video file here (e.g., video_w04.mp4)

7. Reflection

This practice demonstrates embedded programming fundamentals including GPIO configuration, serial communication, digital output control, simulation before physical implementation, testing workflow, and debugging.

The workflow followed: Simulation → Code Debugging → Serial Monitoring → Physical Assembly → Final Validation.

Extra Credit – Assemble the System

The embedded system was assembled on a breadboard including:

The hardware assembly was tested and validated before final code deployment.

Extra Credit – Different Languages and Development Environments

Additional testing was performed using:

Differences observed:

Weekly Rubric Checklist