Skip to content

04. Embedded Programming

Individual Assignment:

Browsing through the data sheet for a microcontroller

For the individual assignment, I analyzed the technical specifications of the ESP32-S3, the SoC (System on Chip) integrated into the Barduino 4.0.2. Studying the datasheet is essential for understanding signal management and the component’s operating limits. It is essentially a technical “instruction manual” that explains exactly what the microcontroller can and cannot do.

1. Architecture and Core

The module is based on the Xtensa® dual-core 32-bit LX7 microprocessor.

Why it matters: Unlike single-core architectures (such as ATtiny), the presence of two cores allows the Wi-Fi/Bluetooth stack to run on one core while leaving the other fully dedicated to user code. This prevents latency and ensures reliable execution of time-critical tasks. Clock speed: Operates at up to 240 MHz and includes a single-precision FPU (Floating Point Unit) for handling complex mathematical calculations efficiently.

2. Memory Management

ROM and SRAM: The chip features 384 KB of ROM and 512 KB of internal SRAM. External Memory: According to the datasheet, the module can support up to 16 MB of Flash and 16 MB of PSRAM. Technical note: A key detail for your documentation (see page 12 of the datasheet): for modules equipped with Octal PSRAM, pins IO35, IO36, and IO37 are internally allocated and therefore cannot be used for other purposes.

3.Pinout and GPIO Matrix

Pin Configuration: The module features 41 total pins, of which up to 36 are usable GPIOs (General Purpose Input/Output) for digital signals. Multifunctionality (Multiplexing): Thanks to the GPIO Matrix, nearly every pin can serve multiple functions. For example, IO4 can operate as a standard digital input/output, as an analog-to-digital converter channel (ADC1_CH3), or as a capacitive touch sensor (TOUCH4). Strapping Pins (Boot Configuration): The datasheet identifies certain critical pins—such as GPIO0—that determine the chip’s boot mode. On my Barduino board, this pin is connected to a push button, allowing entry into programming mode. PSRAM Limitations: A key detail highlighted in the pin mapping tables is that in modules equipped with Octal PSRAM, pins IO35, IO36, and IO37 are internally assigned to memory functions and are therefore not available to the user.

By consulting Table 3-1 (Pin Definitions) of the datasheet, I learned to distinguish between the physical pin number on the module and its logical name (GPIO). For example, in my test setup I will use: Pin 14 (IO13) Pin 15 (IO14)

I will avoid pins 28 to 33, which are reserved for internal Flash memory.

Reserved Pins:

Pins 28, 29, 30, 31, 32, 33: Connected to the module’s internal Flash memory. Connecting external components to these pins may prevent the board from booting or functioning properly.

Pins 34, 35, 36: If the module includes Octal PSRAM, these pins are also internally reserved and unavailable for user applications.

4. Electrical Parameters and Safety (Operating Conditions)

Studying the electrical characteristics is what separates a working prototype from a burned-out module. I extracted the limit values and optimal operating conditions directly from the datasheet to ensure system stability.

To guarantee the longevity of my board, I carefully reviewed Table 6-1 and Table 6-2 of the datasheet. As shown in the screenshot below, the supply voltage range is very narrow (3.0V – 3.6V). This confirmed the importance of the voltage regulator on the Barduino, which steps down the 5V from USB to the required 3.3V for the module.

Operating outside this range can compromise stability, cause unpredictable behavior, or permanently damage the chip.

write and test a program for an embedded system using a microcontroller

to interact (with input &/or output device)

and communicate (with wired or wireless connections)

Programming My Barduino (ESP32-S3)

After analyzing the datasheet of the ESP32-S3-WROOM-1 module, I decided to test the chip’s capabilities with a project called “Mood-Meter.”

The goal of this project is to meet the two core requirements of the assignment: Interact → Touch input + LED output Communicate → Serial wired connection

The project demonstrates both physical interaction with the hardware (via capacitive touch and visual feedback) and data communication through a serial interface, validating the module’s core functionalities in a simple but structured way.

1. The Toolchain: Environment Configuration Following the standard workflow, I used the Arduino IDE. However, unlike the ATtiny, the ESP32-S3 requires specific configuration to be recognized.

Core Installation: In Settings, I added the Espressif board manager URL and installed the esp32 package via Boards Manager. Board Selection: I selected ESP32S3 Dev Module. Native USB: As indicated in the datasheet, this chip handles USB internally. I had to enable the USB CDC On Boot: Enabled option to allow serial communication via the USB-C port.

2. Firmware Development (The Mood-Meter) Being a beginner with programming, I used Gemini as my tutor. Instead of copying banal code, we analyzed the datasheet together to find a creative solution.

Excerpt from the prompt: “I’ve never programmed before, I want something fun but not banal that uses the datasheet.”

AI Suggestion: “Let’s use the integrated capacitive sensors. The datasheet on page 11 identifies pin IO4 as TOUCH4. We can use it to detect human touch without physical buttons.”

For the assignment, I decided not to use a simple button, but to leverage the capacitive sensors (Touch) integrated in the ESP32-S3 module. Based on Table 3-1 of the datasheet, I chose pin IO4 which has the TOUCH4 function. Instead of writing everything from scratch, I asked Gemini to help me translate the idea into code.

3. Code Logic (The Sketch) I wrote (with the help of my digital tutor) a program that reads the capacitance value on pin IO4. The more the user touches the sensor, the more the value changes, triggering a sound and textual response. The program must:

Sense: Read how much “electrical disturbance” (capacitance) there is on pin 4. Communicate: Send a message to the computer via the USB-C cable (Wired Communication). React: Stop blinking if it senses I’m touching it (Interaction). The “at rest” values are around 21900, we’ll use this logic: the higher the value rises (stronger contact), the less frequent the “beeps” become.

4. Testing and Communication (Communicate) The “Communicate” requirement is satisfied through the Serial Monitor.

Wired Connection: The board transmits data to the computer in real time.

Interaction: By touching pin IO4, the LED turns off and the computer receives the message about the pressure status.