Course Content
IoT Engineering Course using ESP32 Wifi Robots

๐Ÿ“˜ Lesson 1.5 โ€“ Blynk Integration & Mobile Control Setup


๐ŸŽฏ Lesson Objective

In this lesson, students will learn:

  • How to fully set up the Blynk IoT platform
  • How to connect ESP32 with Blynk Cloud
  • How to design a mobile control dashboard
  • How to send commands from mobile to ESP32

By the end of this lesson, students will be able to control a robot using their smartphone over the internet.


๐Ÿ“ฑ What is Blynk IoT?

Blynk is a powerful IoT platform that allows you to:

  • Control hardware remotely
  • Build mobile apps without coding
  • Communicate with ESP32 over the internet

๐Ÿ‘‰ It works as a bridge between your mobile phone and ESP32


๐Ÿ”„ How Blynk System Works

Mobile App โ†’ Blynk Cloud โ†’ ESP32 โ†’ Robot

  1. User presses a button in the app
  2. Command goes to Blynk Cloud
  3. ESP32 receives command via WiFi
  4. Robot performs action

๐Ÿ› ๏ธ COMPLETE BLYNK SETUP (STEP-BY-STEP)


๐Ÿ”น Step 1 โ€“ Install App

  • Download Blynk IoT from Play Store
  • Open the app

๐Ÿ”น Step 2 โ€“ Create Account

  • Sign up using email
  • Verify email
  • Login to dashboard

๐Ÿ”น Step 3 โ€“ Create Template

  1. Click on โ€œDeveloper Zoneโ€
  2. Click โ€œNew Templateโ€
  3. Fill details:
  • Template Name โ†’ WiFi Robot
  • Hardware โ†’ ESP32
  • Connection Type โ†’ WiFi

๐Ÿ‘‰ Click Create


๐Ÿ”น Step 4 โ€“ Add Datastreams (VERY IMPORTANT)

Go to Datastreams โ†’ New Datastream โ†’ Virtual Pin

Create the following:

Name Virtual Pin Type
Forward V0 Integer
Backward V1 Integer
Left V2 Integer
Right V3 Integer

๐Ÿ‘‰ Set:

  • Min = 0
  • Max = 1

๐Ÿ”น Step 5 โ€“ Create Device

  1. Go to Devices
  2. Click New Device
  3. Select From Template
  4. Choose your template
  5. Click Create

๐Ÿ”น Step 6 โ€“ Get Auth Token

  • Open your device
  • Copy Auth Token

๐Ÿ‘‰ This will be used in ESP32 code


๐Ÿ”น Step 7 โ€“ Create Mobile Dashboard

  1. Open Blynk mobile app
  2. Select your device
  3. Click Edit Dashboard

๐Ÿ”น Step 8 โ€“ Add Buttons

Add 4 Button Widgets:

Button 1:

  • Name: Forward
  • Datastream: V0
  • Mode: Switch

Button 2:

  • Name: Backward
  • Datastream: V1
  • Mode: Switch

Button 3:

  • Name: Left
  • Datastream: V2
  • Mode: Switch

Button 4:

  • Name: Right
  • Datastream: V3
  • Mode: Switch

๐Ÿ”น Step 9 โ€“ Save Dashboard

  • Click Save
  • Exit edit mode

๐Ÿ’ป ESP32 Code for Blynk Connection

ย 
#define BLYNK_TEMPLATE_ID “YourTemplateID”
#define BLYNK_TEMPLATE_NAME “WiFi Robot”
#define BLYNK_AUTH_TOKEN “YourAuthToken”

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

char ssid[] = “YourWiFiName”;
char pass[] = “YourPassword”;

void setup() {
Serial.begin(9600);

Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
}

void loop() {
Blynk.run();
}

ย 

๐Ÿ” Understanding Virtual Pins

  • Virtual Pins (V0, V1, etc.) are software pins
  • They send values from app to ESP32
  • Example:
    • Button ON โ†’ sends 1
    • Button OFF โ†’ sends 0

๐Ÿงช Practical Activity

  1. Upload code to ESP32
  2. Open Serial Monitor
  3. Open Blynk app
  4. Press buttons

๐Ÿ‘‰ Observe:

  • ESP32 connects to Blynk
  • Device status becomes Online

๐Ÿง  Key Learning Concepts

  • Cloud-based IoT control
  • Mobile app interface design
  • Virtual communication (no physical wires)
  • Real-time device interaction

โš ๏ธ Common Issues & Solutions

Problem Solution
Device Offline Check WiFi connection
Wrong Auth Token Copy correct token
Buttons not working Check Virtual Pins
Not connecting to Blynk Check internet

๐Ÿ”ง Troubleshooting Tips

  • Keep internet stable
  • Restart ESP32 if needed
  • Re-upload code if error occurs
  • Check Template ID and Auth Token carefully

๐Ÿ“ Lesson Summary

In this lesson, students learned how to fully set up the Blynk platform, create a mobile dashboard, and connect ESP32 to control hardware over the internet.


๐Ÿ“Œ Practice Task

  • Add one extra button (Stop)
  • Change Virtual Pin and test
  • Try renaming buttons
Scroll to Top