Embedded Programming
Week 4 Assignment
Assignment Overview
Week 4: Embedded Programming. Group work is linked from the UNNC hub; individual work starts with the UNO R4 WiFi datasheet. Group work compares the Raspberry Pi 5B and Arduino UNO R4 WiFi toolchains.
1. Group Work
Lab group documentation:
- UNNC FabLab — Group Assignments
- Embedded Programming on the group hub
- Unit docs: https://fabacademy.org/2026/labs/unnc/docs/embedded-programming/
Team assignment for Week 4: compare development workflows on two representative platforms — a Linux single-board computer and a microcontroller board.
Part 1 — Raspberry Pi 5B vs Arduino UNO R4 WiFi: Toolchain & Workflow Comparison
This section contrasts an application-processor + OS platform (Raspberry Pi 5B) with a microcontroller (MCU) platform (Arduino UNO R4 WiFi). Both use Arm® cores, but their roles, memory models, and programming workflows differ fundamentally.
1. Architecture Comparison
| Dimension | Raspberry Pi 5B | Arduino UNO R4 WiFi |
|---|---|---|
| Platform class | Single-board computer (SBC) — application processor | Microcontroller board — embedded MCU system |
| Main processor | Broadcom BCM2712 — quad-core Arm Cortex-A76 @ up to 2.4 GHz | Renesas RA4M1 — Arm Cortex-M4 @ 48 MHz (+ ESP32-S3 coprocessor for Wi-Fi/BLE) |
| Typical RAM | 4 GB or 8 GB LPDDR4X (system memory) | 32 KB SRAM (on-chip); 256 KB Flash program memory |
| Operating system | Full Linux (Raspberry Pi OS / Debian-based) | No general-purpose OS; bare-metal firmware (Arduino core) runs directly on MCU |
| Program model | Multi-process, virtual memory, filesystem, networking stack in kernel | Single firmware image; reset → bootloader → setup() / loop() |
| GPIO access | Via OS drivers / libraries (e.g. lgpio, gpiozero) — not direct register bit-banging in user space by default |
Direct peripheral register access through Arduino API / HAL |
| Real-time behavior | Best-effort; preemptive multitasking — not hard real-time | Deterministic, low-jitter control loops suitable for sensing & actuation |
| Typical use cases | Vision, networking, databases, web servers, ML inference, desktop-like apps | Sensor reading, motor/PWM control, low-power I/O, rapid prototyping |
Summary: The Pi 5B is a computer that runs Linux; the UNO R4 WiFi is a device that runs one firmware program. Choose the Pi when you need OS services and compute; choose the MCU when you need predictable, low-level hardware interaction.
2. Toolchain & IDE
| Category | Raspberry Pi 5B | Arduino UNO R4 WiFi |
|---|---|---|
| Primary IDEs | VS Code, Thonny, Geany; terminal + SSH | Arduino IDE 2.x, Arduino Web Editor, PlatformIO (optional) |
| Languages | C/C++, Python 3, Rust, others via apt |
C/C++ (Arduino sketch syntax), limited Python via MicroPython ports (not default on R4) |
| Compilers / build | gcc / g++, cmake, make, pip |
arm-none-eabi-gcc (via Arduino build system / arduino-cli) |
| Build orchestration | Native compile on Pi, or cross-compile on host PC | Arduino CLI / IDE invokes board core + linker scripts for RA4M1 |
| Libraries | System packages (apt), PyPI, system headers |
Arduino Libraries Manager, vendor cores (Renesas UNO R4 core) |
| Debug | gdb, strace, logs, journalctl |
Serial Monitor, optional debugger (SWD) with external probe |
| Official resources | Raspberry Pi documentation | Arduino UNO R4 WiFi docs |
3. Code Compilation & Deployment Workflow
On the Pi, you deploy programs to a running OS. On the UNO R4, you flash firmware into MCU memory and the chip reboots into that image.
Raspberry Pi 5B workflow
- Initial setup: Use Raspberry Pi Imager to write Raspberry Pi OS to microSD (or NVMe).
- Boot: Power on → firmware/GPU loader → Linux kernel → userspace (systemd).
- Develop: SSH or desktop session; edit source (Python/C++) on the Pi or remotely.
- Build:
gcc/g++/cmakeor run Python directly — no cross-flash step for interpreted code. - Deploy: Copy binary/script to filesystem; install deps with
apt/pip; run from shell or register as asystemdservice. - Update: Replace files or packages; reboot only if kernel/drivers change.
Arduino UNO R4 WiFi workflow
- Setup: Install Arduino IDE 2.x + Arduino UNO R4 Boards core (Renesas).
- Develop: Write sketch (
.ino) —setup()runs once,loop()repeats. - Compile: IDE invokes
arduino-builder→ preprocess sketch →arm-none-eabi-gcc→ linked.elf/.bin. - Upload: USB-C connection; tool (e.g. bossac) writes image to internal Flash via on-board bootloader.
- Run: MCU resets; firmware starts from reset vector — no OS in between.
- Debug: Serial Monitor @ 115200 baud for
Serial.print()output.
| Workflow stage | Raspberry Pi 5B | Arduino UNO R4 WiFi |
|---|---|---|
| “Burn” / install | OS image → storage device (SD/NVMe) | Firmware binary → MCU Flash (repeat per sketch upload) |
| Program lifetime | Process ends; OS keeps running | Firmware runs until power-off or re-flash |
| Dependency model | Shared libraries on filesystem | Statically linked into single binary |
| Typical iteration | Edit → build/run → observe logs (seconds) | Edit → Verify/Upload → board resets (seconds) |
4. When to use which platform
- Use Raspberry Pi 5B when the task needs a filesystem, network services, cameras/USB devices, higher compute, or running existing Linux tools.
- Use Arduino UNO R4 WiFi when the task needs simple, fast I/O, low power, always-on control loops, or tight coupling to pins/peripherals.
- Combined systems: Pi for “brain” (logic, UI, networking) + MCU for “reflexes” (motors, sensors) via UART/I2C/USB — a common Fab Academy pattern.
Part 2 — Arduino UNO R4 WiFi: Board Research & Specifications
The Arduino UNO R4 WiFi merges the processing power of the Renesas RA4M1 with the wireless connectivity of the ESP32-S3-MINI-1. It maintains 5V logic and the classic UNO form factor while introducing an integrated 12×8 LED matrix and a Qwiic connector for rapid prototyping. See Official Datasheet.
Technical Specifications
| Feature | Specification | Data Source |
|---|---|---|
| Name | Arduino UNO R4 WiFi | Arduino Datasheet |
| Microcontroller | Renesas RA4M1 (Arm® Cortex®-M4) | RA4M1 User's Manual |
| Connectivity | ESP32-S3-MINI-1 (Wi-Fi® + Bluetooth®) | Arduino Docs |
| Operating Voltage | 5V | Arduino Docs |
| Input Voltage (VIN) | 6–24V | Arduino Store |
| GPIO Pins | 20 | Arduino Pinout |
| Digital / PWM Pins | 14 Digital / 6 PWM | UNO R4 WiFi Cheat Sheet |
| Analog Input Pins | 6 | RA4M1 Hardware Spec |
| DAC (Analog Out) | 1 (12-bit) | RA4M1 Hardware Spec |
| I2C / Qwiic Ports | 1 (Standard) + 1 (Qwiic Connector) | Arduino Cheat Sheet |
| UART / SPI / CAN | 1 UART / 1 SPI / 1 CAN Bus | RA4M1 Peripheral Map |
| Flash Memory | 256 KB (RA4M1) | RA4M1 User's Manual |
| SRAM | 32 KB (RA4M1) | RA4M1 User's Manual |
| EEPROM | 8 KB (Data Flash) | RA4M1 Memory Map |
| Clock Speed | 48 MHz (Main Core) | Arduino Docs |
References
- Arduino Official Docs (docs.arduino.cc):
- Arduino Official Store (store.arduino.cc):
- Arduino Support & Help Center (support.arduino.cc):
- Renesas Official Specifications:
Key Architectural & Integrated Features
- Dual-Core Architecture: Uses a 32-bit Arm® Cortex®-M4 with built-in Floating Point Unit (FPU), offering 3× the clock speed of the UNO R3. [Source: Arm® Architecture Docs]
- Integrated Wireless: Wi-Fi® 802.11 b/g/n and Bluetooth® 5.0 (LE) via ESP32-S3 coprocessor, enabling native Arduino Cloud integration. [Source: Arduino IoT Cloud Support]
- 12×8 LED Matrix: Built-in grid of 96 red LEDs for animations, scrolling text, or sensor data visuals. [Source: Arduino UNO R4 WiFi Cheat Sheet]
- Qwiic Connector: Industry-standard I2C connector for plug-and-play sensor integration (Qwiic/STEMMA QT ecosystem). [Source: Arduino Hardware Design]
- Real-Time Clock (RTC): Built-in RTC for time-sensitive logging; VRTC pin for backup battery, OFF pin for power management. [Source: RA4M1 RTC Peripheral Spec]
- USB-C & HID Support: USB-C port with Human Interface Device (HID) emulation—board can act as keyboard or mouse. [Source: Arduino USB Stack]
- Runtime Diagnostics: Error-catching mechanism that identifies runtime crashes and highlights the specific line of code in the Serial Monitor. [Source: Arduino IDE 2.0/Support]
2. Individual Work
Board for this week: Arduino UNO R4 WiFi. The notes below are from the datasheet.
1.1 Datasheet
The main microcontroller is the Renesas RA4M1 (R7FA4M1AB3CFM), an Arm Cortex-M4 at 48 MHz. Wi-Fi and Bluetooth are on a separate ESP32-S3 module. Source: UNO R4 WiFi documentation.
| Feature | Value | Why it mattered |
|---|---|---|
| Memory | 256 kB flash, 32 kB SRAM, 8 kB data flash | Enough for these small sketches |
| Operating voltage | 5 V (ESP32-S3 runs at 3.3 V) | Board logic is 5 V; the radio module is 3.3 V |
| Digital I/O | 14 pins, 6 with PWM (D3, D5, D6, D9, D10, D11) | PWM is only on D3, D5, D6, D9, D10, and D11 |
| Analog inputs | 6 (A0–A5), 14-bit ADC | Available for sensors later |
| Current per I/O pin | Up to 8 mA | Each LED needs a series resistor |
| Communication | USB-C, 1× UART, 2× I2C, 1× SPI, 1× CAN | USB-C is the programming and serial port |
The 8 mA pin limit is the practical point. An LED with no resistor can pull more than that and damage the pin.
1.2 First sketch — dual LED blink (Tinkercad)
Before working on the physical UNO R4 WiFi board, I tested a basic digital output sketch in Tinkercad Circuits. Two LEDs (red and green) are driven from digital pins D7 and D5. Each LED has a series 1 kΩ resistor; both cathodes share Arduino GND.
- D7 → resistor → red LED anode; cathode → GND
- D5 → resistor → green LED anode; cathode → GND
The sketch sets both pins as outputs, then turns both LEDs on for 1 second and off for 1 second. This confirmed basic pinMode / digitalWrite / delay behavior before moving to more complex programs.
void setup()
{
pinMode(7, OUTPUT);
pinMode(5, OUTPUT);
}
void loop()
{
digitalWrite(7, HIGH);
digitalWrite(5, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(7, LOW);
digitalWrite(5, LOW);
delay(1000); // Wait for 1000 millisecond(s)
}
1.3 Second sketch — button flash (Tinkercad)
Next I added a pushbutton for digital input. The green LED stays on as the idle state; pressing the button turns green off, flashes red for 1 second, then returns to green on. The button uses INPUT_PULLUP on D2 (other side to GND), so a press reads LOW. Edge detection (lastButtonState) plus a short delay reduces bounce so one press triggers one flash.
- D5 → resistor → green LED (idle ON)
- D7 → resistor → red LED (flash once on press)
- D2 ↔ button ↔ GND (
INPUT_PULLUP)
const int buttonPin = 2;
const int redPin = 7;
const int greenPin = 5;
int lastButtonState = HIGH;
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
digitalWrite(greenPin, HIGH);
digitalWrite(redPin, LOW);
}
void loop() {
int buttonState = digitalRead(buttonPin);
if (lastButtonState == HIGH && buttonState == LOW) {
digitalWrite(greenPin, LOW);
digitalWrite(redPin, HIGH);
delay(1000);
digitalWrite(redPin, LOW);
digitalWrite(greenPin, HIGH);
delay(200);
}
lastButtonState = buttonState;
}