Firebeetle ESP 32 error or my laptop?

A fatal error occurred: Failed to connect to ESP32: Download mode successfully detected, but getting no sync reply: The serial TX path seems to be down.
For troubleshooting steps visit: Troubleshooting - ESP32 - — esptool.py latest documentation
Failed uploading: uploading error: exit status 2

I a using an esp32 fire beetle with some sensors after doing trouble shouting and changing equipment I get this new error, I don't think its my codes or connection but my laptop having the issue but this is the program

#include <Arduino.h>
#include "DFRobot_LCD.h"
#include <Wire.h>
#include "WiFi.h"



// DO SENSOR-----------------------------------------------------------------/
#define DO_PIN A1
#define VREF 5000     // VREF(mv)
#define ADC_RES 1024  //ADC Resolution/

#define SINGLE_POINT_CALIBRATION 0
#define READ_TEMP (25)

#define CAL1_V (8354)  //mv  CHANGE AFTER CALIBRATION
#define CAL1_T (25)    //℃


const uint16_t DO_Table[41] = {
  14460, 14220, 13820, 13440, 13090, 12740, 12420, 12110, 11810, 11530,
  11260, 11010, 10770, 10530, 10300, 10080, 9860, 9660, 9460, 9270,
  9080, 8900, 8730, 8570, 8410, 8250, 8110, 7960, 7820, 7690,
  7560, 7430, 7300, 7180, 7070, 6950, 6840, 6730, 6630, 6530, 6410
};

uint8_t Temperaturet;
uint16_t ADC_Raw;
uint16_t ADC_Voltage;
uint16_t DO;

int16_t readDO(uint32_t voltage_mv, uint8_t temperature_c) {
#if SINGLE_POINT_CALIBRATION == 00
  uint16_t V_saturation = (uint32_t)CAL1_V + (uint32_t)35 * temperature_c - (uint32_t)CAL1_T * 35;
  return (voltage_mv * DO_Table[temperature_c] / V_saturation);
#else
  uint16_t V_saturation = (int16_t)((int8_t)temperature_c - CAL2_T) * ((uint16_t)CAL1_V - CAL2_V) / ((uint8_t)CAL1_T - CAL2_T) + CAL2_V;
  return (voltage_mv * DO_Table[temperature_c] / V_saturation);
#endif
}

// pH SENSOR---------------------------------------/
DFRobot_LCD lcd(16, 2);  //16 characters and 2 lines of show

#define PH_PIN 25
float voltage, phvalue, temperature = 25;

float acidVoltage = 2000;     //buffer solution at 4.o
float neutralVoltage = 1390;  //buffer solution at 7.o

const int Sensor_MINvalue1 = 6.5;  // +-0.5 from ph 4.0
const int Sensor_MAXvalue1 = 7.5;



void setup() {
  Serial.begin(115200);


  // LCD Begin //
  lcd.init();
  lcd.setCursor(4, 0);
  lcd.print("Welcome");
  delay(1000);
  lcd.clear();

  lcd.setCursor(3, 0);
  lcd.print("Reading ");
  lcd.setCursor(3, 1);
  lcd.print("pH & DO");
  delay(1000);
  lcd.clear();

  lcd.setCursor(3, 0);
  lcd.print("Please Wait");
  delay(1000);
  lcd.clear();
}



void loop() {



  //pH SENSOR--------------------------------------//
  static unsigned long timepoint = millis();
  if (millis() - timepoint > 1000U) {
    timepoint = millis();  // timepoint = read temperature **

    voltage = analogRead(PH_PIN) / 4095.0 * 3300;


    float slope = (7.0 - 4.0) / ((neutralVoltage - 1500) / 30 - (acidVoltage - 1500) / 3.0);
    float intercept = 7.0 - slope * (neutralVoltage - 1500) / 3.0;


    phvalue = slope * (voltage - 1500) / 3.0 + intercept;  // y=k*x + b [formula]

    if (phvalue < Sensor_MAXvalue1 && phvalue > Sensor_MINvalue1) {
      Serial.print("Voltage:");
      Serial.print(voltage, 1);
      Serial.print("PH:");
      Serial.println(phvalue, 2);

      //LCD setting 16x2
      lcd.setCursor(0, 0);
      lcd.print("PH: ");

      lcd.print(phvalue, 2);

      lcd.setCursor(0, 1);
      lcd.print("Volt: ");
      lcd.print(voltage / 1000, 2);
    } else {
      lcd.init();
      lcd.setCursor(0, 0);
      lcd.print("DOSING REQUIRED");
      delay(1000);
      lcd.clear();
    }
  }

  Temperaturet = (uint8_t)READ_TEMP;
  ADC_Raw = analogRead(DO_PIN);
  ADC_Voltage = uint32_t(VREF) * ADC_Raw / ADC_RES;

  Serial.print("Temperaturet:\t" + String(Temperaturet) + "\t");
  Serial.print("ADC RAW:\t" + String(ADC_Raw) + "\t");
  Serial.print("ADC Voltage:\t" + String(ADC_Voltage) + "\t");
  Serial.println("DO:\t" + String(readDO(ADC_Voltage, Temperaturet)) + "\t");

  //LCD setting 16x2
  lcd.setCursor(9, 0);
  lcd.print((readDO(ADC_Voltage, Temperaturet)) / 1000);
  lcd.print("mg/L");
  delay(5000);
  lcd.clear();
  return;
}

