bluetooth module

06 May 2010 . Edited: 10 May 2010

I'm having some issues getting my bluetooth working with mbed.  I'm unsure of most of the elements (A. my wiring, B. mbed code and C. terminal command/settings to create serial port on my Mac OS X 10.6)  mainly because I can't independently verify functionality of each.

Link to Sparkfun Bluetooth DIP module

A. I followed the wiring from cookbook but was confused about RTS/CTS.  Since sparkfun example showed CTS being grounded, I've alternated grounding those wires during each test.

mbed bluetooth

 

B. Here's my simple test code, pretty straightforward, not sure what is wrong here.  Maybe baud rates.

#include "mbed.h"

Serial bt(p13, p14);
Serial pc(USBTX,USBRX);
int main() {
bt.baud(9600);
while(1) {
bt.printf("hello\n\r");
wait(1);
}
}

C. So far, I've been successful pairing the device (passkey 1234).  I've try these different commands in the terminal to create serial port with mixed success, still not confident on any.

screen /dev/tty.FireFly-2595-SPP
screen /dev/tty.FireFly-2595-SPP 9600
screen /dev/tty.FireFly-2595-SPP 11500

I think my problem lines within setting the baud rates maybe initializing the bluetooth module or my settings of serial port.  If anyone can point me in the right direction that would be great.

10 May 2010 . Edited: 10 May 2010

For those who want to prototype quickly....

Quick bluetooth serial port wiring and code for SparkFun BlueTooth Module

mbed bluetooth wiring


#include "mbed.h"

Serial bt(p9, p10);

int main() {

   bt.baud(9600);

   //congrats, successful bluetooth serial port
   while(1) {
      bt.printf("hey kid, I'm a computer\n\r");
     wait(1);
   }
} 

Passkey for this module is "1234"'

 

 

Mac terminal command

// xxxx = last four digits of bluetooth address of the device
screen /dev/tty.FireFly-XXXX-SPP

10 May 2010

Hi Richard,

Good stuff! I fiddled with this initially (wrote poor excuse for a cookbook page) .. i had problems with baud rate which I never quite got to the bottom of. Certainly didnt spot that PIO7 had to be pulled to set baud rate.

Do you have any plans to wrap up the other functionality, i.e. how to set the device name and passkey and so on? I also seem to remember there is a command mode and a data mode to negotiate?

Godo stuff though.

Cheers,
Chris

10 May 2010

Chris,

Eventually I would like to learn the full potentials of this device but a simple serial is sufficient for this project; I'm a little short on time too (as always).

Here's the link to the command set for anyone else working with this device.

Richard

Please log in to post a reply.