Establish Bluetooth connection from ArduinoBT

Hi,

I'd like to establish an connection from ArduinoBT to another device (a bluetooth heart rate monitor)

So far I didnt find any libraries or similar to actually establish an connection. Does this mean I would have to dive really deep into the bluetooth protocol stuff and perform the whole connection procedure manually by sending the needed messages over some serial port?

Or is there some easier way perhaps with some tutorials?

Hello !

If you want to establish the connection from ArduinoBT to your BT device, then you will have to use the IWrap API. (see bluegiga website, ask for an authentification and get the WT11 user guide/API).

Then if you have a single heart rate device, it will be pretty easy, just get its bt_adress and connect to it. You can easily make a small program that set the commands and returns the reponse from the terminal.

there are a few posts about using IWrap API (you have to switch from data mode to command mode ... then send the command)

maybe have a look at this post http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1252420773 and have a look at the other posts I am referencing which explain how to switch to command mode.

the command should look like that:

/*
 * Send a command when MUX is in OFF:  Switch to COMMAND mode, send a command and switch back to DATA mode
 */
void sendCommand(char* cmd){
  //Switch to COMMAND mode
  digitalWrite(LED_PIN, HIGH); // set led HIGH
  delay(2000);
  Serial.print("+++");
  delay(2000);
  //Send the command
  Serial.println(cmd);

  
  //Read answer
  int k=0;
  char answer[200];
  memset(answer, 0x0, sizeof(answer));
  for(int i=0; i<10;i++){
    delay(200);
    
    while(Serial.available()>0 && k<199){
      if(k > 190){
        blinkLed(2);
      } 
        answer[k] = Serial.read();
        k++;
    }
  }  
  Serial.flush(); 
  //Switch back to DATA mode
  delay(2000);
  Serial.print("+++");
  delay(2000);

  digitalWrite(LED_PIN, LOW); // set led HIGH  
 
 //print answer  now that back in DATA mode
  Serial.println(k);
  Serial.print(answer);
  Serial.println();
  Serial.flush(); 
}

Don't forget to use the command below in the setup to define the escape char to "+++"

Serial.println("SET CONTROL ESCAPE 43 00 1"); // set escape character to + and let DTR switch to command mode

Note that you should change the size of your serial buffer to a bigger value (it is in wire_analog.c, end of file replace 128 by for example 512). [rep arduino/hardware/cores/arduino]. Watch the arduino has a small memory so using too big arrays may crash the program.

Hope that helps !

ps. If you pm me yiur mail, I can mail you the IWrap API pdf

Hi ZNero,

The iWrap documentation can be downloaded from sparkfun without registering:
http://www.sparkfun.com/datasheets/Wireless/Bluetooth/iWRAP3_User_Guide.pdf.

Normally the WT-11 on the Arduino-BT has iWrap 2.2.0 so you have to take care which features are missing.

The bluetooth heart rate devices should use the Health Device Profile (HDP) which will be supported by iWrap4 so either you have to implement the profile yourself, or upgrade your firmware.

Some information about iWrap+HDP: http://www.bluegiga.com/files/bluegiga/Pub%20files/Bluegiga_iWRAP_HDP_Application_Note.pdf.

You should have a look at the receiver module RMCM01 for Polar Heartrate belts http://www.sparkfun.com/commerce/product_info.php?products_id=8660. It should be much easier to use than the Bluetooth devices, because the protocol is much simpler. The range is limited to at most 80cm.

Another alternative are the Garmin Heart Rate Belts for which you would need the receiver chip nRF24L01+ 2.4GHz Transceiver IC - nRF24L01+ - COM-00690 - SparkFun Electronics. I haven't found anything about the protocol so this really a challenge.

MikeT

Hello community,

i am totally new to the arduino scene as well as to using bluetooth.

I want to connect a shimmer sensor (does not matter if you don't know it) to the BT-V06. The shimmer sensor sends some data and i have to use this data to make a decision. Can anyone give a simple example of how to use iWRAP? This example should include everything that is needed to create a bluetooth connection and receive data. If it is not too much work it could also tell how to send data back via bt. I know i am asking for much but if someone could help me i would appreciate that very much.

Greetings,
Crhiss