Pages: [1]   Go Down
Author Topic: Changing Baud Rate on Seeedstudio BT Shield  (Read 1081 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

After finally getting the Seeedstudio BT shield to pair with my Nexus 7 tablet, I found out that I need to set the shield's baud rate to 57600 or 115200.

I'm new to using bluetooth with Arduino, and can't seem to find the resources explaining simply how change the baud rate. I uploaded the code below to the Arduino to prepare the shield to be paired, but if I simply try changing the baud rates in the code, the shield cannot connect.
I tried adding the line
Code:
blueToothSerial.print("\r\n+STBD=115200\r\n");
in the setupBlueToothConnection() method, but still my Nexus 7 is unable to transfer data to the BT shield.

The documentation of the BT shield is here: http://www.seeedstudio.com/wiki/Bluetooth_Shield.

My two questions are:
1. How do I change the baud rate of the BT shield?
2. How can I check what the baud rate of the BT shield is?

Also, if anybody has had experience using the Amarino toolkit with the Seeedstudio BT shield, any tips to get the initial 'test' program running are appreciated. Thanks in advance.

Code:
/* Upload this sketch into Seeeduino and press reset*/
 
#include <SoftwareSerial.h>   //Software Serial Port
#define RxD 6
#define TxD 7
 
#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(38400); //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();
}

Logged

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

Anybody?
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

NO BTshield experience

Just know from experience that 115200 over software serial is tricky at best. First try it with HW serial or lower baud rates.

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Sr. Member
****
Karma: 1
Posts: 272
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd like to help you.  I've connected my sparkfun bluetooth goldmate and used the Serial Monitor. I'd set the baud rate in "Devices and Printers" for my BT device "Firefly-89C1".  Once I click on my BT device, I click on Hardware, then click Properties>Port Settings and changed baud rate to 115200.  Also change Flow Control to Hardware.  Under Services you'll see Serial Port (SPP) COM13.  In Arduino environment, set port to COM13. Then open the Serial Monitor and set baud rate to 115200.  The sketch you've uploaded to the PCB should now be displaying.
Logged

peace*&^

Pages: [1]   Go Up
Jump to: