Go Down

Topic: SOLVED: Seeedstudio BT Shield (Read 23580 times) previous topic - next topic

twychopen

I am using it with the Arduino UNO R3. If I am correct R3 is just the latest version, please correct me if I am wrong. So this shield does work with the Arduino UNO.

Seeed BT shield should work with UNO, but I have been unable to actually get it to connect to my android phone. The original poster has had success using the code above, however I have had no such luck.

WinstonP

Yes, the shield DOES work with the UNO R3. The R3 is different in the placement of the reset switch. The prior two designs had the reset towards the center of the board making it difficult to press when other shields are in place.

And yes, the BT shield does work connecting to my laptop. But I want it to connect to my android phone also; and that's where I'm having the problem. Today I'm going to try using the BT shield in Master mode to see if it will at least detect my phone. Basically that's all I want it to do for now - just DETECT my phone, no connections yet.

Winston

Winston, im interested in your results; I've had no luck detecting or connecting to Android

sam_92

#19
Aug 30, 2012, 10:21 am Last Edit: Aug 31, 2012, 07:16 am by sam_92 Reason: 1
Hi everyone.I was frustrated because of seedstudio BT is not connecting to my android Phone(samsung vibrant running ICS 4.0.4).after doing lot of change in code i had finaly made a simple code to work with seedstudio BT also u can connect your android phone and send commands to arduino board.

make sure that your jumper connection is as shown in picture it is default arduino serial com port.
Tx of sheild is connected to RX of arduino(Pin 0)
Rx of sheild is connected to TX of arduino(Pin 1)
Baudrate is 38400bps so no need to change baudrate of sheild its default baudrate of sheild.

Code: [Select]
char val; // variable to receive data from the serial port
int ledpin = 8; // LED connected to pin 48 (on-board LED)
#include <NewSoftSerial.h>   //Software Serial Port


#define DEBUG_ENABLED  1



void setup() {
 pinMode(ledpin, OUTPUT);  // pin 48 (on-board LED) as OUTPUT
 Serial.begin(38400);       // start serial communication at 9600bps
 
 setupBlueToothConnection();
}


void loop() {
 if( Serial.available() )       // if data is available to read
 {
   val = Serial.read();         // read it and store it in 'val'
 }
 if( val == 'H' )               // if 'H' was received
 {
   digitalWrite(ledpin, HIGH);  // turn ON the LED
 } else {
   digitalWrite(ledpin, LOW);   // otherwise turn it OFF
 }
 delay(100);                    // wait 100ms for next reading

}


void setupBlueToothConnection()
{
 Serial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
 Serial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
 Serial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as "SeeedBTSlave"
 Serial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
 Serial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
 delay(2000); // This delay is required.
 Serial.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.
 Serial.flush();
}

This is a simple led toggle program make sure that to upload this program to your arduino board you need a older version of arduino softwae 0022 .you can write any other program like to control servo here we can write PWM Generation program in this sketch.you can send commands from mobile using Bluetooth SPP software.
I had found that seedstudio BT is not going to inquiry mode automatically that means every time it restart MCU need to send the commands to set it to inquirable mode and also set to slave mode.To work with BT sheild need to write this lines in to code
{
 Serial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
 Serial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
 Serial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as "SeeedBTSlave"
 Serial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
 Serial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
 delay(2000); // This delay is required.
 Serial.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.
 Serial.flush();
}
.

sam_92

#20
Aug 30, 2012, 02:05 pm Last Edit: Aug 30, 2012, 04:38 pm by sam_92 Reason: 1
Hi again.i had successfully implemented firmata protocol to run with seedstudio BT.now Arduino commander is successfully work with this code.
but you need to change the baud rate of seedstudio BT shield to 9600. only use arduino-0022 to successfully  upload this code.

http://i.imgur.com/Dd2CU.jpg
http://imgur.com/1Ee0D
http://i.imgur.com/FzUqJ.png


Do you mind posting your entire sketch?

interesting...
i've had THE EXACT SAME problem about a month ago, also we were talking about it here:
http://www.seeedstudio.com/forum/viewtopic.php?f=4&t=3514&sid=f5b825a6dc9668df91934647c2964ab7&p=13431#p13431

bottom line there was about this:
Quote
As said before is probably due to some android's bt broadcomm module bug that does not allow to find Class of device code 0x00

and some semi working workarrounds.

as a result, i bought a new bluetooth module LM-400 and got it up and running in no time (after i figured out that the AT commands from the manual are outdated -> new firmware was on it).

did anyone else have any luck with the method sam_92 suggested a few posts up, so i know if i should take the shield i was already upset about for not working from the box again and give it another try?

sam_92

#23
Aug 31, 2012, 07:07 am Last Edit: Aug 31, 2012, 09:09 pm by sam_92 Reason: 1
Here i am uploading  sketch file .look at download section below.login in to arduino forum to able to see uploaded files below.code is too big i am not able to write in post.I am using arduino UNO .make sure you are using older version of arduino like 0022 it won't compile in newer version 1.0 and later on.

