Nodemcu with Arduino, Serial Communication, Control and Monitoring

(Last Updated On: April 7, 2021)

Nodemcu with Arduino

Nodemcu With Arduino, Description:

Nodemcu with Arduino– In this tutorial, you will learn how to do Serial communication between Arduino and Nodemcu esp8266 wifi module. For the demonstration purpose in this project LDR and variable resistor will be monitored using the Blynk Application. The Variable Resistor and LDR values will be displayed on the Gauges using the Blynk Application.  Monitoring two Analog sensors is only possible due to the use of the Arduino Uno.

At the end of this tutorial, you will be able to monitor multiple analog sensors and you will also be able to control multiple loads. In this project, no multiplexers will be used. All the sensors and loads will be connected in a normal way. In this Tutorial, I will also explain why we need to connect the Nodemcu and Arduino Uno together. I will also explain when and when not use the Arduino Uno with the Nodemcu ESP8266 wifi module. Without any further delay, let’s get started!!!

Amazon Links:

12v Adaptor:

Arduino Uno

Arduino Nano

Nodemcu ESP8266 WiFi Module:

LM7805 Voltage Regulator:

470uf capacitor:

330-ohm resistor:

DC Female Power Jack:

Female Headers:

Male Headers:

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines


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!

Arduino and Nodemcu ESP8266 together:

I know we can make the same project using only the Nodemcu ESP8266 Wifi module, and we can reduce the project size, power and building time, etc. You know very well the Nodemcu ESP8266 Wifi module has a very limited number of the IO pins, and there is only 1 analog Pin. I have been frequently asked by my followers on YouTube Channel “Electronic Clinic” that how to connect multiple analog sensors or how to increase the IO pins of the Nodemcu Module. My replay is, always use Arduino or Mega with the Nodemcu Module. We can also use a multiplexer, but that needs wiring and complicated programming which we really don’t want. So the easiest option is to use the Arduino Uno or Mega with the Nodemcu ESP8266 Wifi module.

So, that’s the reason I am using Arduino Uno with the Nodemcu Module. In this project, you will learn completely how to connect the Nodemcu module with the Arduino and how to establish Serial Communication. As this project is based on two-way communication, so, in this project we will be monitoring the sensors and controlling some electrical loads both at the same time using the Blynk Application. This project can be easily modified and can be used to monitor any type of sensors.

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.

Nodemcu with Arduino Circuit Diagram:

Nodemcu with Arduino

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

Let’s first start with the regulated Power Supply which is based on the famous LM7805 voltage Regulator. This Regulated Power Supply will be used to power up the Nodemcu ESP8266 wifi module. J1 is the female Power Jack and this is where we connect a 12v Adaptor or Battery or a Solar Panel. Two 470Uf capacitors are connected at the input and output of the voltage regulator. A 330 Ohm resistor is connected in series with a 2.5v LED. This is a current limiting resistor. This is a Power ON LED and it’s the only purpose is to show that the circuit is Turned ON.

The Output of the Regulated Power Supply is connected with the Vin pin of the Nodemcu ESP8266 Wifi Module and the ground is connected with the ground.

A variable resistor is connected with the A0 pin of Arduino, an LDR is connected in series with a 10k resistor, which makes a voltage divider and is connected with the A1 pin of the Arduino. The Tx and Rx pin’s of the Nodemcu are connected with pin2 and pin3 of the Arduino. So the Nodemcu will communicate serially with Arduino Uno through pin2 and pin3. Pin2 is Rx and pin3 is Tx, which will be defined in the programming using the software serial library.

For controlling these relays we will need relay drivers, the relay drivers simply consist of the 2n2222 NPN transistors, 10k ohm resistors, and diodes. As you can see a 10k resistor is connected with the base of 2n2222 NPN transistor as it’s a BJT “bipolar junction transistor” a current controlled device, that’s why we need a current limiting resistor. We usually use a 10k resistor. The emitter of the 2n2222 NPN transistor is connected with the ground while the collector is connected with one side of the relay coil, while the other side of the relay coil is connected with the 12 volts. This relay can be energized and de-energized using this transistor.  As you can see this relay consists of 5 pins, two coil Pins, common, normally closed and normally open. These three pins have no physical connection with the coil pins.

Nodemcu with Arduino

So this is the relay module, you can also use the readymade relay module.

Nodemcu with Arduino

these are 10k resistors connected with the base of 2n2222 NPN transistors,

Nodemcu with Arduino

these are the 1n4007 diodes connected across the relay coil pins,

Nodemcu with Arduino

these are 12v SPDT type relays and these are the terminal blocks. I have soldered some jumper wires so that this relay module can be easily interfaced with other circuits. This relay module consists of 7 relays but I will be using 2 relays. Connect 2 relays with pin number13…and …pin number12 of the Arduino Uno or mega And connect the relay module ground with the ground of Arduino.

Blynk Application Designing:

For the complete step by step application designing watch video tutorial given at the end of this article or following the instructions given below.

  • First of all, open the blynk application…..
  • set the project name as Control and monitor…..
  • Click on the chosen device and select nodemcu….
  • Make sure you set the connection type to wifi….
  • Then click on the create button, an authentication token will be sent on your email id, which will be then used in programming, simply copy and paste it in programming.
  • click on the screen and add a Gauge…..
  • Click on the gauge and set the name as variable resistor…..
  • Now click on the pin and select virtual and select v2….
  • Change the font….click on the push and select 1 second…..
  • Now add another gauge and repeat the same steps. After you are done with adding the Gauges on the screen, then start adding the numeric inputs.
  • Click on the screen and add numeric input……
  • Click on the numeric input, click the pin and select the virtual pin10.
  • Set the minimum value to 10 and the maximum value to 11. These 10 and 11 values will be used to control the relay connected with pin13 of the Arduino. finally set the name as relay1, if you want you can also change the font.
  • Now repeat the same steps for other numeric input and re-arrange the gauges and numeric inputs and change the color if you want.

Nodemcu with Arduino

Our basic application setup is completed.

Nodemcu with Arduino Programming:

This Project is based on two Programs, one program is written for the Arduino Uno while the other program is written for the Nodemcu ESP8266 Wifi Module. First let’s start with the Arduino Programming.

Arduino Programming:

Nodemcu Programming:

For the programs explanation, watch the following Video. Don’t forget to Subscribe. Support my channel by liking this video and sharing this video.

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


  1. hello, I followed his interesting video, I am trying to use the same communication method but I did not understand this part of the code, could you explain me what it does and how it works?
    String getValue(String data, char separator, int index)
    int found = 0;
    int strIndex[] = { 0, -1 };
    int maxIndex = data.length() – 1;


    1. this code is used to split string messages. let’s say you have a message something like.
      let’s say you want to split this message using comma as the delimiter. this is helpful when you have multiple sensors values and you want to split these values on the receiver side. you can use any character as the delimiter.

Leave a Reply

%d bloggers like this: