How to Use ESP32 to Control LED With Blynk Via WiFi

by mybotic in Circuits > Arduino

88346 Views, 72 Favorites, 0 Comments

How to Use ESP32 to Control LED With Blynk Via WiFi

ESP-32DEV-005-500x500.jpg

This tutorial is going to use ESP32 development board to control LED with Blynk via WiFi. Blynk is a Platform with iOS and Android apps to control Arduino, Raspberry Pi and the likes over the Internet. It is a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets. It is also can linked to the Internet over Wi-Fi, Ethernet or Bluetooth.

For details of this module, you may refer to here.

Pin Definition

pin definition.JPG

Material Preparation

Capture.JPG
LED.JPG
download.png

For this tutorial, we require these items:

  1. Arduino NodeMcu IoT ESP32 WiFi & Bluetooth Development Board
  2. LED
  3. Blynk App in Android or iOS apps

Pin Connection

pin connection_bb.jpg

In this tutorial, connect LED's anode to ESP32's p21 and LED's cathode to ESP32's GND.

Setting Up Blynk App

photo_2017-11-20_17-49-16.jpg
photo_2017-11-20_17-49-19 (3).jpg
photo_2017-11-20_17-49-17.jpg
photo_2017-11-20_17-53-43.jpg
photo_2017-11-20_17-49-21.jpg
photo_2017-11-20_17-49-17 (3).jpg
photo_2017-11-20_17-49-20.jpg
photo_2017-11-21_09-31-33.jpg

1. Download blynk apps from Play Store or App Store.

2. After download is done, open the apps and create an account. If you already create an account, you may log in.

3. After you successful create an account, start by creating a new project.

4. Create a project name and choose device by ESP32 Dev Board and choose connection type by WiFi.

5. After press "Create" button, a window will pop up "Auth token was sent to....". You can open your email to check your authentication key.

6. Then, tap anywhere on the canvas to open the widget box. All the available widgets are located here. Now choose a button.

7. Tap on the widget to change the setting. Select the LED pin to Digital- gp21 and mode select to switch.

8. When you are done with the setting, press the PLAY button. This will switch you from EDIT mode to PLAY mode where you can interact with the hardware. While in PLAY mode, you won’t be able to drag or set up new widgets, press STOP and get back to EDIT mode.

Sample Source Code

For this tutorial, it is necessary to download and install the Blynk library from here. This library is enable ESP32 can connect with Blynk.To be able to interface the ESP32 with Blynk, you will have to download this library and save it into your Arduino's libraries files. Then, download this sample source code and change the auth token by check your email and copy it to the coding.

Downloads

Results

23825442_753705174821193_1843214726_o.jpg
3.JPG

Based on the result, the LED will turn on or off when you switch the button on the Blynk app. When you open the serial monitor on Arduino, it will shows out connected to WiFi and the Blynk logo as the diagram below.

Video

Use ESP32 to control LED with Blynk via WiFi

This video shows the demonstration of the tutorial for the use ESP32 to control LED with Blynk via WiFi.