[SOLVED][1661] ESP is not responding

I using esp 01 adapter to connect with arduino
Vcc- 5V for Arduino Uno
Gnd-Gnd
RX-2
TX-3

SENSOR-LM35 , MAX30102

image

firmware i use is this https://www.youtube.com/watch?app=desktop&v=MPyShmRcgD0

My project is Health Monitoring System, here is the coding

#define BLYNK_TEMPLATE_NAME "Heath Monitoring System"
#define BLYNK_AUTH_TOKEN "KqgPmpyCAf9XrWiLNWWmREecLQUEYfBP"

#define BLYNK_PRINT Serial

#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include "MAX30102_PulseOximeter.h"
char auth[] = BLYNK_AUTH_TOKEN;

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "";
char pass[] = "";
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX\

// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600

ESP8266 wifi(&EspSerial);

#define REPORTING_PERIOD_MS     1000
#define sensor A0

LiquidCrystal_I2C lcd(0x27, 16, 2);

byte smile[] = {
  B00000,
  B00000,
  B01010,
  B00000,
  B10001,
  B01110,
  B00000,
  B00000
};
byte mod[] = {
  B00000,
  B00000,
  B01010,
  B00000,
  B11111,
  B00000,
  B00000,
  B00000
};
byte sad[] = {
  B00000,
  B00000,
  B01010,
  B00000,
  B01110,
  B10001,
  B00000,
  B00000
};

PulseOximeter pox;
uint32_t tsLastReport = 0;
float BPM, SpO2;

void onBeatDetected()
{

  Serial.println("Beat!!!");

}

void setup()
{
  Serial.begin(9600);
  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  //Blynk.begin(auth, wifi, ssid, pass);
  // You can also specify server:
  Blynk.begin(auth, wifi, ssid, pass, "blynk.cloud", 80);
  //Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);

  lcd.init();
  lcd.backlight();
  lcd.createChar(1 , smile);
  lcd.createChar(2 , mod);
  lcd.createChar(3 , sad);
  lcd.setCursor(0, 0);
  lcd.print("      Pluse");
  lcd.setCursor(0, 1);
  lcd.print("    Oximeter");
  delay(2000);
  
  if (!pox.begin()) {
    Serial.println("FAILED");
    for (;;);
  } else {
    Serial.println("SUCCESS");
  }
  pox.setIRLedCurrent(MAX30102_LED_CURR_7_6MA);

  pox.setOnBeatDetectedCallback(onBeatDetected);

}

void temperature()
{
  float reading=analogRead(sensor);
  float temperature=reading*((5.0*100.0-0.5)/1024.0); //VOTAGE*ADC converting from 10 mv per degree wit 500 mV offset to degrees ((voltage - 500mV) times 100)
  delay(10);
  
  /*------Display Result------*/

  lcd.setCursor(12,0);
  lcd.print(temperature,1);
  lcd.print("C");
}

void loop()
{
    Blynk.run();
    BPM = pox.getHeartRate();
    SpO2 = pox.getSpO2();

  pox.update();
  if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
    Blynk.virtualWrite(V4, BPM);
    Blynk.virtualWrite(V1, SpO2);
        
    lcd.clear();
    lcd.setCursor(0 , 0);
    lcd.print("BPM : ");
    lcd.print(pox.getHeartRate(),1);

    lcd.setCursor(0 , 1);
    lcd.print("Sp02: ");
    lcd.print(pox.getSpO2());
    lcd.print("%");
    tsLastReport = millis();
  
    if (pox.getSpO2() >= 96) {
      lcd.setCursor(15 , 1);
      lcd.write(1);                 
    }
    else if (pox.getSpO2() <= 95 && pox.getSpO2() >= 91) {
      lcd.setCursor(15 , 1);
      lcd.write(2);                 
    }
    else if (pox.getSpO2() <= 90) {
      lcd.setCursor(15 , 1);
      lcd.write(3);
    }
    temperature();


  }

}

You need to connect Rx on one device to Tx on the other device, and vice-versa.

So, the connections should be…

Pin 2 on the Uno (Rx) —> Tx pin on the ESP-01
Pin 3 on the Uno (Tx) —> Rx pin on the ESP-01

You need to ensure that your ESP-01 is configured to communicate at the same baud rate.

More info on all of this here…

Pete.

Thank you Mr Pete. The connection I changed but still have a same issues.


I think is baud rate problem but i always get AT+ UART Error. Thanks a lot.


The esp 01 connected using Esp01 Programmer Adapter

I don’t understand what your two screenshots are meant to represent.

Pete.

The first screenshot is shown AT command"AT+UART?" show error. the second screenshot shown connection options of esp 01. Sorry for my careless of forgot mention what is these things


The good news is esp 01 can work now. but just for a few second maybe i need to improve my coding. Thanks for your help Pete!

Yes, you do….

None of this (except Blynk.run()) should be in your void loop. You certainly can’t be doing Blynk.virtualWrites in your void loop, otherwise you’ll flood the server.

The majority of this code should be in a function that is called using a BlynkTimer. You should read this…

Pete.

Why is this thing so complicated? I’ve been following your answers from several other questions and running into problems over and over again. Could you please provide me with detailed instrcuctions or point me towards one?

PS: I am using an arduino uno and esp01.

Thanks.

It’s complicated because of your poor hardware choices. The Uno has no internet connectivity, and you’re trying to use a far more powerful processor (the ESP8266) as a WiFi modem for your Uno via serial communications. To make matters worse, your Uno has only one hardware serial port (which you need to use for debugging), so you need to simulate a second serial port using SoftwareSerial - but the Uno doesn’t have the processing power to do this at baud rates higher than 9600.
To get this to work, the ESP8266 needs to be running the correct AT firmware, it needs to be configured to accept and send data at a baud rate that the Uno is using (9600) and it needs to be wired-up to the Uno correctly.
Even when you’ve done all of this, you don’t have the same level of functionality that you have with a board that has native IoT connectivity, because you can’t access the ESP8266’s WiFi connectivity tools directly, so you can’t access functions like querying the RSSI, SSID, BSSID, IPAddress, MAC etc of the ESP8266 and you can’t use functionality like Blynk Edgent, Blynk.Air Blynk.config() and Blynk.connect().

None of these issues exist if you choose an IoT enabled board such as the NodeMCU, Wemos D1 Mini, ESP32 etc.

If you feel the need to persist with the hardware you have, then you should read this guide…

Pete.