Page 1 of 1

ESP32 WiFi setup over BLE

Posted: Fri Apr 06, 2018 8:13 am
by beegee1962
Most small applications that we write have the WiFi credentials integrated in the code. But sometimes you do not want to have your WiFi credentials in the source code, specially if it is open source and maybe accessible as a repository on Github or Bitbucket. Having the WiFi credentials in the code is as well not practical if you sell your devices to others that need to setup the WiFi credentials according to their local network.

There are several solutions available like Espressifs Smartconfig or WiFiManager.

My approach is not to use WiFi to configure the WiFi credentials of an ESP32 module, but to do it over Bluetooth Low Energy (BLE).

To achieve this, the code includes a BLE server that is advertising a custom service. An Android phone or tablet (sorry, I cannot write apps for Iphones) then can connect to this BLE server and the user can setup the WiFi configuration of the phone.

How does it work?

When the ESP32 is powered up it starts a BLE server and advertises a custom service to setup, check or erase the WiFi credentials. The Android app will find the ESP32 BLE server:
  • Image
By clicking on the device name the configuration screen opens. If there are already some WiFi credentials stored on the ESP32, they will be read from the device and displayed:
  • Image
The configuration screen has 3 buttons to read the existing configuration, write a new configuration to the ESP32 or to erase any configuration on the device.

In case you want to use two AP settings, the switch button “Enable two AP” will show the edit boxes for the second AP:
  • Image
The SSID and password for the WiFi APs should be entered in the text edit fields. Then a push on the “Send WiFi config” will send the new WiFi credentials to the ESP32.

The small text field at the bottom will show some debug messages during the process.

Re: ESP32 WiFi setup over BLE

Posted: Sat Apr 07, 2018 4:24 am
by WiFive

Re: ESP32 WiFi setup over BLE

Posted: Sun Apr 08, 2018 4:39 am
by beegee1962
Wanted to do it by myself, just to learn more.

Re: ESP32 WiFi setup over BLE

Posted: Tue May 15, 2018 2:12 pm
by hassan789
thanks for sharing, especially good simple reference for android.

Re: ESP32 WiFi setup over BLE

Posted: Tue Oct 08, 2019 11:38 am
by Yuvaraj1867
Anybody did this with IDF?