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?
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)
/*
* 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
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.
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.
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.