Week 4: Embedded Programming

Assignment Overview

This week focuses on embedded programming - using a microcontroller development board to build and program a basic interactive circuit, and exploring IoT solutions using existing hardware ecosystems.

Date: February 9-11, 2026 Status: ✅ Completed


📋 Assignment Requirements

Group Assignment

Demonstrate and compare toolchains and development workflows for embedded architectures

  • [x] Explored Wio Node as an alternative embedded architecture (Wi-Fi SoC + cloud API)
  • [x] Compared development workflow with Arduino IDE (XIAO SAMD21)
  • [x] Documented and shared findings with group members
  • [x] Group work page: Week 4 Group Assignment

Individual Assignment

Demonstrate and describe the programming process

  • [x] Prepare components and verify pin assignments from datasheet
  • [x] Assemble circuit on breadboard (tact switch + LED)
  • [x] Write and upload firmware using Arduino IDE
  • [x] Verify operation on actual hardware

(Optional) Explore an IoT platform for rapid prototyping

  • [x] Assemble sensor circuit without soldering using Grove standard
  • [x] Configure device and sensor via smartphone app
  • [x] Retrieve sensor data via REST API

Learning Objectives

  • Select and use a microcontroller development board
  • Read and apply documentation (datasheet, reference manual)
  • Implement digital input and output in firmware
  • Evaluate hardware ecosystems for IoT prototyping

🎯 What I Made This Week

Main Assignment: Seeed XIAO (SAMD21) — Button-Controlled LED

I used the Seeed XIAO SAMD21 microcontroller to build a simple interactive circuit on a breadboard. A tact switch serves as digital input; an LED serves as digital output. Pressing the button lights the LED.

Why this board?

  • Compact form factor (21mm × 17.5mm)
  • ARM Cortex-M0+ (SAMD21) — same architecture used in professional tools
  • Arduino IDE compatible
  • USB-C connector built-in
  • Well-documented with active community support

Optional Assignment: Wio Node — Easy IoT

As an optional challenge, I explored Wio Node, a Wi-Fi IoT module built around the Grove connector standard. This platform enables IoT data collection without soldering, breadboards, or writing any code.


🛠️ Main Assignment: Seeed XIAO (SAMD21)

Step 1: Preparing Components

I gathered all the components needed for the circuit.

Materials Components: Seeed XIAO SAMD21, LED, tact switch, breadboard

Components used:

Component Quantity Notes
Seeed XIAO SAMD21 1 Microcontroller
Tact switch 1 Momentary push button
LED 1 Any color
Resistor 1kΩ 1 Current limiting for LED
Breadboard 1
Jumper wires several

Step 2: Breadboard Assembly

I placed the tact switch and LED on the breadboard according to the planned circuit.

Breadboard Assembly Tact switch and LED mounted on breadboard

Connection summary:

XIAO D1  ──── Tact switch (terminal A)
GND      ──── Tact switch (terminal B)

XIAO D7  ──── 1kΩ ──── LED anode (long leg)
GND      ────────────── LED cathode (short leg)

Note: INPUT_PULLUP mode is used — no external pull-down resistor needed for the switch.


Step 3: Verifying Pin Assignments (Datasheet)

Before writing code, I confirmed the pin assignments using the Seeed XIAO SAMD21 reference manual.

Pin Assignment XIAO SAMD21 pin assignment diagram from the datasheet

Key pins confirmed:

Function Pin Notes
Tact switch input D1 With INPUT_PULLUP
LED output D7 Via 1kΩ resistor
GND GND Ground reference
Power 3V3 3.3V output

Why verify the datasheet first: - Confirms pin numbers match physical board layout - Verifies 3.3V logic level for component selection - Prevents incorrect connections that could damage the board


Step 4: Writing Code in Arduino IDE

Following the Seeed XIAO reference manual, I wrote the firmware in Arduino IDE.

Arduino IDE - Code Firmware written in Arduino IDE — pressing the button turns the LED on

📎 Source code

// ============================================================
// Seeed XIAO SAMD21 - Tact Switch + LED
// Press the button to turn on the LED
// ============================================================

const int buttonPin = 1;  // D1 - tact switch input pin
const int ledPin    = 7;  // D7 - LED output pin

void setup() {
  // Set button pin as input with internal pull-up resistor
  // When button is not pressed: pin reads HIGH
  // When button is pressed:     pin reads LOW
  pinMode(buttonPin, INPUT_PULLUP);

  // Set LED pin as output
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // Read the current state of the button
  int buttonState = digitalRead(buttonPin);

  if (buttonState == LOW) {
    // Button is pressed → turn LED on
    digitalWrite(ledPin, HIGH);
  } else {
    // Button is released → turn LED off
    digitalWrite(ledPin, LOW);
  }
}

