Using BlueBee in Master mode

Ever think of using both BlueBee (just BlueBee) to create connection? Let say between two Arduino, talking to each other wirelessly? Can it be done? 
 
Sure it can, but why some Bluetooth module cannot do that? Why previously there is not steps to do it? Well, we found out that the Bluetooth module on Cytron’s BlueBee has master/slave role in one 🙂 After exploring with some experience, finally we get it to work! For your information, Bluetooth require master node to request and create connection, a slave node cannot inquiry and request connection. Therefore, if your Bluetooth module is slave module, it cannot search for other Bluetooth module and create wireless connection, and you will need to get a master Bluetooth to do that. Most of the time, the Bluetooth in laptop, Bluetooth dongle, smart phone is master node. That enable these devices to create connection with BlueBee. With this tutorial, your BlueBee can now be a master node and create connection with another BlueBee.
 
The default role of BlueBee from factory is slave.
 
Capture
Software
  • Hyperterminal, any terminal program can do it, Arduino Serial Monitor, RealTerm, PuttY also can do it. We would like to send AT command and look at the response from BlueBee.
Hardware
Introduction

As master, BlueBlee can search for a slave device and further pair with it, and lastly establish Bluetooth wireless connection. Slave BlueBee cannot search for other BlueBee to be paired. Once paired and connected, both master and slave BlueBee can transmit and receive data transparently. In this tutorial, one BlueBee will be configured as master and the other BlueBee configured as slave. (one master device can only connect to one slave device). 

Step 1, Configure 1st BlueBee as a slave

00

  • Set BlueBee to AT Mode by pushing the slide switch to “AT”.
  • Connect SKXBee with BluBee module to PC via USB cable.
  • Once it powered, press and release RESET button of SKXBee. This is to make sure the BlueBee is in AT Mode. (Every time you change the Mode, press reset button to let the changes take effect).

01

  • Open HyperTerminal, choose the correct COM number for your SKXBee. Under COM properties, press default button and then set the baudrate to 38400 bps for AT Mode. If you do not have HyperTerminal, open up Arduino IDE and click the serial monitor, or use RealTerm or Putty. Any terminal program should be fine.

02

  • Go to “Settings” tab, ticked “Send line ends with line feeds” and “Echo typed characters locally”.
  • Then, type the following AT command in the Hyperterminal window. Remember to press “Enter” at the end of command.
AT CommandResponseDescription
ATOKTyped AT until BlueBee response OK. Sometime for the first time connect, it may return ERROR.
AT+ORGLOK
Reset BlueBee setting to default.
ID: 0
Working Role: Slave Mode
Baudrate: 38400bits/s or 9600bits/s
Stop bit: 1
Parity: None
Pair Code: 1234
AT+RMAADOKCleared any paired devices
AT+PSWD=1234OK
Set password to 1234 (user can choose any password they like, master and slave must have the same password)
AT+NAME=BlueBeeSlaveOK
Set the BlueBee name to BlueBeeSlave
AT+ROLE=0;OK
Set the BlueBee as slave
0 – Slave
1 – Master
2 – Slave Loop
AT+ADDR?+ADDR<address>OK
Get the slave address. Every Bluebee has its own unique address. Copy this adress.
AT+UART=9600,0,0OK
Set the transparent UART baudrate to 9600.(user can choose any baudrate that they prefer.)

HyperTerminal Window

03
  • After his is done, set the BlueBee slave module back to “Transparent” Mode and press Reset button on SKXBee.
Step 2, Configure 2nd BlueBee as Master
  • Set BlueBee to AT Mode by pushing the slide switch to “AT”.
  • Connect SKXBee with BluBee module to PC via USB cable.
  • Once it powered, press and release RESET button of SKXBee. This is to make sure the BlueBee is in AT Mode. (Every time you change the Mode, press reset button to let the changes take effect).
  • Open another HyperTerminal, select the correct COM number for this SKXBee and click the “default” in Port Settings, set the baudrate to 38400 bps for AT Mode.
  • Please set the same settings as the previous HyperTerminal.
  • Enter the following AT command to the BlueBee in HyperTerminal window.
