Pages: [1]   Go Down
Author Topic: bluetooth  (Read 2014 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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?
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 631
Posts: 50163
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where did you put the jumpers?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I let them at the default position.

rx is at 0 and tx is at 1.
« Last Edit: January 13, 2013, 01:32:16 pm by rainerunsinn » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Code:
#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.
« Last Edit: January 14, 2013, 12:28:05 pm by rainerunsinn » Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nobody?
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Code:
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?
« Last Edit: January 29, 2013, 09:54:07 am by Cue2 » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey,

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

Offline Offline
Newbie
*
Karma: 1
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do

Code:
cat /etc/bluetooth/rfcomm.conf

and post the output.

My one looks something like this:
Code:
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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey,

my rfcomm.conf was commented out, so I edited it like yours, but it is still not working.
It looks like this:
Code:
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";
}
« Last Edit: February 12, 2013, 12:21:36 pm by rainerunsinn » Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK lets do things manually, do not rely on blueman. remove any pairing there. Then do
 
   
Code:
    $ sudo sdptool add SP
    $ sudo /etc/init.d/bluetooth restart
    $ sudo rfcomm bind all
    $ rfcomm

you should see
Code:
rfcomm0: xx:xx:xx:xx:xx:xx channel 1 clean

then
Code:
cat /dev/rfcomm0
open another terminal and do
Code:
echo Hi > /dev/rfcomm0

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

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey,

no I don't get a response smiley-confuse
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


did you see exactly this when you did rfcomm?:

Code:
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
Code:
$ sdptool browse local

You should find something like this in the output

Code:
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

Code:
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.
Logged

Pages: [1]   Go Up
Jump to: