Skip to main content

Finding device location using Wi-Fi networks

This guide demonstrates how to use the Wi-Fi nRF Cloud sample to determine a device's location using Wi-Fi networks.

note

The sample in this guide uses Wi-Fi for both nRF Cloud connecivity and for positioning through access-point scanning.

Requirements

One of the following hardware configurations:

And the following software:

Prerequisites

Create an nRF Cloud account.

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:

  1. Open the sample using the nrf/samples/wifi/nrf_cloud template.

  2. Create a build configuration for your target:

    nRF7002 DK:

    1. Select nrf7002dk/nrf5340/cpuapp as the board target.
    2. Click the Build configuration button.

    nRF54L20 DK + nRF7002 EB2:

    1. Select nrf54l20dk/nrf54l20/cpuapp as the board target.
    2. Under CMake options, add -DSHIELD=nrf7002eb2.
      1. Click OK.
    3. Click the Build configuration button.

    Wait for the configuration to finish building.

  3. 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:

  1. Open Serial Terminal.

  2. Choose your device from the upper left drop-down menu.

  3. Press the RESET 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.

  4. Observe in the terminal that the device connects to nRF Cloud and begins requesting its location.

  5. Log in to the nRF Cloud portal.

  6. Select Device Management from the left sidebar.

    A panel opens to the right.

  7. Select Devices from the left sidebar.

  8. Click your device's name or ID to open the Device page.

  9. Find the Location map card.

    Do the following if the map does not load automatically:

    1. Click the clock icon in the corner of the map.
    2. Select a time range from the drop-down menu.
    3. Click Get Data.
  10. Confirm that there is a new Wi-Fi location point on the map.