Summary of the Week
This week focused on Interface and Application Programming. The group explored multiple tools to develop user interfaces and establish communication between software applications and a microcontroller system.
Different platforms were tested to understand how they interact with embedded systems, including serial communication, graphical interfaces, and wireless control.
Objective
The objective was to compare different interface tools and analyze how they communicate with a microcontroller, identifying their workflows, use cases, and communication protocols.
Group Work
In this group assignment, we explored multiple interface development tools and evaluated their functionality in relation to embedded systems. Each tool was analyzed based on how it communicates with the XIAO ESP32-C3 and how it can be used to interact with input/output devices.
Quick Data
- Topic: Interface and Application Programming
- Board: XIAO ESP32-C3
- Tools: PuTTY, Processing, RemoteXY, MIT App Inventor
- Protocols: Serial, WiFi, Bluetooth
- Students:
- Carmen Elena Gutiérrez Apolinario, David Ávila Pimentel, Esteban M. Valladares, Jianfranco Bazán J., Mario Chong, Rocio Maravi, Grace Schwan, Cindy Marilyn Crispin, Jennifer Wong
Tasks and Deliverables
- Compare as many tool options as possible
- Describe workflows and use cases
- Analyze communication methods
- Document the group work
Goal
The goal of this assignment was to explore interface programming tools and understand how they enable communication between users and embedded systems.
Tool Comparison Matrix
We evaluated each development tool based on key parameters including communication type, target device protocols, complexity, and specific use cases.
| Tool | Type | Communication | Use Case | Workflow |
|---|---|---|---|---|
| PuTTY | CLI | Serial | Monitoring / debugging | Direct serial connection |
| Processing | GUI | Serial | Interactive control | Interface → Serial commands |
| RemoteXY | Mobile UI | WiFi | IoT control | App → WiFi → Board |
| MIT App Inventor | Mobile App | Bluetooth | Wireless control | App → Bluetooth → Board |
Equipment Used
| Tool / Device | Purpose |
|---|---|
| XIAO ESP32-C3 | Microcontroller |
| HC-SR04 | Input device (sensor) |
| LED | Output device |
| PuTTY | Serial communication |
| Processing | GUI interface |
| RemoteXY | WiFi interface |
| MIT App Inventor | Bluetooth app |
Procedure 1 – Serial Interface (PuTTY)
Interface-Based Control Test – HC-SR04 with Putty
This section documents the communication between the XIAO ESP32-C3, HC-SR04 and serial with PuTTY software.
Objective
The objective interact between microcontroller, HC-SR04 sensor and an external software.
Software Installation – PuTTY
PuTTY is a free implementation of SSH and Telnet for Windows platforms (Download Site).
Step 1: Download PuTTY
Open a web browser to visit the official PuTTY download site.
Step 2: Choose Features
The installer asks you which PuTTY features to install. Standard features are recommended.
Step 3: Desktop Shortcut
It is convenient to enable a shortcut on your desktop for quick access.
Step 4: Installation Progress
Wait for the installer to finish copying files to the system.
Step 5: Starting PuTTY
Double-click the PuTTY icon to start the PuTTY client and begin configuration.
Initial Interface Exploration & Configuration
Then, you can configure the category and the specific options to set up the serial link.
Category Selection
Navigate through the sidebar categories to explore configuration options.
Connection - Serial
We selected Connection → Serial and configured the specific port and baud rate (115200).
Arduino Code & Validation
The microcontroller reads the distance values from the HC-SR04 ultrasonic sensor and prints them over Serial.
#define TRIG_PIN D2
#define ECHO_PIN D3
void setup() {
Serial.begin(115200);
pinMode(TRIG_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
}
long readDistance() {
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
long duration = pulseIn(ECHO_PIN, HIGH);
long distance = duration * 0.034 / 2;
return distance;
}
void loop() {
long distCM = readDistance();
long distIN = distCM / 2.54;
Serial.print("Distance : ");
Serial.print(distCM);
Serial.print(" cm / ");
Serial.print(distIN);
Serial.println(" in");
delay(500);
}
Arduino IDE Serial Monitor
Confirming correct sensor operation using Arduino's built-in monitor.
PuTTY Serial Port Terminal
Establishing the connection via PuTTY client on the mapped COM Port.
Simultaneous Validation
This side-by-side view demonstrates both screens displaying real-time distance measurements.
Procedure 2 – Graphical Interface (Processing)
Interface-Based Control Test – LED Actuation via Processing
This section documents the validation of LED control using a graphical interface developed in Processing, communicating with the XIAO ESP32-C3 via serial connection.
Objective
The objective of this test was to establish a complete workflow where a user interface sends commands to a microcontroller, enabling real-time control of an output device (LED) integrated into the custom board.
Software Installation – Processing
Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts (Download Page).
Step 1: Download zip
Select your operating system and download the Processing zip file.
Step 2: Extraction
Extract the contents of the downloaded archive into a system folder.
Step 3: Application Run
Double-click the processing executable file to launch the editor.
Initial Interface Exploration (Processing)
Before establishing communication with the microcontroller, an initial exploration of Processing was carried out to understand its rendering pipeline (setup() and draw()) and interaction capabilities.
Sketch 1: Static Shape
A simple static ellipse rendered in the center of a black background.
void setup() {
size(400, 400);
}
void draw() {
background(0);
ellipse(200, 200, 100, 100);
}
Sketch 2: Interactive Mouse Version
An interactive sketch where the shape follows the mouse coordinates and changes fill color when clicked.
void setup() {
size(400, 400);
}
void draw() {
background(0);
if (mousePressed) {
fill(0, 255, 0);
} else {
fill(255);
}
ellipse(mouseX, mouseY, 80, 80);
}
Hardware Configuration & Script Execution
The LED used in this test is integrated into our custom PCB, connected to pin D6.
Step-by-Step Procedure
-
Step 1 – Upload Arduino Code: The microcontroller was programmed to listen for commands ("ON", "OFF", "BLINK") over serial and change the D6 pin accordingly.
Arduino LED Control Code
#define LED_PIN D6 bool blinkMode = false; bool ledState = false; unsigned long lastBlinkTime = 0; void setup() { Serial.begin(115200); Serial.setTimeout(20); pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, LOW); // apagado } void loop() { if (Serial.available()) { String command = Serial.readStringUntil('\n'); command.trim(); if (command == "ON") { blinkMode = false; digitalWrite(LED_PIN, HIGH); Serial.println("ON"); } else if (command == "OFF") { blinkMode = false; digitalWrite(LED_PIN, LOW); Serial.println("OFF"); } else if (command == "BLINK") { blinkMode = true; Serial.println("BLINK"); } } if (blinkMode) { if (millis() - lastBlinkTime > 300) { lastBlinkTime = millis(); ledState = !ledState; digitalWrite(LED_PIN, ledState ? HIGH : LOW); } } } -
Step 2 – Verify Serial Communication: Run the serial monitor and type "ON", "OFF" or "BLINK" to ensure hardware reactions.
Figure 2.6: Verifying led reactions via serial text lines. - Step 3 – Close Serial Monitor: Important! You must close the Serial Monitor before launching the Processing application, otherwise, the serial port will be locked and busy.
-
Step 4 – Run Processing Interface: Open and run the custom Processing script. This script opens a COM port at 115200 and renders interactive graphical buttons ("ON", "OFF", "BLINK") to control the board.
Processing Graphical Interface Code
import processing.serial.*; Serial myPort; String status = "OFF"; void setup() { size(430, 500); smooth(); textAlign(CENTER, CENTER); println(Serial.list()); myPort = new Serial(this, "COM3", 115200); myPort.clear(); } void draw() { background(245); fill(0); textSize(28); text("LED Control", width/2, 60); fill(120); textSize(14); text("ON / OFF / BLINK", width/2, 90); // STATUS BOX fill(255); rect(50, 120, 330, 100, 20); fill(0); textSize(18); text("Status", width/2, 150); fill(status.equals("ON") ? color(0,200,100) : status.equals("BLINK") ? color(0,120,255) : color(150)); textSize(28); text(status, width/2, 190); // BUTTONS drawButton(60, 270, 90, 70, "ON"); drawButton(170, 270, 90, 70, "OFF"); drawButton(280, 270, 90, 70, "BLINK"); } void drawButton(float x, float y, float w, float h, String label) { boolean hover = mouseX > x && mouseX < x + w && mouseY > y && mouseY < y + h; noStroke(); fill(hover ? color(80) : color(50)); rect(x, y, w, h, 15); fill(255); textSize(16); text(label, x + w/2, y + h/2); } void mousePressed() { if (mouseY > 270 && mouseY < 340) { if (mouseX > 60 && mouseX < 150) { send("ON"); status = "ON"; } if (mouseX > 170 && mouseX < 260) { send("OFF"); status = "OFF"; } if (mouseX > 280 && mouseX < 370) { send("BLINK"); status = "BLINK"; } } } void send(String cmd) { myPort.write(cmd + "\n"); println("Sent: " + cmd); }
Graphical Interface Operation
The screenshot shows the running Processing interface transmitting digital commands to COM3.
Results & Troubleshooting
- Results: The custom board LED responded perfectly in real-time to clicking the interactive graphic buttons. Non-blocking timing on Arduino (millis) kept the board responsive.
- Issues Encountered:
- Serial Port Conflict: Resolved by ensuring Arduino Serial Monitor was fully closed before running Processing.
- Incorrect LED pin: Onboard LED couldn't be toggled, so swapped the script configuration to pin D6.
Procedure 3 – WiFi Interface (RemoteXY)
Tool Selection and Configuration
We decided to create a mobile interface using the RemoteXY platform to control our XIAO ESP32-C3 board wirelessly. This platform allows developers to build graphical panels visually and exports the matching Arduino source code automatically.
Step 1: Access Web Editor
Enter the cloud editor workspace at remotexy.com/en/editor/.
Step 1 (Alt): Alternate Workspace view
Another view of the project load page inside RemoteXY interface.
Step 2: Project Settings Configuration
In this stage, the critical communication parameters between the mobile interface and the board hardware are defined in the properties sidebar:
- Connection Type: Wi-Fi Access Point (allows the board to broadcast its own network)
- Motherboard: XIAO ESP32-C3
- Communication Module: Built-in ESP32 Wi-Fi module
- Baud Rate: 115200 (stable serial diagnostic transfer speed)
- SSID Name: IoT_UP
- Password: Configured securely
Interface Design & Variable Configuration
🔹 Step 1: Selecting Graphics Components
From the left pane ("Controls"), we dragged several controls to the virtual mobile screen area:
- Switch: Toggle ON/OFF state
- Button: Momentary toggle impulse
- Gauge: Analog progress dashboard
- Text Label: System labeling identification
🔹 Step 2 & 3: UI Layout & Variables
Organize controls based on basic UX/UI principles (visual hierarchy, landscape layout, ease of use). Then, we linked each layout component to internal variables:
- Switch component → linked to variable
switch_1 - Button component → linked to variable
button_1
🔹 Step 4: Source Code Generation
By clicking on "Get Source Code", RemoteXY automatically compiles network structures, control arrays, sync arrays, and headers.
Procedure 4 – Mobile Application (MIT App Inventor)
MIT App Inventor custom Bluetooth Controller
MIT App Inventor es una plataforma gratuita que permite crear aplicaciones móviles de forma visual, sin necesidad de programar con código tradicional. Funciona mediante bloques tipo "rompecabezas", diseñando la interfaz y el comportamiento de manera sencilla. Es ideal para controlar un ESP32 mediante Bluetooth Serial.
Starting Designer Mode
Launch the App Inventor interface and set up the device view.
Mobile UI Design Steps
Step 1: Create New Project
We created a new project and configured advanced application properties like orientation.
Step 2: Add Containers
Drag a HorizontalArrangement from the Layout palette onto the mobile interface.
Step 3: Layout Properties
Modify layout widths, padding, backgrounds, and align dimensions under the Properties bar.
Step 4: Incorporating Buttons
We added two functional Button controls into the container layout to manage LED power states.
Step 5: Incorporating ListPicker
We added a ListPicker block directly to let users select paired Bluetooth devices.
Step 6: Style Refinements
We refined dimensions, backgrounds, texts, and margin values for all visual components.
Step 7: Media Image Embedding
We loaded a custom image inside the interface to improve graphical appearance and design.
Blocks Coding Logic
We switched the App Inventor mode to **Blocks** to configure logical connections, Bluetooth arrays, and click actions:
Bluetooth Pairing List
Configure ListPicker1.BeforePicking to fetch paired devices using BluetoothClient1.AddressesAndNames.
Connection Selection Action
Configure ListPicker1.AfterPicking to call BluetoothClient1.Connect based on selection.
Connection Status Feedback
Check if connection was successful to change a label text dynamically to "Connected" or "Not Connected".
Toggling Commands
Configure click events for ON and OFF buttons to call BluetoothClient1.SendText transmitting "1" or "0".
App Compiling, Installation & Hardware Verification
Once logic was ready, we compiled the app and programmed the board with Bluetooth receiver configurations:
1. Compile APK QR
Click on Build → Android App (apk) to generate a package QR code.
2. Waiting Server Build
The system builds the source and packs compiled classes in progress.
3. Installing App
The compiled APK was downloaded and successfully installed (Android 11).
Microcontroller Programming (Bluetooth Serial)
Open Arduino IDE, connect the ESP32 board, select the ESP32 Dev Module, and program the controller to act as a Bluetooth host receiving serial char commands:
#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
const int ledPin = 2; // LED Pin representation
void setup() {
SerialBT.begin("ESP32-Bluetooth"); // Bluetooth broadcast name
pinMode(ledPin, OUTPUT);
}
void loop() {
if (SerialBT.available()) {
char c = SerialBT.read();
if(c == '1') {
digitalWrite(ledPin, HIGH); // LED ON
} else if (c == '0') {
digitalWrite(ledPin, LOW); // LED OFF
}
}
}
A. Pair Board in Settings
Turn on mobile Bluetooth, find the broadcast net "ESP32-Bluetooth" and link.
B. List Selector
Open the custom controller app and tap on the device list selector.
C. Toggling Toggles
Select the device to verify link success and click button toggles to trigger LED.
Key Lesson & Conclusions
Key Lessons
Each interface development tool evaluates distinct aspects of microcontroller interaction:
- PuTTY: Excellent direct diagnostic terminal for debugging serial outputs.
- Processing: Robust and visually rich environment to develop customizable desktop graphical controls.
- RemoteXY: Fast drag-and-drop generator ideal for prototyping simple wireless interfaces without manual network coding.
- MIT App Inventor: Highly flexible block programming workspace to build native mobile software controller apps.
Conclusion
This group assignment allowed us to explore multiple interface tools and understand how different communication protocols interact with embedded systems.
We successfully compared serial, graphical, WiFi, and Bluetooth interfaces, demonstrating how each tool enables interaction between the user and the microcontroller.
Overall Testing and Validation Diagram
This diagram summarizes our overall exploration of different physical communication and software layers.
Multimedia Gallery / Video Evidences
This section presents recorded physical demonstrations of the real-time operation of each developed interface system.
Serial Interface Test (PuTTY)
Reading the HC-SR04 ultrasonic sensor and printing data to the Windows serial terminal.
Processing Interface Control
Interactive activation (ON, OFF, BLINK) of the board LED through the custom button panel developed in Processing.
Wireless Bluetooth Control
Wireless connection and LED control using a mobile application developed with MIT App Inventor on a real smartphone.