Close the Arduino IDE, disconnect the ESP32. Open the Arduino IDE, write down the serial ports available with no MCU's connected. Close the IDE. Plug in the ESP32, open the IDE, does a new serial port show up in the lsit?

i tried uploding my program whcih was successful multiple before however when I wanted to upload it today, there was a "Failed uploading: uploading error: exit status 2"

Please enable verbose output during upload and disable verbose output during compilation, perform an upload and post the results here (just in case, no pictures please, the full text as text).

Further your post is lacking detail.

  1. Which operating system?
  2. Which version of the IDE?
  3. Which board?

have a look at how-to-get-the-best-out-of-this-forum

i am using a esp32 fire beetle when I upload it before i was successful however now it does not allow .it Says 'Failed uploading: uploading error: exit status 2"
this is my code

#include <Arduino.h>
#include "DFRobot_LCD.h"
#include <Wire.h>

// DO SENSOR-----------------------------------------------------------------/
#define DO_PIN A1
#define VREF 5000 // VREF(mv) 
#define ADC_RES 1024 //ADC Resolution/

#define SINGLE_POINT_CALIBRATION 0
#define READ_TEMP (25)

#define CAL1_V (8354) //mv  CHANGE AFTER CALIBRATION
#define CAL1_T (25)   //℃


const uint16_t DO_Table[41] = {
  14460, 14220, 13820, 13440, 13090, 12740, 12420, 12110, 11810, 11530,
  11260, 11010, 10770, 10530, 10300, 10080, 9860, 9660, 9460, 9270,
  9080, 8900, 8730, 8570, 8410, 8250, 8110, 7960, 7820, 7690,
  7560, 7430, 7300, 7180, 7070, 6950, 6840, 6730, 6630, 6530, 6410};

uint8_t Temperaturet;
uint16_t ADC_Raw;
uint16_t ADC_Voltage;
uint16_t DO;

int16_t readDO(uint32_t voltage_mv, uint8_t temperature_c)
{
  #if SINGLE_POINT_CALIBRATION == 00
    uint16_t V_saturation = (uint32_t)CAL1_V + (uint32_t)35 * temperature_c - (uint32_t)CAL1_T * 35;
    return (voltage_mv * DO_Table[temperature_c] / V_saturation);
  #else
    uint16_t V_saturation = (int16_t)((int8_t)temperature_c - CAL2_T) * ((uint16_t)CAL1_V - CAL2_V) / ((uint8_t)CAL1_T - CAL2_T) + CAL2_V;
    return (voltage_mv * DO_Table[temperature_c] / V_saturation);
  #endif
}

// pH SENSOR---------------------------------------/
DFRobot_LCD lcd(16, 2); //16 characters and 2 lines of show

#define PH_PIN 25 
float voltage,phvalue,temperature = 25;

float acidVoltage = 2000; //buffer solution at 4.o 
float neutralVoltage = 1390;   //buffer solution at 7.o 

const int Sensor_MINvalue1 = 6.5; // +-0.5 from ph 4.0
const int Sensor_MAXvalue1 = 7.5;



void setup()
{
  Serial.begin(115200);
  pinMode(DO, OUTPUT);  

    // LCD Begin //
  lcd.init();
  lcd.setCursor(4,0);
  lcd.print("Welcome");
  delay(1000);
  lcd.clear();

  lcd.setCursor(3,0);
  lcd.print("Reading ");
  lcd.setCursor(3,1);
  lcd.print("pH & DO");
  delay(1000);
  lcd.clear();

  lcd.setCursor(3,0);
  lcd.print("Please Wait");
  delay(1000);
  lcd.clear();
}



