Blynk Tutorial

Blynk – The Definitive Guide to Beginners

Blynk Tutorial
Blynk Tutorial

If you know anything about IoT using Arduino or NodeMCU then you must be knowing what Blynk is. It is one of the most popular IoT Platforms for Hobbyist and creators.

It is mostly used for,

  • Displaying Sensors Data in Graph, Levels, Indicator Form.
  • Controlling Digital or Analog Pins through the App.
  • One Awesome Feature known as Virtual Pins (which will discuss later!).

You can connect over more than 400 Hardware Boards with your Blynk App.

Some of the common and famous boards are –

  • Arduino Nano, Mini, Pro Mini, Pro Micro, Due, Mega.
  • ESP8266
  • ESP32 
  • Teensy 3.2/3.1
  • DFRobot Bluno
  • Intel Edison
  • Intel Galileo
  • Launchpad MSP432
  • Raspberry Pi
  • SparkFun RedBoard
  • STM32 Nucleo
  • BBC micro:bit

You can find the full list of supported hardware Here.

There are three major components in the platform:

  • Blynk App – allows to you create amazing interfaces for your projects using various widgets we provide.
  • Blynk Server – responsible for all the communications between the smartphone and hardware. You can use our BlynkCloud or run your private Blynk server locally. It’s open-source, could easily handle thousands of devices and can even be launched on a Raspberry Pi.
  • Blynk Libraries – for all the popular hardware platforms – enable communication with the server and process all the incoming and outcoming commands.

We are going to discuss about Blynk App.

Structure of Blynk App

Blynk Architecture
Blynk Architecture

The above image shows the Architecture of the Blynk App.

Now lets understand the above Architecture with an example :

Every time you press a Button in the Blynk app, the message travels to the Blynk Cloud, where it magically finds its way to your hardware. It works the same in the opposite direction and everything happens in a Blynk of an eye.

Now, The Requirements

To learn the Blynk Platform we need some Prerequisites, which I’ve mentioned below.

The Hardware

We will need a Hardware Board which we are going to use to display some values or controlling the hardware using Blynk App.

In this Guide we are going to use an Arduino Uno and ESP 01 WiFi Module.

You can buy those components from the Links given Below.

Arduino Uno

ESP 01 WiFi Module

For Blynk to work we need our hardware to connect to internet.

So for this tutorial we are going to use ESP 01 WiFi Module with our Arduino Uno to connect it to Internet.

A Smart Phone

To control or see any data on Blynk we need to Download the official app of Blynk. Links given below.

Android – Blynk

iOS – Blynk

Blynk Library

To use Blynk with Arduino and it’s IDE, we need to download the Blynk Library.

Click here to download

All the widgets/function available in Blynk we can find in the Example sketches after adding the Library.

If you are first timer then see our tutorial on adding Libraries to Arduino IDE.

Installing Additional Libraries to Arduino

Blynking LED using Blynk and NodeMCU

You will need a NodeMCU and Blynk App for this Example.

Blynk App Configuration

After Login, Create a New Project.

Blynk Configuration

Select your board as NodeMCU and give your Project a Name.

Then the AUTH Token will be sent to your Registered Mail ID. Save that for Programming

Blynk Configuration

Then Select your Widget which is Button

Blynk Configuration

Then Configure your Button to any Pin of NodeMCU.

I’ve set it to D4 which is the onboard LED Pin of NODEMCU

Code

/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  This example runs directly on ESP8266 chip.

  Note: This requires ESP8266 support package:
    https://github.com/esp8266/Arduino

  Please be sure to select the right ESP8266 module
  in the Tools -> Board menu!

  Change WiFi ssid, pass, and Blynk auth token to run :)
  Feel free to apply it to any other example. It's simple!
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

void setup()
{
  // Debug console
  Serial.begin(9600);

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

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

Now upload the Code and wait for NodeMCU to connect with Blynk.

After connection press the button and see your On-board LED on NodeMCU Blynking.

Checkout Projects Made using Blynk

0