Home/Week 04

Week 04

Integrated programming

Integrated programming

  • Group Assignment:
    • Demonstrate and compare toolchains and development workflows for available integrated architectures
    • Document your work on the group work page and reflect on your individual page what you learned
  • Individual Assignment:
    • Explore the datasheet for a microcontroller
    • Write and test a program for an embedded system using a microcontroller to interact (with local input and/or output devices) and communicate (with wired or wireless remote connections)
    đź”— Link to group work (https://fabacademy.org/2026/labs/lima/Weeks/Week4/Week4.html)

This work is linked to the group page where different microcontroller architectures and their development flows are compared.

GROUP ASSIGNMENT

Comparison of development architectures and flows

During the group activity, different microcontrollers were evaluated, comparing not only their architectures, but also theactual toolchains and development flows used to program them.

  • ATmega328P (8-bit AVR)
    It was programmed usingArduino IDE as the main environment. The workflow includes board selection, compilation, and charging via USB or ISP scheduler. It is an accessible system, ideal for rapid learning and prototyping.
  • ARM Cortex-M0 (32-bit – RP2040)
    Worked withArduino IDE and support for RP2040, as well as alternatives such as MicroPython. The flow includes installation of additional packages, board configuration, and direct USB charging. It offers greater performance and flexibility.
  • PIC18F (8-bit)
    It is programmed usingMPLAB X IDE and XC8 compiler. The flow is more technical, including log setup, compilation, and recording with dedicated schedulers. It is common in industrial applications.
  • ESP32 (32-bit, dual-core)
    It was programmed usingArduino IDE or ESP-IDF, requiring installation of additional libraries. The flow includes network configuration, compilation, and USB charging. It stands out for its Wi-Fi and Bluetooth connectivity, ideal for IoT. It was concluded that each architecture requires aspecific toolchain and a distinct development flow, from simple environments such as Arduino IDE to more complex systems such as MPLAB or ESP-IDF. This difference influences the complexity of development, control over hardware, and the type of applications that can be deployed.

Comparison Table or Evidence of Group Work

MCU/Board

CPU / Architecture

Max Clock

Memory (board/chip)

Connectivity

Typical Use

RP2040

Dual-core ARM Cortex-M0+

133 MHz

264 KB SRAM + 2 MB Flash

No wireless

Local control, PWM/ADC/PIO, rapid prototyping

ESP32-C3

32-bit RISC-V (single-core)

160 MHz

400 KB SRAM + 4 MB Flash

Wi-Fi + BLE 5

Basic IoT, connectivity, low cost

ESP32-S3

32-bit Xtensa LX7 dual-core

240 MHz

8 MB PSRAM + 8 MB Flash

Wi-Fi + BLE 5

IoT + heavier applications / light edge AI

ATSAMD11

32-bit ARM Cortex-M0+

48 MHz

16 KB Flash + 4 KB SRAM

No wireless

Minimalist, USB device, simple control, low power

Objective of the group activity

The objective of the group activity was to analyze and compare different microcontroller architectures and their development flows, understanding how each platform uses specific tools, compilers, and programming environments for embedded systems.

Through this activity, the following was sought:

  • Compare architectures such as AVR, ARM Cortex, PIC, and ESP32
  • Identify differences between toolchains and development environments
  • Understand the programming and code upload flows on each platform
  • Evaluate capabilities such as processing, memory, and connectivity
  • Relate each architecture to real applications in embedded systems and IoT
  • Document tests and results collaboratively

This activity allowed us to understand that each microcontroller requires different development processes depending on its architecture, level of complexity and type of application.

Learning Achieved

During the group activity we learned to compare different microcontroller architectures and their development flows, identifying the differences between platforms such as AVR, PIC, RP2040 and ESP32. We also understood how each architecture uses specific tools, compilers and programming environments, allowing us to select the most appropriate technology according to the requirements of an embedded systems project.

  • INDIVIDUAL ASSIGNMENT

Objective of the individual activity

The objective of the individual activity was to explore the operation of a microcontroller by analyzing its datasheet and to develop a basic embedded system capable of interacting with digital inputs and outputs.

To do this, we worked with the XIAO ESP32 microcontroller, implementing a system where:

  • One button doubles as a digital input
  • An LED functions as a digital output
  • The microcontroller processes the signal in real time

In addition, the following were sought:

  • Understanding GPIO Pin Settings
  • Program the system using the Arduino IDE
  • Implement communication between hardware and software
  • Use internal pull-up resistors to optimize the circuit
  • Validate operation through physical testing

This practice allowed him to develop a solid foundation in embedded programming and control of electronic systems.

Tools & Equipment – Integrated Programming

đź’» Equipment used

  • Laptop/Computer
  • Seeed Studio XIAO ESP32 Microcontroller
  • Cable USB-C
  • Breadboard
  • LED
  • Push button
  • Jumper cables
  • USB Power Supply
  • Serial Monitor

⚙️ Software used

  • Arduino IDE
  • Drivers ESP32
  • Web browser
  • ESP32 Official Documentation Page
  • Datasheet del XIAO ESP32
  • 🔌 Electronic Tools
    • Digital Multimeter
    • Precision Tweezers
    • Soldering iron (for additional testing)
    • Breadboard for temporary connections

đź“‚ Materials used

  • LED
  • Push button
  • Electronic Resistors
  • Dupont cables / jumper
  • XIAO ESP32 Plate
  • USB-C connectors
Materials and Equipment Collage

My Process:

1. Datasheet Scan (XIAO ESP32)

For this week, the datasheet analysis of the SeeedStudio XIAO ESP32 microcontroller was carriedout, identifying its main characteristics and capabilities for embedded systems.

Main features

  • Architecture: ESP32 dual-core
  • Frequency: up to 240 MHz
  • Flash Memory: 4 MB
  • Operating Voltage: 3.3V
  • Communication: UART, SPI, I2C, WiFi and Bluetooth
  • Configurable GPIOs
  • USB-C programming

The study of the datasheet made it possible to understand the internal workings of the microcontroller, the distribution of the pins and the communication capabilities necessary for the development of the embedded system.

This information was critical in correctly identifying the pins used for the LED and button.

"This information was used to correctly identify the pins used in the programming of the LED and the button."

2. Pin Setup

The pin configuration of the XIAO ESP32 microcontroller was studied, identifying the connections used for programming.

Pins Used

  • GPIO 2 → LED
  • GPIO 3 → Button
  • 3.3V → Power
  • GND → Earth

The XIAO ESP32's GPIOs can be configured as:

  • Digital Inputs
  • Digital outputs
  • PWM
  • I2C
  • SPI
  • UART

For this practice, the following were configured:

  • A pin as a digital output to control the LED
  • A pin as a digital input to read the status of the button


XIAO SP32 Pin Diagram (pinout)

3. Embedded System Programming

A board was programmed using the XIAO ESP32 microcontroller to control a basic interaction between input and output.

Implemented system

Entry:

  • Button

đź“‹ Departure

  • LED

The operation of the system consists of the fact that, when the button is pressed, the microcontroller detects the signal and turns on the LED.

This exercise allowed us to validate:

  • Digital Input Reading
  • Digital output control
  • Hardware-software interaction
  • Real-time response

The microcontroller's internal pull-up resistor was used to optimize the circuit design.

Internal pull-up resistance was used for the button reading, optimizing the circuit design."

4. Scheduling Process

The programming was done usingArduino IDE.

Workflow

  1. Installing the ESP32 Bracket
  2. XIAO ESP32 Board Selection
  3. USB-C connection
  4. Writing the Code
  5. Program Compilation
  6. Uploading the code to the microcontroller
  7. Real-time testing

The XIAO ESP32 allows direct programming via USB without the need for external programmers.

During development, tests were carried out to verify:

  • Correct button reading
  • LED Operation
  • Immediate system response

Programming was done by direct USB charging, taking advantage of the integrated bootloader.

5. Source Code

c / cpp
const int ledPin = 2;      GPIO connected to the LED
const int buttonPin = 3;   GPIO connected to the button
void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT_PULLUP); We activate internal pull-up resistance
void loop() {
  int state = digitalRead(buttonPin);
  When the button is pressed, the status is LOW (for pull-up)
  if (status == LOW) {
    digitalWrite(ledPin, HIGH); Turn on LEDs
  } else {
    digitalWrite(ledPin, LOW);  Turn off LEDs

Code Explanation

The program sets one microcontroller pin as output (LED) and another as input (button).

An internal pull-up resistor is used, so the button is in the HIGH state when not pressed and switches to LOW when pressed.

In the main loop cycle, the microcontroller constantly reads the status of the button. When a LOW signal is detected, the LED lights up; otherwise, it remains off.

This code demonstrates the basic interaction between input and output in an embedded system, as well as the use of internal resistors to optimize circuit design.

6. Result (Hero Shot)

The final system implemented allows direct interaction between the user and theXIAO SP 32 microcontroller, responding in real time to a physical input by means of a button.

When the button is pressed, the microcontroller processes the digital signal and activates the corresponding output, turning on the LED. This behavior validates the correct operation of the program and the proper configuration of the GPIO pins.

The result shows the integration between hardware and software, demonstrating the control of inputs and outputs in an embedded system.


Problems and Solutions

Problem 1: The microcontroller was not detected by the computer

Solution:
The USB-C cable was checked and the ESP32 board holder was properly installed on the Arduino IDE. The appropriate COM port was then selected.

Problem 2: The LED was not responding when pressing the button

Solution:
Revised the circuit wiring and GPIO pin configuration within the code. The connection to GND has also been fixed.

Problem 3: Incorrect Button Reading

Solution:
The internal pull-up resistor was used through INPUT_PULLUP, avoiding unstable signals and improving the digital reading of the button.

Reflection

During this week, it was possible to understand the basic operation of embedded systems through the integration between hardware and software using the XIAO ESP32 microcontroller.

The datasheet analysis allowed the GPIO pins to be correctly identified and their input and output capabilities to be understood.

On a practical level, the programming made it possible to validate how a physical signal can be processed by the microcontroller to generate an immediate response in the system.

The importance of using internal pull-up resistors to simplify electronic design was also understood.

In conclusion, this practice allowed to strengthen knowledge about:

  • Embedded programming
  • Entry and exit control
  • Microcontroller Configuration
  • Integration between electronics and programming
  • Basic hardware and software debugging

Learning achieved

During this week, it was possible to understand how integrated programming works in embedded systems, identifying the direct relationship between hardware and software through the use of the XIAO ESP32 microcontroller.

Through datasheet analysis and practical programming, we learned:

  • How to interpret technical information from a microcontroller
  • Configuring and Using GPIO Pins
  • Differences between digital inputs and outputs
  • Signal reading via buttons
  • Control of output devices such as LEDs
  • Use of internal pull-up resistors to stabilize signals
  • Basic programming in Arduino IDE
  • Process of compiling and uploading code via USB
  • Importance of Hardware and Software Error Debugging

In addition, the group comparison allowed us to understand that each microcontroller architecture has different tools, development flows and capabilities, depending on the application for which it was designed.

This practice strengthens knowledge in:

  • Embedded programming
  • Basic electronics
  • Hardware-software integration
  • Communication between electronic components
  • Real-time validation and testing

Finally, it was understood that an embedded system not only executes code, but also physically interacts with the environment through sensors, signals and electronic devices, becoming the control core of intelligent systems.

đź“‹ Check-off List

1. Linked to the group assignment page?

Yes. The group page where the tests and configurations related to programming and communication of electronic boards within the Fab Lab were correctly linked.

2. Did you explore and document information from a microcontroller's datasheet?

Yes.
Technical information of the XIAO ESP32-C3 microcontroller was researched and documented, including:

  • pin distribution,
  • 3.3V power supply,
  • I2C communication,
  • digital inputs and outputs,
  • serial communication,
  • and WiFi/Bluetooth wireless capabilities.

Its functions to connect sensors, OLED screen and buzzer were also analyzed.

3. Did you program a board to interact and communicate?

Yes.
A PCB based on the XIAO ESP32-C3 microcontroller was programmed to:

  • read humidity sensor data,
  • display information on OLED screen,
  • activate alerts via buzzer,
  • and communicate via RemoteXY mobile interface.

The system achieved real-time interaction between input, processing and output.

4. Did you describe the programming process used?

Yes. The complete programming flow was documented using Arduino IDE:

  • installation of bookcases,
  • XIAO ESP32-C3 board configuration,
  • definition of inputs and outputs,
  • Sensor reading,
  • Condition programming,
  • I2C communication with OLED,
  • and tests by serial monitor.

Iterative testing was also performed to calibrate the system and correct errors.

5. Did you include your source code?

Yes. The full source code of the project was included, including:

  • Humidity sensor reading,
  • OLED screen control,
  • Activating the buzzer,
  • and communication with RemoteXY.

The code was organized and documented to facilitate future modifications and validations.

6. Did you include "hero shots"?

Yes. Hero shots were made showing the fully functional system, integrating:

  • PCB,
  • OLED screen,
  • sensor,
  • buzzer,
  • and physical structure of the smart pot.

The images show the integration between electronics, programming and digital manufacturing.

âť“ Frequently Asked Questions

1. Is it enough for group assignment if we compare different microcontrollers in theory?

Answer:
No. In addition to theoretical comparison of architectures and toolchains, it is mandatory to demonstrate physical programming on at least two families of microcontrollers. In my case, the group comparison included RP2040, ESP32, PIC, and AVR, but the individual work focused on the actual implementation with the XIAO ESP32-C3, validating digital inputs and outputs using an LED and a button in the Arduino IDE. This ensures the practical application of the development flow, not just the theory.

2. If I modify existing code, is that now my code?

Answer:
Yes, as long as the code is understood, adapted, and tested by the student. In my case, the base program of button reading and LED control on the XIAO ESP32 was written and adjusted in Arduino IDE, using INPUT_PULLUP to optimize the circuit. The code was understood line by line, modified according to the pins used (GPIO 2 and GPIO 3) and physically tested on the microcontroller. In addition, if an example is taken as a reference, it must be analyzed and its origin must be recognized if applicable.

3. How should I include the source code on my website?

Answer:
Source code should not be presented only as an image or capture. It must be included as readable text on the website or as a downloadable file (.ino). In my work week, the code of the XIAO ESP32 is documented directly on the project website within the embedded programming section, showing both the code and its functional explanation (input: button, output: LED, use of internal pull-up). This allows the evaluator to read, copy and understand the operation without the need to open images.

Week Files

Download all resources and files of this week in a compressed .ZIP archive

Download ZIP

Demonstration Videos