PaulitaPerezB
Posts: 6
Joined: Tue Dec 19, 2017 9:34 pm

Problem connecting two BT devices to a Pi3

Tue Apr 17, 2018 12:08 am

I want a HC-06 and a HC-05 BT modules connect simultaneously to the Pi3 using rfcomm.
I normally connect one module with the following command and it works for me.
sudo rfcomm connect hci0 XX:XX:XX:XX:XX:XX

But now I want to connect two modules so I tried this and return an error.
sudo rfcomm connect hci0 XX:XX:XX:XX:XX:XX sudo rfcomm connect hci1 XX:XX:XX:XX:XX:XX

I want to know if there are a way to connect to devices to the Pi3 simultaneously. Because I need to use it to receive data from an Arduino and send orders to another. I do it with a Python script using PySerial.

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Problem connecting two BT devices to a Pi3

Tue Apr 17, 2018 6:42 pm

What error are you getting? You could try

Code: Select all

sudo rfcomm connect 1 XX:XX:XX:XX:XX:XX

PaulitaPerezB
Posts: 6
Joined: Tue Dec 19, 2017 9:34 pm

Re: Problem connecting two BT devices to a Pi3

Tue Apr 17, 2018 7:46 pm

I could fix the problem!! thank you!

I tried this to connect the first module.

Code: Select all

sudo rfcomm connect 1 XX:XX:XX:XX:XX:XX  
and this to connect the second one:

Code: Select all

sudo rfcomm connect 2 XX:XX:XX:XX:XX:XX

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Problem connecting two BT devices to a Pi3

Tue Apr 17, 2018 7:51 pm

That's interesting. I would have thought it would be '0' and '1'. Those BlueZ rascals. Although if rfcomm can't determine a valid device number, it defaults to hci0, so maybe '1' and '2' ends up being hci1 and hci0?

Return to “Troubleshooting”