🌐 Lesson 3.3 – Blynk IoT Platform Setup
In this lesson, we will configure the Blynk IoT platform for our Fire Alert System. After completing this setup, the ESP32 will be able to send real-time fire detection data and status messages to the Blynk dashboard, allowing users to monitor the system remotely from anywhere.
🎯 Objective of This Lesson
By the end of this lesson, you will be able to:
✅ Create a New Blynk Template
✅ Create Multiple Datastreams
✅ Create a Device
✅ Obtain Template ID
✅ Obtain Template Name
✅ Obtain Auth Token
✅ Design a Mobile Dashboard
✅ Design a Web Dashboard
✅ Prepare Blynk Cloud for ESP32 Connection
📝 Step 1 – Create a New Template
After logging into Blynk Console:
1️⃣ Click Templates
2️⃣ Click New Template
3️⃣ Enter the following details:
| Field | Value |
|---|---|
| Template Name | Fire Alert System |
| Hardware | ESP32 |
| Connection Type | WiFi |
4️⃣ Click Done
✅ Template created successfully.
📌 Why Templates Are Important
A Template acts as the blueprint of an IoT project.
It stores:
✅ Datastreams
✅ Dashboard Design
✅ Device Configuration
✅ Cloud Settings
📝 Step 2 – Create Datastreams
Datastreams are used to exchange data between ESP32 and Blynk Cloud.
Navigate to:
Templates
↓
Fire Alert System
↓
Datastreams
Click:
New Datastream
🔥 Datastream 1 – Fire Status
Select:
Virtual Pin
Configure:
| Setting | Value |
|---|---|
| Name | Fire Status |
| Virtual Pin | V0 |
| Data Type | Integer |
| Min | 0 |
| Max | 1 |
Click:
✅ Create
📊 Fire Status Values
| Value | Meaning |
|---|---|
| 0 | No Fire |
| 1 | Fire Detected |
📝 Datastream 2 – Status Message
Click:
New Datastream
Select:
Virtual Pin
Configure:
| Setting | Value |
|---|---|
| Name | Status Message |
| Virtual Pin | V1 |
| Data Type | String |
Click:
✅ Create
📟 Purpose of Status Message
This datastream will display readable text messages such as:
✅ System Safe
or
🔥 Fire Detected
Instead of only displaying 0 and 1.
📝 Step 3 – Create a Device
Navigate to:
Devices
↓
New Device
Select:
From Template
Choose:
Fire Alert System
Enter Device Name:
ESP32 Fire Monitor
Click:
✅ Create Device
📝 Step 4 – Get Template ID
Open:
Templates
↓
Fire Alert System
You will find:
#define BLYNK_TEMPLATE_ID "TMPLxxxx"
Example:
#define BLYNK_TEMPLATE_ID "TMPL6abc123"
Copy this value.
📝 Step 5 – Get Template Name
Inside the template information:
#define BLYNK_TEMPLATE_NAME "Fire Alert System"
Copy this value.
📝 Step 6 – Get Auth Token
Open:
Devices
↓
ESP32 Fire Monitor
Click:
Device Info
You will find:
Auth Token
Copy the token.
Example:
#define BLYNK_AUTH_TOKEN "abcdef123456"
⚠️ Keep this token secure because it allows your ESP32 to communicate with Blynk Cloud.
📱 Step 7 – Design Mobile Dashboard
Open the Blynk Mobile App.
Select:
ESP32 Fire Monitor
Click:
Edit Dashboard
💡 Widget 1 – LED Widget
Purpose:
Show fire detection status visually.
Connect to:
V0
Behavior:
| Value | LED Status |
|---|---|
| 0 | OFF |
| 1 | ON |
📟 Widget 2 – Label Widget
Purpose:
Display system status messages.
Connect to:
V1
Examples:
✅ System Safe
🔥 Fire Detected
🚨 Widget 3 – Notification Widget
Purpose:
Receive emergency notifications when fire is detected.
This allows instant alerts on the smartphone.
🌐 Step 8 – Design Web Dashboard
Open:
Blynk Console
↓
Web Dashboard
💡 Indicator Widget
Connect to:
V0
Purpose:
Show visual fire status.
📟 Label Widget
Connect to:
V1
Purpose:
Display text-based fire status.
Example:
✅ System Safe
or
🔥 Fire Detected
🔄 Data Flow of the Project
Flame Sensor
↓
ESP32
↓
Blynk Cloud
↓
V0 → LED Indicator
↓
V1 → Status Message
↓
Mobile Dashboard
↓
Web Dashboard
📊 Complete System Architecture
🔥 Fire Appears
↓
Flame Sensor Detects Fire
↓
ESP32 Reads Sensor
↓
WiFi Network
↓
Blynk Cloud
↓
V0 = 1
V1 = "🔥 Fire Detected"
↓
Dashboard Updates
↓
User Receives Alert
⚠️ Important Notes
🔹 Save Important Information
Keep these values safe:
BLYNK_TEMPLATE_ID
BLYNK_TEMPLATE_NAME
BLYNK_AUTH_TOKEN
These values will be required in the ESP32 code.
🔹 Use Correct Virtual Pins
| Virtual Pin | Purpose |
|---|---|
| V0 | Fire Status |
| V1 | Status Message |
The same pins must be used in:
✅ Datastreams
✅ Dashboard Widgets
✅ ESP32 Program
🔹 Internet Connection Required
ESP32 must be connected to WiFi to communicate with Blynk Cloud.
📌 Key Points to Remember
✅ Templates organize IoT projects.
✅ Datastreams transfer information between ESP32 and Blynk.
✅ V0 stores Fire Status (0 or 1).
✅ V1 stores Status Messages.
✅ Mobile Dashboard provides remote monitoring.
✅ Web Dashboard provides browser-based monitoring.
✅ Auth Token is required for device authentication.
✅ Blynk Cloud enables real-time IoT communication.
🎯 Lesson Summary
In this lesson, we created a Blynk Template, configured two Datastreams (V0 and V1), created a Device, obtained the Template ID and Auth Token, and designed both Mobile and Web Dashboards. The dashboard can now display both a visual fire indicator and readable status messages. In the next lesson, we will write the complete ESP32 Fire Alert System code and understand its working line by line.