Step 5: Uploading Program to XIAO

I uploaded the firmware to the Seeed XIAO SAMD21 via USB-C.

Upload Success Program successfully uploaded to Seeed XIAO SAMD21

Arduino IDE upload settings:

Setting Value
Board Seeeduino XIAO
Port COM〇〇 (Seeeduino XIAO)
Programmer (default)

Step 6: Operation Test

I tested the complete circuit on the actual hardware.

Operation test: pressing the tact switch lights the LED on the breadboard

Results:

  • ✅ LED turns on immediately when button is pressed
  • ✅ LED turns off when button is released
  • ✅ Board recognized by computer via USB-C
  • ✅ Upload completed without errors

🌐 Group Assignment / Optional: Wio Node

Overview

As both the group assignment contribution and an optional individual challenge, I explored Wio Node — a Wi-Fi IoT module by Seeed Studio. The goal was to evaluate how easily anyone can build an IoT data collection system, and to compare this approach with the Arduino IDE workflow used for the XIAO SAMD21.

The platform is built around the Grove connector standard, enabling:

Feature Result
Soldering Not required
Breadboard Not required
Programming Not required
Sensor connection Plug-and-play

Test: Retrieve temperature and humidity values from a Grove sensor.


Step 1: Registering Wio Node in the App

I registered the target Wio Node device in the Wio Link smartphone app.

Wio App - Device Registration Registering the Wio Node in the Wio Link app

  1. Download the Wio Link app
  2. Press the setup button on Wio Node to enter AP mode
  3. Connect smartphone to Wio Node's Wi-Fi
  4. Enter home Wi-Fi credentials in the app
  5. Device connects to the internet and appears in the app

Step 2: Configuring the Temperature & Humidity Sensor

I configured the Grove temperature and humidity sensor connected to the Wio Node.

Wio App - Sensor Setup Setting up the temperature and humidity sensor in the Wio Link app

Connection is simply plugging the Grove sensor into the Wio Node's Grove port — no soldering required.


Step 3: Checking Sensor Specifications in the App

I verified the sensor specifications and available readings within the app.

Wio App - Sensor Specs Checking temperature and humidity sensor specifications in the Wio Link app


Step 4: Retrieving Sensor Values (Operational)

With the sensor configured, I confirmed live sensor values are being read correctly.

Wio App - Sensor Values Live temperature and humidity values retrieved from the Grove sensor


Step 5: Checking the API Endpoint

The app provides a REST API endpoint for each configured sensor. I confirmed the endpoint URL.

Wio App - API Endpoint API endpoint for the temperature and humidity sensor shown in the app

Example endpoint:

https://us.wio.seeed.io/v1/node/GroveTempHumD0/temperature?access_token=<TOKEN>

Step 6: Reading Sensor Data via Browser

By accessing the API endpoint in a web browser, sensor values are returned as JSON — no code, no app required.

Browser - API Response Temperature and humidity data retrieved directly from a browser

{
  "temperature": 22.5,
  "humidity": 48.0,
  "celsius": true
}

The ability to retrieve live sensor data from any browser or application at any time is a powerful feature of this platform.


Evaluation

Strengths:

Feature Assessment
Assembly ⭐⭐⭐⭐⭐ Plug-and-play, no soldering
Setup time ⭐⭐⭐⭐ Under 10 minutes
Programming skill required ⭐⭐⭐⭐⭐ None
API usability ⭐⭐⭐⭐ Clean REST API
Sensor variety ⭐⭐⭐⭐ Wide Grove ecosystem

My proposal:

It would be ideal if FabLab facilities hosted their own permanent Wio Node API server. Currently the service depends on Seeed's cloud infrastructure. A self-hosted server would allow students to build long-running IoT projects reliably, and aligns with Fab Academy's philosophy of self-sufficiency and open tools.


Sharing with Group Members

The findings and documentation of this Wio Node evaluation were shared with the group members at Nagoya FabLab as a contribution to the group assignment. The full group work is documented on the group assignment page.

📎 Week 4 Group Assignment Page


📦 Design Files

All source files are in docs/files/week04/.

File Description
fabacademy2026_testsketch_samd21.ino Button-controlled LED firmware

🔗 Connection to Final Project

The skills from this week directly apply to my Smart Reptile Habitat System:

From the XIAO exercise: - Digital I/O programming → sensor reading and actuator control in the habitat - Button input → manual override controls - LED output → status indicator LEDs on the control box

