General

Data transfer from Bluno to Intel Galileo through BLE

userHead anandankumar 2014-12-11 16:31:30 12878 Views19 Replies
Dear all,

I am working on a project that involves Bluno as a sensor module. It collects data such as temperature, pH and light intensity. Bluno is assigned as the peripheral role.

It sends the data over Bluetooth LE to an Intel Galileo Gen 2 which has a mPCIe N 135 card that also supports BLE. The Intel Galileo will be my central device. Galileo is running on a Linux image that has the BlueZ library in-built to it.

I am following the "Getting started with Bluetooth LE" by Jared Wolff as seen here at http://www.jaredwolff.com/blog/get-star ... ow-energy/. Up to now, I have managed to successfully run a low energy scan using Intel Galileo using the command:
Code: Select all
hcitool lescan
Result: The Bluno's Bluetooth address was listed with the device name shown as "v1.8Bluno".

I then tried to connect to Bluno using gattool in Linux:
Code: Select all
 sudo gatttool -b <Bluno BLE ADDRESS> -I
Result: Successfully opened gattool in interactive mode.

Then when I tried to connect the Galileo to Bluno using "connect" command, the result showed as:

"Connecting... connect error: connect error: Connection refused (111)".

I then found out that Bluno has a built in password which I discovered through the AT command which is default to DFRobot. I would like to know if whether the password is refusing the connection? If yes, how can I remove the password and allow open connections? If the password can't be removed, how do I go about solving this?

Also, would it be better if I define my own profile/service for the TI CC2540 BLE chip in Bluno or would the "Plain Protocol library" supplied be sufficient to work with?
Any help is greatly appreciated!
2015-01-30 11:28:33 try system(kill process) ? userHeadPic Jose
2015-01-30 11:28:33 try system(kill process) ? userHeadPic Jose
2015-01-29 21:42:04 In my Arduino sketch for Galileo I used the following code:
Code: Select all
system("gatttool -b <ble address> --char-write-req -a "0x0025 -n 0100 --listen > /media/realroot/datalog.txt");
" /media/realroot/datalog.txt " channels the output of the Linux command to that text file located in /media/realroot.

0100 enables notifications on the device. You may refer to this link:
http://stackoverflow.com/questions/1565 ... s-in-linux

The problem I am facing is that when I typed this into my Arduino sketch, I am unable to open the file for read operation. When I used the SD.exists("datalog.txt"), it returns false because the file is being opened (Galileo is continuously receiving the data from Bluno and writing it to the file).

I need a way to stop the process. While testing in the Linux terminal, this can be easily done by pressing CTRL+Z. Similar to typing "hcitool lescan" and then pressing "CTRL+C" to stop the scanning process. How can this be done in an Arduino sketch?

I would like to thank you for your help in advance =)
userHeadPic anandankumar
2015-01-29 21:42:04 In my Arduino sketch for Galileo I used the following code:
Code: Select all
system("gatttool -b <ble address> --char-write-req -a "0x0025 -n 0100 --listen > /media/realroot/datalog.txt");
" /media/realroot/datalog.txt " channels the output of the Linux command to that text file located in /media/realroot.

0100 enables notifications on the device. You may refer to this link:
http://stackoverflow.com/questions/1565 ... s-in-linux

The problem I am facing is that when I typed this into my Arduino sketch, I am unable to open the file for read operation. When I used the SD.exists("datalog.txt"), it returns false because the file is being opened (Galileo is continuously receiving the data from Bluno and writing it to the file).

I need a way to stop the process. While testing in the Linux terminal, this can be easily done by pressing CTRL+Z. Similar to typing "hcitool lescan" and then pressing "CTRL+C" to stop the scanning process. How can this be done in an Arduino sketch?

I would like to thank you for your help in advance =)
userHeadPic anandankumar
2015-01-29 16:52:26 How are you parsing the data into the text file? userHeadPic Jose
2015-01-29 16:52:26 How are you parsing the data into the text file? userHeadPic Jose
2015-01-29 15:39:00 Dear Jose,

Thank you very much for your suggestion!! The hex digits were indeed in ASCII. I went to www.asciitable.com and converted the string sent by Bluno and after conversion, it displayed the correct sensor readings!

Now, the next step that I am trying to accomplish is place that notification handle into a text file. I have successfully parsed the data into the text file. However, the output from the text file grow without bound. As in, it does not overwrite the previous reading but rather adds a new line for each data received from Bluno. What I want is to only have one line of sensor reading that updates each time I write to the file.

You may refer to the output of my text file which I read in Galileo and the values of the sensor readings sent by Bluno. They indeed do match but just that the readings in Galileo is in hex. You may use this "hex to ASCII converter" ---> http://www.rapidtables.com/convert/numb ... -ascii.htm

Galileo: https://drive.google.com/file/d/0Bz90QE ... sp=sharing
Bluno : https://drive.google.com/file/d/0Bz90QE ... sp=sharing
userHeadPic anandankumar
2015-01-29 15:39:00 Dear Jose,

Thank you very much for your suggestion!! The hex digits were indeed in ASCII. I went to www.asciitable.com and converted the string sent by Bluno and after conversion, it displayed the correct sensor readings!

Now, the next step that I am trying to accomplish is place that notification handle into a text file. I have successfully parsed the data into the text file. However, the output from the text file grow without bound. As in, it does not overwrite the previous reading but rather adds a new line for each data received from Bluno. What I want is to only have one line of sensor reading that updates each time I write to the file.

You may refer to the output of my text file which I read in Galileo and the values of the sensor readings sent by Bluno. They indeed do match but just that the readings in Galileo is in hex. You may use this "hex to ASCII converter" ---> http://www.rapidtables.com/convert/numb ... -ascii.htm

Galileo: https://drive.google.com/file/d/0Bz90QE ... sp=sharing
Bluno : https://drive.google.com/file/d/0Bz90QE ... sp=sharing
userHeadPic anandankumar
2015-01-27 18:51:17 Thank you for your reply Jose.

The link I've sent is actually just to illustrate an example whether or not Bluno has any documentation like the algorithm shown in the link.

My problem is actually not converting hex to decimal. It is actually interpreting the hexadecimal value that it is receiving from the sensor.
I need to convert the hex so that I am able to retrieve the actual sensor reading. Could you help me point in the right direction in about this?

Thank you very much for your help =)
userHeadPic anandankumar
2015-01-27 18:51:17 Thank you for your reply Jose.

The link I've sent is actually just to illustrate an example whether or not Bluno has any documentation like the algorithm shown in the link.

My problem is actually not converting hex to decimal. It is actually interpreting the hexadecimal value that it is receiving from the sensor.
I need to convert the hex so that I am able to retrieve the actual sensor reading. Could you help me point in the right direction in about this?

Thank you very much for your help =)
userHeadPic anandankumar
2015-01-27 17:02:28 Very interesting anandankumar,

afaik, LE work with notifications, that makes it low power consumption instead of keeping alive the connection for longer?
You could write a little app that converts the hex package sent into ascii. Just parsing each byte, python should get you something in short time:
http://stackoverflow.com/questions/9210 ... -in-python

But I see no explanation of the 'notification handle' is shaped on the link you shared.  ??? have you figre that out already?
userHeadPic Jose
2015-01-27 17:02:28 Very interesting anandankumar,

afaik, LE work with notifications, that makes it low power consumption instead of keeping alive the connection for longer?
You could write a little app that converts the hex package sent into ascii. Just parsing each byte, python should get you something in short time:
http://stackoverflow.com/questions/9210 ... -in-python

But I see no explanation of the 'notification handle' is shaped on the link you shared.  ??? have you figre that out already?
userHeadPic Jose
2015-01-27 16:27:15 Dear Grey,
I have made some progress in connecting Galileo to Bluno.

Bluno is taking readings from a light sensor and is transmitting the data once every second using the write() function in PlainProtocol.

I managed to do data transfer from Intel Galileo to Bluno. I connected Intel Galileo to Bluno using gatttool. I ran the command "gatttool -b <ble address> -I". This opens up the tool in interactive mode. After that I typed "connect" and successfully connected to the device through BLE. Once connected, Galileo continuously displaying a "notification handle". You may see the image here https://drive.google.com/file/d/0Bz90QE ... sp=sharing
For some reason I can't attach to this post so i've uploaded it to Google Drive.

In the image, you will see two windows. The Serial terminal on the right (COM32) is the sensor data being sent from Bluno. The black window (Linux terminal) shows the sensor value received by Galileo in hex. (notification handle = 0x0025).

My question is, how do I interpret the readings in hex so that it matches the decimal values shown in the serial terminal in Bluno?

As far as I know, the TI sensorTag has an algorithm in converting the hex digits to decimal. You may refer to this webpage:
http://processors.wiki.ti.com/index.php ... ure_Sensor
userHeadPic anandankumar
2015-01-27 16:27:15 Dear Grey,
I have made some progress in connecting Galileo to Bluno.

Bluno is taking readings from a light sensor and is transmitting the data once every second using the write() function in PlainProtocol.

I managed to do data transfer from Intel Galileo to Bluno. I connected Intel Galileo to Bluno using gatttool. I ran the command "gatttool -b <ble address> -I". This opens up the tool in interactive mode. After that I typed "connect" and successfully connected to the device through BLE. Once connected, Galileo continuously displaying a "notification handle". You may see the image here https://drive.google.com/file/d/0Bz90QE ... sp=sharing
For some reason I can't attach to this post so i've uploaded it to Google Drive.

In the image, you will see two windows. The Serial terminal on the right (COM32) is the sensor data being sent from Bluno. The black window (Linux terminal) shows the sensor value received by Galileo in hex. (notification handle = 0x0025).

My question is, how do I interpret the readings in hex so that it matches the decimal values shown in the serial terminal in Bluno?

As far as I know, the TI sensorTag has an algorithm in converting the hex digits to decimal. You may refer to this webpage:
http://processors.wiki.ti.com/index.php ... ure_Sensor
userHeadPic anandankumar
2014-12-19 00:08:13 Dear Grey,

Thanks for you reply! Actually the Intel Galileo has a mPCIe N135 WiFi + v4.0 Bluetooth capability. Is there a way to configure it to receive the data broadcasted by Bluno?

I will look into the BLE link module that you posted. Thanks again!
userHeadPic anandankumar
2014-12-19 00:08:13 Dear Grey,

Thanks for you reply! Actually the Intel Galileo has a mPCIe N135 WiFi + v4.0 Bluetooth capability. Is there a way to configure it to receive the data broadcasted by Bluno?

I will look into the BLE link module that you posted. Thanks again!
userHeadPic anandankumar
2014-12-15 23:45:26 Hello,

Bluno has its own communicating protocol. I am afraid it doesn't support direct connection.
But you could check the Android source code. if you are familiar with Android development, you could extract the useful information from the code.

By the way, I get another idea, you could use a BLE link as its data receiver.
http://www.dfrobot.com/index.php?route= ... ption=true
It supports simple connection.
userHeadPic Grey.CC
2014-12-15 23:45:26 Hello,

Bluno has its own communicating protocol. I am afraid it doesn't support direct connection.
But you could check the Android source code. if you are familiar with Android development, you could extract the useful information from the code.

By the way, I get another idea, you could use a BLE link as its data receiver.
http://www.dfrobot.com/index.php?route= ... ption=true
It supports simple connection.
userHeadPic Grey.CC
2014-12-11 16:31:30 Dear all,

I am working on a project that involves Bluno as a sensor module. It collects data such as temperature, pH and light intensity. Bluno is assigned as the peripheral role.

It sends the data over Bluetooth LE to an Intel Galileo Gen 2 which has a mPCIe N 135 card that also supports BLE. The Intel Galileo will be my central device. Galileo is running on a Linux image that has the BlueZ library in-built to it.

I am following the "Getting started with Bluetooth LE" by Jared Wolff as seen here at http://www.jaredwolff.com/blog/get-star ... ow-energy/. Up to now, I have managed to successfully run a low energy scan using Intel Galileo using the command:
Code: Select all
hcitool lescan
Result: The Bluno's Bluetooth address was listed with the device name shown as "v1.8Bluno".

I then tried to connect to Bluno using gattool in Linux:
Code: Select all
 sudo gatttool -b <Bluno BLE ADDRESS> -I
Result: Successfully opened gattool in interactive mode.

Then when I tried to connect the Galileo to Bluno using "connect" command, the result showed as:

"Connecting... connect error: connect error: Connection refused (111)".

I then found out that Bluno has a built in password which I discovered through the AT command which is default to DFRobot. I would like to know if whether the password is refusing the connection? If yes, how can I remove the password and allow open connections? If the password can't be removed, how do I go about solving this?

Also, would it be better if I define my own profile/service for the TI CC2540 BLE chip in Bluno or would the "Plain Protocol library" supplied be sufficient to work with?
Any help is greatly appreciated!
userHeadPic anandankumar