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.
Combo of NodeMCU Based 4-Channel Relay Board Micro Controller Board Electronic + 5V 1 Amp Adaptor + USB Cable for Programming
Blynk for NodeMCU – Introduction
This tutorial of Robo India is an introduction to Blynk on NodeMCU.
Detailed Tutorial
1. Introduction:
1.2 Supported Hardware
1.2 Blynk App
Blynk application can be found from the following links –
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.
Blynk application can be found from the following links –
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.
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.
- Click on Button.
- Give name to Button say led.
- 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.
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.
- Click on Button.
- Give name to Button say led.
- 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.
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.
#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);
digitalWrite(HIGH,D2);
digitalWrite(HIGH,D3);
digitalWrite(HIGH,D4);
digitalWrite(HIGH,D5);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}
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.
#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); digitalWrite(HIGH,D2); digitalWrite(HIGH,D3); digitalWrite(HIGH,D4); digitalWrite(HIGH,D5); Blynk.begin(auth, ssid, pass); } void loop() { Blynk.run(); }