Industrial FABLAB UCuenca

Week 11 - Networking and Communications

Wireless communication between a XIAO ESP32-C3 and the Blynk IoT platform using WiFi.

Group Assignment

The group assignment for this week focused on comparing networking and communication options. The shared work helped me understand the role of network protocols, communication layers and the difference between local device communication and cloud-based communication.

Open Group Assignment

Assignment Objective

For my individual assignment I used a XIAO ESP32-C3 board with WiFi capability and antenna support to communicate with the Blynk IoT cloud. The goal was to create a simple but complete networking workflow where a command generated in a web dashboard travels through the internet, reaches the microcontroller and changes the state of a physical output connected to pin D10.

This exercise was important for my final project because the Smart Lean Cell uses the same logic: the embedded board collects or receives information, connects to WiFi and exchanges data with a dashboard that allows the user to monitor or control the system remotely.

Blynk Web Dashboard
->
Blynk Cloud
->
XIAO ESP32-C3 + LED D10

System Architecture

The communication architecture is based on WiFi and cloud messaging. The XIAO ESP32-C3 connects to the local WiFi network using the credentials programmed in the Arduino IDE. Once connected, the board authenticates with Blynk using the template ID, template name and authentication token generated in the Blynk Console.

The dashboard uses a virtual datastream. When the user changes the switch widget, Blynk sends the value to the board. The firmware receives that value through a callback function and writes it to the physical pin connected to the LED.

ElementFunctionEvidence
XIAO ESP32-C3Main microcontroller. It connects to WiFi and executes the Blynk firmware.Arduino IDE board selected as XIAO_ESP32C3.
WiFi networkProvides internet connection between the board and Blynk Cloud.Serial monitor shows connection messages.
Blynk CloudReceives dashboard events and routes them to the device.Blynk Console template, device and datastreams.
Virtual pin V1Receives the switch value from the dashboard.Configured as the LED control datastream.
Physical pin D10Controls the LED output on the XIAO board.Configured in firmware as LED_PIN D10.

Communication Protocols Used

The networking system uses a layered communication architecture. The XIAO ESP32-C3 does not communicate directly with the web dashboard; instead, it connects to a WiFi network, reaches the internet through TCP/IP, authenticates with Blynk Cloud, and exchanges values using Blynk datastreams. This approach was selected because it allowed me to test remote monitoring and control without building a custom server from zero.

Protocol / Communication Layer Where it was used Why it was selected
USB Serial Computer to XIAO ESP32-C3 during programming and debugging. It allowed firmware upload from Arduino IDE and serial monitor messages such as Iniciando sistema..., Conectando a WiFi y Blynk... and Sistema listo.
WiFi - IEEE 802.11 XIAO ESP32-C3 to local wireless router. The ESP32-C3 has integrated WiFi, so no extra communication module was required. WiFi also provided enough range and bandwidth for sending simple dashboard commands and receiving cloud updates.
TCP/IP Network transport between the ESP32-C3, router, internet and Blynk Cloud. TCP/IP is the standard internet communication stack. It makes the board reachable by the cloud platform through the local network and allows reliable transmission of the command values.
Blynk IoT protocol / Datastreams Blynk Cloud to ESP32-C3 firmware using the BlynkSimpleEsp32 library. Blynk abstracts the cloud communication and organizes data through virtual pins. In this assignment, virtual pin V1 was used to send the switch state from the dashboard to the ESP32-C3.
HTTPS / Web Dashboard connection User browser to Blynk web dashboard and Blynk Console. The dashboard runs in the browser and communicates securely with Blynk Cloud. This made it possible to control and visualize the device from a web interface without a local application.

Why these protocols were appropriate

WiFi was selected because the final project needs remote monitoring and dashboard visualization, not only short-range communication. Bluetooth would have been useful for nearby device control, but it would not provide the same direct cloud connection. A custom MQTT or HTTP server could also work, but Blynk was chosen because it already provides authentication, dashboard widgets, datastreams and device management in one platform.

The technical decision was therefore based on simplicity, scalability and compatibility with the final project. The same architecture can later be expanded from a simple LED control test to the Smart Lean Cell system, where sensor data, cycle time, inventory count and production indicators are sent to a dashboard in real time.

Step 1 - Board and Arduino IDE Setup

The first step was to configure Arduino IDE 2.3.8 with the correct board. I selected XIAO_ESP32C3 and uploaded a simple blink test to confirm that the board, USB connection and upload process were working correctly. This test is useful because it separates basic hardware issues from later WiFi or cloud configuration problems.

Arduino IDE uploading code to XIAO ESP32-C3
Uploading a basic test program to the XIAO ESP32-C3. This confirmed that the board was detected correctly by Arduino IDE.

Step 2 - Installing the Blynk Library

After confirming that the board could be programmed, I installed the Blynk library for ESP32 from the Arduino IDE Library Manager. This library provides the functions needed to connect the ESP32-C3 to Blynk Cloud and receive values from the dashboard.

The firmware uses two main libraries:

Blynk library installed in Arduino IDE
Blynk ESP32 library installed from the Arduino IDE Library Manager.

Step 3 - Creating the Blynk Project

In Blynk Console I created a new project called Industrial FabAPP. The project acts as the cloud interface between the physical board and the web dashboard. Inside this project, Blynk allows the creation of datastreams, device templates, web widgets and authentication credentials.

