Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Pairing a bluetooth module ?

Status
Not open for further replies.

bianchi77

Advanced Member level 4
Joined
Jun 11, 2009
Messages
1,313
Helped
21
Reputation
44
Reaction score
20
Trophy points
1,318
Location
California
Activity points
9,442
Guys,

How can I pair 2 bluetooth modules ?

HC 05 as a master and HC 06 as a slave...

HC 05 as a transmitter (MCU) and HC 06 as a receiver (MCU)

Any ideas ?
thanks
 

I believe there are AT commands for both that would allow this to happen.

1.) Configure the receiver (Baud rate, Name, pincode, Discoverable(but I think it always is)
2.) Configure the transmitter (baud rate, name, RemoteName, Pincode, set as master, connect)

Here is a link that should have the commands for the HC-05 https://www.instructables.com/files/orig/FOR/4FP2/HKZAVRT6/FOR4FP2HKZAVRT6.pdf
 

I can't get HC 05 as a master, even I put "KEY" on HIGH....and connect Tx and Rx to USB to serial converter,
I tried to give AT command but no response at all....any clues ? thanks
 

What do you mean put the key on high? Did you verify the TX and RX connections? Have you probed the lines to see if there is any communication? Are the logic levels the same? Can you show a system schematic? Is the USB connection showing up in your device manager?
 

i have HC 06 module, there was no problem pairing with my samsung mobile phone.

Power the HC 06 module, ensure voltage does not exceed 3.1 V, also check the polarity of the connections as there is no protection in the module for wrong polarity.

Enable bluetooth in mobile phone, a search for bluetooth devices will show the module as HC 06, click on it, then enter 1234 (default pairing code, in case you have not changed) as pairing code. This will pair the module to the phone.

UART port of the module can be monitored for activity...

thanks
a
 

to arbj2, that's not what I want, I had done that long time a go...

I want to set HC 06 as a master so it can scan slave device which is HC 05, using AT command...there is "KEY" pin and I put on high but no response when I send AT command via computer terminal, I connect PC (TX) to bluetooth (RX) and PC (RX) to bluetooth (TX)....how can I give AT command properly ? thanks
 

I think hc06 is only slave module. You need hc05 for this,it has both master and slave. Odd numbers indicate master and slave while even numbers slave only

but you need to confirm this first..
 

The above assumption is correct. The HC-06 is a slave only where the HC-05 can be set as either.
 

I have both module, HC-05 and HC-06, it meant I tried HC-05 which had "KEY" pin, anyone has experience to make it as Master ? and get AT command for configuring it ? thanks
 


hello,

I am working on a similar project...

i try to use HC06 and /or HC05 as slave
i can establish the link to configure HC05 or HC06
but it seems difficult to put the BT device in the good state when power on.
To be able to put AT command , the BT module must have his led blinking..
if not , no chance to get a link an pass AT commands.
After some power ON / power OFF i can get the good start status : blinking led.
So , by default HC05 is at 9600 bauds ..
i send a new name
and a new speed 19200 bds
but just after reinitialase the uart to the new speed!
The number of available AT commands are very limited, so i think i don't get a true HC05
firmware is linvorV1.8.
Before to use with your PIC ,you better have to initialise it with a terminal + Max3222 <-> HC05

My master is an RN41 bluetooth click from MikroE (at 19200 bds)
It as extended AT commands... an a very good documentation.
(it is not the case for BT linvor , many divergences between all documents)
i allready use it with an Archos 43it tablette successfully and specific Android apk.
Nota :
you can test your master PIC application with an Android tablette or phone with
Amarino.apk or Blueremote.apk ICI

I try to connect my RN41 in Master mode ,
directly to the Mac adresse of my HC05 slave..
but not succefull ,
:cry: i can't establish the link bewtewen thoses BT. devices.

I can post my program (C18) 18F26K22 SLave side if you are interested.

I didn't find any solution on the web , an maybe at least,
i will reorder another RN41 ,wich is more flexible for use, even a bit expansive $$!.

MyBloc_Test_link_RN41_HC05_140402.jpg
 

hello,


