Skip to main content

Bluetooth Bee

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

Model:WLS125E1P

Features

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.

  • 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 redled, 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

Cautions

  • 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

Schematic

Bluetooth Bee Schematic and Board Files in Eagle Format srefrigerated transport servicefrom APS freight company

Pin definition and Rating

Bottom-view:

Pin#Pad TypeDescription
PI0929Bi-DirectionProgrammable input/output line
PI0828Bi-DirectionProgrammable input/output line
PIO727Bi-DirectionProgrammable input/output line
PIO626Bi-DirectionProgrammable input/output line
RTS25CMOS output,tri-stable with weak internal pull-upUART requese to send,active low
PIO524Bi-DirectionProgrammable input/output line
PI0423Bi-DirectionProgrammable input/output line
PCMSY22Bi-DirectionSynchronous PCM data
CTS21CMOS output,tri-stable with weak internal pull-upUART clear to send,active low
PIO320Bi-DirectionProgrammable input/output line
PIO219Bi-DirectionProgrammable input/output line
USBDP18Bi-Direction
USBDN17Bi-Direction
CLK16CMOS output,tri-stable with weak internal pull-upSPI(Serial peripheral interface)clock
MI15CMOS output,tri-stable with weak internal pull-upSPI data output
MO14CMOS output,tri-stable with weak internal pull-upSPI data output
CS13CMOS output,tri-stable with weak internal pull-upChip select for serial peripheral interface,active low
AIO112Bi-DirectionProgrammable input/output line
AIO011Bi-DirectionProgrammable input/output line
GND10VSSGround port
PCMIN9CMO inputSynchronous PCM data input
PCMOT8CMOS outputSynchronous PCM data input
PCMCK7Bi-DirectionSynchronous PCM data input
PIO16Bi-DirectionProgrammable input/output line
IRST5CMOS output,tri-stable with weak internal pull-upResert if low,inpue must be low for>5ms tocause a reset
PIO04Bi-DirectionProgrammable input/output line
RX3CMOS output,tri-stable with weak internal pull-upUART data input
TX2CMOS output,tri-stable with weak internal pull-upUART data input
3V313.3VINtergrated 3.3v(+)supply with on-chip linear regulator output wiyhin 3.15-3.3v

Mechanic Dimensions

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

Usage

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.

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.

Software Instruction

Working Sketch Map

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

Flowchart

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 80x0D 0x0A in Hex. \r and \n represent carriage-return and line-feed(or next line),

2.Set BAUDRATE

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

3.Set Device NAME

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

\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\nAuto-connect forbidden. Save and Rest.
\r\n+STAUTO=1\r\nPermit Auto-connect. Save and Rest.

5.Permit Paired device to connect me

\r\n+STOAUT=0\r\nForbidden. Save and Rest.
\r\n+STOAUT=1\r\nPermit. Save and Rest.

6.Set PINCODE

\r\n +STPIN=2222\r\n

7.Delete PINCODE(input PINCODE by MCU)

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

8.Read local ADDRESS CODE

\r\n+RTADDR\r\nReturn 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\nForbid auto-reconnecting.
\r\n+LOSSRECONN=1\r\nPermit auto-reconnecting.

Commands for Normal Operation

1.Inquire

a) Master

\r\n+INQ=0\r\nStop Inquiring
\r\n+INQ=1\r\nBegin/Restart Inquiring

b) Slave

\r\n+INQ=0\r\nDisable been inquired
\r\n+INQ=1\r\nEnable 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\nSerial 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\nConnect to a device with address of "aa,bb,cc,dd,ee,ff”

4.Bluetooth module requests inputting PINCODE

\r\n+INPIN\r\n

5.Input PINCODE

\r\n+RTPIN=code\r\n
Example: RTPIN=0000Input 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)

Programming

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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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 https://www.seeedstudio.com/depot/

*/


/* 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);
setupBlueToothConnection();

}

void loop()
{
//Typical Bluetoth command - response simulation:

//Type 'a' from PC Bluetooth Serial Terminal
//See Bluetooth Bee - Wiki for instructions

if(blueToothSerial.read() == '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
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 CheckOK()
{
char a,b;
while(1)
{
if(blueToothSerial.available())
{
a = blueToothSerial.read();

if('O' == a)
{
// Wait for next character K. available() is required in some cases, as K is not immediately available.
while(blueToothSerial.available())
{
b = blueToothSerial.read();
break;
}
if('K' == b)
{
break;
}
}
}
}

while( (a = blueToothSerial.read()) != -1)
{
//Wait until all other response chars are received
}
}

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

Delay Based Implementation

The following sketch is a modification of above program using delay() instead of CheckOK(). In this case the hardware serial port is used for debugging purpose. Open serial monitor with setting 9600 baud. The complete communication between MCU and Bluetooth Bee will be visible in serial monitor.

/*
BluetoothBee Demo Code - Delay Based Implementaion
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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 https://www.seeedstudio.com/depot/

*/

/* Upload this sketch into Seeeduino and press reset*/

#include <SoftwareSerial.h> //Software Serial Port
#define RxD 11
#define TxD 12

SoftwareSerial blueToothSerial(RxD,TxD);

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

}

void loop()
{

if(blueToothSerial.read() == 'a')
{
blueToothSerial.println("You are connected to Bluetooth Bee");
//You can write you BT communication logic here
}
}

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[])
{
char a;
blueToothSerial.print(command);
Serial.print(command); //For debugging, Comment this line if not required
delay(3000);

while(blueToothSerial.available()) //For debugging, Comment this line if not required
{ //For debugging, Comment this line if not required
Serial.print(char(blueToothSerial.read())); //For debugging, Comment this line if not required
} //For debugging, Comment this line if not required
}

Connecting Bluetooth Bee to PC (via Bluetooth Dongle) under GNU/Linux

This procedure demonstrates how Bluetooth Bee can be connected to PC under GNU/Linux OS. An USB Bluetooth Dongle is used at PC side to communicate with Bluetooth Bee. The flow control implementation sketch is uploaded to Seeeduino.

  • Install gnome-bluetooth

sudo apt-get install gnome-bluetooth

  • Open bluetooth-properties application from shell

  • Click Set up new device

and click Forward

  • Open PIN options...

  • Set Fixed PIN 0000. 0000 is the default pin used in the above sketch.

  • Device Setup Window opens

  • and Setup Completed dialog opens. Click Close.

  • The address of the Bluetooth Bee00:13:EF:00:00:24 is displayed in shell.

  • Bind the Bluetooth Bee to rfcomm port. Here the address of Bluetooth Bee is bound to a serial port device /dev/rfcomm0
user@user-desktop:~$ sudo rfcomm bind 0 00:13:EF:00:00:24 1
user@user-desktop:~$ ls /dev/rfcomm*
/dev/rfcomm0
  • This /dev/rfcomm0 serial port can be accessed by any serial port terminal like cutecom.

  • Open /dev/rfcomm0 with baud rate:38400, Databits: 8, Stopbits: 1 and No Flow Control

  • Send character 'a'

  • Seeeduino + Bluetooth Bee will reply with "You are connected to Bluetooth Bee"

Connecting Bluetooth Bee to PC (via Bluetooth Dongle) under Windows

  • Install the Microsoft Bluetooth default drivers. Open Control Panel -> Bluetooth Devices

  • Click Add button.

  • Check My devices is set up and ready to be found and click Next button

  • Select the "SeeedBlueToothBee" device and click Next.

  • Select Use the passkey found in the documentation and enter 0000

  • Passkeys are exchanged and an outgoing serial port COM5 is assigned for our communication.

  • A task-bar balloon shows that a new Bluetooth Serial Port link is added.

  • COM5 is assigned for communication. This port should be used to communicate PC with Bluetooth Bee.

  • This COM5 serial port can be accessed by any Serial Port terminal.

  • Open COM5 with baud rate:38400, Databits: 8, Stopbits: 1 and No Flow Control

  • Send character 'a'

  • Seeeduino + Bluetooth Bee will reply with "You are connected to Bluetooth Bee"

Connecting Bluetooth Bee to PC using UartsBee in Master Mode

This demo uses hardware arrangement described in [Hardware Installation - UartSBee. Connect UartSbee to PC using a mini USB cable.

  • Open a serial terminal and connect to UartSBee serial port device like COM1 in Windows or /dev/ttyUSB0 in GNU/Linux with baud rate:38400, Databits: 8, Stopbits: 1 and No Flow Control

  • Send \r\n+STWMOD=1\r\n command. This configures the Bluetooth Bee in master mode.

  • Send \r\n+INQ=1\r\n command. Bluetooth Bee searches available Bluetooth devices in neighborhood and list the address of the devices. In this case with +RTINQ=0,19,86,0,19,1E;desktop, where desktop is a PC with Bluetooth interface. While inquiring the red and green led blinks alternatively.

  • Send \r\n+CONN=0,19,86,0,19,1E\r\n where 0,19,86,0,19,1E is the address of desktop.

  • Enter the pin 0000 at PC side and complete the connection.

Bill of Materials (BOM) /parts list

Support

If you have questions or other better design ideas, you can go to our forum or wish to discuss.

Version Tracker

RevisionDescriptionsRelease
v1.0Initial public releaseDec 14, 2009
v1.1Modify Inquire command and add some notesMar 15, 2010
v1.2Modify Hardware and Software featuresApr 04, 2010
v1.3Update the profile, add the return status, delete ECHO command.Apr 21, 2010
v2.0Update the module as HM-01(The same with the newest Bluetooth shield). The AT command can not compatible with before.Dec 4, 2014

Bug Tracker

Bug Tracker is the place you can publish any bugs you think you might have found during use. Please write down what you have to say, your answers will help us improve our products.

Additional Idea

  • Implement a wireless PS/2 Keyboard / Mouse.

  • Wireless control a toy robot from PC.

How to buy

Click here to buy:https://www.seeedstudio.com/depot/bluetooth-bee-p-598.html?cPath=139_142.

Licensing

This documentation is licensed under the Creative Commons Attribution-ShareAlike License 3.0 Source code and libraries are licensed under GPL/LGPL, see source code files for details.

If you want to make some awesome projects by Bluetooth Bee, here's some projects for reference.

Seeed Pet

This is an interesting demo made by seeduino and Grove (title=undefined). SEEED PET is kind of an electronic pet in our studio. It is a platform for the newbie engineers to be familiar with our company’s products and practice. Every newbie engineer will be added some new ideas or elements on the SEEED PET.

I want to make it.

Share Your Awesome Projects with Us

Born with the spirit of making and sharing, that is what we believe makes a maker.

And only because of this , the open source community can be as prosperous as it is today.

It does not matter what you are and what you have made, hacker, maker, artist and engineers,

as long as you start sharing your works with others,

you are being part of the open source community and you are making your contributions .

Now share you awesome projects on with us on Recipe, and win a chance to become the Core User of Seeed.

  • Core Users, are those who showing high interests and significant contributions in Seeed products.

  • We cooperate with our Core Users in the development of our new product, this, in another word, the Core Users will have the chance to experience any new products of Seeed before its official launch, and in return we expect valuable feedback from them to help us improving the product performance and user experience. And for most of cases if our Core Users have any good ideas for making things, we'll offer hardware pieces, PCBA services as well as technical support. Besides, further commercial cooperation with the Core Users is highly possible.

Schematic Online Viewer

Resources

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...