Author Topic: HC-05 Bluetooth module sleep after 5 secs idle  (Read 1984 times)

0 Members and 1 Guest are viewing this topic.

Offline iMoTopic starter

  • Super Contributor
  • ***
  • Posts: 5749
  • Country: li
HC-05 Bluetooth module sleep after 5 secs idle
« on: August 04, 2023, 07:13:07 am »
It is 10 years back I first time asked on this less known "issue" (afaik on arduino forum and perhaps on stm32duino too) - thus it could be somebody found a solution in the meantime  ;D

Module is the slave, paired, everything works fine, I've been using several modules with lot of boards for a decade already.

Now the "issue" - when there is none TX activity via serial (via the wire connected to an mcu) for more than 5 seconds, the module enters a "sleep mode". That is great, as the current consumption drops from 20mA to 2mA.

In order the wake up the module from the sleep, you have to either send a char from the host PC (via the air), or, send a char via the TX wire (off the mcu). Ok, that is how it should work..

BUT - the wake up takes some rather long time (at least that is my understanding), thus when you for example send a 100 char long message at 115k2 every 6 seconds, the first 20-30 chars of the message get simply lost.

In order to disable the "sleep" I did mess in past with some crazy settings I saw in various versions of the DS I randomly tried with none result.

Perhaps somebody knows a trick how to change/disable the "sleep" setting in the lovely HC-05 module?
« Last Edit: August 04, 2023, 07:15:27 am by iMo »
Readers discretion is advised..
 

Offline eutectique

  • Frequent Contributor
  • **
  • Posts: 490
  • Country: be
Re: HC-05 Bluetooth module sleep after 5 secs idle
« Reply #1 on: August 04, 2023, 11:30:02 am »
What does AT+SNIFF? return ?
 
The following users thanked this post: iMo

Offline iMoTopic starter

  • Super Contributor
  • ***
  • Posts: 5749
  • Country: li
Re: HC-05 Bluetooth module sleep after 5 secs idle
« Reply #2 on: August 05, 2023, 08:36:20 am »
Here it is - it looks like as a pretty ancient firmware..

Code: [Select]
AT+VERSION?
+VERSION:1.0-20090818
OK
AT+IPSCAN?
ERROR:(1)
AT+STATE?
+STATE:INITIALIZED
OK
AT+SNIFF?
ERROR:(0)
AT+UART?
+UART:115200,0,0
OK

PS: I've been dealing with the issue in an app such I send a char (ie. "+" as my first item in the record is a positive number) and wait 50ms. When the mcu sends data within 5secs I get +1234, when the period is more than 5secs I get 1234. Quite a naive workaround but at least it works..

PPS: even so I get from time to time a "+" when the period is >5secs. It seems when the module is in sleep, it depends whether you fit exactly with the first character in a slot when the module is sniffing or not.
« Last Edit: August 05, 2023, 09:19:54 am by iMo »
Readers discretion is advised..
 

Offline eutectique

  • Frequent Contributor
  • **
  • Posts: 490
  • Country: be
Re: HC-05 Bluetooth module sleep after 5 secs idle
« Reply #3 on: August 05, 2023, 09:00:48 pm »
IMO, the cleaner way would be to read the module state (AT+STATE?) and send only if it is in the proper state. This command will also wake the module up.

If you want to keep the module awake, but AT+EXSNIFF is not implemented, just send AT+STATE? every two seconds or so.
 

Offline iMoTopic starter

  • Super Contributor
  • ***
  • Posts: 5749
  • Country: li
Re: HC-05 Bluetooth module sleep after 5 secs idle
« Reply #4 on: August 06, 2023, 06:29:44 am »
That is "extremely" complicated. In order to enter the AT mode you have to set pin34 to high and power the module off/on. Then you have to switch the mcu baudrate in 38k4, do the AT stuff, then go back into Data mode in a similar way and also switch mcu into 115k2 I've been using.

Readers discretion is advised..
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf