Hello Particle Community!
I have created an Android app that will allow you or any person (even your customers!) to configure the Wi-Fi credentials of an Argon from an Android device.
It complements the BLE WiFi Setup Manager Library created by @Dan-Kouba , posted here.
You can see it in action here:
You can install it on your Android device from Google Play:
Below there is an example firmware that overcomes one limitation of the library flagged by @steeves in this post:
Also flagged by @melt777 here:
Here's the example firmware:
#include "Particle.h"
#include "ble_wifi_setup_manager.h"
// This example does not require the cloud so you can run it in manual mode or
// normal cloud-connected mode
SYSTEM_MODE(AUTOMATIC);
SYSTEM_THREAD(ENABLED);
SerialLogHandler logHandler(LOG_LEVEL_WARN, {
{"app", LOG_LEVEL_ALL},
{"system.ctrl.ble", LOG_LEVEL_ALL},
{"wiring.ble", LOG_LEVEL_ALL},
});
BLEWiFiSetupManager wifi_manager;
// callback for when the wifi credentials are set by the app or library
void provisionCallback()
{
// avoid a timeout error on the app side
// this gives time to the app to disconnect on its own
delay(1000);
System.reset();
}
void setup()
{
// set some default credentials in case things go wrong
// with this, the user can create a hotspot and the sensor can connect to it
// so the library can provision the device
WiFi.setCredentials("sensor", "sensor123");
wifi_manager.setup();
wifi_manager.setProvisionCallback(provisionCallback);
}
void loop()
{
wifi_manager.loop();
}
The trick is to create a hotspot on your phone (with credentials sensor/sensor123), so the Argon can connect and the library can run.
Tested Android 12 on a Pixel 5, Pixel 3, and an Amazon Fire 7" tablet.
Anyone can install the app from Google Play.
Cheers!
Gustavo.