Getting Started with Blynk
This is a hands-on introduction to a very popular tool among the maker’s community, Blynk.
Blynk allows you to control Arduino, ESP8266, Raspberry Pi and other such boards through their iOS and Android apps. It provides an easy to use dashboard through which you can monitor various sensors and control actuators. In this lesson, we will be toggling the built-in LED in our NodeMCU using Blynk app. So let’s get into making
Step – 1: Install Blynk app for your iOS or Android device
Step – 2: Create a new Blynk account
Step – 3: Create a new project. Give it any name you prefer. For the device, we will be using NodeMCU
You will receive an auth token in your mail after the project is created, which we will use shortly.
Step – 4: After the project is created, a project section like below will appear
Click on the button labeled “+” to add “Button” widget to your project
The widget will be added to your project as below
Step – 5: Click on the newly created Button widget. Select D0 as pin and slide to SWITCH mode as shown below. D0 is your virtual pin through which we can control physical pins on our board.
Step – 6: Upload the following code to NodeMCU. Be sure to replace the wifi name, password and the auth key with the one you received in your email when you created the project.
#define BLYNK_PRINT Serial
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth = "Your-Auth-Key";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid = "Your-Wifi-Name";
char pass = "Your-Wifi-Pass";
// Debug console
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
Step – 7: After uploading is done, just hit the play button in your app, and you can now toggle the built-in LED in your NodeMCU using your smartphone
Note: Blynk comes with something called “Energy”. For each new project and widget you create, you consume energy. It’s like credits that are initially given to every new user. Once you run out of Energy, you either have to delete existing projects and widgets to recycle Energy, or you can buy more Energy.