Bluetooth Shield connection problem (Arduino UNO, PC, HTC)

Hello,

I recently bought a BT Shield.

When I tried to connect it to my HTC Wildfire S + Arduino UNO + Arduino IDE 0022, I failed (I didnt even find it). After some time of research i read, that there are some problems with the compatibility. So I decidet to try a connection with my PC (win vista, BT Stick). The same problem there I couldnd find the shield.

My Setup:
Arduino UNO
BT shield RX pin7, TX pin 6
The Sketch:

[code]/*
BluetoothShield Demo Code Slave.pde. This sketch could be used with
Master.pde to establish connection between two Arduino. It can also
be used for one slave bluetooth connected by the device(PC/Smart Phone)
with bluetooth function.
2011 Copyright © Seeed Technology Inc. All right reserved.

Author: Steve Chang

This demo code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

For more details about the product please check http://www.seeedstudio.com/depot/

*/

/* Upload this sketch into Seeeduino and press reset*/

#include <NewSoftSerial.h> //Software Serial Port
#define RxD 6
#define TxD 7

#define DEBUG_ENABLED 1

NewSoftSerial blueToothSerial(RxD,TxD);

void setup()
{
Serial.begin(9600);
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
setupBlueToothConnection();

}

void loop()
{
char recvChar;
while(1){
if(blueToothSerial.available()){//check if there’s any data sent from the remote bluetooth shield
recvChar = blueToothSerial.read();
Serial.print(recvChar);
}
if(Serial.available()){//check if there’s any data sent from the local serial terminal, you can add the other applications here
recvChar = Serial.read();
blueToothSerial.print(recvChar);
}
}
}

void setupBlueToothConnection()
{
blueToothSerial.begin(9600); //Set BluetoothBee BaudRate to default baud rate 38400
blueToothSerial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as “SeeedBTSlave”
blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
delay(2000); // This delay is required.
blueToothSerial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable
Serial.println(“The slave bluetooth is inquirable!”);
delay(2000); // This delay is required.
blueToothSerial.flush();
}
[/code]

I changed the Baud rate of the bluetooth connection, cause I thought that would help but it didnt.

P.S.: The green led D1 Is flashing 2x per second, i hadnt had the case where D1 and D2 were flashing (which acording to my research means that no bluetooth connection is established) so that means My shield has connected, BUT WHY CANT I FIND IT!?!

thanks
Sebastian

 blueToothSerial.begin(9600); //Set BluetoothBee BaudRate to default baud rate 38400

maybe the bluetooth baudrate is wrong , the default baud rate is 38400 if you had no change it ever more. It is important that remember the baudrate if you want to set it .
furthermore, if succeed , D1(red) and D2(green) were flashing , is the status that the bluetooth waiting for connection .
hope it can help you .

deray

Hi,

Than you for your reply, but I tried that and sadly it didnt worm… But the LED’s are blinking now (D1 and D2). Cause I wasnt able to get a connection I changed TX and RX pins cause in the previous configuration It sayd TX in the code and RX on the board. But it from start on blinks green.

I cant find a solution.

if the LED(green and red) are blinking now , can it be found by your Phone and PC ?

Ok,

i finally got it to work with my pc. It took about 20min for my PC to discover it. After connecting I opened up the terminal (the USB serial one was already open). After I did that it again took 5mins. After that it finally showed Connect:OK :smiley:.

The connection to my HTC Wildfire S still dosnt work. I think its cause Connecting takes so long (or discovering the device?!?).

Is there a way to speed up the process, so my sellphone can discover the shield?

So, I uploadet the Master Sketch to my Arduino and testet it with my HTC here is the Serial output of the result:

Master is inquiring! Connecting to slave:64,A7,69,F6,A1,D7;HTC Connect again! Connect again! Connect again! Connect again! Connect again! Connect again! Connect again! Connect again!

so it sayd “Connectagain!” this appears quote from the Code:

else if(recvBuf.indexOf("CONNECT:FAIL") != -1){ Serial.println("Connect again!"); break; }
so whats the point!?!

Can anyon tell me: Is it possible to connect the shield with the HTC Wildfire S??

I failed to connect with my MOTOROLA same as you , I don’t know why it happened. but used two bluetooth shield, it succeed to connected another one as master . So I think is not the problem of the bluetooth , but the problem of the phone settings .Of course, it is my opinion just .