Menu Close

Blynk for NodeMCU – Introduction

This tutorial of Robo India is an introduction to Blynk on NodeMCU.

Detailed Tutorial

1. Introduction:

Blynk is a Platform with IOS and Android apps to control Arduino, Raspberry Pi and the likes over the Internet. It’s a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets.

1.2 Supported Hardware

1.2 Blynk App 

Blynk application can be found from the following links –

1. Android Blynk App

2. IOS Blynk App

After downloading the app, create an account and log in. (If possible than log in with your real mail id for better connectivity later.)

You’ll also need to install the Blynk Arduino Library, which helps generate the firmware running on your ESP8266. Download the latest release from https://github.com/blynkkk/blynk-library/releases , and follow along with the directions there to install the required libraries.

2. Create a Blynk Project

Click the “Create New Project” in the app to create a new Blynk app. Give it any name.

Blynk works with hundreds of hardware models and connection types. Select the Hardware type. After this, select connection type. In this project we have select WiFi connectivity.

The Auth Token is very important – you’ll need to stick it into your ESP8266’s firmware. For now, copy it down or use the “E-mail” button to send it to yourself.

3. Add Widgets To The Project

Then you’ll be presented with a blank new project. To open the widget box, click in the project window to open.

We are selecting a button to control Led connected with NodeMCU.

  1. Click on Button.
  2. Give name to Button say led.                                    
  3. Under OUTPUT tab- Click pin and select the pin to which led is connected to NodeMCU, here it is digital pin 2, hence select digital and under pin D2. And Click continue.

Under MODE tab- Select whether you want this button as “push button” or “Switch”.

You have successfully created a GUI for Arduino.

4. Upload The Firmware

Now that your Blynk project is set-up, open Arduino and navigate to the ESP8266_Standalone example in the File > Examples > Blynk > Boards_WiFi> ESP8266_Standalone menu.

5. Stand Alone Programming Code:

Before uploading, make sure to paste your authorization token into the auth [] variable. Also make sure to load your Wifi network settings into the Blynk.begin(auth, “ssid”, “pass”) function.

#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();
}

6. Execution

After the app has uploaded, open the serial monitor, setting the baud rate to 9600. Wait for the “Ready” message.

Then click the “Run” button in the top right corner of the Blynk app. Press the button and watch the LED

Then add more widgets to the project. They should immediately work on the ESP8266 without uploading any new firmware.

7. Output

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com

4 Comments

  1. Amit

    Thank you, for the support.
    Kindly acknowledge that I had done all as suggested but finally I could get “Leaving…
    Hard resetting via RTS pin…” and Done Uploading but practically no results at all. Serial Monitor is blank all the time and even after Reset pin is pressed. I had attempted this 7-8 times but all in vain.
    My Node MCU is neither online as shown by Blynk App.
    Kindly help.

  2. Shubham

    Hi Amit. The same thing was happening with me when i realised the following mistakes i made.
    1. Check on your Blynk app that you have chosen the correct type of Chip – Generic, ESP8266 or NodeMcu.

    2. Double check that the authorization token is correct to the dot. Copy paste the token and re-check it.

    3. Cross check that you have placed in the correct credentials of the network. My mistake was that i was using a small letter in place of a capital letter and that messed up the entire stuff.

    4. Finally if all is done and still not connecting then check the baud rate and open the serial monitor before you upload the sketch.

    It was the 1st and the 3rd point that was creating trouble for me.

Leave a Reply