Embedded Networking and Communications
Home ← →
Objective of this Week
- To establish communication between two projects and exchange data messages.
Blynk
Blynk is an Internet of Things (IoT) platform that enables users to remotely control and monitor hardware devices such as ESP32, Arduino, or Raspberry Pi through a smartphone app or web dashboard. It provides a user-friendly interface where custom dashboards with buttons, sliders, and gauges can be created to interact with devices in real time. The platform operates through three main components — the Blynk app, Blynk Cloud, and the Blynk library — which together manage communication between the hardware and the user interface. By using a unique authentication token, devices can securely connect to the Blynk Cloud over Wi-Fi or other networks. Blynk supports automation, data logging, and real-time monitoring, making it ideal for smart home, industrial, and educational IoT applications.

What we will do…
We developed a Blynk IoT-based relay control system, where the Blynk cloud platform acts as the communication medium between the user dashboard (sender) and the ESP32-C3 device (receiver). The project fulfills the goal of sending a message between two networked systems.
Components Used
- XIAO ESP32-C3
- Relay Module
- Bulb
Arduino Coding
#define BLYNK_TEMPLATE_ID "TMPL337DCKdeb"
#define BLYNK_TEMPLATE_NAME "Mani"
#define BLYNK_AUTH_TOKEN "iCzrcMPmcVBfhYtzlhXt-9cqAoCpfl2q"
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
// Wi-Fi credentials
char ssid[] = "Forge_office";
char pass[] = "Forged@Forge";
// Relay connected to D0 (GPIO2 on XIAO ESP32-C3)
#define RELAY_PIN 2
#define VPIN V0
BLYNK_WRITE(VPIN)
{
int value = param.asInt();  // Get 0 or 1 from Blynk
if (value == 1) {
digitalWrite(RELAY_PIN, HIGH);
Serial.println("Relay ON (GPIO2 HIGH)");
} else {
digitalWrite(RELAY_PIN, LOW);
Serial.println("Relay OFF (GPIO2 LOW)");
}
}
void setup() {
Serial.begin(115200);
pinMode(RELAY_PIN, OUTPUT);
digitalWrite(RELAY_PIN, LOW);
Serial.println("Connecting to Blynk...");
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
}
void loop() {
Blynk.run();
}
Working
- The ESP32-C3 connects to Wi-Fi and authenticates with the Blynk Cloud.
- When the Switch in the Blynk dashboard is toggled, it sends a value (1 or 0) to V0.
- The ESP32-C3 receives this value and controls the relay output (GPIO2) accordingly.
- The bulb turns ON/OFF based on the relay state.
- The serial monitor logs the received messages for verification.
Testing
Conclusion
Learning outcomes
- Learned to establish direct serial communication between multiple boards.
- Implemented Wi-Fi-based data exchange using Blynk Cloud.
- Understood synchronization between physical devices and online dashboards.
- Developed skills in configuring Blynk IoT for real-time control and monitoring.




