Good day to all I have a problem. I don’t know whether it’s about blynk or my node. My issue is that when I connect my node to my laptop it sends the data to my blynk in the website but if I use my charger 5v as the power supply then it only shows online on the blynk website but no values are sent. What could be a solution for this one? Note that I used the same wire on my charger and on my laptop to power my nodemcu.
#define BLYNK_TEMPLATE_ID "TMPL64qpH6bPb"
#define BLYNK_TEMPLATE_NAME "mq137"
#define BLYNK_AUTH_TOKEN "zeFfyjNsRBwxi2LXwTTR2ZQ2njAa9F8p"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>
#include <BlynkSimpleEsp8266.h>
char auth[x] = "zeFfyjNsRBwxi2LXwTTR2ZQ2njAa9F8p"; // Replace with your Blynk Auth Token
char ssid[x] = "waWifi"; // Replace with your Wi-Fi SSID
char pass[] = "123456789"; // Replace with your Wi-Fi Password
SoftwareSerial nodemcuSerial(D7, D8); // RX, TX pins on NodeMCU
BlynkTimer timer;
void myTimer() {
while (nodemcuSerial.available()) {
String data = nodemcuSerial.readStringUntil('\n');
// Split the received data into ammonia and CO2 values
int commaIndex = data.indexOf(',');
String ammoniaValue = data.substring(0, commaIndex);
String co2Value = data.substring(commaIndex + 1);
float ppmValueAmmonia = ammoniaValue.toFloat();
float ppmValueCO2 = co2Value.toFloat();
Blynk.virtualWrite(V0, ppmValueAmmonia); // Send the ammonia ppm value to V0
Blynk.virtualWrite(V1, ppmValueCO2); // Send the CO2 ppm value to V1
Serial.print("Received ppm values - Ammonia: ");
Serial.print(ppmValueAmmonia);
Serial.print(", CO2: ");
Serial.println(ppmValueCO2); // Print ppm values to the serial monitor
}
}
void setup() {
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
nodemcuSerial.begin(9600);
timer.setInterval(1000L, myTimer);
}
void loop() {
Blynk.run();
timer.run();
}
thanks in advance.