Update via bluetooth

I’m doing some test with a bluetooth module, all is perfect.

But I want to update ota, but without a wifi connection. My question is: if I’m connected via bluetooth, the esp can get http update (download a bin from my ftp server) using internet connection of the phone via bluetooth?

Ok, I made myself

Use a variable store in eeprom, that if is changed by app, restart the esp with a wifi connection, download and install the new fw, and then restart in bt mode :slight_smile:

that is a nice way to update firmware. Show us the sketch for reference. Thanks

1 Like

The same auth/ssid/psw:

char auth[] = "RWDKd5xxxx";
char ssid[] = "xxx";
char pass[] = "xxx";

the setup code

void setup() {
       
    EEPROM.begin(512); 
    readEpromValue();
    updateProcess = EEPROM.read(500); // 500 is one slot unused in my sketch
    
    if (updateProcess == 1) {  
      Serial.begin(115200);
      Serial.println("Wifi mode");
      
      EEPROM.write(500, 0);  EEPROM.commit(); // for restart in BT mode in any case
      
      WiFi.begin(ssid, pass); // i use a hotspot of my phone at need
      while (WiFi.status() != WL_CONNECTED) {  }
      checkUpdate(); // void with upgrade from http
      } else {  
      SerialBLE.begin(9600);
      Blynk.config(SerialBLE, auth); // connect in BT mode
      }

and the code for start the update process in wifi mode from app

BLYNK_WRITE(Vxx) { // long press widget
if (param.asInt() == 1) {    
     longPressTimer = timer.setTimeout(longPressMillis, updateEsp);  
     } else {
     timer.deleteTimer(longPressTimer);  
     }
}

void updateEsp () {
EEPROM.write(500, 1);  EEPROM.commit(); 
ESP.reset(); 
}
1 Like