HC-06 - how to tell if connected to a device?

Hi,

I have a project that uses a HC-06 BT module which connects to an Android app. All seems to be working well. I am able to check the connection at the Andriod side and now I want to add a check at the Arduino side. Iwould like to test to see if the BT module is powered and connected to the Android device.

There doesn't seem to be a way in software to do this, once the BT module is connected it doesn't reply to AT commands and there doesn't seem to be a way for the Arduino to know if the BT module is there and if it is if it is connected. I wondered if anybody has a wayor if anybody has done a hardware method?

I thought I may be able to piggy back the modules on board LED. The LED flashes when powered but not connected and the LED changes to solid on when connected. Can I simply make a connection from the LED pin on the BT module to the Ardiono to test to see if the LED light is constant, would this work?

I think the HC06 can only operate as a slave and the HC05 can operate as master or slave. The device I have is slave only and it does not seem to have any command to tell if it is paired.

I will be interested to hear if you can figure something out with the LED. I think it is a case of suck it and see. It sounds like it might be effective. Just be careful about connections to the 5v Arduino if your HC06 is a 3.3v device. The Arduino should easily read 3.3v signals but its 5v output could damage a 3.3v device unless the voltage is stepper down. For the LED you probably just need to read the signal.

...R

I managed to have a quick play. I made a connection from the HC-06's LED pin (pin 24) to the Arduino. Initially used analogRead and then used digitalRead.

The analog value is in the 720's when the LED is on (0 or 1 when it is off). The 720 value is high enough to be read as as a digital HIGH. Using a digital pin and digitalRead I got a HIGH/LOW as the LED flashed. Now I just need to create the code to test for either no LED, flashing LED or a constant on LED.

RE voltages. The module I have accepts up to 6V in and I have it connected to 5V. I have the output from the module connected directly to the Arduino and the input (from the Arduino) connected through a voltage divider.

MartynC: Now I just need to create the code to test for either no LED, flashing LED or a constant on LED.

If you just want to know if it is connected or not you could simplify that by just looking for a constant LED.

I will bookmark this Thread so I can try it out myself sometime.

...R