Re: Raspberry Pi 3 Bluetooth Setup
I appear you be having the same same problem I have a miflora bluetooth sensor i pair and trust the sensor but I get the following repeatedly, getting data from the sensor is a bit hit and miss but it does work.
[CHG] Device C4:7C:8D:61:9D:0C Connected: yes
[CHG] Device C4:7C:8D:61:9D:0C Connected: no
[CHG] Device C4:7C:8D:61:9D:0C Connected: yes
[CHG] Device C4:7C:8D:61:9D:0C Connected: no
[CHG] Device C4:7C:8D:61:9D:0C Connected: yes
[CHG] Device C4:7C:8D:61:9D:0C Connected: no
in the syslog I get :
Feb 26 13:26:20 raspberrypi3 bluetoothd[1578]: g_attrib_unregister: invalid id
Feb 26 13:26:33 raspberrypi3 bluetoothd[1578]: g_attrib_unregister: invalid id
Feb 26 13:26:47 raspberrypi3 bluetoothd[1578]: g_attrib_unregister: invalid id
Feb 26 13:27:01 raspberrypi3 bluetoothd[1578]: g_attrib_unregister: invalid id
Any one any idea whats wrong and how to fix ?
[CHG] Device C4:7C:8D:61:9D:0C Connected: yes
[CHG] Device C4:7C:8D:61:9D:0C Connected: no
[CHG] Device C4:7C:8D:61:9D:0C Connected: yes
[CHG] Device C4:7C:8D:61:9D:0C Connected: no
[CHG] Device C4:7C:8D:61:9D:0C Connected: yes
[CHG] Device C4:7C:8D:61:9D:0C Connected: no
in the syslog I get :
Feb 26 13:26:20 raspberrypi3 bluetoothd[1578]: g_attrib_unregister: invalid id
Feb 26 13:26:33 raspberrypi3 bluetoothd[1578]: g_attrib_unregister: invalid id
Feb 26 13:26:47 raspberrypi3 bluetoothd[1578]: g_attrib_unregister: invalid id
Feb 26 13:27:01 raspberrypi3 bluetoothd[1578]: g_attrib_unregister: invalid id
Any one any idea whats wrong and how to fix ?
Re: Raspberry Pi 3 Bluetooth Setup
Probably not the same issue at all; in fact almost every post on this thread refers to a separate issue.
The Mi Flora sensor is a BLE device. Use gatttool to communicate.
The Mi Flora sensor is a BLE device. Use gatttool to communicate.
-
- Posts: 5
- Joined: Fri Feb 03, 2017 4:43 am
Re: Raspberry Pi 3 Bluetooth Setup
Well, since I posted this problem with bluetooth, I´ve since solved my problem. It seems that when I entered the code for the setup procedure, I didn´t push the enter key. After trying the setup procedure several times, I finally entered the 6 digit code and pressed ¨enter¨ key and the keyboard paired immediately. Problem solved. As a matter of fact, I´m typing this message on my newly installed blue tooth keyboard. It´s funny how you can simply overlook a simple step as the ¨enter¨ key.
Rusty
Rusty
Re: Raspberry Pi 3 Bluetooth Setup
Since I posted I also resolved my problem .. incidentally I was using a python script which used gatttoll to get the data https://github.com/open-homeautomation/miflora , however that was not the problem .. my mistake was I paired the miflora device on the Raspberry pi desktop app (I think it may be called Blueman) when I disconnected this, the problem was resolved .. it appears that pairing on Blueman results in continually trying to get data from the miflora device like connect .. disconnect .. connect .. disconnect etc, were as the python script limits this process to say once every hour (programmable) connect .get data. disconnect.
Re: Raspberry Pi 3 Bluetooth Setup
Say you're running a non-gui how do you get a 'sticky' bluetooth setup for a keyboard? As it stands you need to have two keyboards to get the unit setup every time you boot or ssh to the system and set it up after each boot.
Re: Raspberry Pi 3 Bluetooth Setup
Hi guys.
I've read the entire thread and did some things mentioned here, but so far no luck.
My new raspi 3B just arrived, I installed Raspbian and I'm trying to set up Bluetooth on it. The usual problem:
The device is up to date (newest rpi-update from github, also did apt-get update upgrade etc.):
Overlay is not enabled:
Rfkill reports:
dmesg reports:
bluetoothd is running:
bluetoothctl doesn't see the controller:
Packages are installed (except blueman, but it shouldn't be needed at this stage and I don't want to depend on xorg anyway):
btbcm module is loaded:
/sys/kernel/debug/bluetooth contains:
What else can I try?
Thanks.
I've read the entire thread and did some things mentioned here, but so far no luck.
My new raspi 3B just arrived, I installed Raspbian and I'm trying to set up Bluetooth on it. The usual problem:
Code: Select all
$ hcitool scan
Device is not available: No such device
Code: Select all
$ sudo rpi-update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** Performing self-update
*** Relaunching after update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** Your firmware is already up to date
Code: Select all
$ grep pi3-disable-bt /boot/*.txt
Code: Select all
$ rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
Code: Select all
$ dmesg | grep -i blue
[ 12.348119] Bluetooth: Core ver 2.22
[ 12.348179] Bluetooth: HCI device and connection manager initialized
[ 12.348348] Bluetooth: HCI socket layer initialized
[ 12.348358] Bluetooth: L2CAP socket layer initialized
[ 12.348399] Bluetooth: SCO socket layer initialized
[ 12.366287] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 12.366296] Bluetooth: BNEP filters: protocol multicast
[ 12.366311] Bluetooth: BNEP socket layer initialized
Code: Select all
$ ps aux | grep blue
root 1722 0.0 0.2 4812 2560 ? S 14:06 0:00 /usr/sbin/bluetoothd
Code: Select all
$ bluetoothctl
[bluetooth]# list
[bluetooth]#
Code: Select all
$ dpkg -s pi-bluetooth bluez bluez-firmware|grep Version
Version: 0.1.3
Version: 5.23-2+rpi2
Version: 1.2-3+rpi1
Code: Select all
$ lsmod | grep btbcm
btbcm 7916 0
bluetooth 365511 6 bnep,btbcm
Code: Select all
$ sudo mount -t debugfs none /sys/kernel/debug
$ sudo ls -l /sys/kernel/debug/bluetooth
total 0
-r--r--r-- 1 root root 0 kwi 12 14:06 l2cap
-rw-r--r-- 1 root root 0 kwi 12 14:06 l2cap_le_default_mps
-rw-r--r-- 1 root root 0 kwi 12 14:06 l2cap_le_max_credits
-r--r--r-- 1 root root 0 kwi 12 14:06 sco
Thanks.
Re: Raspberry Pi 3 Bluetooth Setup
Problem solved.
The problem is that I passionately hate systemd with all my heart, so the first thing I did after installation was removing it and installing a normal init system (sysvinit).
It looks like pi-bluetooth package is broken and provides only /lib/systemd/system/hciuart.service, but doesn't provide normal init scripts in /etc/init.d (+ symlinks).
This will explain everything:
I added a call to btuart to /etc/rc.local (it should be a proper init file in init.d with a symlink in rc2.d, but calling it after bluetoothd starts works too) and it solved the problem.
The problem is that I passionately hate systemd with all my heart, so the first thing I did after installation was removing it and installing a normal init system (sysvinit).
It looks like pi-bluetooth package is broken and provides only /lib/systemd/system/hciuart.service, but doesn't provide normal init scripts in /etc/init.d (+ symlinks).
Code: Select all
$ dpkg -L pi-bluetooth
/.
/lib
/lib/systemd
/lib/systemd/system
/lib/systemd/system/hciuart.service
/usr
/usr/bin
/usr/bin/btuart
/usr/share
/usr/share/doc
/usr/share/doc/pi-bluetooth
/usr/share/doc/pi-bluetooth/changelog.gz
/usr/share/doc/pi-bluetooth/copyright
Code: Select all
$ btuart
bcm43xx_init
Flash firmware /lib/firmware/BCM43430A1.hcd
Set Controller UART speed to 921600 bit/s
Device setup complete
$ hcitool scan
Scanning ...
00:12:xx:xx:xx:xx Jornada 720
Re: Raspberry Pi 3 Bluetooth Setup
I am trying to make bluetooth work between raspberry pi 3b and a smart phone and I get the same errors observed in this post. I try to understand how to solve the problem according to the last post titled "solved" but I can not understand the way. Thank you in advance for any help to solve this problem.
-
- Posts: 1
- Joined: Wed Jun 07, 2017 2:15 am
Re: Raspberry Pi 3 Bluetooth Setup
@phiv:
I had no luck with bluetoothctl until I found a post (lost the link) with this:
Note that the default-agent, pair, and trust commands are not used.
I had no luck with bluetoothctl until I found a post (lost the link) with this:
Code: Select all
$ sudo bluetoothctl
[bluetooth]# power on
[bluetooth]# agent on
[bluetooth]# scan on
Discovery started
[CHG] Controller B8:27:EB:6C:FE:83 Discovering: yes
[NEW] Device E7:8E:FB:3B:2A:69 Charge 2
[bluetooth]# connect 58:71:33:C0:18:19
Attempting to connect to 58:71:33:C0:18:19
[CHG] Device 58:71:33:C0:18:19 Connected: yes
Connection successful
Re: Raspberry Pi 3 Bluetooth Setup
The 'power on' command is not needed, the hci0 device is powered on at boot in Raspbian. Since you are connecting to a BLE device, there's no need for pairing (therefore the 'agent on' is not needed either.)
When pairing with a classic Bluetooth device, you will need to start the agent, pair, and trust the remote device. 'Default-agent' has indeed been deprecated. Sudo is also not needed in recent versions of Raspbian.
When pairing with a classic Bluetooth device, you will need to start the agent, pair, and trust the remote device. 'Default-agent' has indeed been deprecated. Sudo is also not needed in recent versions of Raspbian.
-
- Posts: 1
- Joined: Wed Jun 07, 2017 4:29 pm
Re: Raspberry Pi 3 Bluetooth Setup
I was tearing hair out trying to get both a PI 3 B and a Zero W to play nicely with Bluetooth on Jessie, until I stumbled on http://raspberrypi.stackexchange.com/qu ... ith-tablet item which advocates setting a compatibility flag in /etc/systemd/system/dbus-org.bluez.service.
Yes, it is a CAPITAL C for the -C option, but unlike what's written in the comment (if you also want to be able to communicate serially) you should do "add sp", NOT "SP" as it's written.
After performing these steps, a different BT icon appeared in Pixel and everything worked as you'd hope.
Hope this helps someone else avoid wasting the hours it cost me!
Yes, it is a CAPITAL C for the -C option, but unlike what's written in the comment (if you also want to be able to communicate serially) you should do "add sp", NOT "SP" as it's written.
After performing these steps, a different BT icon appeared in Pixel and everything worked as you'd hope.
Hope this helps someone else avoid wasting the hours it cost me!
Re: Raspberry Pi 3 Bluetooth Setup
Yes, that information has been repeatedly expressed on this forum. 'sudo sdptool add SP' (with caps) is perfectly acceptable.
The 'different BT icon' is not the result of either the compatibility flag nor adding the SPP. I suspect you have installed blueman in addition to the Bluetooth GUI panel included with Raspbian Pixel (not recommended).
The 'different BT icon' is not the result of either the compatibility flag nor adding the SPP. I suspect you have installed blueman in addition to the Bluetooth GUI panel included with Raspbian Pixel (not recommended).
Re: Raspberry Pi 3 Bluetooth Setup
Good Morning,
Please be patient with me because I am new to Raspberry Pi, Linux and forums.
I'm trying a serial connection via bluetooth between the Raspberry Pi 3 and the Arduino HC-5 bluetooth. So I wanted to know the differences between connecting a device via serial bluetooth on Raspberry and setting up the Pi for other devices such as bluetooth mouse and keyboard, which I saw in this topic.
Sorry for my English, I'm Brazilian and I do not know much English, so you can blame the Google translator.
Thank you in advance.
Please be patient with me because I am new to Raspberry Pi, Linux and forums.

I'm trying a serial connection via bluetooth between the Raspberry Pi 3 and the Arduino HC-5 bluetooth. So I wanted to know the differences between connecting a device via serial bluetooth on Raspberry and setting up the Pi for other devices such as bluetooth mouse and keyboard, which I saw in this topic.
Sorry for my English, I'm Brazilian and I do not know much English, so you can blame the Google translator.
Thank you in advance.
Re: Raspberry Pi 3 Bluetooth Setup
One major difference is that the Serial Port Profile is not included on the Pi by default. See this post for configuring the SPP: viewtopic.php?p=947185#p947185
-
- Posts: 4
- Joined: Mon Aug 28, 2017 4:40 am
Re: Raspberry Pi 3 Bluetooth Setup
Hi, guys.
I've installed raspbian stretch and have succesfully connected my phone, laptop with pi by bluetooth. Also i've translated sound from this devices to pi by using the And all is working fine, but i have to run aplay on every connect/disconnect. And here goes the thing. Is there any simple way to run aplay by default on connect of certain devices.
I've installed raspbian stretch and have succesfully connected my phone, laptop with pi by bluetooth. Also i've translated sound from this devices to pi by using the
Code: Select all
bluealsa-aplay xx:xx:xx... &
Re: Raspberry Pi 3 Bluetooth Setup
Thanks for this command, it's something that took me a while to find. How is your audio quality? Mine is stuttering all over the place from my phone to the Pistrangealx wrote: ↑Mon Aug 28, 2017 4:50 amHi, guys.
I've installed raspbian stretch and have succesfully connected my phone, laptop with pi by bluetooth. Also i've translated sound from this devices to pi by using theAnd all is working fine, but i have to run aplay on every connect/disconnect. And here goes the thing. Is there any simple way to run aplay by default on connect of certain devices.Code: Select all
bluealsa-aplay xx:xx:xx... &
Re: Raspberry Pi 3 Bluetooth Setup
I did some more testing, it works fine if you are playing music from a PC to the Pi but it is unlistenable if you are using an Android phone, I am using an S8+.jason_a69 wrote: ↑Sat Sep 23, 2017 11:03 amThanks for this command, it's something that took me a while to find. How is your audio quality? Mine is stuttering all over the place from my phone to the Pistrangealx wrote: ↑Mon Aug 28, 2017 4:50 amHi, guys.
I've installed raspbian stretch and have succesfully connected my phone, laptop with pi by bluetooth. Also i've translated sound from this devices to pi by using theAnd all is working fine, but i have to run aplay on every connect/disconnect. And here goes the thing. Is there any simple way to run aplay by default on connect of certain devices.Code: Select all
bluealsa-aplay xx:xx:xx... &
The issue has been logged here
https://github.com/Arkq/bluez-alsa/issues/60
As far as I can see, it has not been resolved yet...
So it's back to pulseaudio and Jessie for me. I am using Stretch lite, I am not sure if the desktop version works or not.
-
- Posts: 4
- Joined: Mon Aug 28, 2017 4:40 am
Re: Raspberry Pi 3 Bluetooth Setup
I`m using desktop and it`s all fine with playing music from my android phone, no difference from pc - oxygen 4.1
but it is unlistenable if you are using an Android phone
Re: Raspberry Pi 3 Bluetooth Setup
Just to clarify - what's your PI setup? Are you using a Bluetooth USB device or an onboard one?strangealx wrote: ↑Tue Sep 26, 2017 4:25 amI`m using desktop and it`s all fine with playing music from my android phone, no difference from pc - oxygen 4.1
but it is unlistenable if you are using an Android phone
-
- Posts: 4
- Joined: Mon Aug 28, 2017 4:40 am
Re: Raspberry Pi 3 Bluetooth Setup
Pi 3 model B, onboard bluetooth, stretch desktop. No additional devices, except usb hard drivejason_a69 wrote: ↑Tue Sep 26, 2017 4:28 amJust to clarify - what's your PI setup? Are you using a Bluetooth USB device or an onboard one?strangealx wrote: ↑Tue Sep 26, 2017 4:25 amI`m using desktop and it`s all fine with playing music from my android phone, no difference from pc - oxygen 4.1
but it is unlistenable if you are using an Android phone
Re: Raspberry Pi 3 Bluetooth Setup
Ok thank youstrangealx wrote: ↑Tue Sep 26, 2017 5:49 amPi 3 model B, onboard bluetooth, stretch desktop. No additional devices, except usb hard drivejason_a69 wrote: ↑Tue Sep 26, 2017 4:28 amJust to clarify - what's your PI setup? Are you using a Bluetooth USB device or an onboard one?strangealx wrote: ↑Tue Sep 26, 2017 4:25 am
I`m using desktop and it`s all fine with playing music from my android phone, no difference from pc - oxygen 4.1
I am using stretch-lite.
Phone to onboard pi 3 bluetooth -> audio stutters
Phone to usb bluetooth -> audio fine (you can disable onboard bluetooth with this line in config.txt)
Code: Select all
dtoverlay=pi3-disable-bt
Last edited by jason_a69 on Sat Mar 03, 2018 2:24 pm, edited 1 time in total.
-
- Posts: 4
- Joined: Mon Aug 28, 2017 4:40 am
Re: Raspberry Pi 3 Bluetooth Setup
There is a node.js wrapper for bluetoothctl - https://www.npmjs.com/package/bluetoothctl
So if you are using node.js on your pi, you can do some magic with it and run what you want on bluetooth device connect.
So if you are using node.js on your pi, you can do some magic with it and run what you want on bluetooth device connect.
Re: Raspberry Pi 3 Bluetooth Setup
Hi guys. I'm having the
error.
What i DO notice is that even though i have it enabled, the bluetooth service must be manually started every time i reboot.
What can i do? Pi3 with latest raspbian.
Thanks!
Code: Select all
gabriel@kraken:~ $ sudo bluetoothctl
[bluetooth]# agent on bluetoothd...
Agent registered
[bluetooth]# scan on
[b]No default controller available[/b]
[bluetooth]# :(
Code: Select all
gabriel@kraken:~ $ sudo dmesg | grep Blue
[ 108.571587] Bluetooth: Core ver 2.22
[ 108.571669] Bluetooth: HCI device and connection manager initialized
[ 108.571686] Bluetooth: HCI socket layer initialized
[ 108.571696] Bluetooth: L2CAP socket layer initialized
[ 108.571720] Bluetooth: SCO socket layer initialized
[ 108.593426] Bluetooth: RFCOMM TTY layer initialized
[ 108.593451] Bluetooth: RFCOMM socket layer initialized
[ 108.593466] Bluetooth: RFCOMM ver 1.11
[ 273.400628] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 273.400645] Bluetooth: BNEP filters: protocol multicast
[ 273.400678] Bluetooth: BNEP socket layer initialized
Code: Select all
gabriel@kraken:~ $ sudo systemctl status bluetooth
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2017-12-01 20:49:39 -03; 7min ago
Docs: man:bluetoothd(8)
Main PID: 1672 (bluetoothd)
Status: "Running"
CGroup: /system.slice/bluetooth.service
└─1672 /usr/lib/bluetooth/bluetoothd
Dec 01 20:49:38 kraken systemd[1]: Starting Bluetooth service...
Dec 01 20:49:39 kraken bluetoothd[1672]: Bluetooth daemon 5.43
Dec 01 20:49:39 kraken systemd[1]: Started Bluetooth service.
Dec 01 20:49:39 kraken bluetoothd[1672]: Starting SDP server
Dec 01 20:49:39 kraken bluetoothd[1672]: Bluetooth management interface 1.14 initialized
What can i do? Pi3 with latest raspbian.
Thanks!
Re: Raspberry Pi 3 Bluetooth Setup
I'm running a code on Arduino and using Bluefruit EZ-link to pass data from Arduino to Raspberry Pi3B. The Arduino code is working as well as its setup with the EZ Link as we've already got the whole thing running on Windows.
I've already successfully paired and bind serial port named /dev/rfcomm0. Now when I run a simple read code:
import serial
ser = serial.Serial('/dev/rfcmm0', 9600)
while True:
res = ser.read()
print res
I'm seeing that the EZ Link LED is blinking fast, an indicator that it is connected via bluetooth to the Pi. However, I'm not seeing anything printed.
Hope someone point out what am I missing. I've been stuck with this the whole day.
I've already successfully paired and bind serial port named /dev/rfcomm0. Now when I run a simple read code:
import serial
ser = serial.Serial('/dev/rfcmm0', 9600)
while True:
res = ser.read()
print res
I'm seeing that the EZ Link LED is blinking fast, an indicator that it is connected via bluetooth to the Pi. However, I'm not seeing anything printed.
Hope someone point out what am I missing. I've been stuck with this the whole day.
Re: Raspberry Pi 3 Bluetooth Setup
I am using Raspbian Jessie (RetriPie). How to make bluetooth powered off by default (so, that I could power it on using bluetoothctl) or, at least, make bluetoothctl to remember "power" parameter state after reboot?