Show Posts
Pages: [1]
1  Using Arduino / Networking, Protocols, and Devices / Re: Changing Baud Rate on Seeedstudio BT Shield on: January 11, 2013, 06:18:37 pm
Anybody?
2  Using Arduino / Networking, Protocols, and Devices / Changing Baud Rate on Seeedstudio BT Shield on: January 09, 2013, 08:03:04 pm
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();
}

Pages: [1]