17

I'm making an IoT device that will serve a web app over WiFi which can be accessed to control it.

I would like to make it easy to set up. For example, the easiest way I can imagine is as follows; all it would need is a phone or similar with NFC capabilities. (Only hypothetically, because this assumes NFC etc can do it!)

  1. User powers up IoT device
  2. User holds phone against IoT device's NFC pad
  3. IoT device asks phone for WiFi credentials
  4. IoT device uses credentials to connect to WiFi
  5. IoT device directs phone's browser to its URL

But right away I can see possible flaws:

  • Phone is unlikely to want to give credentials away; security risk.
  • Phone is unlikely to want to navigate to the given URL; security risk.
  • NFC probably doesn't have defined standards for these kinds of operations; even if security issues are mitigated (e.g. by asking user permission), I can't believe I'd be lucky enough for this to be implemented. So an app would have to be downloaded for the phone to do all this. Which means an app would need to be written for Apple, another for Android etc, plus in the case of Apple it would have to be approved, and either way the user would have to search for it, install it and learn how to use it - all defeating the purpose of having a web interface.

Obviously some users will not have NFC-compatible phones, so there would also have to be a secondary method.

The only awareness of a solution I have comes from how my WiFi IP security camera works. It requires first connecting it via Ethernet cable to a router with on a 192.168.1.X subnet with a given IP reserved (e.g. my camera required 192.168.1.100 to be reserved or free). Then from there, the user navigates to http://192.168.1.100/, logs in with the camera's supplied username and password, then from there, configures the camera with the WiFi access point name and password.

But that method had one serious disadvantage: it required that the router operates on the subnet 192.168.1.X. Mine operated on 192.168.0.X. Thankfully I was able to reconfigure it. But my new router doesn't have that ability!! I would have been stuck. Additionally, the above method is quite a pain; quite a few steps.

What other solutions have been implemented to solve the problem of setting up an IoT device's WiFi connection, and then informing the user of its IP address so he/she can access its web interface?

3
  • 2
    Welcome to the IoT Stack Exchange. Do you have restrictions on what modules you are including in your IoT device, besides Wi-Fi?
    – Helmar
    Commented Jan 6, 2017 at 15:13
  • 1
    It makes no difference what subnet the router operates on. You could still have configured a device (phone, laptop, whatever) with IP address 192.168.1.200 and navigated to 192.168.1.100 and it would have worked. Commented Jan 6, 2017 at 21:03
  • 1
    A half-baked idea: use a TTS (text to speech) engine such as espeak (linux) for output
    – Jayy
    Commented Jan 11, 2017 at 18:09

4 Answers 4

8

Some devices support connecting to a router through Wi-Fi Protected Setup (WPS), which is a feature of most modern routers to allow any device to connect to your network (with a limited period of time to initiate the connection) once you've pressed the WPS button on the router.

The button tends to look like this:

WPS Button

(ArnoldReinhold, Cisco router WPS button, CC BY-SA 3.0)

By doing this, you don't need any input to your IoT device - simply press the button to connect to your network et voila!

This issue is also explored further in Connecting devices to the Internet of Things with Wi-Fi. Along with the WPS idea that I initially suggested, they have a few other options:

Another common approach is to have the coffee maker appear as an access point with its own SSID and pass phrase, which is supplied on the manufacturer's quick start card. In this approach, when the coffee maker is plugged in and powered on the SSID of the coffee maker is broadcast so that it is easily identified. A user disconnects from the wireless network, connects wirelessly and directly to the coffee maker, and navigates to an area to enter the SSID and network pass phrase. The device is then configured as a client on the user's network.

This method would seem most practical for any network where you are unable to use WPS (no WPS support from your router, perhaps, or concerns about WPS security). Of course, it is quite involved and would require more technical knowledge, so it's not ideal.

All of these methods I've outlined only really work if you're in control of the design of the IoT device - as a consumer, if the device's connection method doesn't work, it's essentially tough luck - the only option is to return it to the store!

11

A usual method is that the IoT device sets up a temporary Wi-Fi access point. This AP can be open, or the password et cetera can even be coded into a QR Code. Such codes can easily be generated by tools like this. Try this one:

ExampleQRCode

The advantage is that the user has to provide the actual Wi-Fi password and both of your security risks are avoided, since that link is not any URL, but a standard Wi-Fi descriptor that phones usually support. Thus, only this temporary access point is not very secure. Another advantage is that you only need a camera on the Smart Phone and I'd hazard the guess that every IoT employing user will have a phone with a camera.

1
  • Many of my larger devices use this, but hotspot is a better name for it. Commented Dec 5, 2023 at 11:04
4

I am glad that you got other answers, because NFC is probably the wrong technology for this.

Your phone reads NFC tags and acts upon them; no request to the ‘phone, and no to and fro communication.

So, at best, you could tag the device – with a URL. When the phone taps the device, it is redirected to a web page which allows the user to visually configure and then instructs the device non-visually on the new configuration.

It’s not difficult, but I would recommend one of the other answers. I am posting this only to offer another option to you and any future searchers of this question.

Obviously some users will not have NFC-compatible phones, so there would also have to be a secondary method.

Indeed :-)

5
  • 1
    Could an active NFC tag be used to exchange information more dynamically though? I was under the impression that there is to-and-fro in that case, so it might be useful.
    – Aurora0001
    Commented Jan 11, 2017 at 16:41
  • 2
    Not any to and fro that you can control. An NFC tag can contain only a payload, which is read by a device. The payload can be a URL, an email address, a 'phone number, etc, but it is read only. I generally code a URL, with parameters which my server will handle and perform all of the logic http://me.com/foo.php?device=X etc. You could intercept the read in an Android App & handle it there, without going to a server, but I find my solution to work out better.
    – Mawg
    Commented Jan 11, 2017 at 16:52
  • 2
    Btw, “active” just means that it has its own power source (small battery) and “passive” that the tag is powered by a reader when it comes near.
    – Mawg
    Commented Jan 11, 2017 at 16:52
  • 1
    An NFC tag only has a payload, but NFC is not limited to tags! AFAIK all NFC phones are physically capable of using NFC in other modes, though the software might not always expose it. The NFC protocol can be used in peer-to-peer mode as well. That wouldn't even raise the cost of the device, I think: the point of tag mode (reader-writer mode) is that the tag doesn't have any power source except the electrical field, and for this application a power source is available. Commented Jan 13, 2017 at 13:00
  • 1
    "NFC is not limited to tags" - chip, then? The industry refers to them as tags, but I am flexible :-) "the tag doesn't have any power source except the electrical field" as with RFID, this is true for passive tags, but not for active - that's the difference between them.
    – Mawg
    Commented Jan 13, 2017 at 13:07
0

In 2022, a system called "Wi-Fi Easy Connect" was introduced to solve this exact problem. The underlying protocol is called Device Provisioning Protocol (DPP).

With this system, the device to be connected (Enrollee) exposes a public key, usually via a QR code, and another device with the network credentials (the Configurator) obtains that information and then transfers the information via the same wi-fi network.

If the network is managed by a company, they could even register the devices they buy into their central database so that the router can immediately enroll them as soon as they are turned on.

The great news is that Android already implements the Configurator role: Settings -> Wi-Fi -> select an active Wi-Fi network -> "Add a device" -> scan QR code. This however seems to require support from the Wi-Fi driver so it might not be available on every device.

References:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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