void loop()
{
    
    //-----------------------------------------------------------------------------------//
  //pH SENSOR
    static unsigned long timepoint = millis();

    if(millis()-timepoint>1000U){
      timepoint = millis();// timepoint = read temperature 

      voltage = analogRead (PH_PIN)/1024.0*5000; 

      float slope = (7.0-4.0)/((neutralVoltage-1500)/30 - (acidVoltage-1500)/3.0);
      float intercept = 7.0 - slope*(neutralVoltage-1500)/3.0;

      phvalue = slope*(voltage-1500)/3.0 + intercept;   // y=k*x + b [formula]

      if( phvalue < Sensor_MAXvalue1 && phvalue > Sensor_MINvalue1 ){
         Serial.print("Voltage:");
         Serial.print(voltage,1);
         Serial.print("PH:");
         Serial.println(phvalue,2);

          //LCD setting 16x2
         lcd.setCursor(0,0);
         lcd.print("PH:");
        
         lcd.print(phvalue,2);

         lcd.setCursor(0,1);
         lcd.print("Volt:");
         lcd.print(voltage/1000,2);} 
      else {
        lcd.init();
        lcd.setCursor(0,0);
        lcd.print("DOSING REQUIRED");
        digitalWrite(DO, HIGH);// turn relay OFF
        delay(3000);
        lcd.clear(); }   
    }

    Temperaturet = (uint8_t)READ_TEMP;
    ADC_Raw = analogRead(DO_PIN);
    ADC_Voltage = uint32_t(VREF) * ADC_Raw / ADC_RES;

    Serial.print("Temperaturet:\t" + String(Temperaturet) + "\t");
    Serial.print("ADC RAW:\t" + String(ADC_Raw) + "\t");
    Serial.print("ADC Voltage:\t" + String(ADC_Voltage) + "\t");
    Serial.println("DO:\t" + String(readDO(ADC_Voltage, Temperaturet)) + "\t"); 

    lcd.setCursor(9,0);
    lcd.print((readDO(ADC_Voltage, Temperaturet))/1000);
    lcd.print("mg/L");
    delay(5000);
    lcd.clear();   
    return; 
}

have you updated the IDE or changed your system recently ?
try pressing the RESET button before upload
check the COM port by running Windows device manager - under Ports (COM & LPT) you should see the COM port appear and disappear as you plug/unplug the ESP32 connector
under File>Preferences > Show Verbose output during click compile and upload
click Upload button then upload the resultant text

i have done all this but i still get the same issue

You certainly have not done this as requested.

what do u mean?


#include <Arduino.h>
#include "DFRobot_LCD.h"
#include <Wire.h>


// DO SENSOR-----------------------------------------------------------------/
#define DO_PIN A1
#define VREF 5000 // VREF(mv) 
#define ADC_RES 1024 //ADC Resolution/

#define SINGLE_POINT_CALIBRATION 0
#define READ_TEMP (25)

#define CAL1_V (8354) //mv  CHANGE AFTER CALIBRATION
#define CAL1_T (25)   //℃


const uint16_t DO_Table[41] = {
  14460, 14220, 13820, 13440, 13090, 12740, 12420, 12110, 11810, 11530,
  11260, 11010, 10770, 10530, 10300, 10080, 9860, 9660, 9460, 9270,
  9080, 8900, 8730, 8570, 8410, 8250, 8110, 7960, 7820, 7690,
  7560, 7430, 7300, 7180, 7070, 6950, 6840, 6730, 6630, 6530, 6410};

uint8_t Temperaturet;
uint16_t ADC_Raw;
uint16_t ADC_Voltage;
uint16_t DO;

int16_t readDO(uint32_t voltage_mv, uint8_t temperature_c)
{
  #if SINGLE_POINT_CALIBRATION == 00
    uint16_t V_saturation = (uint32_t)CAL1_V + (uint32_t)35 * temperature_c - (uint32_t)CAL1_T * 35;
    return (voltage_mv * DO_Table[temperature_c] / V_saturation);
  #else
    uint16_t V_saturation = (int16_t)((int8_t)temperature_c - CAL2_T) * ((uint16_t)CAL1_V - CAL2_V) / ((uint8_t)CAL1_T - CAL2_T) + CAL2_V;
    return (voltage_mv * DO_Table[temperature_c] / V_saturation);
  #endif
}

