No value in Blynk apps

I had followed your every detail instruction and boom its worked! Thank you very much for your help and guide sir. Iam really appreciate it :smile:

1 Like

Another question sir, I already used the A0 pin on my nodeMCU for the voltage sensor, can i use digital pin for my current sensor?

Presumably you’re using a voltage divider to measure the battery voltage.
How were you planning on measuring the current?


Yes, I am using voltage divider to measure the battery voltage.
For the current, I am planning to use ACS712 current sensor as picture below


The ACS712 provides an analogue output, so can’t be used with a digital pin.
You’d need to use a multiplexer to give more analogue pins.

The ACS712 has a maximum current rating of 30A (assuming you buy the correct module) and all of the current being drawn has to go via the sensor. If this is for a leisure battery then it could be okay (maybe).


1 Like

Multiplexer for example like ADS1115 (in the picture below)? Will it need extra coding to pair it with nodeMCU?


I was thinking more like the 74HC4051 Multiplexer, which is in effect an electronically controlled selector switch that connects your existing analogue to one of 8 (in this case) analogue inputs, rather than an analogue to digital converter like the ADS1115 - although either would work.

Both would requite additional coding, but in different ways.

Another option is to use an ESP32 board, but once again, coding changes would be needed.

Are you 100% sure about being able to pass all the current you want to measure through the ACS712?



Better buy LoLin ESP32 with 18 ADC for only 5$ ?

1 Like

well i am only measuring current about 2A max so maybe the ACS712 will able to do it. OR maybe I just buy a sensor that can detect both current and voltage?

But I already bought the ESP8266 and the ACS712 sensor, wanna make full use of them

Unfortunately both your voltage and current sensing methods each require an analog pin, of which an ESP8266 only has one. So if you want to make full use, then you need to either add in a ADC multiplexor, change to an ESP32 with multiple ADC ports or use a different sensor like the INA219 that runs on i2C and will read both voltage and current as well as being much more accurate than the ACS712.

I have used both for similar monitoring of a battery and charge… and a bunch of other stuff…


Nice project! Is that INA219 sensor you using in your project doesnt required analogpin and can detect both current, voltage and even power? It is suitable to detect 15V max and 2A max rating?

It uses the i2C communication bus.

Yes, no problem. 0 to 26 VDC and the current is read via a shunt so not sure the max, but probably whatever the primary contacts are good for. I think I have seen as high as 4-5A on my solar charger.


Great! I’ve decided to give INA219 a try and already ordered it from my supplier

It seem I can find any connection diagram for my ESP8266 nodeMCU to connect with INA219. I try connecting the SCL and SDA pin of the INA219 into my D1&D2 pin of my nodeMCU but the INA219 become hot and I afraid I might have burn it. Can help me with my connection?

here is another Forum topic that might help…

I have following all the guide that you have given to me but I got this whether there are load or no load connected to the Vin+ and Vin- of the INA219.

These are my latest code

#include <Wire.h>
#include <Adafruit_INA219.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>

Adafruit_INA219 sensor219;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "-";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "-";
char pass[] = "-";

#define DHTPIN 0          // D3
// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11

BlynkTimer timer;
float setpoint = 0;
bool relayoff = true;
const int relayPin = 12;  // D6;

BLYNK_WRITE(V0)  // slider widget
  setpoint = param.asFloat();
  relayoff = true;  

int analogInput = A0;
float vout = 0.0;
float vin = 0.0;
float R1 = 30000.0; //  
float R2 = 7500.0; // 
int value = 0;  

  float busVoltage = 0;
  float current = 0; // Measure in milli amps
  float power = 0;
void sendSensor()

  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, t);
  Blynk.virtualWrite(V6, h);
  if((setpoint < t) && (relayoff == true))
    digitalWrite(relayPin, 0); // assuming relay is active HIGH
    relayoff = true;
  if((setpoint > t) && (relayoff == true))
    digitalWrite(relayPin, 1); // assuming relay is active HIGH
    relayoff = true;

   // read the value at analog input
  value = analogRead(analogInput);
  vout = (value * 3.3) / 1024.0;
  vin = vout / (R2/(R1+R2));         
  Serial.print("INPUT V= ");
  Blynk.virtualWrite(V1, vin);

  busVoltage = sensor219.getBusVoltage_V();
  current = sensor219.getCurrent_mA();
  power = busVoltage * (current/1000); // Calculate the Power
  Serial.print("Bus Voltage:   "); 
  Serial.println(" V");  
  Serial.print("Current:       "); 
  Serial.println(" mA");
  Serial.print("Power:         "); 
  Serial.println(" W");  


  Blynk.virtualWrite(V2, busVoltage);

void setup()
   Wire.begin(4,5); //SDA, SCL
   pinMode(analogInput, INPUT);
   Serial.print("DC VOLTMETER");
   Blynk.begin(auth, ssid, pass);
   pinMode(relayPin, OUTPUT);

  // Setup a function to be called every second
  timer.setInterval(5000L, sendSensor);

void loop()

I connected the SCL to D1 and SDA to D2

Hello, I have problem regarding with INA219 sensor. I have tried the sensor on my Arduino Uno and it work. But when I connect the INA219 to my NodeMCU, its not working. I had connected the SCL to D1 and SDA to D2 from INA219 to NodeMCU. I am suspecting that the I2C pin on my NodeMCU is not active. Iam using below code.

include <Wire.h>
#include <Adafruit_INA219.h>

Adafruit_INA219 ina219;

void setup(void) 
  while (!Serial) {
      // will pause Zero, Leonardo, etc until serial console opens

  uint32_t currentFrequency;
  // Initialize the INA219.
  // By default the initialization will use the largest range (32V, 2A).  However
  // you can call a setCalibration function to change this range (see comments).
  // To use a slightly lower 32V, 1A range (higher precision on amps):
  // Or to use a lower 16V, 400mA range (higher precision on volts and amps):

  Serial.println("Measuring voltage and current with INA219 ...");

void loop(void) 
  float shuntvoltage = 0;
  float busvoltage = 0;
  float current_mA = 0;
  float loadvoltage = 0;
  float power_mW = 0;

  shuntvoltage = ina219.getShuntVoltage_mV();
  busvoltage = ina219.getBusVoltage_V();
  current_mA = ina219.getCurrent_mA();
  power_mW = ina219.getPower_mW();
  loadvoltage = busvoltage + (shuntvoltage / 1000);
  Serial.print("Bus Voltage:   "); Serial.print(busvoltage); Serial.println(" V");
  Serial.print("Shunt Voltage: "); Serial.print(shuntvoltage); Serial.println(" mV");
  Serial.print("Load Voltage:  "); Serial.print(loadvoltage); Serial.println(" V");
  Serial.print("Current:       "); Serial.print(current_mA); Serial.println(" mA");
  Serial.print("Power:         "); Serial.print(power_mW); Serial.println(" mW");


This what Iam getting on the NodeMCU

I had figure out the problem within my project. The problem was my NodeMCU i2c pin, it work fine after i switch the NodeMCU with new one. The problem is the voltage showing is not correct with my battery voltage which 12V. How do I fix this