Sample description
The Wi-Fi Provisioning Service sample demonstrates how to provision a device with Nordic Semiconductor’s Wi-Fi chipsets over Bluetooth® Low Energy.
Requirements
The sample supports the following development kit:
Hardware platforms |
PCA |
Board name |
Build target |
---|---|---|---|
PCA10143 |
|
The sample requires a smartphone (configurator) with Nordic Semiconductor’s nRF Wi-Fi Provisioner app installed in one of the following versions:
Overview
With this sample, you can provision a Wi-Fi device that lacks input or output capability. The sample is divided into three parts:
Task and event handling component: Handles provisioning-related tasks and events.
Transport layer: Based on Bluetooth Low Energy and exchanges information between the device and the nRF Wi-Fi Provisioner app.
Configuration management component: Manages the provisioning data (in RAM and flash) accessed by multiple threads.
Building and running
This sample can be found under samples/wifi/provisioning
in the nRF Connect SDK folder structure.
To build the sample with Visual Studio Code, follow the steps listed on the How to build an application page in the nRF Connect for VS Code extension documentation. See Building and programming an application for other building and programming scenarios and Testing and debugging an application for general information about testing and debugging in the nRF Connect SDK.
The sample generates header and source files based on protocol buffer definitions in .proto
files during the build process.
You must install a protocol buffer compiler to generate the files.
See the Nanopb sample in the zephyr documentation for more information.
Testing
After programming the sample to your development kit, complete the following steps to test it:
Connect the kit to the computer using a USB cable. The kit is assigned a COM port (Windows) or ttyACM device (Linux), which is visible in the Device Manager.
Connect to the kit with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.
Observe the following output:
wifi_prov: BT Advertising successfully started
Open the nRF Wi-Fi Provisioner app.
Enable Bluetooth if it is disabled.
Search and connect to the device you want to provision. If the connection and pairing are established, observe the following output:
wifi_prov: BT Connected: <configurator BT address> wifi_prov: BT pairing completed: <configurator BT address>, bonded: 0
Start an access point scan.
Enter the password, if required.
Establish a Wi-Fi connection.
Observe the following output, if the connection is successful:
wpa_supp: wlan0: CTRL-EVENT-CONNECTED - Connection to <AP MAC Address> completed [id=0 id_str=]
Dependencies
This sample uses the following sdk-nrfxlib library:
This sample also uses a module that can be found in the following location in the nRF Connect SDK folder structure:
modules/lib/nanopb
In addition, it uses the following Zephyr libraries:
-
include/bluetooth/bluetooth.h
include/bluetooth/conn.h
include/bluetooth/uuid.h
include/bluetooth/gatt.h
-
include/settings/settings.h