Assignments
Week 4 – Embedded Programming
Assignment
Individual assignment
- Browse through the data sheet for a microcontroller.
- Write and test a program for an embedded system using a microcontroller to interact (with input and/or output devices) and communicate (with wired or wireless connections).
- Extra credit: assemble the system
- Extra credit: try different languages and/or development environments
Group assignment
- Demonstrate and compare the toolchains and development workflows for available embedded architectures.
Contribution to the Group Assignment
During the group assignment, my contribution focused on the technical research and structured comparison of different microcontroller boards.
I reviewed the official datasheets of the following boards:
- Arduino R3
- ESP32
- Raspberry Pi Pico 2W
- Arduino Nano
From each datasheet, I extracted and analyzed key technical specifications such as processor architecture (8-bit vs 32-bit), clock frequency, Flash memory, SRAM, operating voltage, number of digital and analog I/O pins, communication protocols (UART, SPI, I2C), and wireless connectivity features.
Additionally, I developed a comparative table that organized these technical parameters in a clear and structured format. The comparison criteria were selected based on embedded system requirements, including processing capability, memory constraints, communication needs, and hardware flexibility.
Development Board and Microcontroller
What is a Development Board?
A development board is a complete electronic platform designed to help us prototype, test, and program embedded systems easily. It includes a microcontroller as its main brain, along with additional components such as voltage regulators, USB interface, communication ports, buttons, LEDs, and sometimes wireless modules.
In simple words, the development board is the physical platform that allows us to interact with the microcontroller safely and efficiently without building the entire circuit from scratch.
What is a Microcontroller?
A microcontroller is a small integrated circuit that acts as the brain of an embedded system. It contains a processor (CPU), memory, input/output pins, and communication interfaces all inside a single chip. It executes programs written by the user to control sensors, motors, LEDs, displays, and communication systems.
Every development board includes at least one microcontroller. The board provides the supporting electronics, while the microcontroller performs the actual computation and control tasks.
Arduino UNO R3
The Arduino UNO R3 is one of the most popular development boards for learning embedded systems. It is widely used in education and beginner projects to control LEDs, sensors, motors, and other electronic components. It provides a simple and accessible way to understand how hardware and software interact.
Development Board Overview
The Arduino UNO R3 is one of the most widely used development boards. It is based on the ATmega328P microcontroller and operates at 5V logic. It is ideal for beginners and simple embedded applications.
| Feature | Specification |
|---|---|
| Digital Pins | 14 |
| PWM | 6 |
| Analog Inputs | 6 |
| Operating Voltage | 5V |
| Main MCU | ATmega328P |
Microcontroller – ATmega328P
The ATmega328P is an 8-bit AVR microcontroller running at 16 MHz. It is simple, efficient, and widely supported. It integrates memory, timers, ADC, and communication interfaces in a single chip.
| Feature | Specification |
|---|---|
| Architecture | 8-bit AVR |
| Flash Memory | 32 kB |
| SRAM | 2 kB |
| EEPROM | 1 kB |
| ADC Resolution | 10-bit |
| Clock Frequency | 16 MHz |
The Arduino UNO R3 is an ideal board for understanding the fundamentals of embedded systems. Its 8-bit architecture and simple development workflow make it highly suitable for beginners and educational environments. Although it has limited memory and processing power compared to modern boards.
Raspberry Pi Pico 2 W
This board is used for modern embedded system development. It supports wireless connectivity and is flexible for building automation systems, sensor networks, and custom hardware solutions.
Development Board Overview
The Raspberry Pi Pico 2 W is a compact and powerful development board designed for embedded systems and IoT applications. It integrates a modern dual-core microcontroller and a wireless communication module. Despite its small size, it offers advanced peripherals and programmable I/O capabilities.
| Feature | Specification |
|---|---|
| Digital GPIO | Up to 30 programmable pins |
| PWM | 16 hardware PWM channels |
| Analog | 12-bit ADC |
| SPI | 2 buses |
| I2C | 2 buses |
| UART | 2 ports |
| Main MCU | RP2350 (ARM Cortex-M33 dual-core) |
| Wireless | WiFi + Bluetooth (CYW43439) |
Microcontroller – RP2350
The RP2350 is a 32-bit ARM Cortex-M33 dual-core microcontroller. It is designed for higher performance and security compared to previous RP2040 versions. It includes programmable I/O blocks (PIO), which allow custom hardware communication protocols to be implemented in software.
| Feature | Specification |
| Architecture | ARM Cortex-M33 (dual-core) |
| Frequency | Up to 150 MHz |
| SRAM | Up to 520 kB |
| Flash | External (typically 4 MB) |
| ADC | 12-bit |
| PWM | 16 channels |
| PIO | 2 programmable I/O blocks |
Wireless Module – CYW43439
The Pico 2 W integrates the CYW43439 module for wireless communication, allowing WiFi and Bluetooth Low Energy connectivity.
| Feature | Specification |
| WiFi | 802.11 b/g/n (2.4 GHz) |
| Bluetooth | BLE 5.2 |
| Operating Voltage | 3.3V |
The Raspberry Pi Pico 2 W combines modern ARM architecture with integrated wireless communication. Its dual-core design and programmable I/O (PIO) blocks provide flexibility for advanced hardware control. It supports both traditional C/C++ development and alternative environments such as MicroPython.
ESP32 (ESP32-WROOM)
The ESP32 is widely used for Internet of Things (IoT) projects. It enables wireless communication through WiFi and Bluetooth, allowing devices to connect to networks, send data, and interact remotely.
Development Board Overview
The ESP32 development board is designed for IoT and wireless applications. It integrates a powerful dual-core processor and built-in WiFi and Bluetooth. It operates at 3.3V logic level and is widely used for smart devices, home automation, and wireless control systems.
| Feature | Specification |
| Digital GPIO | Up to 34 pins |
| PWM | Hardware PWM (LEDC) |
| Analog | 12-bit ADC |
| DAC | 2 channels (8-bit) |
| SPI | 4 buses |
| I2C | 2 buses |
| UART | 3 ports |
| Main MCU | Xtensa LX6 |
| Wireless | WiFi + Bluetooth |
Microcontroller – Xtensa LX6
The ESP32 uses a 32-bit dual-core Xtensa LX6 architecture. It is optimized for wireless communication and real-time applications. It integrates advanced peripherals, hardware encryption, and deep sleep modes for low power consumption.
| Feature | Specification |
|---|---|
| Architecture | Xtensa LX6 (dual-core) |
| Frequency | Up to 240 MHz |
| SRAM | 520 kB |
| Flash | External (usually 4 MB) |
| ADC | 12-bit |
| DAC | 2x 8-bit |
| WiFi | Integrated |
| Bluetooth | Classic + BLE |
The ESP32 is a powerful dual-core microcontroller designed for IoT and wireless applications. Its integrated WiFi and Bluetooth capabilities make it ideal for connected systems. Compared to traditional Arduino boards, it offers significantly higher processing speed and memory, allowing for more complex and real-time applications.
Arduino Nano
The Arduino Nano offers similar functionality to the UNO but in a much smaller form factor. It is commonly used in compact or space-limited projects, such as wearable devices or small embedded prototypes. It allows users to control electronic components while maintaining a minimal physical size.
Development Board Overview
The Arduino Nano is a compact version of the Arduino UNO R3. It uses the same ATmega328P microcontroller but in a smaller form factor. It is ideal for projects where space is limited, such as wearable devices or compact embedded systems.
| Feature | Specification |
|---|---|
| Digital Pins | 14 |
| PWM | 6 |
| Analog Inputs | 8 |
| Operating Voltage | 5V |
| Main MCU | ATmega328P |
Microcontroller – ATmega328P
The Arduino Nano uses the same 8-bit AVR ATmega328P microcontroller found in the Arduino UNO R3. It runs at 16 MHz and includes internal Flash memory, SRAM, EEPROM, ADC, timers, and communication interfaces.
| Feature | Specification |
|---|---|
| Architecture | 8-bit AVR |
| Flash | 32 kB |
| SRAM | 2 kB |
| EEPROM | 1 kB |
| ADC | 10-bit |
| Frequency | 16 MHz |
Difference Between Arduino Nano and Arduino UNO R3
Although both boards use the same microcontroller, the main differences are physical size and pin layout.
| Feature | Arduino Nano | Arduino UNO R3 |
|---|---|---|
| Size | Compact | Larger board |
| USB | Mini/Micro USB | USB Type-B |
| Analog Pins | 8 | 6 |
| Shield Compatibility | No direct shield stacking | Compatible with Arduino shields |
| Form Factor | Breadboard friendly | Standard Arduino layout |
In summary, both boards behave almost identically in programming, but the Nano is preferred for compact designs, while the UNO is better for prototyping with shields. The Arduino Nano offers the same functionality as the UNO R3 but in a compact and breadboard-friendly format. It is especially useful for space-constrained projects and embedded prototypes where physical size matters
Development Boards Comparison
| Feature | UNO R3 | Nano | UNO R4 WiFi | ESP32 | Pico 2 W |
|---|---|---|---|---|---|
| Main MCU | ATmega328P | ATmega328P | R7FA4M1 (ARM M4) | Xtensa LX6 | RP2350 |
| Architecture | 8-bit AVR | 8-bit AVR | 32-bit ARM Cortex-M4 | 32-bit Xtensa (dual-core) | 32-bit ARM Cortex-M33 (dual-core) |
| Clock Speed | 16 MHz | 16 MHz | 48 MHz | Up to 240 MHz | Up to 150 MHz |
| Flash Memory | 32 kB | 32 kB | 256 kB | External (~4 MB) | External (~4 MB) |
| SRAM | 2 kB | 2 kB | 32 kB | 520 kB | Up to 520 kB |
| WiFi | No | No | Yes | Yes | Yes |
| Bluetooth | No | No | BLE | BLE | BLE |
Individual assignment
In this individual assignment, I will test and compare two different microcontroller boards: the Seeeduino and the Arduino R4. The objective is to evaluate their behavior, compatibility, and performance for my embedded systems development. Before working with the physical boards, I will first use a simulation environment. This allows me to validate the circuit design, test the code, and detect possible errors in a safe and controlled way. Using a simulator reduces the risk of damaging components and helps optimize the development process.
Seeeduino XIAO nRF52840
This microcontroller is designed for low-power wireless applications. It is commonly used in wearable devices, smart sensors, and compact IoT projects where energy efficiency is important.
Development Board Overview
The Seeeduino XIAO nRF52840 is a compact and powerful development board designed for IoT and Bluetooth applications. Despite its small size, it integrates wireless communication and advanced low-power features.
| Feature | Specification |
|---|---|
| Digital Pins | Up to 14 |
| Analog Inputs | Yes (12-bit ADC) |
| PWM | Yes |
| USB | Native USB |
| Main MCU | nRF52840 |
Microcontroller – nRF52840
The nRF52840 is a 32-bit ARM Cortex-M4F microcontroller optimized for wireless communication and low-power applications. It integrates Bluetooth and advanced peripherals for IoT systems.
| Feature | Specification |
|---|---|
| Architecture | ARM Cortex-M4F (32-bit) |
| Flash Memory | 1 MB |
| RAM | 256 kB |
| ADC Resolution | 12-bit |
| Bluetooth | BLE 5.0 |
| USB | Full-speed USB 2.0 |
The Seeeduino XIAO nRF52840 is a compact and powerful development board based on a 32-bit ARM Cortex-M4 microcontroller with integrated Bluetooth Low Energy (BLE). Despite its small size, it offers strong processing capabilities and low power consumption.
Arduino UNO R4 WiFi
This board is used for more advanced embedded applications. It allows higher performance projects and supports wireless communication, making it suitable for connected systems and interactive prototypes.
Development Board Overview
The Arduino UNO R4 WiFi is an upgraded version of the classic UNO platform. It is designed for embedded programming, rapid prototyping, and IoT applications. This board integrates a powerful 32-bit microcontroller and a WiFi/Bluetooth module, making it suitable for both control systems and wireless communication.
| Category | Function |
|---|---|
| Digital | ON/OFF control signals |
| PWM | Power control (motors, LEDs) |
| Analog | Voltage reading |
| I2C | 2-wire communication |
| SPI | High-speed communication |
| UART | Serial TX/RX |
| Power | 5V system supply |
| Main MCU | R7FA4M1AB3CFM#AA0 |
Microcontroller – R7FA4M1AB3CFM#AA0
The R7FA4M1AB3CFM#AA0 is a 32-bit ARM Cortex-M4 based microcontroller. It operates at 5V logic level for compatibility with previous Arduino shields. It includes internal memory, ADC, DAC, timers, and advanced communication interfaces for industrial and embedded applications.
| Feature | Specification |
|---|---|
| Flash | 256 kB |
| SRAM | 32 kB |
| Data Flash | 8 kB (EEPROM) |
| ADC | 14-bit |
| DAC | Up to 12-bit |
| CAN | Yes |
| DMAC | 4 channels |
WiFi / Bluetooth Module – ESP32-S3-MINI-1-N8
The ESP32-S3 module acts as a secondary processor dedicated to wireless communication. It operates at 3.3V and communicates with the main MCU through a logic-level translator.
| Feature | Specification |
|---|---|
| WiFi | 2.4 GHz (802.11 b/g/n) |
| Bluetooth | BLE 5 |
| SRAM | 512 kB |
| ROM | 384 kB |
| Operating Voltage | 3.3V |
The Arduino UNO R4 WiFi represents a significant evolution from the classic UNO architecture. With a 32-bit ARM Cortex-M4 microcontroller and integrated wireless capabilities, it bridges the gap between beginner-friendly boards and more advanced embedded systems.
1) Embedded Systems
An embedded system is a specialized computing system designed to perform a specific task within a larger device or process. Unlike general-purpose computers, embedded systems are built for dedicated functions such as sensing, control, automation, and real-time interaction. They are commonly found in robots, industrial equipment, smart devices, and manufacturing systems.
Basic Composition: Input → Controller → Output
In general, an embedded system can be described using three main blocks:
- Input: Sensors or user inputs that provide data to the system (e.g., button, LDR, potentiometer, temperature sensor).
- Controller: The microcontroller that reads inputs, processes information, and makes decisions (e.g., Seeeduino, Arduino UNO R4).
- Output: Actuators or indicators controlled by the system (e.g., LED, buzzer, motor, LED matrix).
Input
Controller
Output
2) System Architecture
The embedded workflow follows a standard architecture where the controller reads an input signal, processes it, and produces an output action. In addition, the system can communicate the measured values and states to a computer or another device using a wired or wireless connection.
Workflow
- Read input: Acquire data from a sensor or button (analog/digital).
- Process data: Filter, average, debounce, or compare against a threshold.
- Decision: Determine the system state (e.g., ON/OFF, alert/not alert).
- Drive output: Activate an actuator (LED, buzzer, motor, LED matrix).
- Communicate: Send values and system state through Serial (wired) or WiFi/BLE (wireless, if available).
3) Safety First: Simulation Before Hardware (Tinkercad)
Before building the circuit physically, I will first test the logic and wiring using a simulator (Tinkercad). Simulating the circuit helps validate connections and program behavior in a controlled environment, reducing the risk of short circuits, incorrect pin usage, or damaging the board and components. Once the simulation results match the expected behavior, I will implement the same circuit on real hardware and perform final tests.
Exercise 2.1
In the simulation, the onboard LED responded immediately after uploading the code, confirming that the digital output pin was correctly configured. The LED turned on and off at the programmed interval without delays or unstable behavior, validating that the basic output.
Exercise 2.2
During the simulation, the external LED connected through the breadboard behaved as expected when the digital signal was activated. The resistor correctly limited the current, and no abnormal behavior was observed. The simulation allowed verification of wiring connections and polarity before assembling the real circuit.
4) Exercises
I prepared three small exercises to demonstrate embedded interaction and communication-ready structure: (1) Seeeduino blinking an LED, (2) Arduino UNO R4 blinking an LED, and (3) Arduino UNO R4 controlling the built-in LED matrix. Each code block is included as plain text so anyone can copy and paste it directly from the repository.
Exercise 1 — Seeed Studio: BLINK LED
This program turns an LED on and off repeatedly. It can use the onboard LED (LED_BUILTIN) or an external LED connected to a digital pin.
// Exercise 1: Seeed Studio - Blink LED
// Works with most Arduino-compatible Seeeduino boards.
// If your board has an onboard LED, LED_BUILTIN will work.
const int LED_PIN = LED_BUILTIN; // or set a pin number, e.g., 6
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH);
delay(500);
digitalWrite(LED_PIN, LOW);
delay(500);
}
Exercise 2 — Arduino UNO R4: BLINK LED
Same idea as Exercise 1, but tested on Arduino UNO R4. This verifies basic output control on the R4 platform.
// Exercise 2: Arduino UNO R4 - Blink LED
// Uses the onboard LED by default.
const int LED_PIN = LED_BUILTIN;
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH);
delay(300);
digitalWrite(LED_PIN, LOW);
delay(300);
}
For the physical implementation, I will use an external LED mounted on a prototyping board (breadboard). The LED will be connected to a digital output pin through a current-limiting resistor (110Ω–220Ω) to prevent damage. This setup allows me to clearly visualize the output behavior of the Arduino UNO R4 during testing.
// Exercise 2: Arduino UNO R4 - LED
// Uses the onboard LED by default.
const int LED_PIN = 6;
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH);
delay(300);
digitalWrite(LED_PIN, LOW);
delay(300);
}
I added a push button connected to pin 2 to allow user interaction with the system. When the button is pressed, the LED turns on, and when it is released, the LED turns off. This demonstrates how the microcontroller reads an input and controls an output in real time.
// Arduino UNO R4 - LED controlled by Button on pin 2
const int buttonPin = 2;
const int ledPin = 6;
void setup() {
pinMode(buttonPin, INPUT_PULLUP); // Use internal pull-up resistor
pinMode(ledPin, OUTPUT);
}
void loop() {
int buttonState = digitalRead(buttonPin);
if (buttonState == LOW) { // Button pressed
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}
Exercise 3 — Arduino UNO R4 WiFi: Built-in LED Matrix
This exercise displays a simple pattern on the built-in 12x8 LED matrix. (If you have Arduino UNO R4 Minima, this feature is not available.) Required library: Arduino_LED_Matrix.
#include <Arduino_LED_Matrix.h>
ArduinoLEDMatrix matrix;
// 12 columnas x 8 filas = 96 LEDs
uint8_t frame[8][12] = {0};
void setup() {
matrix.begin();
frame[0][0] = 1; // Turns on one LED (row 0, column 0)
matrix.loadPixels(frame);
}
void loop() {
}
5) Technical Comparison: Seeed Studio XIAO nRF52840 vs Arduino UNO R4
Both controllers can run embedded applications (read inputs, process data, drive outputs, and communicate), but they differ in processing, memory, logic voltage, and onboard features. Since my Seeeduino is the Seeed Studio XIAO nRF52840, the specs below refer to this exact model.
| Feature | Seeed Studio XIAO nRF52840 | Arduino UNO R4 (Minima / WiFi) |
|---|---|---|
| Microcontroller | Nordic nRF52840 (Arm Cortex-M4F) | Renesas RA4M1 (Arm Cortex-M4) |
| Clock speed | Up to 64 MHz | 48 MHz |
| Memory (Flash / RAM) | 1 MB Flash / 256 KB RAM + (board) 2 MB QSPI Flash | 256 KB Flash / 32 KB RAM |
| Logic / Operating voltage | 3.3 V logic (careful with 5 V sensors/modules) | 5 V operating voltage (UNO-style compatibility) |
| Wireless connectivity | Bluetooth LE (BLE) + NFC |
Minima: no wireless WiFi: includes ESP32-S3 module (WiFi/BLE) |
| Communication interfaces | I2C, UART, SPI (varies by board variant) | UART, I2C, SPI, CAN + DAC |
| Onboard special features | Very compact form factor; some variants include IMU + mic (Sense) |
UNO R4 WiFi includes built-in 12x8 LED matrix (Minima does not include the matrix) |
| Best fit (summary) | Compact BLE/NFC projects, low-power wearables, TinyML/IoT BLE applications | Classic Arduino ecosystem compatibility, education, 5V modules, matrix demos (WiFi) |