Arduino ProjectsESP8266IOT Projects

Multiple analog sensors monitor using Nodemcu esp8266

Multipole Analog sensors with ESP8266:


multiple analog sensors with Nodemcu ESP8266 and Arduino- My previous tutorial was based on how to monitor an analog sensor using only the Nodemcu esp8266 wifi module and Blynk application. The disadvantage of using Nodemcu alone is that, you can monitor only one analog sensor, as in Nodemcu ESP8266 Wifi Module we have only one analog pin A0.

In many situations, you need to monitor multiple analog sensors. But when it comes to the Nodemcu esp8266 wifi module we can only monitor one analog sensor. As in Nodemcu module we have only one analog pin A0. But no worries we have some other options.  ,

  1. We can go for a multiplexer and use it with Nodemcu esp8266 wifi module and connect multiple analog sensors. Or
  2. We can use Nodemcu esp8266 wifi module with the Arduino Uno or Mega and connect as many sensors as we want.

The first option involves a lot of coding, wiring and its overall price increases above the price of Arduino UNO or mega. And you will find a lot of videos on this, but personally, I didn’t like this. While The second option is really easy, you don’t need heavy coding, you can connect many sensors as you want. So my choice is the second option.

So in this Tutorial, you will learn how to monitor multiple analog sensors using Nodemcu esp8266 wifi module, Arduino or mega, and Blynk Application.

For the libraries installation and Nodemcu esp8266 wifi module power supply making, you can watch a video given at the end of this Article.

Amazon Links:

12v Adaptor:

Arduino Uno

Arduino Nano

Mega 2560:

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!

Multiple Analog Sensors with Nodemcu ESP8266 Circuit Diagram:

multiple analog sensors

This is the complete circuit diagram of the multiple analog sensors monitoring using Nodemcu, Arduino Uno or Mega and Blynk application. For the schematics and PCB designing, I used Cadsoft eagle 9.1.0 Verison. This version of the Cadsoft eagle can be downloaded freely from the Cadsoft official website.

On the left side, you can see the 5V regulated power supply based on the LM7805 voltage regulator. This power supply is used to power up the Nodemcu ESP8266 Wifi Module. But as in this small project I am using only one sensor so that’s why I have not connected the output of the voltage regulator with the Vin Pin of the Nodemcu module. But my recommendation is, you should connect a wire from the output of the voltage regulator with the VIN pin of the Nodemcu Module.

When the sensors with the Arduino Uno or Mega board are increased, then the Arduino won’t be able to power up the Nodemcu Module, as a result the Nodemcu Module will keep resetting, and on the Blynk application it will show the Nodemcu module in the offline mode. So if you end up in a situation like this, then you should power up Nodemcu ESP8266 Wifi Module using the 5V regulated power supply, and don’t forget to add the capacitors.

A variable resistor is connected with A0 pin of Arduino and 5v to this variable resistor is given through pin4 of the Arduino, an LDR is connected in series with a 10k resistor, which makes a voltage divider and is connected with 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.

The reason for defining another serial port on pin number 2 and pin number 3 is that, we want to use the Arduino’s default serial port only for the debugging purposes. Using the Sofware serial library we can define multiple serial ports without any problem. So, in this project, the Arduino’s default serial port will be used for sending the information to the computer serial terminal while the with the other serial port Nodemcu esp8266 wifi module will be connected.

Note: this old version of the Blynk app is no more functional. For the blynk mobile App setup and dashboard setup ready my article on the New Blynk V2.0. In this article I have explained how to migrate your projects from Blynk 1.0 to the new Blynk V2.0. You can also watch the video.

Blynk Application:

The Blynk application designing is explained in the video given at the end of this Article.

Multiple Analog Sensors Programming:

In this project two programs are used, one program is written for the Arduino and another program is written for the Nodemcu esp8266 wifi module.

Multiple Analog Sensors Arduino Programming:

#include <SoftwareSerial.h>

SoftwareSerial nodemcu(2,3);

int sensor1 = A0;
int sensor2 = A1; 
int sensor3 = A2; 

int sdata1 = 0; // sensor1 data
int sdata2 = 0; // sensor2 data
int sdata3 = 0; // sensor3 data

String cdata; // complete data, consisting of sensors values

void setup()

pinMode(sensor1, INPUT);
pinMode(sensor2, INPUT);
pinMode(sensor3, INPUT);
digitalWrite(4, HIGH); 


void loop()
    sdata1 = analogRead(sensor1);
    sdata2 = analogRead(sensor2);
    sdata3 = analogRead(sensor3);
   cdata = cdata + sdata1+","+sdata2+","+sdata3; // comma will be used a delimeter
   delay(2000); // 100 milli seconds
   cdata = ""; 


Multiple Analog Sensors Nodemcu esp8266 wifi module Programming:

Before you start the programming first of all make sure you download all the necessary libraries and also make sure you install the latest version of the Arduino IDE.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SoftwareSerial.h>
#include <SimpleTimer.h>

char auth[] = "10febb08bd194876a96633b56e659eab";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ZONG MBB-E8231-6E63";
char pass[] = "08659650";

SimpleTimer timer;

String myString; // complete message from arduino, which consistors of snesors data
char rdata; // received charactors

int firstVal, secondVal,thirdVal; // sensors 
// This function sends Arduino's up time every second to Virtual Pin (1).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V1, millis() / 1000);

void setup()
  // Debug console

  Blynk.begin(auth, ssid, pass);



void loop()
   if (Serial.available() == 0 ) 
   {;; // Initiates BlynkTimer
  if (Serial.available() > 0 ) 
    rdata =; 
    myString = myString+ rdata; 
   // Serial.print(rdata);
    if( rdata == '\n')
   //  Serial.println(myString); 
  // Serial.println("fahad");
// new code
String l = getValue(myString, ',', 0);
String m = getValue(myString, ',', 1);
String n = getValue(myString, ',', 2); 

firstVal = l.toInt();
secondVal = m.toInt();
thirdVal = n.toInt();

  myString = "";
// end new code


void sensorvalue1()
int sdata = firstVal;
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V2, sdata);

void sensorvalue2()
int sdata = secondVal;
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V3, sdata);


String getValue(String data, char separator, int index)
    int found = 0;
    int strIndex[] = { 0, -1 };
    int maxIndex = data.length() - 1;

    for (int i = 0; i <= maxIndex && found <= index; i++) {
        if (data.charAt(i) == separator || i == maxIndex) {
            strIndex[0] = strIndex[1] + 1;
            strIndex[1] = (i == maxIndex) ? i+1 : i;
    return found > index ? data.substring(strIndex[0], strIndex[1]) : "";

Watch Video Tutorial:

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. Hi thanks for the good job. I only want to know if esp-01 could be used to replace the nodemcu in your tutorial. And if there’s any change/s to be made in the code. Thanks.

  2. hello,i have a question regarding the nodemcu 3.3v refrence voltage and you giving it 5v as a serial communication to the node it safe as doing it
    thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button