A Deploy the Fleet customer recently reached out asking if we have any advice on approaches to provisioning an ESP32 device with WiFi credentials. Many are familiar with the SoftAP approach in which the ESP32 temporarily acts as a WiFi access point. The client connects their phone or computer to that AP and does a credential exchange with the ESP32 device. This works but is generally too technical for many beginners and especially for non-technical customers.
Here is the repo. Instructions are included in the README for how to get up and running.
Continue reading if you want more details.
Why BLE Provisioning?
I’ve found through creating multiple consumer products that provisioning over BLE using an app is far more customer-friendly. This is natively supported in ESP-IDF. However, many people like to use the Arduino coding style for their projects, especially in the maker and educational communities.
What are My Options?
The good news is the Arduino library for ESP32 provides a provisioning example out-of-the-box which supports BLE provisioning. The bad news is it will not work in the native Arduino IDE or even in VSCode with the Arduino IDE extension installed. The reason is quite simple. To use BLE provisioning you have to modify the sdkconfig file of your project to enable Bluetooth. This is not supported natively in the Arduino IDE. While there are some creative ways to make it work, it’s non-trivial.
Even if you decide to use the recommended approach of including the Arduino libary as a component in a native ESP-IDF project….it doesn’t actually work at the time of this posting! The project will compile and flash but, due to a bug in the library it won’t actually work when you run the firmware. So instead of giving all of the steps I went through to figure this out I decided to take a different approach and just create a sample repo with all the instructions you need to get up and running.
The following videos are step-by-step walkthroughs on each platform showing you how to use the example project we’ve created.
Mac and Windows
Linux Using Docker
I hope this example project will be a helpful starting point for your ESP32 project. If you have any questions or issues using the project please submit an issue on the repo or reach out directly to firstname.lastname@example.org and we’ll be happy to assist you.