Provisioning an ESP32 Wifi Connection Possible?

I’m working on a project which will be deploying devices to customers, and having them connect the device to their local wifi network. We’re using the ESP32 module and basing things off the Golioth Basics example.

One thing I’m running into is that I’m trying to use the Espressif wifi provisioning manager, like in their examples and components directories.

We were able to get the Esp example running, which is reassuring. However, I can’t get it to play nicely with the Golioth code for a couple reasons. Has anyone else experienced this problem?

High-level summary of a couple issues I ran into:

  1. The nvs write/read uses “unknown” as the default ssid and psk, and checks for that to see if the credentials are present. However, the wifi_prov_mgr checks for a string length of 0 to determine if it’s provisioned. Also, changing the NVS_DEFAULT_STR to “” seems to cause other grief.
  2. I’m getting a hard error which resets the code when I run the wifi_prov_mgr_start_provisioning. I didn’t have a chance to dig in to this further, but the remainder of the error message wasn’t very helpful.

Hi Seth,

I haven’t tried the Espressif provisioning example you linked to, but we do have a proof-of-concept for using Web-Bluetooth provisioning with the golioth_basics example. I tested it out just now and it is working for me. Is this an approach that is useful for your project?

Thanks for bringing up the issues about using unknown for default credentials. It does sound like a zero-length string makes more sense because unknown could be a legitimate SSID/PSK. We’ll look into fixing that.

I’m not sure I can troubleshoot the second issue without more information. I think ESP-IDF has a feature that can provide more information on what caused the hard reset. This would be a good starting place to see we can narrow the scope on the cause.

I’ll try that out and see if it works. We started with the Golioth basics example, but have fairly heavily modified it. Is this solution for PC or smartphone or either? (I’m assuming either, but want to double check.)

I haven’t investigated all the implications, but it might be worth looking into erasing the key entirely, rather than forcing an empty string. That should play better with the esp shell as well as the provisioned check.

Honestly, I’m probably going to make that a lower priority. If the example you provided works, then I’d happily just use that instead.

So that Web BLE Provisioning demo worked surprisingly well. I have two caveats with it.

  1. The webpage and the ESP32 seems to be disconnecting pretty quickly (~30 seconds). It will reconnect easily, but with the auto-reconnect checked, I’m getting disconnect+reconnect cycles quite often. I haven’t seen 2.4GHz band issues at my office in the past, so it might be something else.
  2. The Golioth PSK credentials are readable in plain-text. Is this a security concern at all?