From the Wio Node exercise: - REST API data retrieval → remote monitoring of temperature/humidity in the terrarium - Grove sensor ecosystem → rapid integration of temperature, humidity, UV sensors


🔧 Problems and Solutions

Problem 1: LED Not Lighting Up

What Happened: The LED did not light up when the output code ran.

Why It Happened: The LED was connected in reverse orientation (cathode and anode swapped).

How I Solved It: Flipped the LED on the breadboard. The longer leg (anode) connects toward the resistor; the shorter leg (cathode) connects to GND.

What I Learned: Always check LED polarity before powering the circuit.


Problem 2: Button Reading Always HIGH

What Happened: The digital input from the tact switch always read HIGH, even when not pressed.

Why It Happened: The input pin was floating (no defined state), so it picked up electrical noise.

How I Solved It: Used INPUT_PULLUP mode, which enables the XIAO's internal pull-up resistor. This sets the default state to HIGH when the button is released, and LOW when pressed — no external resistor needed.

What I Learned: - Digital input pins must never be left floating - INPUT_PULLUP is the simplest solution for button inputs on Arduino-compatible boards


⏱️ Time Management

Activity Time Spent Notes
Component preparation 0.5 hours
Breadboard assembly 0.5 hours
Datasheet review 1 hour XIAO SAMD21 reference manual
Code writing & upload 1 hour Arduino IDE
Operation test 0.5 hours
Wio Node setup & testing 1.5 hours App setup + API test
Documentation & photography 2 hours
Total 7 hours

✅ Evaluation Checklist

Group Assignment

✅ Demonstrated and compared toolchains and development workflows

  • [x] Wio Node (Wi-Fi IoT platform) explored and documented
  • [x] Compared with Arduino IDE workflow (XIAO SAMD21)
  • [x] Findings shared with group members
  • [x] Documented on group work page

Individual Assignment

✅ Demonstrated embedded programming process

  • [x] Components prepared and pin assignments verified from datasheet
  • [x] Breadboard circuit assembled (tact switch + LED)
  • [x] Firmware written and uploaded via Arduino IDE
  • [x] Operation verified on actual hardware

✅ (Optional) IoT platform explored

  • [x] Wio Node assembled using Grove standard
  • [x] Device and sensor configured via smartphone app
  • [x] Sensor data retrieved via REST API
  • [x] Platform evaluated and documented

Documentation Requirements

✅ Showed process with photos and video

  • [x] Component preparation
  • [x] Breadboard assembly
  • [x] Pin assignment from datasheet
  • [x] Code in Arduino IDE
  • [x] Upload success
  • [x] Operation test (video)
  • [x] Wio Node all steps

✅ Included source code

  • [x] fabacademy2026_testsketch_samd21.ino in repository

✅ Recorded problems and solutions

  • [x] LED polarity issue
  • [x] Floating input issue

File Management

✅ Compressed images (recommended: less than 500KB each)

  • [x] All images under 500KB

✅ Saved all files to GitLab repository

  • [x] Pushed to repository

💭 Reflection

What Went Well

  1. Reading documentation first: Checking the reference manual before wiring prevented most connection mistakes — a habit worth keeping for every project.

  2. Wio Node evaluation: The Grove ecosystem demonstrated remarkably fast IoT prototyping. Getting live sensor data in a browser within 10 minutes of unboxing is genuinely impressive.

  3. Problem identification: Both issues (LED polarity, floating input) were identified quickly because expected behavior was understood from the documentation.

What I'd Do Differently

  1. Use INPUT_PULLUP from the start: I initially planned to use an external pull-down resistor, but INPUT_PULLUP is simpler and eliminates the need for extra components.

  2. Add software debouncing: For production use, a debounce implementation would prevent false triggers from mechanical switch bounce.

Lessons Learned

  • Always read the datasheet: Pin assignments and electrical limits are the ground truth. A few minutes of reading saves hours of debugging.
  • Floating inputs cause unreliable behavior: INPUT_PULLUP is the simplest solution — this principle applies to every digital input circuit.
  • Two approaches to IoT, both important: While developing with Arduino IDE is an essential skill for engineers, integrated solutions like Wio Node that allow anyone to easily implement IoT are equally important. I believe we must place greater value on such solutions alongside traditional embedded programming.

For Next Week — 3D Scanning and Printing

  • [ ] Review available 3D scanner at the lab
  • [ ] Prepare 3D model for printing (refine Week 2 Fusion 360 model)
  • [ ] Study support material strategies for complex geometries
  • [ ] Document 3D printing parameters and results

📚 References


Last updated: February 18, 2026