AT CommandResponseDescription
ATOKTyped AT until BlueBee response OK. Sometime for the first time connect, it may return ERROR.
AT+ORGLOKReset BlueBee setting to default.
ID: 0
Working Role: Slave Mode
Baudrate: 38400bits/s or 9600bits/s
Stop bit: 1
Parity: NonePair Code: 1234
AT+RMAADOKCleared any paired devices
AT+NAME=BlueBeeMasterOKSet the BlueBee name to BlueBeeMaster
AT+ROLE=1OKSet the BlueBee as master
0 – Slave
1 – Master
2 – Slave Loop
AT+RESETOKReset command after BlueBee changing role from Slave to Master.
AT+CMODE=1OKAllow connecting to any address.
AT+INQM=0,5,5OKInquire mode – standard, stop after 5 devices found, (or) stop searching after 5 seconds
AT+PSWD=1234OKSet password, should be the same as the slave.
AT+INITOKStart bluetooth transmit and receive profile library
AT+INQ+INQ<address>+INQ<address>…OKSearching for bluetooth device around. It should reply back the address of every detected bluetooth device around. Make sure the BlueBeeSlave is power up and you will notice that BlueBeeSlave address that you copied somewhere earlier is in the list.
AT+PAIR=<BlueBeeSlave address>,20OKPairing the BlueBeeMaster and BlueBeeSlave
<BlueBeeSlave address>, ex: 12,3,289431. Note that ‘:’ is change to ‘,’
AT+BIND=<BlueBeeSlave address>OKBind address
AT+CMODE=0OKOnly allow connecting to the “bind address”
AT+UART=9600,0,0OKSet the transparent UART baudrate to 9600.(user can choose any baudrate thet they prefer.)
AT+LINK=<BlueBeeSlave address>OKAnd now to actually connect both devices.

Hyperterminal Window

04

05
  • Set the Master BlueBee to Transparent Mode by pushing the slide switch to “Trans”. Press and release Reset button of SKXBee to let the changes take effect.
  • Now, you should have 2 set of SKXBee and BlueBee connected to your computer and 2 HyperTerminal. Allow some time for the master BlueBee to search for the slave BlueBee and establish wireless connection. If the connection is successful established, the master BlueBee and slave BlueBee will show blinking on status LED with heartbeat pattern (LED will blink twice and stop around 2 seconds, and repeat itself). If no blinking with heartbeat pattern, try resetting both slave and master device. And wait again.

Transmitting and Receiving Data between Master and Slave BlueBee Using HyperTerminal

06

07

  • Now, in transparent mode, the baudrate is 9600 bps. Please change both the HyperTerminal COM port baudrate to 9600 under the Port Properties window (you need to disconnect the HyperTerminal first). In my example, Master BlueBee is connected to COM5 while Slave BlueBee is connected to COM6 (The COM port will be different in other computer). Please make sure that both BlueBee are in Transparent Mode.

08

  • Now, you can type any message in any HyperTerminal, the message will appear on another HyperTerminal, and it is bidirectional.

09

  • You can now Transmit/Receive data using the Hyperterminal via BlueBee.

Connect Master BlueBee with two or more slave at the same time?

This bluetooth module use Serial Port Profile (SPP). Only one connection at a time is allowed in this profile. The SPP defines two roles, Device A and Device B.

  • Device A – This is the device that takes initiative to form a connection to another device (initiator/Master).
  • Device B – This is the device that waits for another device to take initiative to connect (acceptor/Slave).

For more information about SPP, you can read this document.

 If you have further inquiry, welcome to discuss in our technical forum as we seldom check the comments in tutorial site.


 
 

Buy

Leave a Reply

Your email address will not be published. Required fields are marked *