To get more information, i did again test with only terminals COM1 and COM2
COM1 attach to RN41
Com2 attach to HC05

I fund that my HC05 , sell as a master , is in fact a slave Only !
because a very reduced set of AT commands ...
so,now, i only use a RN41 as master , others as slave..

When power ON, HC05 must have a blinked led.. else no chance to connect.
The function of input KEY is not clear...
Maybe i will add a wire on the RESET pin of RN41...

If you want a true Bluetooth Master, invest in a RN41 (or others trade mark!) wich has a full set of commands
and a very good user manual & documentation.
even cost is double ( 24€ for HC0x , 48€ for RN41)

I found out a good set of command to start RN41 as Master and easily connect to my HC06
i wrote this script for Vbray terminal.

Code:
program RN41_Init;
var i: integer;
var str: string;

//
begin
ShowMessage('Init RN41 for HC05 bleu ');
Delay(2000);
begin
i:=0;
// disconnect command mode
   ComSendStr('---');ComSendChr(13);Delay(100);
// pass to command mode with $$$ without CR
// very slow commande, each char separated
// don't works,if 3 char collapsed
   ComSendChr(36);Delay(1);
   ComSendChr(36);Delay(1);
   ComSendChr(36);Delay(1);
   Delay(100);
// Help list
//   ComSendStr('H');ComSendChr(13);Delay(100);
// store adresse
   ComSendStr('SR,98D331B17D69');ComSendChr(13);Delay(100);
// 250 sec time allowed for command mode
   ComSendStr('ST,250');ComSendChr(13);Delay(100);
// Payring mode
   ComSendStr('SM,6');ComSendChr(13);Delay(100);
// store adresse to connect with
   ComSendStr('SR,98D331B17D69');ComSendChr(13);Delay(100);
// display Local BT adresse
   ComSendStr('GB');ComSendChr(13);Delay(100);
// display Extended Settings
//   ComSendStr('E');ComSendChr(13);Delay(100);
// display Other Settings
   ComSendStr('O');ComSendChr(13);Delay(100);
// display settings
   ComSendStr('D');ComSendChr(13);Delay(100);
// Connect to the specific BT adress
  ComSendStr('C,98D331B17D69');ComSendChr(13);Delay(100);
 
Delay(2000);
end;
end.

to init the RN41, the 3 char "$" must be send with some delai between , not collapsed
to avoid aleas and without <CR>.
When connected to the slave
Slave can enter in remote command mode for RN41
and check the status
GK must respond with '1' if link is OK (else response is '0')
after , Slave must stop the command mode, to stop the command mode by "---"
and so, re enable the UART transparent link.

Diplaying sequence of RN41 init:
17:53:34.000> END
17:53:34.125> CMD
17:53:34.312> AOK
17:53:34.437> AOK
17:53:34.562> AOK
17:53:34.687> AOK
17:53:34.812> 00066607DB49
17:53:34.937> ***OTHER Settings***
17:53:34.937> Profile= SPP
17:53:35.000> CfgChar= $
17:53:35.000> SniffEna=0
17:53:35.000> LowPower=0
17:53:35.062> TX Power=4
17:53:35.062> IOPorts= 0
17:53:35.062> IOValues=0
17:53:35.125> DebugMod=0
17:53:35.125> RoleSwch=0
17:53:35.125> ***Settings***
17:53:35.187> BTA=00066607DB49
17:53:35.187> BTName=MyBT-DB49
17:53:35.187> Baudrt=19.2
17:53:35.187> Parity=None
17:53:35.187> Mode =Manu
17:53:35.187> Authen=0
17:53:35.187> Encryp=0
17:53:35.265> PinCod=1234
17:53:35.265> Bonded=1
17:53:35.265> Rem=98D331B17D69
17:53:35.265> TRYING
17:53:37.125> 18F_CONNECT
17:54:21.937> XMsg from HC05-B to RN41
17:54:22.750> Msg from HC05-B to RN41
17:54:23.187> Msg from HC05-B to RN41
17:55:03.062> X
17:56:03.125> X
17:57:03.187> X

X is sended by the slave every 60 secondes.

Now i will come back to my application et do tests in this environnment..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top