Week 04 | Embedded Programming

Group Assignment

This week's group assignment consisted of analyzing the microcontroller architecture used in our laboratory. The objective was to understand the main characteristics of the microcontroller, including its architecture, memory structure, peripherals, and programming capabilities.

We explored the ESP32-C3 microcontroller integrated in the Seeed Studio XIAO ESP32-C3 development board, reviewing its technical documentation, pinout, and hardware features used for embedded programming.

The complete documentation of the group work can be found in the following page:

Group assignment documentation


Individual Assignment

The objective of this assignment was to understand the basic process of programming a microcontroller using Arduino IDE and verify the behavior of a digital output by controlling an external LED connected on a breadboard.

Through this exercise, I explored the typical embedded programming workflow: connecting the hardware, writing the code, uploading the program to the microcontroller, and verifying the behavior of the circuit.


Hardware Used

The following components were used in this activity:

  • Seeed Studio XIAO ESP32-C3 development board
  • Breadboard
  • Red LED
  • Current-limiting resistor
  • Jumper wires
  • USB-C cable for power and programming

The XIAO ESP32-C3 is a compact development board based on the ESP32-C3 microcontroller. It can be programmed using Arduino IDE and provides several GPIO pins that can be configured as digital inputs or outputs.


Programming Environment Setup

The first step was to install and configure the Arduino IDE. After that, the correct board definition for the XIAO ESP32-C3 was selected and the serial port assigned to the board was configured.

At the beginning of the process, I encountered some issues related to board selection and the use of the built-in LED definition. After selecting the correct XIAO ESP32-C3 board and testing the communication through the Serial Monitor, I confirmed that the microcontroller was correctly running uploaded programs.


Circuit Design

To test the microcontroller output, I built a simple circuit on a breadboard. The goal was to control an external LED using one of the digital pins of the XIAO board.

The circuit was connected as follows:

  1. A digital pin from the XIAO was connected to a current-limiting resistor.
  2. The resistor was connected to the anode of the LED.
  3. The cathode of the LED was connected to the GND pin of the microcontroller.

The resistor is necessary to limit the current flowing through the LED and protect both the LED and the microcontroller.

This type of circuit is one of the most common tests in embedded programming because it quickly verifies whether the microcontroller is executing the uploaded program correctly.


Code Used

The following code was uploaded to the board in order to control the LED:


						#define LED_PIN 2

						void setup() {
						pinMode(LED_PIN, OUTPUT);
						}

						void loop() {
						digitalWrite(LED_PIN, HIGH);
						delay(500);
						digitalWrite(LED_PIN, LOW);
						delay(500);
						}
						

In this program, the selected pin is configured as a digital output, and then its state alternates between HIGH and LOW every 500 milliseconds. This creates the blinking effect on the external LED.


Results

After uploading the program, the LED connected to the digital pin turned on successfully, confirming that the board was correctly programmed and that the circuit was properly connected.

This result demonstrated that the microcontroller was able to control an external component through a digital output pin. It also confirmed that the programming environment, hardware connections, and power supply were working correctly.


What I Learned

Through this exercise, I learned the basic workflow required to program a microcontroller using Arduino IDE, including board selection, code compilation, program upload, and hardware testing.

I also learned how to configure a GPIO pin as a digital output and how to control its state through code in order to interact with an external electronic component.

In addition, this activity reinforced my understanding of breadboard-based prototyping and the importance of using a current-limiting resistor when working with LEDs.


Reflection

This assignment helped me better understand the relationship between software and hardware in an embedded system. Even though the circuit was simple, it represented an important first step in learning how to interact with physical components through a microcontroller.

The process also required several tests and adjustments, especially when identifying the correct board configuration and verifying the external LED connection. This trial-and-error process was useful to understand that debugging is a natural part of embedded programming and electronics prototyping.

As a next step, I would like to continue exploring more advanced input and output interactions, such as push buttons, sensors, and multiple output devices connected to the XIAO ESP32-C3.