Blynk Terminal Widget for remote monitoring Nodemcu and Arduino

(Last Updated On: October 19, 2019)

Blynk Terminal Widget

Description:

Blynk Terminal Widget– In this Tutorial, you will learn how to use the blynk application terminal widget to display the sensor data using Nodemcu esp8266 wifi module and Arduino. If you are using Arduino then you should be quite familiar with Serial monitor which is used for reading the strings and sensors data. The serial monitor is usually used for debugging purposes.


The Blynk application Terminal Widget is just like the Arduino’s Serial Monitor. The only difference is that the Arduino’s Serial monitor works only when the Arduino is connected with the Laptop or computer, while the Blynk application Terminal Widget is completely Wireless and can be used for remote monitoring. Using the blynk application terminal widget you can monitor your sensors from anywhere around the world. I will also display the sensor value on the Arduino’s serial monitor.

For the step by step explanation watch video tutorial given at the end of this article.

Blynk Terminal Widget

For the best understanding, I am going to use a variable resistor as the sensor. You can replace the variable resistor with any other sensor.

Today’s episode covers

  1. Circuit diagram
  2. Interfacing
  3. Programming and finally
  4. testing

Without any further delay let’s get started!!!



The components and tools used in this project can be purchased from Amazon, the components Purchase links are given below:

Arduino Uno: https://amzn.to/2tVz1vu
Mega 2560: https://amzn.to/2ze1kdu
GSM sim900A: https://amzn.to/2LLeFzy
Neo 6m GPS module: https://amzn.to/32XCYiX
Mq-2 gas/smoke sensor: https://amzn.to/313Sx6O
Nodemcu esp8266 wifi module: Best price https://amzn.to/2NAvmiB
LM7805 Voltage Regulator: https://amzn.to/2IZEl5x
Potentiometer: https://amzn.to/2JSLbfg
330 ohm resistors pack: https://amzn.to/2NtlAeh
5v 2A adaptor: https://amzn.to/2GsNfcw
2n2222 npn transistors: https://amzn.to/2EmXsIb
10k Resistor: https://amzn.to/2KTd6OW
lm7805 Voltage Regulator: https://amzn.to/2IZEl5x
330-ohm resistors pack: https://amzn.to/2NtlAeh
LDR pack: https://amzn.to/2m2khGR
female DC power jack socket: https://amzn.to/2KEo1gt
470 uf capacitors: https://amzn.to/2xDCOzf
5×7 cm vero board: https://amzn.to/2OHGbvn
female headers: https://amzn.to/2zqmtiJ
connection wires: https://amzn.to/2DpBuW7
Super Starter kit for Beginners: https://amzn.to/2KJvmKG
Jumper Wires: https://amzn.to/2KMoVXs
Bread Board: https://amzn.to/2MS4q8X
12v Adaptor: https://amzn.to/2Ntr6h1
PCB plate: https://amzn.to/2IUwpCt
Variable Supply: https://amzn.to/2MT4Qfj
Digital Multimeter: https://amzn.to/2Nvft9i
Vero Board / strip board: https://amzn.to/2MTf9jD
Soldering iron kit: “best” You guys should definitely purchase this: https://amzn.to/2zfoNuJ
Solder wire: https://amzn.to/2ufUMWf
Wire Stripper: https://amzn.to/2KOqxfU
wire cutter: https://amzn.to/2ucIq14
PCB small portable drill machine: https://amzn.to/2Nu62XF

DISCLAIMER:

Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!


This project is based on my previous two tutorials.

 

 

In this tutorial, you will learn how to install the Nodemcu esp8266 wifi board and how to download and use the Blynk library and how to fix the USB UART driver error.

 

 

While in this tutorial you will learn how to make a power supply for Nodemcu esp8266 wifi module so that it can be easily powered up using a 12v adaptor or battery. In this tutorial, a Vero Board is used. While if you want to use a PCB. then you can watch the following video tutorial.

Circuit Diagram:

Blynk Terminal Widget

This schematic is designed in cadsoft eagle 9.1.0 version. If you want to learn how to make a schematic and PCB then watch my tutorial given above.

Let’s start with the 5v regulated power supply based on the lm7805 voltage regulator. J1 is the Female Power Jack and this is where we connect a 12v adaptor or a Solar Panel or a 12v battery. The female power jack J1 is connected with the Input and GND legs of the voltage regulator. Two 470uf capacitors are connected at the input and output sides of the LM7805 voltage regulator. The capacitor connected at the output is compulsory. As you can see a 330-ohm resistor is connected in series with a 2.5v LED. This is a current limiting resistor.


To power up the Nodemcu ESP8266 wifi module, a wire from the output of the voltage regulator is connected with the Vin pin of the Nodemcu ESP8266 wifi module, and make sure all the grounds are connected together.

