Skip to content

Onboarding to WiFi with BLE Serial using Improv

Alex Lennon edited this page Oct 10, 2024 · 8 revisions

Overview

So we've always had challenges with good mechanisms to onboard headless smart IoT and embedded devices to the cloud.

With many devices such as smart home lightbulbs and so forth from manufacturers such as Tuya you have a couple of options

  • put the device into a WiFi access point mode
  • use some other kind of communications channel such as Bluetooth to send the WiFi SSID and password information
  • add a cellular modem so the WiFi problem goes away

Projects such as Tasmota do a good job of dropping into AP mode and providing a web-server interface to provision networking information but this is in all honesty fiddly and not great for people who aren't all that technical. For our Kettle Companion business we added a cellular modem to Tasmota so we could simply plug in devices and they would work. However this is not always appropriate or cost-effective.

For many lower cost devices a good option is to enable people to use a mobile phone application to provision smart devices and this appears to be relatively common nowadays. However we've been unable to find a Bluetooth SIG profile standard for this which is slightly strange. (Maybe somebody else knows where there may be one?). In the absence of a SIG standard we found the Improv standard for provisioning via Bluetooth BLE or Serial.

Yocto/OpenEmbedded Improv recipes & example server

We've added a python3-improv recipe to our meta-dynamicdevices layer and the needed dependencies to support including an Improv onboarding server into a Yocto/OpenEmbedded distribution. We have an example server which receives SSID/password and uses those to create a NetworkManager connection using nmcli.

Currently this code should be viewed as alpha quality but it works under test here to onboard devices.

This layer currently targets Yocto Kirkstone so some recipes have been backported and the version of the python3-bless recipe is contrained to be older than the latest by Python 3.10 used in Kirkstone as newer releases use the Buffer class which isn't available in 3.10.

There may be issues using python3-improv with more recent releases of Yocto and if so please raise an issue here. However with Kirkstone the example server is starting up automatically with systemd and we can provision with nmcli.

We use our DISTRO=lmp-dynamicdevices and within this you can see we add the DISTRO_FEATURE:append = "improv" to enable the onboarding server. You should also just be able to add python3-improv into your CORE_IMAGE_INSTALL.

The onboarding-server.py script is provided as a basic example and will no doubt be enhanced to provide a startup check to see if the provisioning server actually needs to run and an authentication mechanism. We also need to wait to check the connection is established correctly and provide an IP address or web address to client apps.

Issues

  • need to check if server should run up
  • need to look at physical authentication support (e.g. button press)
  • need to understand how to support a token passing based authentication (e.g. to link a device to an app via a cloud API)

As ever PR's are always appreciated if you want to help improve this!

Clients

We're currently using the iOS Konfigurator application to test device provisioning.

TODO

  • We haven't yet managed to get web browser based provisioning going and would appreciate assistance with this
  • We'd like to hear of any other Improv protocol supporting applications out there to build a list of resources