Bluetooth presence (via HC05 and Jeenode)

90 replies [Last post]
brett
Offline
Providence, United States
Joined: 9 Jan 2010
Andrew I updated the wiki

Andrew I updated the wiki page on the blue node with some sample output.  I'll paste again here.
I flash this onto my arduno and reattached my bluetooth device to make sure I wasn't going mad.

[BlueNode.1] - RF disabled
SYNC> AT
OK
SYNC> AT+NAME=blueNode
OK
SYNC> AT+ROLE=1
OK
SYNC> AT+INIT
ERROR:(17)
SYNC> AT+INQM=0,5,15
OK
ASYNC> AT+INQ
OK
+INQ:12:37:E90912,520204,7FFF
device=12:37:E90912 type=520204 rssi=7FFF
OK

Another command you might want to try.

// Set Connection mode.
// 1 - connect the module to any address.
sendBluetoothCommand("AT+CMODE=1", SYNC);

Put this before the AT+INIT and see if that helps any.

Brett

AndrewJ
Offline
United Kingdom
Joined: 22 Nov 2012
Thanks Brett for

Thanks Brett for clarifying,

i've added the line

 sendBluetoothCommand("AT", SYNC);
  sendBluetoothCommand("AT+NAME=blueNode", SYNC);
  // AT+ROLE=p1
  // p1 - 0 Slave Role, 1 Master Role, 2 Slave-Loop role.
  sendBluetoothCommand("AT+ROLE=1", SYNC);
  sendBluetoothCommand("AT+CMODE=1", SYNC);
  sendBluetoothCommand("AT+INIT", SYNC);
  // AT+INQM=p1,p2,p3
  // p1 - 0 inquire_mode_standad, 1 inquire_mode_rssi
  // p2 - maximum number of bluetooth devices response
  // p3 - the maximum of limited inquiring time. 1~48 (1.28s ~ 61.44s)
  //      15*1.28 = 19sec
  sendBluetoothCommand("AT+INQM=0,5,15", SYNC);

Same output alas...

[BlueNode.1]18 g212 @ 868Mhz
SYNC> AT
OK
SYNC> AT+NAME=blueNode
OK
SYNC> AT+ROLE=1
OK
SYNC> AT+CMODE=1
OK
SYNC> AT+INIT
ERROR:(17)
SYNC> AT+INQM=0,5,15
OK
ASYNC> AT+INQ
OK
OK
OK
OK
ASYNC> AT+INQ
OK
OK
OK
OK
OK
ASYNC> AT+INQ
OK
ASYNC> AT+INQ

Andrew

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Andrew that's a bummer.   I

Andrew that's a bummer.   I don't know what could be wrong with your BT device its almost as if the antenna isn't connected!?  You ordered from a different supplier this time?
You have set everything just like Gary and I have so all things being equal lets blame the hardware.

Brett

AndrewJ
Offline
United Kingdom
Joined: 22 Nov 2012
BrettSure is, as long as im

Brett

Sure is, as long as im not doing something stupid i dont mind blaming the hardware.

not much else i can think other than provide a 5v supply prehaps

original order was from the UK (more expensive but same week postage)

Thanks

Andrew

magill
Offline
Joined: 27 Apr 2012
HC-05 issues

Andrew

I have surrendered after fighting with 2 of these devices. Same response as you. Interestingly the second module I ordered was slightly different from the first, but behaved exactly the same.

John

AndrewJ
Offline
United Kingdom
Joined: 22 Nov 2012
Hi John, Thats a real shame,

Hi John,

 

Thats a real shame, and i was thinking i was doing something very wrong....well my 2nd modeule is on its way over from a different supplier heres hoping!!

 

Thanks,

Andrew

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Its got to be how its being

Its got to be how its being initialized but if everybody has the same unit how can this be so?
That make 3 units between Andrew and John that just don't function with my code, ok I missed out the AT+INIT and when I retested my code I got error(16) "SSP not initalized" but onced Iadded AT+INIT got error(17) "already initialized" and the unit worked, as per my wiki page.

I find that hard to believe the defect rate is this high.  Maybe I should buy another and hope I get a dud so I can investigate.   This is surreal.   Gary are you using my code or some other variant?  What is your AT sequence?
Yours work right?

Brett

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Brett, I haven't tried your

Brett,

 I haven't tried your version of the code yet sorry, stupid iphone and then the raspberry pi stuff put it on a back burner.

i can try to give it a go and see if it works with my unit.

I had success with my original attempt though, init code shown below:

  BTSerial.begin(9600); delay(200);
  BTSerial.write("AT+ROLE=1\r\n");
  delay(500);
  BTSerial.write("AT+INQM=0,5,15\r\n");
  delay(500);
  BTSerial.write("AT+RESET\r\n");
  delay(500);
  BTSerial.begin(38400);
  delay(200);
  BTSerial.write("AT+INIT\r\n");
I did this as I was concerned the key pin wouldn't go high straight away and the datasheet suggested this might cause a connection at 9600 baud. Therefore I opted to do this, reset then switch to 38400 for the scan.
The fact that Andrew is getting OK responses though suggest your code has the correct baud rate so I can't see what is different.

Best I check your code after a factory reset of the module maybe
Garry
magill
Offline
Joined: 27 Apr 2012
HC-05 command mode

Andrew

Have you noticed that the module starts to flash fast ie it drops out of command mode. I have tried every combination of commands, including delays between them, on 2 modules. I give up! On to the next project.

John

AndrewJ
Offline
United Kingdom
Joined: 22 Nov 2012
John, Yes i get two slow

John,

 

Yes i get two slow flashes, then it drops into fast flashing.

i dont want to give up just yet :)

 

Andrew

AndrewJ
Offline
United Kingdom
Joined: 22 Nov 2012
New HC-05 arrived today, the

New HC-05 arrived today, the comms board it sits on is a different design with different pinouts so thats something positive as it ensures its a different batch

Im stuggling to get any serial debug out of the latest sketch, can somebody verify this works ok for them?

http://livebox-hah.googlecode.com/svn/trunk/userapps/arduino/Bluetooth/B...

thanks

Andrew

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Did you enable debug - it is

Did you enable debug - it is turned off by default.  You should get something!?
Brett

AndrewJ
Offline
United Kingdom
Joined: 22 Nov 2012
Brett,So it is, I missed that

Brett,

So it is, I missed that i will remove the comments from //#define SERIAL 1

Thanks

Andrew

AndrewJ
Offline
United Kingdom
Joined: 22 Nov 2012
After enabling Debug this is

After enabling Debug this is the current output

Sadly no OK from the first AT command

[BlueNode.1]18 g212 @ 868Mhz
SYNC> AT

bobonline19
Offline
Joined: 4 Apr 2013
hc-05 variants
I don't know if it helps at all but on the hc-05 adapter board that came with mine there is a tiny switch that has to be continually pressed to keep it in AT mode. Otherwise it tries to open a transparent Bluetooth serial data link. Part of the problem with progressing my nodes further
AndrewJ
Offline
United Kingdom
Joined: 22 Nov 2012
(No subject)

Thanks for the info,

I need to check the FTDI levels for the new board, the new adaptor board suggests the comms needs to be at 3.3v

its also possible it requires a 5v + supply and not 3v

no switch as far as i can see....

 

Old on Left, new on Right