// pH SENSOR---------------------------------------/
DFRobot_LCD lcd(16, 2); //16 characters and 2 lines of show

#define PH_PIN 25 
float voltage,phvalue,temperature = 25;

float acidVoltage = 2000; //buffer solution at 4.o 
float neutralVoltage = 1390;   //buffer solution at 7.o 

const int Sensor_MINvalue1 = 6.5; // +-0.5 from ph 4.0
const int Sensor_MAXvalue1 = 8.5;



void setup()
{
  Serial.begin(115200);
  pinMode(D0, OUTPUT); 


    // LCD Begin //
  lcd.init();
  lcd.setCursor(4,0);
  lcd.print("Welcome");
  delay(1000);
  lcd.clear();

  lcd.setCursor(3,0);
  lcd.print("Reading ");
  lcd.setCursor(3,1);
  lcd.print("pH & DO");
  delay(1000);
  lcd.clear();

  lcd.setCursor(3,0);
  lcd.print("Please Wait");
  delay(1000);
  lcd.clear();

}



void loop()
{
  //pH SENSOR
    static unsigned long timepoint = millis();

    if(millis()-timepoint>1000U){
      timepoint = millis();// timepoint = read temperature 

      voltage = analogRead (PH_PIN)/4095.0*3300; 

      float slope = (7.0-4.0)/((neutralVoltage-1500)/30 - (acidVoltage-1500)/3.0);
      float intercept = 7.0 - slope*(neutralVoltage-1500)/3.0;

      phvalue = slope*(voltage-1500)/3.0 + intercept;   // y=k*x + b [formula]

      if( phvalue < Sensor_MAXvalue1 && phvalue > Sensor_MINvalue1 ){
         Serial.print("Voltage:");
         Serial.print(voltage,1);
         Serial.print("PH:");
         Serial.println(phvalue,2);

          //LCD setting 16x2
         lcd.setCursor(0,0);
         lcd.print("PH: ");
        
         lcd.print(phvalue,2);

         lcd.setCursor(0,1);
         lcd.print("Volt: ");
         lcd.print(voltage/1000,2);} 
      else {
        lcd.init();
        lcd.setCursor(0,0);
        lcd.print("DOSING REQUIRED");
        digitalWrite(D0, HIGH);// turn relay OFF
        delay(3000);
        lcd.clear(); }   
    }

    Temperaturet = (uint8_t)READ_TEMP;
    ADC_Raw = analogRead(DO_PIN);
    ADC_Voltage = uint32_t(VREF) * ADC_Raw / ADC_RES;

    Serial.print("Temperaturet:\t" + String(Temperaturet) + "\t");
    Serial.print("ADC RAW:\t" + String(ADC_Raw) + "\t");
    Serial.print("ADC Voltage:\t" + String(ADC_Voltage) + "\t");
    Serial.println("DO:\t" + String(readDO(ADC_Voltage, Temperaturet)) + "\t"); 

    //LCD setting 16x2
    lcd.setCursor(9,0);
    lcd.print((readDO(ADC_Voltage, Temperaturet))/1000);
    lcd.print("mg/L");
    delay(5000);
    lcd.clear();   

}
  

I am currently using esp32 fire beetle,with dissolved oxygen and ph sensor with a relay and LCD, I have uploaded the programme a few weeks back and it was successfully however now it has an exit status 2 upon uploading

The error because of a failure of communication between the PC and ESP32. Check your wiring, carefully. How is the PC connected to the ESP32?

Did you try the instructions in the troubleshooting page?

Please do not post screenshots of code and/or error messages. See that big old button "COPY ERROR MESSAGES"? Please use that button and paste the error into a post in code tags.

You did well to properly post the code in your first post. Most new members have to be asked to read the guidelines. Good job.

Bad USB cable ?

Click File>Preferences - you get a frame so
image

click compile and upload - this will enable verbose output which gives much more information about errors etc
then copy and upload the error messages as text (not images)

could you be overruning the end your array DO_Table? put a print to display the array index

int16_t readDO(uint32_t voltage_mv, uint8_t temperature_c)
{
     Serial.println(temperature_c));

I have merged your cross-posts @aniqchino.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

1 Like

@aniqchino is this the same board that was emitting smoke recently?

nope

A fatal error occurred: Failed to connect to ESP32: Download mode successfully detected, but getting no sync reply: The serial TX path seems to be down.

A fatal error occurred: Failed to connect to ESP32: No serial data received.