Finding device location using Wi-Fi networks¶
This guide demonstrates how to use the nRF Cloud multi-service sample and nRF7002 EK to determine a device's location using Wi-Fi networks.
Note
The sample in this guide uses a cellular connection for connectivity to nRF Cloud and data transfer. It uses Wi-Fi to scan for access points, not for connectivity.
Requirements¶
- nRF9160 DK with nRF7002 EK Wi-Fi shield attached.
- Modem firmware v1.3.5 or later.
- nRF Connect SDK v2.5.0 or later.
- VS Code with the nRF Connect for VS Code extension.
- nRF Connect for Desktop tools:
- Serial Terminal
- nRF Programmer to update modem firmware.
- Cellular Monitor for certificate management.
- The nRF Cloud multi-service sample.
- Activated SIM card for cellular connection.
Prerequisites¶
- Create an nRF Cloud account.
- Update the modem firmware on the device.
Generating device credentials¶
If you have never connected your device to nRF Cloud before, you must generate credentials for your device and onboard it.
If your device is already connected to nRF Cloud, you do not need to generate credentials again. You only need to build and flash the sample.
Build and flash the sample¶
The steps in this section refer to How to build an application from the nRF Connect SDK in the nRF Connect for VS Code documentation. When you build and flash the sample, include the following changes:
- Create the multi-service sample using the
nrf/samples/cellular/nrf_cloud_multi_service
template. - Create a build configuration for the nRF9160 DK target, with the following additions:
- Under Kconfig fragments, choose
overlay-nrf7002ek-wifi-scan-only.conf
.- Click OK.
- Under Cmake options, add
-DSHIELD=nrf7002ek
.- Click OK.
- Under Kconfig fragments, choose
-
Click the Build configuration button.
Wait for the configuration to finish building.
-
Flash the sample to your device.
Connecting the device to nRF Cloud and viewing its location¶
Your device is now ready to connect to nRF Cloud and scan for Wi-Fi access points. To confirm that your device is correctly configured and sending Wi-Fi location data to nRF Cloud, complete the following steps:
- Open Serial Terminal.
- Choose your device from the upper left drop-down menu.
-
Press the RESET (SW5) button on the device.
The device boots and attempts to connect to nRF Cloud. If the device does not immediately connect, wait for it to attempt connection again before beginning troubleshooting.
-
Observe in the terminal that the device connects to nRF Cloud and begins requesting its location.
- Log in to the nRF Cloud portal.
-
Select Device Management from the left sidebar.
A panel opens to the right.
-
Select Devices from the left sidebar.
- Click your device's name or ID to open the Device page.
-
Find the Location map card.
Do the following if the map does not load automatically:
- Click the clock icon in the corner of the map.
- Select a time range from the drop-down menu.
- Click Get Data.
-
Confirm that there is a new Wi-Fi location point on the map.