Raspberry Pi 3 Bluetooth Setup


132 posts   Page 1 of 6   1, 2, 3, 4, 5, 6
by real_ale » Tue Mar 01, 2016 12:04 pm
How do i setup bluetooth on RPi 3.
Posts: 10
Joined: Sat Oct 26, 2013 9:08 am
by Douglas6 » Tue Mar 01, 2016 12:13 pm
Code: Select all
sudo apt-get install pi-bluetooth
seems to be the best way
User avatar
Posts: 3747
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL
by tonywaite » Tue Mar 01, 2016 3:24 pm
Just a quick 'hello world' that may be helpful!
- the first release of Raspbian Jessie for the Pi3 (26th Feb 2016) has pi-bluetooth pre-loaded and working 'out of the box';
- so if you type 'sudo service bluetooth status' and return, it should show 'active (running)';
- and if you have an adjacent *active* BLE device and type 'sudo hcitool lescan' and return ...
... you should see the callsign of the active BLE devices that it spotted;
Posts: 30
Joined: Sat Sep 15, 2012 10:13 am
by jigneshkerai89 » Tue Mar 01, 2016 5:23 pm
Followed the following:
sudo apt-get install bluetooth bluez blueman
sudo reboot

wait for reboot - The current raspian image does not have native support for the inbuilt bluetooth on the RPi 3. However if you run hciconfig - It will shows the BD address of the Pi. Run hcitool scan to get the BD address of the pairable devices in range.

Then follow:
sudo bluetoothctl

in the [bluetooth]# type agent on followed by default-agent

To pair type pair xx:xx:xx:xx:xx:xx where xx:xx:xx:xx:xx:xx is your BD address of the device you want to pair
Next type trust xx:xx:xx:xx:xx:xx

I am using bluetooth to connect to serial on python so I simply run sudo rfcomm bind 0 xx:xx:xx:xx:xx:xx via subprocess.call to created a serial port.

Make sure to run sudo rfcomm release 0 at the end of the script to release the serial port
Posts: 1
Joined: Tue Mar 01, 2016 5:12 pm
by HenkVB » Thu Mar 03, 2016 3:06 pm
Tried to execute your commands. After "sudo bluetoothctl" I get the command-line "[bluetooth]#"
So far so good, however at that point my usb-keyboard does'nt respond anymore. I can only get back with the command "Ctrl C" to the previous (standard) command-line.

Any suggestions on this?

Thanks
Posts: 2
Joined: Thu Mar 03, 2016 2:33 pm
by Douglas6 » Thu Mar 03, 2016 3:52 pm
That probably means that the Bluetooth daemon is not running (bluetoothctl is somewhat lacking in error handling). The daemon should start automatically after a reboot. Check the status from a command-line with
Code: Select all
systemctl status bluetooth
or you can start it manually with
Code: Select all
sudo systemctl start bluetooth
User avatar
Posts: 3747
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL
by frankymusic » Thu Mar 03, 2016 4:42 pm
Hi all,
I received my Rpi 3 today, together with a BT keyboard "ultron"...

hcitool scan delivers the BT address of my keyboard (20:73:AB:00:0D:C3).

Until "agent on" and "default-agent" everything runs as expected, but...
... the "pair" (together with the address of that keyboard) always says:
20:73:AB:00:0D:C3 not available...

Does anybody get an idea?

Thanks in advance
Frank
Posts: 13
Joined: Thu Mar 03, 2016 4:09 pm
by HenkVB » Thu Mar 03, 2016 6:44 pm
Douglas6 wrote:That probably means that the Bluetooth daemon is not running (bluetoothctl is somewhat lacking in error handling). The daemon should start automatically after a reboot. Check the status from a command-line with
Code: Select all
systemctl status bluetooth
or you can start it manually with
Code: Select all
sudo systemctl start bluetooth


Thanks for the tip, works fine!
Posts: 2
Joined: Thu Mar 03, 2016 2:33 pm
by silenced » Fri Mar 04, 2016 7:46 pm
frankymusic wrote:Hi all,
I received my Rpi 3 today, together with a BT keyboard "ultron"...

hcitool scan delivers the BT address of my keyboard (20:73:AB:00:0D:C3).

Until "agent on" and "default-agent" everything runs as expected, but...
... the "pair" (together with the address of that keyboard) always says:
20:73:AB:00:0D:C3 not available...

Does anybody get an idea?

Thanks in advance
Frank


Do try the following:

~~~~
• sudo bluetoothctl
• agent on
• default-agent
• scan on
• pair xx:xx:xx:xx:xx (device id)

(if asked for a "PIN code" -> enter that "PIN code" on your bluetooth keyboard and press ENTER on the bluetooth keyboard)

• trust xx:xx:xx:xx:xx (if not asked for a pin code this may work too)
• connect xx:xx:xx:xx:xx
~~~~

