User Tools

Site Tools



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 B/B+ and Raspberry Pi 4.

Images for Raspberry Pi 4 include recipe pi-bluetooth. It provides a script that starts automatically and properly configures BT-HCI. The same script is used in Raspbian.

* Verify that the Bluetooth module is detected:

hciconfig -a

Note: Check the troubleshooting if the Bluetooth module is NOT detected

* Launch 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

* Start Bluetooth systemd service:

rfkill unblock bluetooth
hciconfig hci0 up
systemctl start bluetooth
bluetooth.txt · Last modified: 2019/10/01 08:28 by leonanavi