WEEK 11 – Networking and Communications

Assignment Documentation

XIAO ESP32-C6 + Blynk Cloud LED Control

This assignment focused on understanding how an embedded system can communicate through a wireless network. I used a XIAO ESP32-C6, WiFi, and Blynk Cloud to control a physical LED from a virtual button in a mobile or web dashboard.

The purpose of this practice was not only to turn an LED on and off, but also to understand the complete communication flow between the user interface, the cloud platform, the WiFi network, and the microcontroller. This workflow is important for IoT applications because it allows a physical device to be controlled remotely.

In this case, the Blynk virtual button sends a value to the XIAO ESP32-C6. The board receives that value, changes the state of the physical LED, and also sends a message back to the Blynk dashboard.

Cellphone / Computer → Blynk Cloud → WiFi Network → XIAO ESP32-C6 → Physical LED

1. Checklist

2. Group Assignment

Communication Between Boards

For the group assignment, we explored communication between different embedded boards. The objective was to understand how microcontrollers can exchange information using networking tools and communication channels.

My individual assignment is connected to the group work because it uses the same principle of networked communication, but focuses on one board connected to a cloud dashboard. Instead of communicating only between boards, this test connects a physical output to an IoT interface.

3. What is Networking and Communications?

Networking and communications in embedded systems refers to the ability of a device to send and receive information through a communication protocol. This can happen through wires, such as UART, I2C, SPI, or USB, or wirelessly through technologies such as WiFi, Bluetooth, LoRa, or cellular networks.

For this assignment, I used WiFi because the XIAO ESP32-C6 has integrated wireless connectivity. WiFi allowed the board to connect to the internet and communicate with Blynk Cloud. This makes the board work as an IoT node, capable of receiving commands from a dashboard and controlling a local output.

Protocol / Technology Type Use Use in this Assignment
UART / Serial Wired Debugging and board-to-computer communication Used with the Serial Monitor to verify the program status.
I2C Wired Connecting sensors and modules with two wires Not used, but useful for future sensor nodes.
SPI Wired Fast communication with displays, memory, or modules Not used in this LED control test.
WiFi Wireless Internet connection and IoT dashboards Main communication technology used to connect the board to Blynk.
Blynk Virtual Pins Cloud communication Exchange data between dashboard widgets and hardware V1 was used for the virtual button and V2 for the message label.

4. Board and Components Used

XIAO ESP32-C6 Board

The main board used in this assignment was the XIAO ESP32-C6. This board is small, easy to integrate into compact projects, and includes WiFi connectivity. This made it suitable for testing a wireless communication workflow with Blynk Cloud.

The LED was used as a physical output device. When the virtual button in Blynk is activated, the ESP32-C6 receives the value and changes the LED state.

Component Function
XIAO ESP32-C6 Main microcontroller with WiFi communication.
LED Physical output controlled from Blynk.
220 Ω resistor Protects the LED from excessive current.
WiFi network Allows connection between the board and Blynk Cloud.
Blynk dashboard Interface used to control and monitor the LED state.
XIAO ESP32-C6 board with antenna

XIAO ESP32-C6 used as the wireless node for this assignment.

5. Blynk Cloud Configuration

Blynk Cloud was used as the IoT platform for this assignment. The first step was to create a template and a device. This device generates an authentication token, which is necessary for the microcontroller to connect to the correct project in Blynk.

The authentication token works like a digital identity for the board. If the token is incorrect, the board may connect to WiFi, but it will not communicate with the Blynk dashboard.

Blynk device configuration

Blynk device created for the XIAO ESP32-C6 communication test.

6. Datastream Configuration

Virtual Pins

In Blynk, a datastream is a communication channel between the dashboard and the hardware. For this assignment, I used two virtual pins:

It is important to understand that virtual pins are not the same as physical pins. A physical pin, such as D5, is connected to real hardware. A virtual pin, such as V1 or V2, only exists inside Blynk and is used to send or receive data through the cloud.

Blynk Element Virtual Pin Function
Button V1 Sends 1 when ON and 0 when OFF.
Label / Text V2 Displays the message sent by the ESP32-C6.
Blynk datastream configuration

Datastream configuration using virtual pins for button control and message display.

7. Arduino IDE Code

The Arduino code connects the XIAO ESP32-C6 to WiFi and then to Blynk Cloud. The code includes the Blynk template information, the authentication token, the WiFi credentials, and the physical LED pin.

One error I found during programming was caused by special characters in comments. The arrow symbol was interpreted incorrectly by the compiler because the comment block was not opened correctly. I solved this by using a proper block comment and replacing special arrows with normal text.

/********
   XIAO ESP32-C6 + Blynk
   Control of a physical LED from a virtual button (V1)
   Dynamic message in Blynk using virtual pin V2

   Flow:
   Cellphone - Blynk Cloud - ESP32 - LED
   ESP32 - Blynk Label
********/

/* ===== REQUIRED BLYNK CONFIGURATION ===== */
#define BLYNK_TEMPLATE_ID "TMPL2gO3e-htD"
#define BLYNK_TEMPLATE_NAME "FabacademyJR"
#define BLYNK_AUTH_TOKEN "YOUR_BLYNK_AUTH_TOKEN"

/* ===== LIBRARIES ===== */
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>

/* ===== HARDWARE CONFIGURATION ===== */
#define LED_PIN D5

/* ===== WIFI DATA ===== */
char ssid[] = "YOUR_WIFI_NAME";
char pass[] = "YOUR_WIFI_PASSWORD";

/* ===== FUNCTION EXECUTED WHEN BUTTON V1 CHANGES ===== */
BLYNK_WRITE(V1)
{
  int value = param.asInt();

  digitalWrite(LED_PIN, value);

  if (value == 1) {
    Blynk.virtualWrite(V2, "Hola ZOI");
  } else {
    Blynk.virtualWrite(V2, " ");
  }
}

/* ===== SETUP ===== */
void setup()
{
  Serial.begin(115200);
  delay(1000);

  Serial.println("Starting system...");

  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, LOW);

  Serial.println("Connecting to WiFi and Blynk...");
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

  Serial.println("System ready.");
}

/* ===== LOOP ===== */
void loop()
{
  Blynk.run();
}

For safety and documentation clarity, the real WiFi password and Blynk token should not be published in the final website. In the public version, they should be replaced with placeholders such as YOUR_WIFI_PASSWORD and YOUR_BLYNK_AUTH_TOKEN.

8. Code Upload and Serial Monitor

Programming Process

  1. Open Arduino IDE.
  2. Install or verify the ESP32 board package.
  3. Select the XIAO ESP32-C6 board or the compatible ESP32-C6 option.
  4. Select the correct USB port.
  5. Install the Blynk library if it is not already installed.
  6. Paste the corrected code.
  7. Replace the WiFi name, WiFi password, and Blynk token.
  8. Upload the code to the board.
  9. Open the Serial Monitor at 115200 baud.
  10. Verify that the board connects to WiFi and Blynk.
Arduino IDE and Serial Monitor

Arduino IDE and Serial Monitor used to verify the WiFi and Blynk connection.

9. Functional Test

The final test confirmed that the communication system worked correctly. When the virtual button in Blynk was turned ON, the ESP32-C6 received the value 1 through V1 and turned on the physical LED connected to D5.

When the virtual button was turned OFF, the ESP32-C6 received the value 0 and turned off the LED. At the same time, the message in the Blynk label changed depending on the LED state.

Blynk Button Value Sent ESP32-C6 Action Message on Blynk
OFF 0 LED turns off Blank message
ON 1 LED turns on Hola ZOI

Final functional test showing the LED controlled from Blynk through WiFi.

10. Problems Encountered and Solutions

Problem Cause Solution
Compilation error with special characters. The comment block was not opened correctly and the compiler tried to read the arrow symbol as code. I corrected the comment syntax and replaced special symbols with simple text.
The board did not appear online in Blynk. The authentication token or WiFi credentials may have been incorrect. I verified the token from the correct Blynk device and checked the WiFi name and password.
The LED did not turn on. The physical pin in the code did not match the real LED connection. I checked the PCB connection and defined the correct LED pin in the code.
The dashboard did not control the hardware. The button was connected to a different virtual pin. I configured the Blynk button to use V1, matching the function BLYNK_WRITE(V1).

11. Results

The result of this assignment was a functional IoT control system. The XIAO ESP32-C6 connected to WiFi, authenticated with Blynk Cloud, received commands from a virtual button, controlled a physical LED, and sent a message back to the dashboard.

This demonstrated the complete communication workflow between software and hardware. The assignment also helped me understand the importance of correctly configuring physical pins, virtual pins, WiFi credentials, and cloud authentication tokens.

12. Learning Outcomes

13. Conclusion

This assignment allowed me to understand how networking and communications are applied in embedded systems. By using the XIAO ESP32-C6 and Blynk Cloud, I was able to connect a physical device to an IoT platform and control an LED from a virtual dashboard.

The most important learning outcome was understanding the complete communication path: the user interacts with a button in Blynk, the cloud sends the value to the ESP32-C6, the board activates the physical LED, and then the board sends a message back to the dashboard.

This practice is useful for future Fab Academy projects because the same logic can be expanded to sensors, motors, dashboards, production monitoring, automation systems, and final project applications.