The Thread NFC MeshCoP example demonstrates Thread native commissioning through NFC with the use of OpenThread and Border Router. It uses the on-chip NFC tag that is present on nRF52840 to initiate a commissioning procedure.
This example implements the CLI interface, so more advanced users can communicate with the node through a serial port and configure it manually. For more information, refer to Thread CLI Example.
For proper operation, this example must be used along with Nordic's Border Router with the EXPLORE-NFC-WW Raspberry Pi shield.
The image below presents the hardware components used in this example:
After the border router is booted together with the NFC shield, you can run commissioning. If the device was previously commissioned, you can perform a factory reset to remove any network information. To start the commissioning process, bring the NFC antenna of the device close to the NFC antenna of the border router. You can determine progress of the commissioning with BSP_LED_0 and BSP_LED_1.
On startup, the node will try to automatically connect to the last known network. If it succeeds, the device enters commissioned state. Otherwise, it switches to not commissioned state. In not commissioned state, NFC is enabled as Type 2 Tag with NDEF message containing the commissioning data. After NFC field detection (device is read by the Border Router NFC shield), the node switches to commissioning state, in which it tries to join the network with maximum three attempts. If it succeeds, the device starts network attachment and enters the commissioned state. Otherwise, it falls back to not commissioned state waiting for another NFC read.
State | LED indication |
---|---|
Not connected | Low frequency blink - 200 ms on, 800 ms off. |
Attaching | High frequency blink - 100 ms on, 100 ms off. |
Connected | Solid. |
State | LED indication |
---|---|
Not commissioned | Low frequency blink - 200 ms on, 800 ms off. |
Commissioning | High frequency blink - 100 ms on, 100 ms off. |
Commissioned | Solid. |
You can find the source code and project files in the following folder: <InstallFolder>\examples\thread\nfc_meshcop
.
To test this example, you need the nRF52840 Development Kit and Nordic's Border Router with the EXPLORE-NFC-WW Raspberry Pi shield.