As the Nodemcu will communicate with Arduino through serial communication, so for this we need a serial port, as I always say never use the Arduino’s default serial port for communication with other devices, Use Arduino’s default serial port only for the debugging purposes. So now the question is if we are using the Arduino’s default serial port for debugging purposes then how we will communicate with Nodemcu Module?

Well my friends no worries at all, we can define multiple serial ports using the Software serial library, which I will explain in the programming. So as you can see the Nodemcu Rx pin is connected with Arduino’s pin3 and the Nodemcu Tx pin is connected with Arduino’s pin2 and the ground is connected with the ground.

A variable resistor is connected with the Analog pin A0 of the Arduino, while the remaining two legs of the variable resistor are connected with 3.3v and ground. As I said earlier this variable resistor will be used as the sensor.

Blynk Terminal Widget


Blynk Mobile Application Setup:

First of all, open the blynk application

Blynk Terminal Widget

Click on the New Project and Set the project name as Arduino Nodemcu, if you want you can set any other name.

Blynk Terminal Widget

Click on the choose device and select Nodemcu.

Make sure you set the connection type to wifi.

Blynk Terminal Widget

Then click on the create button, an authentication token will be sent on your email id, which will be then used in programming. T

Blynk Terminal Widget

This is the authentication token, we will simply copy this and paste in our programming.

Blynk Terminal Widget

Now click anywhere on the screen and search for the Notification and click to add.

Blynk Terminal Widget

Now click on the terminal to open the settings.

Blynk Terminal Widget

Select virtual pin V12. Set the add newline to yes. That’s it.

Our basic application setup is completed.

Programming:

Arduino Programming:



Arduino Program explanation:

We start with

#include <SoftwareSerial.h>

#include means that this is a preprocessor directive and .h means that this is a header file. So with the help of this, you can make multiple serial ports. So let’s define a serial port with name Nodemcu on pin number 2 and pin number 3 of the Arduino.

SoftwareSerial nodemcu(2,3); pin number 2 is the Rx and pin number 3 is the Tx

int vresistor = A0; // a variable resistor is connected with analog pin A0 of the Arduino

int vdata = 0; // this is a variable of the type integer and will be used to store the value of variable resistor.

String mystring; // my string is a variable of the type string.

As you you know my friends, every Arduino, and the mega program has at least two functions which are the void setup() and void loop() functions. Void means that this function is not returning any value while the empty parenthesis means that this function is not taking any arguments as the input.

Serial.begin(9600);  // activates the serial communication at baud rate of 9600. This will be used for debugging purposes.

nodemcu.begin(9600); // activates the serial communication with Nodemcu connected with pin2 and pin3 of arduino and 9600 is the baud rate.


pinMode is a function and it takes two arguments as the input the pin number or pin name which is vresistor  and the status which can be input or output.

}

Then starts the void loop function.

vdata = analogRead(vresistor);  // reads the variable resistor and stores the value in vdata

  mystring = mystring + “Variable resistor: ” + vdata;  // we make a complete message, and send it to the Nodemcu module and also send it to the serial monitor and then empty the mystring variable for new data and then a delay of 1 second as 1000 milliseconds are equal to 1 second.

Now let’s discuss the Nodemcu programming.

Nodemcu ESP8266 wifi module Programming:


Nodemcu Program Explanation:

Before you start the programming, first of all, make sure that you download all the necessary libraries and you install the Nodemcu board and you also install a driver for the USB UART.

char auth[] = ” aa7fced027354cbe9b57307d404d98e2″;

this is the authentication number which was sent via email, I simply copied and past it over here.

// Your WiFi credentials.

// Set password to “” for open networks.

char ssid[] = “ZONG MBB-E8231-6E63”;

char pass[] = “08659650”;

This is the name of your wifi password.

Then, starts the void setup function. I have already explained these instructions in my previous tutorials on Nodemcu.

The void loop function consists of two if conditions.

   if (Serial.available() == 0 )

   {

  Blynk.run();

  timer.run(); // Initiates BlynkTimer

   }

  if (Serial.available() > 0 )

  {

    rdata = Serial.read();

    myString = myString+rdata;

  }

This if condition means, if Nodemcu module hasn’t received any data then simply keep executing Blynk.run and timer.run functions. While the other condition means if the Nodemcu module has received data from the Arduino then simply read the Nodemcu module and add the received characters with the mystring variable to make a complete message.


Sensorvalue1() function is a user-defined function and it is used to send the variable resistor value to the virtual pin 12 and finally, we empty the variable for new data, this is really important.

Note: for the Best understanding watch video tutorial given below.

Watch Video Tutorial:

 

Recommended For You

About the Author: Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

Close