That's how I got my bluetooth keyboard with integrated mousepad running. (This one: http://www.amazon.de/gp/product/B00GHO9DJW (not available for sale anymore.))
Posts: 1
Joined: Fri Mar 04, 2016 7:37 pm
by ta2025 » Fri Mar 04, 2016 8:15 pm
Any other ideas?

I have confirmed BT is running in my Pi3.
I have done a complete system update.
I did a firmware update.
I do an hcitools scan and I get an address of my BT speaker

I do exactly what Frank did and I get the same message.

Device A0:E9:D8:00:3B:98 is not available.


I followed up with:
sudo systemctl start bluetooth

and I have tried many times.
Posts: 19
Joined: Wed Jan 25, 2012 6:29 pm
by Douglas6 » Fri Mar 04, 2016 8:50 pm
What type of device is it? Are you sure it's in discoverable mode when you try to pair with it?
User avatar
Posts: 3747
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL
by ta2025 » Tue Mar 08, 2016 4:55 pm
Douglas6 wrote:What type of device is it? Are you sure it's in discoverable mode when you try to pair with it?


Absolutely. Not my first rodeo with bluetooth devices :)

There seems to be be multiple generations of bluetooth stacks in the RP community in general. Some of the information is probably old.
Posts: 19
Joined: Wed Jan 25, 2012 6:29 pm
by Douglas6 » Tue Mar 08, 2016 5:10 pm
Sorry, I'm straw-clutching here; no offense intended. I've not run into that error. Did you turn 'scan on' in bluetoothctl and wait for the device to appear?
User avatar
Posts: 3747
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL
by hamdy.aea » Sat Mar 12, 2016 3:57 pm
I have paired my Raspberry Pi 3 to my Hardman Kardon bluetooth soundstick. The status is OK but i receive no sound on the speakers.
Hamdy Abou El Anein
Posts: 22
Joined: Sat Mar 12, 2016 3:55 pm
by fruitoftheloom » Sat Mar 12, 2016 4:16 pm
hamdy.aea wrote:I have paired my Raspberry Pi 3 to my Hardman Kardon bluetooth soundstick. The status is OK but i receive no sound on the speakers.


https://wiki.debian.org/BluetoothUser/a2dp
.
Ex Computer Repair & Service Technician.
RPi 3B, HP Envy 4500 Wireless Printer, Google Chromecast, Android Smart Phone, HD 1080p TV and 3/4G Mobile Internet make ideal companions.
Posts: 13310
Joined: Tue Mar 25, 2014 12:40 pm
Location: Bognor Regis UK
by hamdy.aea » Sat Mar 12, 2016 5:22 pm
Now I have another problem. The bluetooth adapter is not found.
Hamdy Abou El Anein
Posts: 22
Joined: Sat Mar 12, 2016 3:55 pm
by hamdy.aea » Sat Mar 12, 2016 5:30 pm
root@raspberrypi:~# hcitool dev
Devices:
Hamdy Abou El Anein
Posts: 22
Joined: Sat Mar 12, 2016 3:55 pm
by pauly » Sat Mar 12, 2016 8:43 pm
I get "Device is not available: No such device" when I try to scan, what am I missing?
Code: Select all
pi@raspberrypi-3-drivecam:~ $ hcitool scan
Device is not available: No such device
pi@raspberrypi-3-drivecam:~ $ sudo bluetoothctl
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# list
[bluetooth]# devices
[bluetooth]# scan
Missing on/off argument
[bluetooth]# scan on
No default controller available
[bluetooth]# list
[bluetooth]# power on
No default controller available
[bluetooth]# quit
Agent unregistered
pi@raspberrypi-3-drivecam:~ $ systemctl status bluetooth
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)
   Active: active (running) since Sat 2016-03-12 20:35:25 UTC; 2min 46s ago
     Docs: man:bluetoothd(8)
 Main PID: 2689 (bluetoothd)
   Status: "Running"
   CGroup: /system.slice/bluetooth.service
           └─2689 /usr/lib/bluetooth/bluetoothd
pi@raspberrypi-3-drivecam:~ $ hcitool scan
Device is not available: No such device
pi@raspberrypi-3-drivecam:~ $ sudo hcitool scan
Device is not available: No such device
pi@raspberrypi-3-drivecam:~ $ hcitool dev
Devices:
User avatar
Posts: 12
Joined: Sat Mar 09, 2013 7:14 am
Location: Kent
by Douglas6 » Sat Mar 12, 2016 9:22 pm
Pauly: you are missing either the latest firmware on a Pi3, or a recognized Bluetooth dongle on a Pi1-2.
User avatar
Posts: 3747
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL
by pauly » Sat Mar 12, 2016 9:26 pm
thanks, I have a pi3, thought everything was as up to date as could be. Have updated with rpi-update and still the same result. Anything else I can try?
User avatar
Posts: 12
Joined: Sat Mar 09, 2013 7:14 am
Location: Kent
by Eaglepete » Sun Mar 13, 2016 12:03 pm
Hi All.
New member & also new to RPi :shock: so please be gentle with me :D
Just got RPi 3 for Kodi use :roll: managed to install from noobs without keyboard ( had to borrow a wired mouse but no keyboard ) Installed openelec , checked zeroconf , enabled Bluetooth etc ( as directed by yatse app ) but it won't find my mini keyboard ( the type you get with an m8 android box from eBay )
Have connected yatse ( eventually ) but really would like my keyboard !!!