Blynk Console datastreams section
Blynk Console development area. This is where datastreams are created for device communication.
Blynk web dashboard editor
Web dashboard editor where widgets are added to interact with the ESP32-C3.

Step 4 - Dashboard Widget Configuration

A switch widget was added to the web dashboard. This widget sends a value to the ESP32-C3 through Blynk Cloud. When the switch is ON, it sends 1; when it is OFF, it sends 0. The widget was connected to the datastream named LED_PIN, assigned to virtual pin V1.

This mapping is the key part of the communication system: the dashboard does not directly control pin D10. Instead, it updates virtual pin V1 in Blynk, and the ESP32 firmware translates that virtual value into a physical output.

Blynk switch widget added to the dashboard
Switch widget placed on the Blynk web dashboard for remote control.
Blynk switch widget configuration
Widget configuration: title, datastream, ON value and OFF value.

Step 5 - Device Token and Firmware Connection

When a new device is created in Blynk, the platform generates three important values: template ID, template name and authentication token. These values must be declared at the beginning of the Arduino sketch so the board knows which Blynk project it belongs to.

For documentation and security, the token and WiFi password are represented with placeholders in the code shown below. In the actual Arduino IDE sketch, the values generated by Blynk were copied into the firmware.

Blynk new device credentials
Blynk generates the template ID, template name and authentication token for the new device.
Arduino IDE with Blynk credentials
Firmware with Blynk credentials, WiFi data, libraries and hardware pin configuration.

Firmware Logic

The code uses the Blynk event function BLYNK_WRITE(V1). This function runs automatically every time the dashboard switch changes. The received value is converted to an integer and then written to the physical output pin D10.

#define BLYNK_TEMPLATE_ID   "YOUR_TEMPLATE_ID"
#define BLYNK_TEMPLATE_NAME "Industrial FabAPP"
#define BLYNK_AUTH_TOKEN    "YOUR_AUTH_TOKEN"

#include <WiFi.h>
#include <BlynkSimpleEsp32.h>

#define LED_PIN D10

char ssid[] = "YOUR_WIFI_NETWORK";
char pass[] = "YOUR_WIFI_PASSWORD";

BLYNK_WRITE(V1)
{
  int value = param.asInt();
  digitalWrite(LED_PIN, value);
}

void setup()
{
  Serial.begin(9600);
  pinMode(LED_PIN, OUTPUT);

  Serial.println("Iniciando sistema...");
  Serial.println("Conectando a WiFi y Blynk...");
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
  Serial.println("Sistema listo.");
}

void loop()
{
  Blynk.run();
}
Code blockPurpose
Blynk credentialsIdentify the device and connect it with the correct Blynk template.
WiFi credentialsAllow the XIAO ESP32-C3 to connect to the local wireless network.
BLYNK_WRITE(V1)Receives the value sent by the Blynk switch widget.
digitalWrite(LED_PIN, value)Transforms the cloud command into a physical output on pin D10.
Blynk.run()Keeps the connection active and processes incoming Blynk events.

Step 6 - Communication Test

After uploading the firmware, the serial monitor was used to verify the connection process. The board first starts the program, then connects to WiFi, authenticates with Blynk Cloud and finally reports that the system is ready. This confirms that the device is online and able to receive commands from the dashboard.

Serial monitor showing Blynk connection ready
The serial monitor confirms the communication sequence: start, WiFi/Blynk connection and ready state.

Communication Flow

The final communication sequence works as follows:

  1. The XIAO ESP32-C3 starts and initializes pin D10 as an output.
  2. The board connects to the configured WiFi network.
  3. The board authenticates with Blynk Cloud using the device token.
  4. The Blynk dashboard switch changes the value of virtual pin V1.
  5. The ESP32-C3 receives the V1 value through BLYNK_WRITE(V1).
  6. The firmware writes the received value to physical pin D10.
  7. The LED turns ON or OFF depending on the dashboard command.
This same logic is scalable. Instead of controlling only one LED, the board can send sensor values, receive control commands, display messages, calculate production indicators or update a dashboard in real time.

Results

The networking test was successful. The XIAO ESP32-C3 connected to the WiFi network, authenticated with Blynk and received commands from the web dashboard. The Blynk switch controlled the physical output through the virtual pin structure, demonstrating a complete cloud-based communication loop.

TestResult
Board detected by Arduino IDESuccessful
Blynk library installedSuccessful
Blynk template and device createdSuccessful
WiFi connection establishedSuccessful
Dashboard command received by ESP32-C3Successful
Physical output controlled from BlynkSuccessful

Reflection

This assignment helped me understand networking as a complete system rather than only a programming task. The communication depends on several layers working together: the hardware pin, the firmware, the WiFi network, the cloud service, the virtual datastream and the dashboard widget.

The most important lesson was that Blynk makes the cloud connection easier, but the designer must still understand how data travels from a virtual interface to a physical device. This knowledge became very useful for my final project, where the Smart Lean Cell uses a dashboard to visualize production data and connect physical activity with digital feedback.

Hero Shot - WiFi Communication Test

These videos show the final communication test between the Blynk dashboard and the XIAO ESP32-C3. The interaction demonstrates the main objective of this week: sending a command from a cloud interface and receiving it on the physical board through WiFi.

Remote interaction test using the Blynk dashboard and the XIAO ESP32-C3.
Second view of the WiFi communication workflow and physical response.