Blynk app for remote monitoring Nodemcu esp8266 and Arduino

Blynk app

Description:

Blynk app– Using the Nodemcu esp8266 wifi module and  Arduino, you can learn how to use the blynk app application terminal widget to show the sensor data. If you’re using Arduino, you’ll know which serial monitor is being used for. Typically the serial monitor is used for debugging purposes.

The Terminal Widget program from Blynk app is just like the Serial Monitor from Arduino. The only difference is that the Arduino Serial monitor only operates when the Arduino is attached to the laptop or device, while the Blynk app Terminal Widget program is completely wireless and can be used to control remotely. You can monitor your sensors from anywhere in the world using the Blynk app device terminal widget. I will also show the value of the sensor on the serial monitor of Arduino.

I’m going to use a variable resistor as the sensor for the best understanding.

Today’s episode covers

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

Let’s continue without any further delay!!!

The Amazon Purchase links are given below:

Nodemcu esp8266 wifi module: Best price https://amzn.to/2MyzgFY
Arduino Uno: https://amzn.to/39aq6ZT
Mega 2560: https://amzn.to/2SszMsI
lm7805 Voltage Regulator: https://amzn.to/2ERYoTJ
330-ohm resistors pack: https://amzn.to/2Qj1Igg
female DC power jack socket: https://amzn.to/377Pg9M
470uf capacitors: https://amzn.to/2MrN3xR
5×7 cm Vero board: https://amzn.to/37b7KWO
female headers: https://amzn.to/350w6RE
connection wires: https://amzn.to/2MvOJXd
Super Starter kit for Beginners: https://amzn.to/398dliF
Jumper Wires: https://amzn.to/2SrnBwo
Bread Board: https://amzn.to/2MxV5FM
12v Adaptor: https://amzn.to/2MuOlZk
PCB plate: https://amzn.to/2MuwNMB
Variable Supply: https://amzn.to/39d0KdP
Digital Multimeter: https://amzn.to/34WbVoa
Vero Board / stripboard: https://amzn.to/39nL9Zg
Soldering iron kit: “best” You guys should definitely purchase this: https://amzn.to/2PVwexF
Solder wire: https://amzn.to/2QlOvTS
Wire Stripper: https://amzn.to/353tYJa
wirecutter: https://amzn.to/2tV2lFj
PCB small portable drill machine: https://amzn.to/2MvQqnx

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!



Circuit Diagram:

Blynk app

This circuit schematic is designed in cadsoft eagle 9.1.0 version.

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 app

Blynk Mobile App Setup:

First of all, open the blynk app

Blynk app

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

Blynk app

Click on the chosen device and select Nodemcu.

set the connection type to wifi.

Blynk app

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 app


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

Blynk app

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

Blynk app

Now click on the terminal to open the settings.

Blynk app

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 on Arduino’s pin number 2 with the name Nodemcu and pin number 3.

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

int vresistor = A0; // A variable resistor is attached to the Arduino’s analog pin A0.

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 which takes two arguments as the input.

}

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, then send it to the serial monitor, then empty the mystery variable for new data and then 1 second delay as 1000 milliseconds is equivalent to 1 second.
Now let’s talk about programming for Nodemcu.

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 the conditions.

if (Serial.available() == 0 )

{

Blynk.run();

timer.run(); // Initiates BlynkTimer

}

if (Serial.available() > 0 )

{

rdata = Serial.read();

myString = myString+rdata;

}


If this means state, if no data has been obtained by the Nodemcu module, simply continue to run Blynk app.run and timer.run functions. While the other condition means that if the Nodemcu module has received data from the Arduino, only read the Nodemcu module and add the characters obtained 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.

Watch Video Tutorial

Recommended For You

Leave a Reply

%d bloggers like this: