0

I've seen on the internet how the IoT device gets connected to the Android/iOS apps. In one video, one guy kept pressing one button for several seconds and the device enters in pairing mode and mobile app detects that device and he just selected the WiFi and device setup itself.

I wonder how this system works. If anybody knows how this is implemented it would be get help to me.

Thanks in advance.

  • There are lots of different ways to do this depending on what hardware you have available. What research have you already done? As it is the question is too broad. – hardillb Feb 3 '20 at 10:16
  • @hardillb I'm talking about ESP8266. I know it can work on AP mode. But I don't want that. – Rahulsinh Feb 3 '20 at 11:02
  • it is implemented using AP mode .... since AP mode is not an option for you, then that pretty much leaves bluetooth as a way to pair your device – jsotola Feb 3 '20 at 17:35
1

There are probably a lot of different ways this is done, but here is one (note that this would require using an ESP32 rather than an ESP8266 because we need BLE):

  • Your IoT device advertises its presence over BLE. It also advertises a service and characteristics will can be used to send it configuration information.

  • You have your own custom app running on the customer's phone. It detects the BLE device, possibly asks for a few configuration questions, gets the WiFi credentials from the phone, and sends them to the device over BLE using the aforementioned characteristics.

  • Your device receives the configuration, saves it, and configures WiFi to connect to the network.

  • Now the smartphone and device can continue their "discussion" over Wi-Fi.

Surprisingly, even on iOS it's possible to get the current Wi-Fi configuration info, including SSID (the network name) and credentials (password), provided you meet some conditions.

See https://developer.apple.com/documentation/systemconfiguration/1614126-cncopycurrentnetworkinfo for documentation on how to do this on iOS and https://izziswift.com/get-the-currently-connected-wifi-informations-in-swift-4-x/ for an example.

I'm pretty sure you can do the same on Android, I'm just too lazy to look that up right now. As others would say: "left as an exercise for the reader"...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.