Arduino101 Using BLE for Two-way Communication with UART Control

I am new to the Arduino world and have jumped in full-tilt to an Arduino101 BLE implementation.

After receiving my Arduino101 in the mail last week, I have gone through all the CurieBLE examples. I have my Arduino101 communicating via BLE with the nRF Toolbox UART on my iPhone.

I find the documentation of RX and TX BLE characteristics and attributes extremely lacking. Making for significant trial and error. I can determine the length of input received from iPhone and extract a single character.

Can someone point me to an example that shows the Arduino101 code that implements rx and tx characteristics and the associated attributes that are:

1) Required for UART interactions (e.g. the nRF appears to check for 'required' characteristics); 2) Available for use (e.g. I'd like to read a string of UART input). 3) I'd like to send some data from the Arduino to my phone.

Thanks!

Bluetooth "Low energy" seems to be very different than ordinary bluetooth. For one thing, there is no standard "Serial Port Profile" for exchanging serial data, leaving vendors and programmers to define their own data exchange protocols that will do the same thing, with varying degrees of proprietary-ness and secrecy. (incidentally ruining most hopes of using some standard "terminal" program on the other end. Sigh.)

Here's a page that looks like it contains a reasonable amount of info: http://support.connectblue.com/display/PRODBTSPA/Bluetooth+Low+Energy+Serial+Port+Adapter+-+Getting+Started

(The situation is ... annoying.)

(This also means that your BLE devices MUST talk to a BLE host; they won't talk to the standard BT on your laptop...) (It's not clear to me yet whether supporting BT 4 on a laptop also means being able to talk to BLE devices.)

Thanks for the pointer. I reviewed that information.

I've found the Nordic nRF documentation and BLE libraries to be very helpful.

I have used Nordic's nRF UART on my iPhone and can now send commands to my Arduino101.

I'm now working to read multi-byte commands, but I can't seem to find an array in the BLE protocol that I can step through successfully.

More to come!

Arduino101 reading a string from BLE is solved!

I’m using nRF UART on my iPhone as my ‘central’. I then modified the Nordic rxCharacteristicWritten() to read a series of bytes sent. Here’s a segment of my code:

char inData[20];

void rxCharacteristicWritten(BLECentral& central, BLECharacteristic& characteristic) {
Serial.print("Handler – rxCharactersiticWritten. Length: ");

int len = characteristic.valueLength(); // Reads the length of data sent from central
Serial.println(len);

if (len != 0) {

for (int i=0; i < len; i=i+1){
inData = characteristic*; // Reads each byte of input*
_ Serial.println(inData*);
}
i = len + 1 ; // Add newline to make inData a string*
inData = ‘\n’;
* Serial.println(inData);
}
}*

So simple, yet so difficult - because it’s not documented!_

Sorry all,

The critical line above is:

inData = characteristic*: // Read each byte of input*

This is the easier way of reading every character. I based this from shadeydave’s Arduino 101 BLE Rover Remote Control.

void rxCharacteristicWritten(BLECentral& central, BLECharacteristic& characteristic) {
if (characteristic.value()) { //check if there is value
int len = characteristic.valueLength(); //get size
for(int i=0; i<len; i++){
Serial.print((char)characteristic.value()); //print every character

  • }*
  • }*
    }