9 Replies Latest reply on Feb 12, 2015 7:38 AM by QuackieDuck

    Data transfer from Bluno to Intel Galileo using Bluetooth Low Energy

    QuackieDuck

      Dear all,

       

      I am working on a project that involves Bluno as a sensor module that transmits data to Intel Galileo. Bluno is basically an Arduino Uno + BLE (using TI CC2540 BLE chip). It collects data from temperature, pH and light sensors. It sends the data over Bluetooth LE to an Intel Galileo Gen 2 through the mPCIe N 135 card. The Intel Galileo is my central device and receives the data sent from Bluno.

       

      I have successfully managed to perform a data transfer from Bluno to Galileo using the command "gatttool -b <BLE address> --char-write-req -a 0x0025 -n 0100 --listen"

       

      The BLE address can be obtained from "hcitool lescan". 0x0025 is the notification handle that Galileo is reading from Bluno. 0100 enables notification. The output I received is in hex which can be converted to char using an ASCII table / hex to ASCII text converter. You may refer to the images below for the transmitter (Bluno) and receiver (Galileo) outputs.

      Bluno.jpgGalileo.jpg

       

      In the first line of my Serial monitor (left pic), Bluno is sending "<>312,90,187;". In Galileo, the data received is in hex format as shown on the right image. The first line of the Linux terminal is "3c 3e 33 31 32 2c 39 30 2c 31 38 37 3b 0a". (Note: 2 Hex digits represent 1 byte). You can use www.rapidtables.com/convert/number/hex-to-ascii.htm to convert that hex result. You will find that you will receive the same result sent over by Bluno.

       

      I then used system() which allows me to run Linux commands from an Arduino sketch using the following line of code:

      system("gatttool -b <BLE address> --char-write-req -a 0x0025 -n 0100 --listen >/dev/ttyGS0 >/media/realroot/datalog.txt");

       

      That code parses the data received from Galileo into the text file named "datalog.txt" which is located on the top level of my SD card.

      The problem that I am facing is that once the Arduino runs the system("gatttool ... --listen") command, I am unable to open the datalog.txt file using SD.open("datalog.txt"); to perform a read operation. I need to read this file so that I can extract it out as a string and convert the hex result into its ASCII representation.

       

      In a Linux Terminal where the user can manually connect using gatttool, the user can easily press "CTRL+Z" to stop the listening process.

      How can I stop the listening process in an Arduino sketch so that Galileo will not write to the file and I can perform read file operation?

       

      I would like to thank you in advance for answering my question.