3 Replies Latest reply on Feb 9, 2015 11:33 AM by MPayne

    Bluetooth between two Edisons

    hz7225

      Can someone tell me how to set up Bluetooth connection (either classical Bluetooth or BLE) between two Edison and send data back and forth?

        • 1. Re: Bluetooth between two Edisons
          CMata_Intel

          Hi hz7225

           

          First, I recommend you to take a look at this document: Intel® Edison Bluetooth User Guide -Page 13, will help you to pair and connect the devices.

          In order to send data between them, you can create a C-script using libbluetooth-dev (Using the the Release2, you will see the library in /usr/include/bluetooth)

          I dont' have a sample code to help you with this, but the next links will give you an idea on how to start:

          tutorials:common:development:bluez_programming [Cubieboard Docs]

          An Introduction to Bluetooth Programming

          Bluetooth programming in C with BlueZ

           

          Regards;

          CMata

          • 2. Re: Bluetooth between two Edisons
            MPayne

            BT Classic:

             

            In console 1,Enable BT for edison1 using connman by executing the commands:

            root@edison:~# systemctl start connman

            root@edison:~# connmanctl enable bluetooth

            Execute the command to change the BD address edison1 to avoid edison2 having the same:

            root@edison:~# hciconfig

            root@edison:~# mount -v | grep factory

            root@edison:~# mount -o remount,rw /dev/partition_identifier /factory

            root@edison:~# vi /factory/bluetooth_address  #Set new bt address

            root@edison:~# reboot

             

            In console 2,Enable BT for edison2 by executing the command:

            root@edison:~# rfkill unblock bluetooth

            Execute the command to check the BD address:

            root@edison:~# hciconfig

             

            In console1, register NAP, add br0, set discoverable for edison2 by executing the command:

            root@edison:~# ./test/test-nap br0

             

            In console2, execute the command:

            root@edison:~# brctl addbr br0

            root@edison:~# ifconfig br0 192.168.1.1

             

            In console2, enter into BT shell and execute the following commands:

            root@edison:~# bluetoothctl

            [bluetooth]# discoverable on

             

            In console1, execute the command to enter into bluetooth shell and to initiate pairing:

            root@edison:~# bluetoothctl

            [bluetooth]# agent DisplayOnly

            [bluetooth]# default-agent

            [bluetooth]# scan on

            [bluetooth]# pair BT_ADR_EDISON2

             

            Validate whether the same pass key is prompted on both the console and enter "yes" on both the consoles for request confirmation.

             

            Validate whether the edison2 device has NAP service registered by executing the command:

            [bluetooth]# info BT_ADDR

             

            After successful pairing,connect to NAP by executing the command:

            root@edison:~# connmanctl

             

            Execute the command:

            connmanctl> services

             

            Initiate the connection from edison1 to edison2 :

            connmanctl> connect bluetooth_XXXXXXXXXX