Bees Shield + Bluetooth Bee: Cannot initiate it

Hi guys,

I’ve been trying to initiate my bluetooth bee module in slave discovery mode with no success with the following setup:

  1. I have a Seeeduino and a Bees Shield. The switch on the shield is set to ‘Atmega’ which means to me that I want the bee module to communicate with the board and not usb (think this is correct). The Bee1Rx and Tx jumpers are set to 8 for Tx and 9 for Rx. I have also placed the bee module on BEE1 socket on the shield

  2. The code I am trying to initialize the module is the following:

#include <NewSoftSerial.h>   //Software Serial Port
#define RxD 9
#define TxD 8
 
NewSoftSerial blueToothSerial(RxD,TxD);
 
void setup() 
{ 
    Serial.begin(38400);          //Serial port for debugging, Comment this line if not required  
    pinMode(RxD, INPUT);
    pinMode(TxD, OUTPUT);
    setupBlueToothConnection();
 
} 
 
void loop() 
{ 
 
} 
 
void setupBlueToothConnection()
{
    //Serial.print("Setting up Bluetooth link");       //For debugging, Comment this line if not required    
    blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
    delay(1000);
    sendBlueToothCommand("\r\n+STWMOD=0\r\n");
    sendBlueToothCommand("\r\n+STNA=modem\r\n");
    sendBlueToothCommand("\r\n+STAUTO=0\r\n");
    sendBlueToothCommand("\r\n+STOAUT=1\r\n");
    sendBlueToothCommand("\r\n+STPIN=0000\r\n");
    delay(2000); // This delay is required.
    blueToothSerial.print("\r\n+INQ=1\r\n");
    
    delay(2000); // This delay is required.
    Serial.print("Setup complete");
 
}
 
void sendBlueToothCommand(char command[])
{
    blueToothSerial.print(command);
    delay(3000);
                                             
}

I power the shield through my laptop’s usb and I only got a constant green blink (every one sec) on the bluetooth module and nothing else.

I have also tried to talk to it through the serial, by changing the switch to ‘usb’ on the shield and using the following code:

void setup() 
{ 
    Serial.begin(38400); 
    pinMode(13, OUTPUT);
    setupBlueToothConnection();
 
} 
 
void loop() 
{ 
  //just to know when sending BT commands is over
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);  
 
} 
 
 
void setupBlueToothConnection()
{
    
    delay(1000);
    sendBlueToothCommand("\r\n+STWMOD=0\r\n");
    sendBlueToothCommand("\r\n+STNA=SeeeduinoBluetooth\r\n");
    sendBlueToothCommand("\r\n+STAUTO=0\r\n");
    sendBlueToothCommand("\r\n+STOAUT=1\r\n");
    sendBlueToothCommand("\r\n +STPIN=0000\r\n");
    delay(2000); // This delay is required.
    sendBlueToothCommand("\r\n+INQ=1\r\n");
    delay(2000); // This delay is required.
}
 
//Checks if the response "OK" is received

void sendBlueToothCommand(char command[])
{
    Serial.print(command);
    delay(3000);
       
}

But again no luck!

Any ideas?

The switch is for XBee socket 2.
Please change the code as following, and try again.
#define RxD 8
#define TxD 9

Regards,
Steve

Hi Steve,

Thanks for the suggestion, I’ve tried and had no luck again. same green-only blinking.

I also tried with an external 9V power supply, just in case, made no difference.

Is there a way I could try to send commands through the serial, instead using the NewSoftSerial library?

Thanks

UPDATE:

I managed to set the Bee in inquiring mode (red and green led flashing) by changing the BluetoothBee BaudRate to 57600 (maybe I accidentally set it to that on previous attempts).

So I confirm that the following code has worked for me (Bee1 RX pin jumper on 9 and Tx on 8):

#include <NewSoftSerial.h>   //Software Serial Port
#define RxD 8
#define TxD 9

NewSoftSerial blueToothSerial(RxD,TxD);

void setup() 
{ 
    Serial.begin(38400);          //Serial port for debugging, Comment this line if not required  
    pinMode(RxD, INPUT);
    pinMode(TxD, OUTPUT);
    setupBlueToothConnection();

} 

void loop() 
{ 

} 

void setupBlueToothConnection()
{
    //Serial.print("Setting up Bluetooth link");       //For debugging, Comment this line if not required    
    blueToothSerial.begin(57600); //Set BluetoothBee BaudRate
    delay(1000);
    sendBlueToothCommand("\r\n+STWMOD=0\r\n");
    sendBlueToothCommand("\r\n+STNA=modem\r\n");
    sendBlueToothCommand("\r\n+STAUTO=0\r\n");
    sendBlueToothCommand("\r\n+STOAUT=1\r\n");
    sendBlueToothCommand("\r\n+STPIN=0000\r\n");
    delay(2000); // This delay is required.
    blueToothSerial.print("\r\n+INQ=1\r\n");
    
    delay(2000); // This delay is required.
    Serial.print("Setup complete");

}

void sendBlueToothCommand(char command[])
{
    blueToothSerial.print(command);
    delay(3000);
                                             
}

No I am trying to pair it with my Android 2.2 phone, will post any successful attempts on that too.