9 Replies Latest reply on Aug 10, 2016 2:09 AM by thomatwn123

    Send Data from Arduino (HC-05) to Intel Edison (minibreakout board)

    Kharrazi

      Hello!

       

      I'm currently working on a project that requires me to read Temperature every 5 secs interval and sends it to the intel edison via bluetooth.

      Hardware details:

      1. HC-05

      2. Arduino Nano

      3. DHT11

      4. intel edison minibreakout board

       

      The questions are:

       

      1. How to permanently code arduino into edison? I've tried IoT - Communicate to Arduino code with your Android* Phone by Bluetooth Serial Port Profile (SPP) on Intel® Edison | Int… but whenever I reboot my edison, the codes that i previously compiled is gone and I need to recompile it again.

       

      2. I've the same question as this post HC-05 + edison, but unfortunately no solution to that problem. I managed to pair HC-05 with my edison but was unable to connect with it after pairing and this Failed to connect: org.bluez.Error.NotAvailable  error appeared.

       

       

       

      My deepest gratitude to those who ever willing to help me with this.

       

       

       

      Regards,

      Kharrazi

        • 1. Re: Send Data from Arduino (HC-05) to Intel Edison (minibreakout board)
          Intel_Peter

          Hello Kharrazi,

           

          Which image are you using? If it is the latest image, there is a known issue with it about Arduino sketches not being persistent. Nevertheless, the user AliDouiyek found a workaround for this; take a look at it on Re: Run Arduino sketch on boot Workaround.

           

          Regarding your second question, can you explain to us which steps you have tried so far? On both, the Edison and the HC-05 sides.

           

          Peter.

          • 2. Re: Send Data from Arduino (HC-05) to Intel Edison (minibreakout board)
            Jacobus_C

            Hi,

             

            I am also struggling with the same problem at the moment. I am using an Arduino micro that is connected to both a distance sensor and a HC-06 Bluetooth device. The HC-06 is basically the same as the HC-05 as they have the same firmware, but it can only be used as a slave and not as both a master and a slave like the HC-05. I can't speak for Kharrazi, but I assume that more or less the same steps were followed.

             

            To set up the Bluetooth deviceon the Arduino, I made a software serial connection, so  the code looked something like this:

             

            #include <SoftwareSerial.h>

            SoftwareSerial BT(10, 11); //Where pin 10 will now be RX and pin 11 TX

             

            void setup()

            {

                 BT.begin(9600);

            }

            void loop()

            {

                 BT.println("Hello");

            }

             

            So the only catch to connecting the Bluetooth module to the Arduino was to make sure that RX, TX connections of the module was connected to the TX, RX connections of the Arduino respectively and since the logic level of the RX, TX pins on the module is 3.3V, a voltage divider circuit was made to bring down the TX voltage of the Arduino pin. This setup works perfectly when I connect it to my phone by using Bluetooth ssp pro as well as TerraTerm on my computer, but as soon as I want to connect it to the Edison, I get the same error as Kharrazi.

             

            To try and connect it to the Edison, I used the following commands:

            rfkill list (to check if the bluetooth is soft blocked)

            rfkill unblock bluetooth

            bluetoothctl

            agent KeyboardDisplay

            default-agent

            scan on (till it found my device)

            scan off

            pair 98:....:54

            trust 98:...:54

            connect 98:...:54

             

            Then I get the error "Failed to connect: org.bluez.Error.NotAvailable". I checked with info 98:...:54 and it gave me this:

             

            Name: HC-06

            Alias: HC-06

            Class: 0x001f00

            Paired: yes

            Trusted: yes

            Blocked: no

            Connected: no

            LegacyPairing: yes

            UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)

             

            So the device is paired and trusted, but it does not want to connect.

             

            Any help would be greatly appreciated.

             

            Regards,

            Jacobus

            • 3. Re: Send Data from Arduino (HC-05) to Intel Edison (minibreakout board)
              Kharrazi

              Hi Peter,

               

              1. My edison is currently running version 159. I'll try Re: Run Arduino sketch on boot Workaround. thanks!

               

              2. I set my HC-05 as Slave with 115200 baudrate. I cant get much details on the setting I made to my HC-05 at the moment, no idea why I cant access to its AT command. Will figure that one out later.

               

              I managed to setup my sensor part (arduino nano + DHT11 + HC-05) nicely. Running smooth with my android bluetooth terminal app. and arduino serial (bluetooth) monitor. Everything works wonder.

               

              Here is what I did to setup the connection betweeen my HC-05 with my edison:

               

              root@edison:~# rfkill unblock bluetooth

              root@edison:~# bluetoothctl

              [bluetooth]# agent KeyboardDisplay

              [bluetooth]# default-agent

              [bluetooth]# scan on

              [NEW] Device 20:15:05:22:24:02 Temp Sensor HC05

              [bluetooth]# scan off

              [bluetooth]# pair 20:15:05:22:24:02

              Attempting to pair with 20:15:05:22:24:02

              [CHG] Device 20:15:05:22:24:02 Connected: yes

              Request PIN code

              [agent] Enter PIN code: XXXXXXX

              [CHG] Device 20:15:05:22:24:02 UUIDs:

                      00001101-0000-1000-8000-00805f9b34fb

              [CHG] Device 20:15:05:22:24:02 Paired: yes

              Pairing successful

              [CHG] Device 20:15:05:22:24:02 Connected: no

              [bluetooth]# trust 20:15:05:22:24:02

              [CHG] Device 20:15:05:22:24:02 Trusted: yes

              Changing 20:15:05:22:24:02 trust succeeded

              [bluetooth]# connect 20:15:05:22:24:02

              Attempting to connect to 20:15:05:22:24:02

              [CHG] Device 20:15:05:22:24:02 Connected: yes

              Failed to connect: org.bluez.Error.NotAvailable

              [CHG] Device 20:15:05:22:24:02 Connected: no

               

              Is it because my Edison is not drawing anything from my HC-05 making it to disconnect? Meaning that I need a script to call the data, no?

               

              3. What are the differences between agent KeyboardDisplay, DisplayYesNo... etc?

               

              sorry for the late respond.

              Thanks in advance!

              • 4. Re: Send Data from Arduino (HC-05) to Intel Edison (minibreakout board)
                Intel_Peter

                I'm not sure why the connection is not established, I believe it may have to do with something on the HC-05 side because all you did seems fine. Can you try to create the connection from the HC-05? Is that possible? If so, is there a difference between the outcomes?

                 

                The Bluetooth agent is basically at what level you interact with the Bluetooth device to pair/connect the device. If you choose DisplayYesNo you will only have to enter yes or no, it also depends on what device you are interacting with and what it is capable of.

                 

                Peter.

                • 5. Re: Send Data from Arduino (HC-05) to Intel Edison (minibreakout board)
                  Kharrazi

                  2. I'll work into that and will update here once completed.

                   

                  3. thanks!

                  • 6. Re: Send Data from Arduino (HC-05) to Intel Edison (minibreakout board)
                    Intel_Peter

                    Sure , let us know if you have any updates on your project.

                     

                    Peter.

                    • 7. Re: Send Data from Arduino (HC-05) to Intel Edison (minibreakout board)
                      Sergio_ic

                      Hi Kharrazi,

                       

                      Have you managed to establish a connection between Intel Edison and Arduino (HC-06)? I'm having a similar problem trying to connect my Intel Edison to an Arduino Mini Pro with the module HC-06.

                       

                      The only thing I've managed so far is to add to the intel edison bluetooth serial communication (SPP) following the instructions from section 6.7 (http://download.intel.com/support/edison/sb/edisonbluetooth_331704007.pdf) . Now I'm able to connect my PC and Intel Edison and read the data sent from my PC in the Intel Edison. But I cannot connect the intel edison with HC-06. I hope that there is a solution to this problem...

                      • 8. Re: Send Data from Arduino (HC-05) to Intel Edison (minibreakout board)
                        Kharrazi

                        Hi all,

                         

                        Goodnews! God is gracious!


                        As i suspected, i need a script to call it in order for it to work. Edison seems to paired with HC-05, but it was unable to connect when you request it through bluetoothctl. It will not latch unlike android and pc once 'connect' request is prompt. It'll give Failed to connect: org.bluez.Error.NotAvailable error message if you try to connect with it. You can check whether your device is successfully paired by entering paired-devices command in bluetoothctl.


                        Additional info:

                        Here's my AT command setting on HC-05(master/slave module)

                        AT+UART=115200,1,0

                        AT+ROLE=0 //slave mode


                        Here's what i did, I use node.js to retrieved data from edison bluetooth serial port. I use the sample code in eelcocramer/node-bluetooth-serial-port · GitHub . I follow the instruction in Wirelessly control an Arduino with NodeJS over Bluetooth | Servicelab.org , once I created the node.js script inside my root folder, I run the script on background e.g.: # node <myscriptname>.js &

                         

                        Now access bluetoothctl and follow these steps(assuming that you already rfkill unblock bluetooth at the beginning):


                        agent DisplayKeyboard

                        default-agent

                        scan on

                        //your deviceID will display here if it broadcasts

                        scan off

                        pair <deviceID>

                        //enter your pin if requested

                        trust <deviceID>

                        connect <deviceID>

                        // at this point your terminal will display the data fed by your bluetooth device.

                        exit

                         

                        let me know if my explanation wasn't clear to you.

                        Hope this help!

                        Cheers!

                         

                        p/s: sorry for the late update on this post. Fussy weeks lately. and i haven't tested it on HC-06 but i'm assuming it'll work the same with HC-05. the only different is that HC-05 able to switch mode between Slave or Master.

                        2 of 2 people found this helpful
                        • 9. Re: Send Data from Arduino (HC-05) to Intel Edison (minibreakout board)
                          thomatwn123

                          Hi,

                               I have successfully connected my phone as BT  device and did the SPP communication. But now the problem is, whenever I am trying to connect my another ECG BT sensor, I get something like this

                           

                          [CHG] Device 00:0E:00:09:D8:F6 Paired: yes

                          Pairing successful

                          [CHG] Device 00:0E:00:09:D8:F6 Connected: no

                          [bluetooth]# connect 00:0E:00:09:D8:F6

                          Attempting to connect to 00:0E:00:09:D8:F6

                          [CHG] Device 00:0E:00:09:D8:F6 Connected: yes

                          Failed to connect: org.bluez.Error.NotAvailable

                           

                          How can I solve this problem? Even I downgraded my Edison and even tried with Ubilinux still get same result "Failed to connect: org.bluez.Error.NotAvailable". Pleas help me out in this critical situation

                           

                              here is the full try on edison and failure status. Need your urgent positive solution to deal with my present situation as am in final semester of my masters degree.

                           

                          root@edison:~# cd /home/root/bluetooth

                          root@edison:~/bluetooth# ls

                          SPP-loopback.py

                          root@edison:~/bluetooth# python SPP-loopback.py &

                          root@edison:~/bluetooth# rfkill unblock bluetooth

                          root@edison:~/bluetooth# hciconfig hci0

                          hci0:   Type: BR/EDR  Bus: UART

                                  BD Address: 98:4F:EE:06:16:5E  ACL MTU: 1021:8  SCO MTU: 64:1

                                  UP RUNNING PSCAN

                                  RX bytes:661 acl:0 sco:0 events:38 errors:0

                                  TX bytes:1472 acl:0 sco:0 commands:38 errors:0

                           

                           

                          root@edison:~/bluetooth# hciconfig hci0 up

                          root@edison:~/bluetooth# hciconfig hci0 piscan

                          root@edison:~/bluetooth# bluetoothctl

                          [NEW] Controller 98:4F:EE:06:16:5E BlueZ 5.24 [default]

                          [bluetooth]# agent KeyboardDisplay

                          Agent registered

                          [bluetooth]# default-agent

                          Default agent request successful

                          [bluetooth]# scan on

                          Discovery started

                          Discovery started

                          [CHG] Controller 98:4F:EE:06:16:5E Discovering: yes

                          [NEW] Device BB:A0:51:00:00:AB ZL-RC02D

                          [NEW] Device 00:0E:00:09:D8:F6 00-0E-00-09-D8-F6

                          [CHG] Device 00:0E:00:09:D8:F6 LegacyPairing: no

                          [CHG] Device 00:0E:00:09:D8:F6 Name: CYUT

                          [CHG] Device 00:0E:00:09:D8:F6 Alias: CYUT

                          [CHG] Device BB:A0:51:00:00:AB RSSI: -89

                          [bluetooth]# scan off

                          [CHG] Device 00:0E:00:09:D8:F6 RSSI is nil

                          [CHG] Device BB:A0:51:00:00:AB RSSI is nil

                          Discovery stopped

                          [CHG] Controller 98:4F:EE:06:16:5E Discovering: no

                          [bluetooth]# trust 00:0E:00:09:D8:F6

                          [CHG] Device 00:0E:00:09:D8:F6 Trusted: yes

                          Changing 00:0E:00:09:D8:F6 trust succeeded

                          [bluetooth]# pair 00:0E:00:09:D8:F6

                          Attempting to pair with 00:0E:00:09:D8:F6

                          [CHG] Device 00:0E:00:09:D8:F6 Connected: yes

                          Request PIN code

                          [agent] Enter PIN code: 0000

                          [CHG] Device 00:0E:00:09:D8:F6 UUIDs:

                                  00001101-0000-1000-8000-00805f9b34fb

                          [CHG] Device 00:0E:00:09:D8:F6 Paired: yes

                          Pairing successful

                          [CHG] Device 00:0E:00:09:D8:F6 Connected: no

                          [bluetooth]# discoverable on

                          Changing discoverable on succeeded

                          [bluetooth]# connect 00:0E:00:09:D8:F6

                          Attempting to connect to 00:0E:00:09:D8:F6

                          [CHG] Device 00:0E:00:09:D8:F6 Connected: yes

                          Failed to connect: org.bluez.Error.NotAvailable

                          [CHG] Device 00:0E:00:09:D8:F6 Connected: no

                           

                          Thanks and regards

                           

                           

                          Susanta Sharma