I can't follow the prompts above as I don't know where or if I can put them in as it boots straight into Kodi ??

Any help would be much appreciated 8-)
Posts: 1
Joined: Sun Mar 13, 2016 11:44 am
by phiv » Sun Mar 13, 2016 12:32 pm
I have the same problem as Pauly. Devices are not listed in
Code: Select all
hcitool dev
, yet when I run
Code: Select all
systemctl start bluetooth
,
Code: Select all
dmesg | grep Blue
shows the driver is loaded correctly (I think). Should I see more in this output?:

Code: Select all
[ 1486.123815] Bluetooth: Core ver 2.21
[ 1486.123898] Bluetooth: HCI device and connection manager initialized
[ 1486.123916] Bluetooth: HCI socket layer initialized
[ 1486.123928] Bluetooth: L2CAP socket layer initialized
[ 1486.123957] Bluetooth: SCO socket layer initialized
[ 1486.164113] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 1486.164133] Bluetooth: BNEP filters: protocol multicast
[ 1486.164152] Bluetooth: BNEP socket layer initialized


I run OSMC; I tried
Code: Select all
sudo apt-get install rpi-update
in case the firmware is out of date but the rpi-update package is not in the repo. Manually getting and running rpi-update gives the following errors, so I did not proceed.
Code: Select all
osmc@osmc:~$ sudo rpi-update
You appear to be trying to update firmware on an incompatible distribution. To force update, run the following:
sudo -E RPI_UPDATE_UNSUPPORTED=0 rpi-update



Any other ideas?
Last edited by phiv on Sun Mar 13, 2016 12:50 pm, edited 1 time in total.
Posts: 4
Joined: Thu Jul 25, 2013 10:38 am
by phiv » Sun Mar 13, 2016 12:49 pm
Ok, I risked it and updated firmware, which OSMC normally blocks until it is tested with the distribution. Same issue:
Code: Select all
 *** Downloading specific firmware revision (this will take a few minutes)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   168    0   168    0     0    902      0 --:--:-- --:--:-- --:--:--   908
100 49.3M  100 49.3M    0     0  1232k      0  0:00:40  0:00:40 --:--:--  130k
 *** Updating firmware
 *** Updating kernel modules
 *** depmod 4.1.19+
 *** depmod 4.1.19-v7+
 *** Updating VideoCore libraries
 *** Using HardFP libraries
 *** Updating SDK
 *** Running ldconfig
 *** Storing current firmware revision
 *** Deleting downloaded files
 *** Syncing changes to disk
 *** If no errors appeared, your firmware was successfully updated to 2a7eb4fc4cef07906c36e9adcf76f053daabe371
 *** A reboot is needed to activate the new firmware
osmc@osmc:~$ dmesg | grep Blue
[ 1486.123815] Bluetooth: Core ver 2.21
[ 1486.123898] Bluetooth: HCI device and connection manager initialized
[ 1486.123916] Bluetooth: HCI socket layer initialized
[ 1486.123928] Bluetooth: L2CAP socket layer initialized
[ 1486.123957] Bluetooth: SCO socket layer initialized
[ 1486.164113] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 1486.164133] Bluetooth: BNEP filters: protocol multicast
[ 1486.164152] Bluetooth: BNEP socket layer initialized
osmc@osmc:~$ hcitool dev
Devices:
osmc@osmc:~$ systemctl status bluetooth
* bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)
  Drop-In: /etc/systemd/system/bluetooth.service.d
           `-local.conf
   Active: active (running) since Sat 2016-03-12 20:05:09 EST; 11h ago
     Docs: man:bluetoothd(8)
 Main PID: 844 (bluetoothd)
   Status: "Running"
   CGroup: /system.slice/bluetooth.service
           `-844 /usr/lib/bluetooth/bluetoothd
Posts: 4
Joined: Thu Jul 25, 2013 10:38 am
by phiv » Sun Mar 13, 2016 12:53 pm
The bluetoothctl shows no device even though the agent seems to work:

Code: Select all
[bluetooth]# devices
[bluetooth]# agent-on
Invalid command
[bluetooth]# agent on
Agent registered
[bluetooth]# list
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# scan on
No default controller available
[bluetooth]# list
[bluetooth]#
Posts: 4
Joined: Thu Jul 25, 2013 10:38 am
by Douglas6 » Sun Mar 13, 2016 2:35 pm
If you are running the latest Raspbian image, or using NOOBS 1.8, it will just work. If you are trying to upgrade a Wheezy image, see various threads on this forum. If you're using NOOBS < 1.8, you may be out of luck, and will have to flash a new card. If you are running OSMC, or other OS, it's best to ask on their forum.
User avatar
Posts: 3747
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL