Hc05 dissconnects when phone locks

Discussion in 'Embedded Systems and Microcontrollers' started by utilityhacker, Jan 1, 2016.

  1. utilityhacker

    Thread Starter Member

    May 1, 2014
    40
    4
    So i'm doing this home automation project Using mobile phone and decided to use a bluetooth module hc05 for wireless communication along with an arduino. For prototyping i made a simple circuit on breadboard to toggle an led on or off. The connections were pretty simple HC05>>> vcc to 5v, gnd to arduino gnd, rx to arduino tx(pin1), tx to arduino rx(pin0). I used a bluetooth terminal app on my andriod phone to toggle the led on and off and it worked. The problem is when ever i lock my screen the Hc05 disconnects and i have to reconnect it every single time. this is no good and happens with all of the bluetooth terminal apps i tried. i could really use some help with this.
     
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    990
    Have you tried other bluetooth devices with your phone to see if it has the same issue?


    I think you are going to have to modify the app on your Android to automatically reconnect to the HC05 when it comes out of sleep.
     
  3. utilityhacker

    Thread Starter Member

    May 1, 2014
    40
    4
    I tried sending files to other phones and it worked fine. Also i connected another phones with the module and it behaves the same way (disconnects).
    I'm using an app from the android store and im not good at android programming.
    Maybe some at commands or firmare might do the job?
     
  4. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    990
    Well it is a free app so you get what you get. I have only dabbled in Android programming. If I had to guess, I would say there is an event generated when Android wakes up from sleep. You texting app probably makes use of this event to reconnect to the last device that was connected.
     
  5. utilityhacker

    Thread Starter Member

    May 1, 2014
    40
    4
    While I was trying to make it work, I found that untill I kill the task of the bluetooth app , it actually stayed connected even when the phone was locked. So yeah promblem is solved. All i had to do was minimize the app rather than killing it(app closes when back button pressed).
    Thankyou for your help! :)
     
Loading...