Provisioning refers to the process of initializing and configuring a new device to be added to an existing network. In this exercise, we will learn how to provision your nRF70 series device to be added to an existing and operational Wi-Fi network.
We will do this by using the Wi-Fi Bluetooth LE based provisioning sample, which is a sample available in the nRF Connect SDK. This sample uses a smartphone as the provisioner device. The smartphone will use an app called “nRF Wi-Fi Provisioner” to connect to your Wi-Fi device via Bluetooth Low Energy. By using this app, you will be able to choose the Wi-Fi network you wish to connect to and enter the credentials for your local AP.
This course builds on the nRF Connect SDK Fundamentals course and focuses on Wi-Fi. You need to read Lesson 1 in the nRF Connect SDK Fundamentals to learn how to install the nRF Connect SDK on your machine and build applications. Furthermore, completing the nRF Connect SDK Fundamentals course is strongly advised as it provides a comprehensive understanding of the nRF Connect SDK.
The exercises in this course assume you have a basic understanding of the nRF Connect SDK.
0. Clone the GitHub repository for this course.
0.1 Clone the GitHub repository for this course.
Copy the link to the repository and use VS Code’s Command Palette to clone the repository.
1. Build and flash the Wi-Fi Provisioning sample to your board.
1.1 In the nRF Connect window in Visual Studio Code, select Create a new application under the WELCOME menu.
1.2 Select Copy a sample, then select the nRF Connect SDK version you are using. Search for “Bluetooth LE Wi-Fi provision” and select the sample with path nrf/samples/wifi/provisioning/ble
.
In the next step, you will input the path to where you want to store this exercise. Save the application to wherever you cloned the code base for this course, as <wifi_fund_repo>\<version_directory>\l1\l1_e1_sol
.
1.3 Add a build configuration and select the board target for whichever board you are using.
Under Board, select nrf7002dk_nrf5340_cpuapp
, then click Build Configuration.
Under Board, select nrf5340dk_nrf5340_cpuapp
. Then, under Extra CMake arguments, write the following line and click OK.
-DSHIELD=nrf7002ek
Then select Build Configuration.
Alternatively, you can add the following line to the CMakeLists.txt file of the application you are building
set(SHIELD nrf7002ek)
1.4 Build and flash the application to your device.
Make sure jumpers P22 and P23 are installed on your board or you will get an error while building.
2. View the terminal output
2.1 In VS Code, in the nRF Connect Extension window, go to Connected Devices and connect to the COM port of your board by clicking the electric plug icon as shown in the image below. Then choose the default COM port settings 115200 8n1 rtscts:off.
Since the nRF5340 is a dual-core SoC, there will be two COM ports available. Select one and if there is no log output, try the other.
1. Install the Serial Terminal app.
Open nRF Connect for Desktop, navigate to the Serial Terminal app and click Install.
2. Launch the Serial Terminal app.
3. Connect to your board and find the COM ports.
2.2 If this was successful, you should see the following message printed on your serial terminal.
Note down your device’s address, shown in the red box here, as we will need that information later on. Your Wi-Fi device is now advertising its presence and readiness to connect over Bluetooth LE.
3. Download and launch nRF Wi-Fi Provisioner.
3.1 Download nRF Wi-Fi Provisioner from your app store.
3.2 Make sure Bluetooth is enabled on your smartphone.
3.3 Launch the app on your smartphone, select “Provision over Bluetooth LE” and grant the app permission to use Bluetooth when prompted.
4. Find your device on the Scanner page.
Now your smart phone will start scanning for devices advertising using Bluetooth, such as your nRF70 series DK. You should now see your device appear on the Scanner page in the app.
You can make sure the device appearing on your nRF Provisioning app is actually your nRF70 series DK by verifying the address that was printed in step 2.2.
5. Pair the device with the app.
Select the device, and when asked if you wish to pair via Bluetooth, select Yes.
6. Select and enter the credentials for your Wi-Fi network.
6.1 Select Start Provisioning
6.2 Select the Wi-Fi network you want your board to connect to and enter the password for that network. Then press Provision.
6.1 Click on Scan to scan for nearby advertising Access Points.
6.2 Select the Wi-Fi network you want your board to connect to.
6.3 Scroll down to the Access Point menu.
6.4 Under Access Point, enter the password for your Wi-Fi network.
6.5 Finally, click Set.
6.6 When completed correctly, the Device Status menu should look something like this.
7. You have successfully provisioned your Wi-Fi device to the network.
Upon successful provisioning, you should be able to see a similar view to the picture shown below.
We have now provisioned the board to a Wi-Fi network over Bluetooth LE, and the device is now connected to that network. The credentials are stored on the device, to be retrieved for future connections in the rest of the exercises in the course.