bluetooth

Hey,
I bought myselfe an arduino bluetooth shield. http://imall.iteadstudio.com/im120417010.html

I tried to communicate with my pc via the following code:

void setup()
{
  Serial.begin(9600);
}


void loop()
{
if (Serial.available())
  {
    Serial.write("Incomming");
  }
Serial.write("HELLO");
}

I had paired my pc with the arduino bluetooth and connected the bluetooth of my pc to /dev/rfcomm0

But I see no income and no outgoing. What am I doing wrong?

Where did you put the jumpers?

I let them at the default position.

rx is at 0 and tx is at 1.

Try 38400 Baud rate, and is your switch to CMD or DAT.

Hey,

thank you for your answer. I tried it with 38400 Baud, but nothing happened:-(
my switch is at DAT, when I set it on CMD I can't find the shield with my computer.

I also tried it with software serial:

#include <SoftwareSerial.h>
SoftwareSerial ss(6,7); //I set the jumper for rx to 6 and tx to 7
void setup()
{
  ss.begin(9600);
}
void loop()
{
  if(ss.available())
  {
     ss.write("Incomming"); 
  }
}

But this neither worked.

can you elaborate on how you have set up your linux machine and how you listen for incoming data on rfcomm0?

Does it make a difference if you use Serial.print("Hello") instead?

Hey,

I used blueman to connect the shield to /dev/rfcomm0
Then I used cat /dev/rfcomm0 to listen and echo hello > /dev/rfcomm0 to send.
Serial.print("Hello") and Serial.write("Hello") don't make a difference.

Nobody?

I don't know what the problem could be, far too many things could be wrong and without being able to see how your linux box or shield is set up it's hard to say. when you type "rfcomm" at the command line does it show your bluetooth device?

rfcomm0: xx:xx:xx:xx:xx:xx channel 1 closed

where "xx:xx:xx:xx:xx:xx" is the address of your particular bluetooth shield?

Hey,

when I enter: rfcomm
I get this information: rfcomm0: 00:23:4D:E5:7F:0F -> 00:12:11:12:06:48 channel 1 connected [reuse-dlc tty-attached]

Do

cat /etc/bluetooth/rfcomm.conf

and post the output.

My one looks something like this:

rfcomm0 {
         # Automatically bind the device at startup
         bind yes;
         # Bluetooth address of the device
         device xx:xx:xx:xx:xx:xx;
         # RFCOMM channel for the connection
         channel 1;
         # Description of the connection
         comment "Arduino";
}

again where "xx:xx:xx:xx:xx:xx" would be the address for your particular bluetooth shield.

Hey,

my rfcomm.conf was commented out, so I edited it like yours, but it is still not working.
It looks like this:

rfcomm0 {
	# Automatically bind the device at startup
	bind yes;

	# Bluetooth address of the device
	device 00:12:11:12:06:48;

	# RFCOMM channel for the connection
	channel	1;

	# Description of the connection
	comment "arduino";
}

OK lets do things manually, do not rely on blueman. remove any pairing there. Then do

    $ sudo sdptool add SP
    $ sudo /etc/init.d/bluetooth restart
    $ sudo rfcomm bind all
    $ rfcomm

you should see

rfcomm0: xx:xx:xx:xx:xx:xx channel 1 clean

then

cat /dev/rfcomm0

open another terminal and do

echo Hi > /dev/rfcomm0

let me know if you don't get a response in the first terminal.

Hey,

no I don't get a response :~

did you see exactly this when you did rfcomm?:

rfcomm0: xx:xx:xx:xx:xx:xx channel 1 clean

(without xx:xx... of course ) Make sure you didn't get something else. It would be nice to see a complete copy of your terminal output while you are doing these things too. It's difficult to diagnose a problem without knowing what exactly happened.

Do

$ sdptool browse local

You should find something like this in the output

Service Name: Serial Port
Service Description: COM Port
Service Provider: BlueZ
[...]
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
  Channel: 1

then do

sdptool records xx:xx:xx:xx:xx:xx

(with your BT shield address)
you should see something like

Service Name: SPP
[...]
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 1

make sure all the channel numbers match each other and your rfcomm.config file. Also make sure your cat and echo commands output file name match the actual rfcomm. e.g make sure it isn't >/dev/rfcomm0 when your shield is on rfcomm1.

If that still doesn't work then I've ran out of ideas, maybe your bluetooth shield is faulty.