1 2 3 4 Previous Next 48 Replies Latest reply on Jun 3, 2015 10:01 AM by SherryL

    Bluetooth communication Edison/phone


      Hi all,


      I'm creating this post to ask a question concerning Bluetooth. Sorry for opening a new post around this but I didn't find something that worked for me on other posts.


      I only want to have a BT communication and exchange data between Intel Edison and Android phone.

      First I have this : communication between my laptop with BT dongle and the python script rfcomm-server.py included in python-bluez and Android phone with BlueTerm app.

      This works really fine without any modification to add.


      So I wanted to have the same python script on Edison. Problem : program does not compile because it seems not to be able to import bluetooth library (library is not in Edison so, I'm using release ww42 by the way).


      I'm trying to compile my own Yocto image and try to add the needed package but I'm facing errors creating image and I don't know how to add the package I need.

      I also tried some opkg but not sure if I tried everything.


      So what do you think I should do ?

      Maybe try to have a different approach (use C script but I will probably also have a library problem).


      Thank you in advance, any help will be appreciated.


      May I add that I am quite new to this board and also Yocto, if you want me to add some information (about what I tried already or anything else) don't hesitate, I really tried several things but can't tell you about everything or the post might be really too long. I was really lost at the beginning trying to understand commands about bluetoothctl and how I would exchange data. I began to see things clearer recently trying to reproduce communication between my Linux PC and Android phone. Just for now, I'm thinking I can compile the python script by creating my own image but facing some troubles now and don't know what package do I will have to include and how to do so... So first, I am on the right way thinking that creating my own image will help or is there other things I need to do, maybe there is something much simpler to do ?



        • 1. Re: Bluetooth communication Edison/phone
          Frederick Blais

          Hi thom@s


          Please take a look at this thread : Bluetooth ubilinux if you don't mind installing Ubilinux.

          I got Bluetooth working perfectly with Python

          I even tried the rfcomm-server.py example


          Good luck!

          • 2. Re: Bluetooth communication Edison/phone

            Hi thom@s,


            I download the python-bluez 0.1.4 but it seems to be compatible only with BlueZ4 and the Edison image comes with BlueZ5. Maybe you use the os library to use Linux commands and use this guide in your code https://communities.intel.com/docs/DOC-23618 .



            • 3. Re: Bluetooth communication Edison/phone

              hi thom@s,


              Here ( RFCOMM sockets ) you can find a very simple example of RFCOMM bluetooth server. It compiles perfectly with Intel Edison toolchain.


              >SDK_ROOT/sysroots/i386-pokysdk-darwin/usr/bin/i586-poky-linux/i586-poky-linux-gcc -m32 -march=i586 --sysroot=SDK_ROOT/sysroots/core2-32-poky-linux  rfcomm-server  rfcomm-server.c -lbluetooth




              • 4. Re: Bluetooth communication Edison/phone



                thank you all for your help and interest in my post !


                Damain : I tried the C program but as with python, I have the problem that the bluetooth libraries are not available...


                JPMontero_Intel : I already checked this guide but not sure how I can turn these instructions into a program to have bluetooth communication. Samples provided on RFCOMM sockets seemed simpler.


                speccy88 : thank you for your post, I think this is quite what I was looking for. I managed to install ubilinux on my Edison (had some problem with my WiFi network, took me some time to deal with) and installed python-bluez, so I don't have the error around the library anymore. However, following the post, it seems that bluez is not installed on ubilinux (Re: ubilinux (Debian) now available from Emutex Labs). Could you tell me a bit more on how you did get around to install bluetooth on ubilinux ? I had some trouble with this : wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.24.tar.xz telling me that

                GnuTLS: A TLS packet with unexpected length was received.

                Unable to establish SSL connection.


                Thank you in advance !



                • 5. Re: Bluetooth communication Edison/phone
                  Frederick Blais

                  Hi Thom@s,


                  All I did is follow those steps:

                  Re: ubilinux (Debian) now available from Emutex Labs

                  Put these missing files in my filesystem:


                  And install pybluez:

                  apt-get install python-bluez

                  That's weird, it looks like you got some trouble with wget.

                  Here is my suggestion :

                  1. download that file ( http://www.kernel.org/pub/linux/bluetooth/bluez-5.24.tar.xz ) on your computer (the one you use to connect to Edison via SSH)

                  2. Use FileZilla client and connect to your Edison with the SFTP protocol. You will be able to drag and drop files from your computer to your Edison

                  Keep me up to date with your progress. If I got it to work, there is no reason you couldn't, our hardware/software is the same.

                  • 6. Re: Bluetooth communication Edison/phone

                    try wget --no-check-certificate URL

                    • 7. Re: Bluetooth communication Edison/phone

                      Hi all and thanks for your answers !


                      After facing several weird errors I needed to reflash the Edison with ubilinux and the wget command worked, I followed these steps (just needed apt-get update and apt-get upgrade before) from the post you mentioned Re: ubilinux (Debian) now available from Emutex Labs :

                      $ apt-get install libusb-dev libdbus-1-dev libglib2.0-dev automake libudev-dev libical-dev libreadline-dev rfkill

                      $ wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.24.tar.xz

                      $ tar xf bluez-5.24.tar.xz

                      $ cd bluez-5.24

                      $ ./configure –disable-systemd

                      $ make -j 2

                      $ make install

                      I think I'm really close to do it but I'm bit confused with the steps that follow, it is said :

                      Then from the original image (I have downloaded on my laptop and mounted the ext4 file locally) you should copy the following folder and files to your Edison ubilinux filesystem:






                      I'm not really sure about what to do, I think I have to copy those folders in order to have it on Edison, right ? I don't understand what I am supposed to do to have these files on my laptop (mount ext4 locally ?) and then to transfer it on Edison (I think that speccy88 mentioned about FilZilla, this should do it ?).


                      Plus speccy88 you said :

                      Put these missing files in my filesystem:


                      But I can't access to it, it's giving an "Unauthorized web page" !

                      Are the files I need in this zip file ?


                      Your help has been really useful from the beginning and I'm sure this is close to work !

                      If anyone can give me a hand about this cause I'm a bit confused !


                      Thank you,




                      EDIT :

                      Just saw and followed this to have the files : Re: Bluetooth ubilinux

                      So to recap all of what I did :

                      * install bluez-5.24

                      * copy /lib/firmware/bcm43341.* in new directory /etc/firmware/

                      * get the files :

                      /etc/bluetooth/                                   --> wget Edison Yocto image and mount -o loop edison-image-edison.ext4 ./foo and I copied the file ./foo/etc/bluetooth in new directory on Edison /etc/bluetooth

                      /usr/sbin/bluetooth_rfkill_event          --> same wget Yocto, mount, and copied ./foo/usr/sbin/bluetooth_rfkill_event in new directory /usr/sbin/bluetooth_rfkill_event on Edison

                      /usr/sbin/brcm_patchram_plus          --> git clone broadcom bluetooth, make and copy all files in new directory /usr/sbin/brcm_patchram_plus on Edison


                      Running bluetooth_rfkill_event on Edison give me the following :

                      root@ubilinux:~# execute brcm_patchram_plus --use_baudrate_for_download --no2bytes --enable_fork --enable_lpm --enable_hci --baudrate 3000000 --patchram /etc/firmware/bcm43341.hcd --bd_addr 00:43:34:b1:be:ef /dev/ttyMFD0

                      sh: 1: brcm_patchram_plus: Permission denied


                      I tried  chmod 777 /usr/sbin/brcm_patchram_plus/brcm_patchram_plus but still permission denied...

                      Must be a problem with the way I imported /usr/sbin/bluetooth_rfkill_event ??? Do I have to do a "make" somewhere ?

                      If someone can tell me, I must have done something wrong or forgot something, I'll may try to reflash ubilinux and try all the steps again just to check.

                      • 8. Re: Bluetooth communication Edison/phone
                        Frederick Blais

                        Forget about the ext4 stuff.


                        I don't know why you are not able to download the files. Here they are again on my Dropbox

                        Dropbox - Edison


                        What you have to do is just make sure that the following directories exist and that contains the files (there should be 6 files) :

                        /etc/bluetooth/   (4 files inside this directory)




                        Use the way you want to copy the files to the Edison, but my favorite way is SFTP with FileZilla.



                        Your path is weird :



                        You seem to have a directory called brcm_patchram_plus/ this is not what I have.

                        copy the brcm_patchram_plus file to the /usr/sbin directory


                        probably you get the permission denied because of that


                        Can you give me the output of

                        ls /etc/bluetooth/ 

                        ls /usr/sbin/

                        • 9. Re: Bluetooth communication Edison/phone

                          Is there a way to pair Edison with Andriod without using ubilinux?


                          [A.K.A: When is Intel (tired of waiting) releasing the "new" yocto firmware for this device? ]

                          How to set Edison Bluez password without ubilinux install <-- is this even possible, even with ubilinux?


                          I am using a windows 7 host and unable to install ubilinux.

                          • 10. Re: Bluetooth communication Edison/phone

                            Hi, thanks for keeping to give some good help


                            speccy88 you are right, I had it correct in /etc/bluetooth with 4 .conf files and in /usr/sbin/bluetooth_rfkill_event

                            But for /usr/sbin/brcm_patchram_plus it was a repertory within all the files I extracted after downloading broadcom bluetooth, including the brcm_patchram_plus.

                            So I downloaded the files from your Dropbox link, but I don't know why, it didn't work (couldn't launch bluetooth_rfkill_event like it wasn't existing on my Edison).

                            So I got back into my previous steps (download broadcam bluetooth and ONLY put the brcm_patchram_plus in /usr/sbin AND extracted bluetooth_rfkill_event and files to include in /etc/bluetooth from the Yocto image downloaded on my Edison) and it worked.

                            I can check my device and see the MAC address. Thanks a lot for all your help !!

                            Still I have something to deal with : as I want to connect with my phone to Edison, it asks me for the PIN code for pairing (displaying this message on the phone, but nothing on Edison to be displayed), but I don't know where to find it in my Edison (tried 0000 and 1234 and also tried to check in the files but don't know where to find !). I wanted to use bluetoothctl like I could to with Yocto, but when I enter in bluetoothctl and type for the command (like pair+MAC address) it's not displaying any text).


                            Anyone to know where I can fin the pin code for bluetooth pairing of Edison ?


                            I think and also hope it is the last step before I can confim that all's been working great and I'll be able to post an entire solution !






                            Plus for hk101, using Intel Edison with the Yocto image (release ww42 and also ww36) I was able to pair with my Android phone using bluetoothctl on Edison. But I didn't use it on Windiws, so can't help on this side, sorry...

                            • 11. Re: Bluetooth communication Edison/phone
                              Frederick Blais

                              Congrats thom@s!


                              some more info (maybe some of these you already know):


                              To enable bluetooth on Edison after reboot issue these 2 commands

                              bluetooth_rfkill_event &

                              rfkill unblock bluetooth


                              once done, you should be able to see your hci0 interface


                              >hci0: Type: BR/EDR  Bus: UART

                              >  BD Address: 00:43:34:B1:BE:EF  ACL MTU: 1021:8  SCO MTU: 64:1

                              >  UP RUNNING PSCAN ISCAN

                              >  RX bytes:7481 acl:0 sco:0 events:170 errors:0

                              >  TX bytes:2115 acl:0 sco:0 commands:119 errors:0


                              Notice the PSCAN and ISCAN, this makes your device discoverable by others... to get it enter this command

                              hciconfig hci0 piscan


                              If you want to see other devices you can try this command (it sees my Pebble watch, my Linux computer and my iPhone)

                              hcitool scan

                              >Scanning ...

                              >  00:17:E9:A5:1F:71 Pebble 1F71

                              >  00:1B:10:00:2A:EC fred-i3-0

                              >  84:8E:0C:3F:3D:8A Frédérick’s iPhone


                              I got the code below to work succesfully without any pairing

                              Client code on the Edison :

                              import bluetooth


                              bd_addr = "00:1B:10:00:2A:EC"

                              port = 1

                              sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM )

                              sock.connect((bd_addr, port))

                              sock.send("Hello, World!")



                              Server code on my Linux computer (USB Bluetooth dongle)

                              import bluetooth


                              server_sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM )

                              port = 1



                              client_sock,address = server_sock.accept()

                              print "Accepted connection from ",address

                              data = client_sock.recv(1024)

                              print "received [%s]" % data




                              So that is what I have so far. I tried the bluetoothctl command but I got nothing, it seems to freeze. If you are able to make a pairing on Ubilinux, I would be really interested on how you did it.

                              • 12. Re: Bluetooth communication Edison/phone

                                Hi thom,

                                I guess I was not clear in my post above. Here is what I am looking for:

                                1. Setup Edison to be pairable, discoverable with a known pin. This pin is one I setup in configuration.

                                2. Use my android (or iOS) phone to detect and find edison and pair with Edison, and be able

                                to send information to Edison using my phone, using the known pin.

                                3. I would like to have the above functionality in the Edison out-of-the-box

                                4. I have a windows 7 OS as host. To port debian/ubilinux, I understand it can only be done using a linux host.

                                    I did find an instructable blog that showed how to do it via windows, but the ublinux folks removed dfu-utils from their

                                    web site :-(.

                                So my request:

                                Anyone out there in Edison land that has a ubilinux(with Bluetooth) that I can download and use the "reboot ota" method of flashing Edison?

                                • 13. Re: Bluetooth communication Edison/phone

                                  Hi !


                                  well speccy88 this is GOOD !! thank you very very much for your useful help and fast answers !! finally works (problem with pairing because I was running the server in Edison and connecting from smartphone).

                                  So bluetooth communication worked with client rfcomm on Edison and server rfcomm on laptop (I'll then have to dig a bit into Bluetooth Android to make it work cause client on Edison doesn't send message to phone right know).

                                  I'll keep on working about this, I'll post the entire solution soon (at least for communication between Edison and laptop) but check if I manage with Android first.




                                  Okay, I won't be able to help you with porting debian/ubilinux using windows 7. But I think I'll have to try to find how to setup pin in config files of Edison so I'll let you know if I find something.



                                  Anyway, thank you all for your answers, I've got what I want (will post entire solution soon but have to check some more before to add phone part if I can). I'm happy to have some fast answers (I was working and searching on my own during hours before this!!!).



                                  • 14. Re: Bluetooth communication Edison/phone

                                    Hi Thomas,

                                    OK. I found a dfu_util.exe in other threads and now I am able to use windows to flash edison with ubilinux successfully. Yay! But, ( there is

                                    always a but :-) ).. Following Daniele_Cleri's instructions instructions link_here


                                    I am unable to get the following libs to install apparently due to broken links?


                                    Err http://security.debian.org/ wheezy/updates/main libxml2 i386 2.8.0+dfsg1-7+wheezy1

                                      404  Not Found [IP: 80]


                                    I am able to ping google.com from Edison.


                                    Anyone else see this error? If so how to fix?


                                    =========================== transcript of attempted install ==================

                                    root@ubilinux:~# apt-get install  libdbus-1-dev libglib2.0-dev

                                    Reading package lists... Done

                                    Building dependency tree

                                    Reading state information... Done

                                    The following extra packages will be installed:

                                      libdbus-1-3 libelf1 libffi5 libglib2.0-0 libglib2.0-bin libglib2.0-data

                                      libpcre3 libpcre3-dev libpcrecpp0 libxml2 pkg-config sgml-base

                                      shared-mime-info xml-core zlib1g-dev

                                    Suggested packages:

                                      libglib2.0-doc sgml-base-doc debhelper

                                    The following NEW packages will be installed:

                                      libdbus-1-dev libelf1 libffi5 libglib2.0-0 libglib2.0-bin libglib2.0-data

                                      libglib2.0-dev libpcre3 libpcre3-dev libpcrecpp0 libxml2 pkg-config

                                      sgml-base shared-mime-info xml-core zlib1g-dev

                                    The following packages will be upgraded:


                                    1 upgraded, 16 newly installed, 0 to remove and 33 not upgraded.

                                    Need to get 1,302 kB/9,581 kB of archives.

                                    After this operation, 30.1 MB of additional disk space will be used.

                                    Do you want to continue [Y/n]? Y

                                    Err http://http.debian.net/debian/ wheezy/main libxml2 i386 2.8.0+dfsg1-7+wheezy1

                                      404  Not Found

                                    Err http://security.debian.org/ wheezy/updates/main libxml2 i386 2.8.0+dfsg1-7+wheezy1

                                      404  Not Found [IP: 80]

                                    Err http://security.debian.org/ wheezy/updates/main libdbus-1-3 i386 1.6.8-1+deb7u4

                                      404  Not Found [IP: 80]

                                    Err http://security.debian.org/ wheezy/updates/main libdbus-1-dev i386 1.6.8-1+deb7u4

                                      404  Not Found [IP: 80]

                                    Failed to fetch http://security.debian.org/pool/updates/main/libx/libxml2/libxml2_2.8.0+dfsg1-7+wheezy1_i386.deb  404  Not Found [IP: 80]

                                    Failed to fetch http://security.debian.org/pool/updates/main/d/dbus/libdbus-1-3_1.6.8-1+deb7u4_i386.deb  404  Not Found [IP: 80]

                                    Failed to fetch http://security.debian.org/pool/updates/main/d/dbus/libdbus-1-dev_1.6.8-1+deb7u4_i386.deb  404  Not Found [IP: 80]

                                    E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

                                    1 2 3 4 Previous Next