HC-05 switching to AT command mode, can it be done through serial line ?

Buzby

Senior Member
Hi All,

I've got my HC-05 running with my 28X2 using hserin/out straight out of the box no problem.

Unfortunately I can't find a datasheet that indicates if it is possible to change to command mode via serial comms.

I know it can be done by pulling a pin high, but I'd like to do it like a dial-up modem did, using some kind of trigger string.

Does anyone know if the HC-05 supports this ?

Cheers,

Buzby
 

srnet

Senior Member
I have been looking at the setup and config of these quite a bit over the last few days, the only method I see described of getting into command mode is via the pins.

If it were possible, using some form of trigger string down the serial, you would expect to see it mentioned.
 

Buzby

Senior Member
... If it were possible, using some form of trigger string down the serial, you would expect to see it mentioned.
Yes, but some datasheets are better than others. e.g. Only one I've found explains what the 'x' in replies like ERROR(x) means.

Now I've got another problem.

the HC05 works fine with the default settings, but I need to change a few.

I wrote some rough PICAXE code to read the setting in AT mode, and it works for some settings, but not for others.

eg.

AT+VERSION? returns +VERSION:2.0-20100601
OK

AT+ADDR? returns +ADDR:2015:2:58086
OK

AT+PSWD=6789 returns OK

AT+PSWD? returns 6789
OK

So I can read and write PSWD, but when I try AT+NAME? there is no reply, not even an OK or error.

Do you have any ideas ?

Cheers,

Buzby
 

srnet

Senior Member
Do you have any ideas ?
No sorry.

I took the view that the least I had to do to make it work the better.

It works, for me after a reset, so I did not see the need to chnage anything, apart from the baud rate.
 

Buzby

Senior Member
I fully understand. Leaving as much as possible at default is usually the best. ( I learn't that with all that faffing with URF/ERF last year ! )

There is a new development though. This morning I powered the kit up, and connected my phone via Bluetooth. I must have been a bit sleepy, because I did not recognise the significant fact the phone saw the name as 'BUZBY', which was what I tried setting last night.

So it looks like the name was set, but without any confirmation or readback.

I'm not at my kit again till tonight, so I'll test this further then.

Cheers,

Buzby
 

Buzby

Senior Member
Also see this sheet.

It pays to read data sheets for other model devices as it often contains information suitable to all model devices........ Chinese instructions !!!

View attachment 18086
That sheet is the only one that explains the error codes !.

There seem to be lots of datasheets with varying levels of detail, but they all agree on one thing, AT mode neeeds a pin level change.
 

techElder

Well-known member
Buzby, did you happen to try the commands as you've shown without the "AT" and/or without the "AT+" ??

AT+VERSION? returns +VERSION:2.0-20100601
OK

AT+ADDR? returns +ADDR:2015:2:58086
OK

AT+PSWD=6789 returns OK

AT+PSWD? returns 6789
OK
 

Buzby

Senior Member
All the commands start with 'AT+', I didn't try anything else.
The replies all start with '+' followed by the copy of the command, then any results.

Reading a bit more on the internet it does seem that there are quite a few people seeing firmware issues with these HC devices, most cured by changing to a different supplier, or re-flashing the HC, not a route I want to go down !.
 

srnet

Senior Member
I just aquired a HC-06.

Plugged it into my project, a LoRa telemtry receiver.

On the Hudl I paired it, shows as HC-06.

Started the Blueterm+ application on the Hudl tablet, connected it to the HC-06.

Turned on the LoRa telemetry receiver and hey presto, text output on the Hudl, no config of the HC-06 required, the default baud of 9600 is fine by me.

I did note that the LED indications on the HC-06 were;

Switched on, not paired - rapid flash.
Switched on paired with Hudl - rapid flash
Connected in Blueterm table application - LED on permanently
 

Buzby

Senior Member
The HC-05 worked like that, straight out of the box.

The problem came when trying to set parameters other than the default.
The HC-05 is far more complex than the HC-06, but I've since learned the 06 would do what I need anyway.

I've also learned that the magic button on the HC-05 affects the behaviour of the AT mode depending on when it pressed.

So now I've got +NAME working, i just need to sort out the baudrate.
 

BeanieBots

Moderator
I concur, the HC-06 is much simpler to use. (and cheaper)
Only go for the HC-05 if you want it to be the Bluetooth master.
 
Top