User Tools

Site Tools


bluetooth

Bluetooth

Step by step tutorial how to pair and connect with Bluetooth a device with AGL to a smartphone. This tutorial has been tested with the built-in Bluetooth in Raspberry Pi 3.

* Verify that the Bluetooth module is detected:

hciconfig -a

* Start Bluetooth systemd service:

rfkill unblock bluetooth
hciconfig hci0 up
systemctl start bluetooth

* Launch bluetoothctl:

bluetoothctl

* Power on the Bluetooth controller:

[bluetooth]# power on

* Enable the agent and set it as default:

[bluetooth]# agent on
[bluetooth]# default-agent

* Set the Bluetooth controller as discoverable for 3 minutes and pairable:

[bluetooth]# discoverable on
[bluetooth]# pairable on

* Scan for other device to retrieve the smartphone:

[bluetooth]# scan on

* Find out the MAC address of the smartphone:

[bluetooth]# devices

* Pair with the smartphone:

[bluetooth]# pair smartphone_mac_address

* Enter 4 digit PIN if prompted. Enter the same PIN on the smartphone.

[agent]PIN code: ####

* Allow the service authorization if requested.

[agent]Authorize service service_uuid (yes/no): yes

* Trust the smartphone:

[bluetooth]# trust smartphone_mac_address

* Connect to the smartphone:

[bluetooth]# connect smarphone_mac_address

Verify that the smartphone is successfully connected and display information about it with the following command:

[bluetooth]# info smarphone_mac_address

The device has been successfully paired with the smartphone and you now can exit bluetoothctrl:

[bluetooth]# quit
bluetooth.txt · Last modified: 2016/10/21 15:34 by leonanavi