Setting Up Bluetooth OOB Pairing with NFC on Raspberry Pi

This post shows steps to setup Bluetooth Out-Of-Band (OOB) pairing using NFC [1] on Raspberry Pi using nfcpy [2]. The goal is to pair a phone and Raspberry Pi by just touching each other.

 

Prerequisites (parentheses indicate my environment)

 

Steps
1. Installation
1-1. Install nfcpy.

1-2. Verify installation by running the module.

The output should be like this:

1-3. As the output suggests, copy line 11 above and execute it.

1-4. Reboot the system.

1-5. After reboot, run the module again.

This time, the output should be like this:

 

2. Setting up Bluetooth OOB Pairing
2-1. Download example code [3].

2-2. Create NDEF data [4] for Bluetooth OOB pairing [5].

Note: Replace “XX:XX:XX:XX:XX:XX” with your Raspberry Pi’s Bluetooth device address.

2-3. Write NDEF data to NFC adapter [6].

2-4. Open another terminal and launch Bluetooth command line interface.

2-5. Enable the pairing agent.

2-6. Set the agent as default agent.

2-7. Enable discoverable mode.

 

3. Test
3-1. Enable NFC on the phone.

3-2. Move the phone close to the NFC adapter.

3-3. Allow the pairing request on the phone.

3-4. Allow the service authorization on Raspberry Pi if requested.

 

 

References
[1] Bluetooth Secure Simple Pairing Using NFC – NFC Forum
[2] Python module for near field communication – nfcpy
[3] nfcpy – GitHub
[4] NFC Data Exchange Format – nfcpy
[5] make btcfg – nfcpy
[6] emulate – nfcpy

 

 

Sponsor Link

Leave a Reply

Your email address will not be published. Required fields are marked *