ESP32 WiFi setup over BLE
Posted: 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:
In case you want to use two AP settings, the switch button “Enable two AP” will show the edit boxes for the second AP:
The small text field at the bottom will show some debug messages during the process.
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:
In case you want to use two AP settings, the switch button “Enable two AP” will show the edit boxes for the second AP:
The small text field at the bottom will show some debug messages during the process.
- Full project description: ESP32 WiFi setup over BLE (ESP32 code)
- Source code for ESP32 code: ESP32_WiFi_BLE_ANDROID
- Source code for Android code: ESP32_WiFi_BLE_ESP32
- Google Play link for the Android app: ESP32 WiFi setup over BLE