How to connect colibri module with smartphone/tablet via Bluetooth?

Hello, Toradex community.
I have a question about Bluetooth with colibri imx6ull (Linux).

I’m now trying to connect Colibri IMX6ULL CPU module and external Bluetooth device (e.g. iPhone). I would like to pair and connect by the external device’s trigger, the usecases are listing below:

  1. Starting scan by iPhone and the colibri module will be discoevered.
  2. Pairing request from iPhone and the colibri module will receive it.
  3. Colibri module will trust the iPhone, and the pairing will be established.
  4. Connecting from iPhone, and the connection will be established.

When I use bluetoothctl command on Linux, I was able to connect them by the following way:

(1) Setting the Linux

# bluetoothctl
[NEW] Controller 00:XX:YY:AA:BB:CC colibri-imx6ull [default]
Agent registered 
[bluetooth]# discoverable on
[bluetooth]# pairable on
[bluetooth]# devices

(2) Operating iPhone to connect the discovered colibri device.

(3) Pairing from Linux device.

[bluetooth]# devices
[NEW] Device 11:22:33:44:55:66 My iPhone
[bluetooth]# pair 11:22:33:44:55:66
[bluetooth]# trust 11:22:33:44:55:66

(4) Operating iPhone to retry connection. Because after I pair and trust my iPhone, I was able to confirm the establishment of Bluetooth connection between colibri module and the iPhone.

How can I realize the expected usecase listed above? Is it possible to establish connection triggered by the external device?

HI @T_Miya

Could you provide the version of the Software of your module? What is your application?

How can I realize the expected usecase listed above?
You just try it out.

Is it possible to establish connection triggered by the external device?
What kind of external device? Could you explain this a bit better?

Thanks and best regards, Jaski

Thanks for your response.

There is no application about Bluetooth. I would like to know how can I prepare the software which can respond the pairing or connection request from the external device (e.g. smartphone).

External device means the smartphone or tablet (Android, iOS or Windows, for example). When I use the bluetoothctl, it is only possible to pair and connect triggered by Linux (Colibri), not by the external device. I would like the external device to be the trigger of pairing and connection.

hi @T_Miya

Sorry about the late response. Actually for Bluetooth, each device can decide or ask for the connection. Depending on the services the device provide, the device will be master (audio output) or slave (speaker). So usually you don’t any special application for that. However for pairing you need to accept the connection on module side, if module is the slave.

Further you can check for Pybluez, which gives you access tot the System Bluetooth resources. Maybe you can write your own script, which will answer to the incoming bluetooth connection.

Best regards, Jaski

Thank you very much for you response.
I will try to check Pybluez.

Best regards, T_Miya.

You are welcome.