Someone help me out of this I continued working for three days but did not sleep well.
I am very depressed. My data with out the esp8266 module shows on the serial monitor but connecting with Blynk both in the app and on the serial monitor does not show.
CODE:
#define BLYNK_TEMPLATE_ID "TMPLPuOI0K84"
#define BLYNK_DEVICE_NAME "Solar Panel Monitoring SystemCopy"
#define BLYNK_AUTH_TOKEN "kkgd2KnVZJpQVxjrdbRZN9xxCx54836t"
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#define ESP8266_BAUD 115200
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <DHT.h>;
#include <SoftwareSerial.h>
//Constants
#define DHTPIN 4 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE);
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = " ";
char pass[] = " ";
// or Software Serial on Uno, Nano...
SoftwareSerial EspSerial(10, 11); // RX, TX
ESP8266 wifi(&EspSerial);
BlynkTimer timer;
void sendSensor() {
// put your setup code here, to run once:
float hum = dht.readHumidity();
float temp = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(hum) || isnan(temp)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Blynk.virtualWrite(V4, temp);
Blynk.virtualWrite(V5, hum);
Serial.print(" Temperature: ");
Serial.print(temp);
Serial.print(" Humidity: ");
Serial.print(hum);
}
void setup() {
// put your main code here, to run repeatedly:
Serial.begin(115200);
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
dht.begin();
timer.setInterval(1000L, sendSensor);
}
void loop(){
Blynk.run();
timer.run();
}
You are creating a SoftwareSerial port called EspSerial and initialising it at 115200 baud.
Unfortunately, the Arduino Uno or Nano that you’re using doesn’t have the processing power to emulate a serial port at this speed, so it’s working for a very short while, then failing.
You need to change the ESP8266_BAUD value to 9200, but at the same time you need to re-configure your ESP8266 to also communicate at 9200 baud. How you do this will depend on the hardware you are using and whether you have an FTDI adapter available to you.
I work on multiple sensor which give me data on analog pin in this way I need multiple analog pins.
sir if I buy the new ESP8266 so I can change the baud rate on AT command.
You can change the baud rate of your existing ESP8266, or buy a new one and change that. Either way, you need a way to connect the ESP8266 to your computer to do that. An FTDI is the simplest way of doing that, but there are other ways. It rather depends on the hardware you have available to you.
The ESP not responding message is usually caused by either:
mismatched baud rates
Incorrect wiring (Rx and Tx not crossed over, or other wiring issues)
I need just WiFi to transfer my virtual pin data to the cloud and also display it on a serial monitor like WEMOSE.
If I buy NODEMCU, I can do it or not.
I also re-flashed the ESP8266 and changed the Baud rate on the AT command, but now I check my default baud rate like AT+UART_DEF?. It shows me an error and also when I connect to Arduino, it shows me on the serial monitor that ESP is not responding. I am stressed.