For changing the baud rate you need to use USB to 232 breakout board. http://www.wide.hk/products.php?product=CP2102-USB-to-232-Breakout-Board you can use SScom32e software to configure the baud rate.
this sketch will definately work with seedstudio BT modem just make sure that you have configure the baud rate at 9600bps .i had done lot of work to get it work with this sheild. :)
Hope you guys soon you will  going to enjoy arduino commander it's awesome :)
If you are facing any problem to changing the baud rate let me know i will post method to change baud rate of this sheild.

I am using a Shield, and this is still not working for me. Here is the code I am using:

#include <SoftwareSerial.h>   //Software Serial Port
#define RxD 0
#define TxD 3

#define DEBUG_ENABLED  1

SoftwareSerial 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();
}


Any ideas?  I am using Samsung Galaxy SII to try to connect, but I am unable to discover. Also the shield is blinking just green, two times per cycle.

sam_92

#25
Sep 01, 2012, 01:13 pm Last Edit: Sep 01, 2012, 01:49 pm by sam_92 Reason: 1
This has to be a simple solution.For discover the sheild in your mobile phone red light on sheild must be blinking.First  of all try this solution- Push reset switch loacted on arduino board.after pushing reset switch MCU will send the commands to set it to discover mode.

also make sure that you have chenged the baud rate of sheild at hardware level.otherwise u cannot see correct message which you had sent it from pc.if 9600bps does't work then try out with default sheild baud rate which is 38400bps.
Also check   jumper connection on sheild .

#26
Sep 02, 2012, 02:40 am Last Edit: Sep 02, 2012, 02:47 am by soyamericano Reason: 1
I solved the problem! The board is labeled backwards; tx and rx need to be reversed in the code to get the board to run!

PaulS

Code: [Select]
#define RxD 0
Why are you trying to use the hardware serial pin for software serial?

alx5246


Here i am uploading  sketch file .look at download section below.login in to arduino forum to able to see uploaded files below.code is too big i am not able to write in post.I am using arduino UNO .make sure you are using older version of arduino like 0022 it won't compile in newer version 1.0 and later on.

For changing the baud rate you need to use USB to 232 breakout board. http://www.wide.hk/products.php?product=CP2102-USB-to-232-Breakout-Board you can use SScom32e software to configure the baud rate.
this sketch will definately work with seedstudio BT modem just make sure that you have configure the baud rate at 9600bps .i had done lot of work to get it work with this sheild. :)
Hope you guys soon you will  going to enjoy arduino commander it's awesome :)
If you are facing any problem to changing the baud rate let me know i will post method to change baud rate of this sheild.


I would very much appreciate a post to describe how to change the baud rate of the shield. I cannot figure out how to use the configuration commands.

WinstonP

#29
Sep 08, 2012, 09:24 pm Last Edit: Sep 08, 2012, 11:45 pm by WinstonP Reason: 1
OK, it's been a while but I have an update. I've got the Arduino Uno R3 with a Seeeduino BT shield able to scan for BT devices; which is what I wanted to start with.
Code: [Select]
/*  */
#include <SoftwareSerial.h>   //Software Serial Port

#define RxD 5
#define TxD 6

#define DEBUG_ENABLED  1

char recvChar;
String recvBuf;
String recvAddr;
String recvInq;

SoftwareSerial blueToothSerial(RxD,TxD);

void setup()
{
 Serial.begin(9600);
 pinMode(RxD, INPUT);
 pinMode(TxD, OUTPUT);
 setupBlueToothConnection();
 //wait 1 sec and flush the serial buffer
 delay(1000);
 Serial.flush();
 blueToothSerial.flush();
 Serial.println(" ");
 Serial.println("restarted....");
 Serial.println("Starting BTScan....");

}

void loop()
{
 btScan();
}

void setupBlueToothConnection()
{
 blueToothSerial.begin(38400); //Set Bluetooth to 38400
 blueToothSerial.print("\r\n+STWMOD=1\r\n");//set bluetooth to master mode
 blueToothSerial.print("\r\n+STNA=PeddleComp\r\n");//set bluetooth name as "PeddleComp"
 blueToothSerial.print("\r\n+STAUTO=0\r\n");// no Auto-connection
 delay(2000); // This delay is required.
 blueToothSerial.flush();
 blueToothSerial.print("\r\n+INQ=1\r\n");//make the master inquire
 delay(2000); // This delay is required.
}
   
void btScan()  //scan for devices
{
 if (blueToothSerial.available())
 {
   recvChar = blueToothSerial.read();
   recvBuf += recvChar;
   if (((recvChar > 47) && (recvChar < 58)) || ((recvChar > 64) && (recvChar < 71)))  // get numbers and A-F only
   {
     recvAddr += recvChar;
     if(recvAddr.length()==12)
     {
       Serial.println(recvAddr);
       recvAddr = "";
       blueToothSerial.flush();
     }
   }
 }
}

If anyone knows a better way to trap the numbers and A-F only; please let me know. BASIC was my first language and that was on a 4K Trash-80 Model I.

Go Up