Bluetooth Bee

From Wiki 来自痴汉的爱
Jump to: navigation, search



Bluetooth Bee is an easy to use Bluetooth Serial Port Profile(SPP) module compatible with existing Xbee sockets, designed for transparent wireless serial connection setup. Serial port Bluetooth module is fully qualified Bluetooth V2.0+EDR(Enhanced Data Rate) 3Mbps Modulation with complete 2.4GHz radio transceiver and baseband. It uses CSR Bluecore 04-External single chip Bluetooth system with CMOS technology and with AFH(Adaptive Frequency Hopping Feature). It has the smallest footprint of 12.7mm x 27mm. Hope it will simplify your overall design/development cycle for форекс брокеры.




Hardware Features

  • Typical -80dBm sensitivity.
  • Up to +4dBm RF transmit power.
  • Fully Qualified Bluetooth V2.0+EDR 3Mbps Modulation.
  • Low Power 1.8V Operation, 1.8 to 3.6V I/O.
  • торговые сигналы FxLot
  • PIO control.
  • UART interface with programmable baud rate.
  • Integrated PCB antenna.
  • xBee compatible headers.

Software Features

  • Default Baud rate: 38400, Data bits:8, Stop bit:1,Parity:No parity, Data control: has.
  • Supported baud rate: 9600,19200,38400,57600,115200,230400,460800.
  • Use CTS and RTS to control the data stream.
  • When a rising pulse is detected in PIO0, device will be disconnected.
  • Status instruction port PIO1: low-disconnected, high-connected;
  • PIO10 is connected to red led, PIO11 is connected to green led. When master and slave are paired, red and green led blinks 1time / 2s in interval, while disconnected only green led blinks 2 times/ s.
  • Auto-connect the last device on power as default.
  • Permit matched device connect by default.
  • Default PINCODE:”0000”.
  • Auto-reconnect in 30 min when disconnected as a result of beyond the range of connection.

Application Ideas

  • As a Wireless Serial Port for Arduino / Seeeduino and other MCUs
  • As a Bluetooth Serial Port for PC when connected with UartSBee


  • While using with Seeeduino / Arduino, set the operation voltage to 3.3V. Else use a proper logic level converter.
  • While using with UartSBee, set the operation voltage to 3.3V
  • Command to change baud rate is persistent even after reset. Hence remember the baud rate for next use.
  • When using SoftwareSerial, do not set the baud rate above 38400


Bluetooth Bee Schematic and Board Files in Eagle Format refrigerated transport services from APS freight company

Pin definition and Rating


Pin # Pad Type Description
PIO9 29 Bi-Direction Programmable input/output line
PIO8 28 Bi-Direction Programmable input/output line
PIO7 27 Bi-Direction Programmable input/output line
PIO6 26 Bi-Direction Programmable input/output line
RTS 25 CMOS output, tri-stable with weak internal pull -up UART request to send, active low
PIO5 24 Bi-Direction Programmable input/output line
PIO4 23 Bi-Direction Programmable input/output line
PCMSY 22 Bi-Direction Synchronous PCM data strobe
CTS 21 CMOS output, tri-stable with weak internal pull -up UART clear to send, active low
PIO3 20 Bi-Direction Programmable input/output line
PIO2 19 Bi-Direction Programmable input/output line
USBDP 18 Bi-Direction
USBDN 17 Bi-Direction
CLK 16 CMOS output, tri-stable with weak internal pull -up SPI(Serial peripheral interface) clock
MI 15 CMOS output, tri-stable with weak internal pull -up SPI data output
MO 14 CMOS output, tri-stable with weak internal pull -up SPI data output
CS 13 CMOS output, tri-stable with weak internal pull -up Chip select for serial peripheral interface, active low
AIO1 12 Bi-Direction Programmable input/output line
AIO0 11 Bi-Direction Programmable input/output line
GND 10 VSS Ground port
PCMIN 9 CMOS input Synchronous PCM data input
PCMOT 8 CMOS output Synchronous PCM data output
PCMCK 7 Bi-Direction Synchronous PCM data clock
PIO1 6 Bi-Direction Programmable input/output line
 !RST 5 CMOS input with weak internal pull-up Reset if low,input must be low for >5ms to cause a reset
PIO0 4 Bi-Direction Programmable input/output line
RX 3 CMOS input with weak internal pull-up UART Data input
TX 2 CMOS output,tri-stable with weak internal pull-up UART Data output
3V3 1 3.3V Integrated 3.3V(+)supply with on-chip linear regulator output within 3.15-3.3V

Mechanic Dimensions

Bluetooth Bee board is of 12.7mm x 27mm size.


Hardware Installation

Connecting to Arduino with XBee Shield

Use a XBee® Shield to connect Bluetooth Bee to Seeeduino / Arduino. Refer the XBee® Shield documentation on how to set the toggle switches to correct positions.

Seeeduino BluetoothBee Xbee Shield.JPG

Connecting to PC with UartSbee

Use an UartSBee to connect Bluetooth Bee to PC. Set the power selection toggle switch to 3.3V before connecting BlueTooth Bee.

BluetoothBee with UartSBee.JPG

Software Instruction

Working Sketch Map

The following sketch presents an overview of Bluetooth Bee operation in master and slave mode.



The following flowchart gives a quick start guide to Bluetooth Bee programming.


Commands to change default configuration

1. Set working MODE

\r\n+STWMOD=0\r\n Set device working mode as client (slave). Save and Rest.
\r\n+STWMOD=1\r\n Set device working mode as server (master). Save and Rest.

Note: \r\n is necessary for operation and the value of are 0x0D 0x0A in Hex. \r and \n represent carriage-return and line-feed(or next line),


\r\n+STBD=115200\r\n Set baudrate 115200. Save and Rest.
Supported baudrate: 9600, 19200,38400,57600,115200,230400,460800.

3. Set Device NAME

\r\n+STNA=abcdefg\r\n Set device name as “abcdefg”. Save and Rest.

4. Auto-connect the last paired device on power

\r\n+STAUTO=0\r\n Auto-connect forbidden. Save and Rest.
\r\n+STAUTO=1\r\n Permit Auto-connect. Save and Rest.

5. Permit Paired device to connect me

\r\n+STOAUT=0\r\n Forbidden. Save and Rest.
\r\n+STOAUT=1\r\n Permit. Save and Rest.


\r\n +STPIN=2222\r\n Set pincode “2222”, Save and Rest.

7. Delete PINCODE(input PINCODE by MCU)

\r\n+DLPIN\r\n Delete pincode. Save and Rest.

8. Read local ADDRESS CODE

\r\n+RTADDR\r\n Return address of the device.

9. Auto-reconnecting when master device is beyond the valid range (slave device will auto-reconnect in 30 min when it is beyond the valid range)

\r\n+LOSSRECONN=0\r\n Forbid auto-reconnecting.
\r\n+LOSSRECONN=1\r\n Permit auto-reconnecting.

Commands for Normal Operation:

1. Inquire

a) Master
\r\n+INQ=0\r\n Stop Inquiring
\r\n+INQ=1\r\n Begin/Restart Inquiring
b) Slave
\r\n+INQ=0\r\n Disable been inquired
\r\n+INQ=1\r\n Enable been inquired

When +INQ=1 command is successful, the red and green LEDS blink alternatively.

2. Bluetooth module returns inquiring result

\r\n+RTINQ=aa,bb,cc,dd,ee,ff;name\r\n Serial Bluetooth device with the address “aa,bb,cc,dd,ee,ff” and the name “name” is inquired

3. Connect device

\r\n+CONN=aa,bb,cc,dd,ee,ff\r\n Connect to a device with address of "aa,bb,cc,dd,ee,ff”

4. Bluetooth module requests inputting PINCODE


5. Input PINCODE

Example: RTPIN=0000 Input PINCODE which is four zero

6. Disconnect device Pulling PIO0 high will disconnect current working Bluetooth device.

7. Return status \r\n+BTSTA:xx\r\n
xx status:

  • 0 - Initializing
  • 1 - Ready
  • 2 - Inquiring
  • 3 - Connecting
  • 4 - Connected

(Note: This is not a command, but the information returned from the module after every command)


Flow Control Based Implementation

The following sketch configures Bluetooth Bee for Transportunternehmen as Slave Device and waits for connection request from PC or other master device. Bluetooth Bee is connected to Seeeduino via XBee Shield as shown above. Bluetooth Bee is connected to digital Pins 11 and 12 of Arduino / Seeduino. We use NewSoftSerial library for supporting serial communication on these pins. The hardware serial port of Arduino is available for uploading sketch or debugging. This sketch uses a flow control mechanism using CheckOK(). It avoids using arbitrary delay between each command. If CheckOK() is not required, use a delay of at least 3 seconds between commands.

BluetoothBee Demo Code - Flowcontrol Based Implementation
2010,2011 Copyright (c) Seeed Technology Inc.  All right reserved.
Author: Visweswara R
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
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
/* Upload this sketch to Seeeduino and press reset*/
#include <SoftwareSerial.h>   //Software Serial Port
#define RxD 11
#define TxD 12
#define DEBUG_ENABLED  1
SoftwareSerial blueToothSerial(RxD,TxD);
void setup() 
    pinMode(RxD, INPUT);
    pinMode(TxD, OUTPUT);
void loop() 
  //Typical Bluetoth command - response simulation:
  //Type 'a' from PC Bluetooth Serial Terminal
  //See Bluetooth Bee - Wiki for instructions
  if( == 'a')
    blueToothSerial.println("You are connected");
    //You can write you BT communication logic here
void setupBlueToothConnection()
    blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
    sendBlueToothCommand("\r\n +STPIN=0000\r\n");
    delay(2000); // This delay is required.
    delay(2000); // This delay is required.
//Checks if the response "OK" is received
void CheckOK()
  char a,b;
    a =;
    if('O' == a)
      // Wait for next character K. available() is required in some cases, as K is not immediately available.
         b =;
      if('K' == b)
  while( (a = != -1)
    //Wait until all other response chars are received
void sendBlueToothCommand(char command[])