ESP32 WiFi setup over BLE

User avatar
beegee1962
Posts: 7
Joined: Fri Oct 13, 2017 8:42 am
Location: Philippines
Contact:

ESP32 WiFi setup over BLE

Postby beegee1962 » Fri Apr 06, 2018 8:13 am

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.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: ESP32 WiFi setup over BLE

Postby WiFive » Sat Apr 07, 2018 4:24 am


User avatar
beegee1962
Posts: 7
Joined: Fri Oct 13, 2017 8:42 am
Location: Philippines
Contact:

Re: ESP32 WiFi setup over BLE

Postby beegee1962 » Sun Apr 08, 2018 4:39 am

Wanted to do it by myself, just to learn more.

User avatar
hassan789
Posts: 156
Joined: Thu Jun 29, 2017 2:15 am

Re: ESP32 WiFi setup over BLE

Postby hassan789 » Tue May 15, 2018 2:12 pm

thanks for sharing, especially good simple reference for android.

Yuvaraj1867
Posts: 63
Joined: Wed Mar 06, 2019 4:39 am
Contact:

Re: ESP32 WiFi setup over BLE

Postby Yuvaraj1867 » Tue Oct 08, 2019 11:38 am

Anybody did this with IDF?

Who is online

Users browsing this forum: No registered users and 106 guests