1

Hello I want to get an arduino get status of bluetooth hc 05 if connect with device or not . I'm trying by myself and search on internet website but I can't find useful things.

  • Can you show us the code you have written so far? – VE7JRO Jan 1 '18 at 19:28
  • if (Serial1.available()) { Serial1.print("AT+BIND"); Serial.println(Serial1.print("AT+BIND")); } – user41370 Jan 2 '18 at 18:25
  • This's one code of codes who I tryed . The other codes mybe the same but with some differents order... – user41370 Jan 2 '18 at 18:30
0

In hc05 there is led that shows you Bluetooth is paired or not. In datasheet it says that connected the PIO9 pin. You can connect this pin to arduino's digitial input pin. After that you can understand is it paired or not.

AT+BIND? gives you which device you currently paired.

  • If I connect PIO9 pin maybe it's get write in serial.read() if it's connect or not ...? – user41370 Jan 2 '18 at 18:20
  • No its not like that. When you paired this led turns on so if you make a little bit solder and you can get a wire from there and put this wire to arduino's digitial input pin. When Bluetooth paired this pin goes HIGH and if its not connected this pin goes LOW – Musa Jan 2 '18 at 18:35
  • Ok I edited the post check it again – Musa Jan 2 '18 at 21:48
0

Different Bluetooth adapters (using the HC-05 module) provide different signals, besides its Rx and Tx. Most bring out a "key" input that puts the module into command mode where serial communication is between the external pins and the module itself - 'AT' commands & queries to the module's firmware. When the module is not in command mode, the firmware just passes serial data through the Bluetooth radio, ignoring the content. Some provide an LED- or State signal that you can read (or observe on an LED) to know whether the devices is paired (communicating) or unpaired (in command mode).

On some, this is a simple logic signal; on others it is a square wave of 1/2 to 1 Hz which means your code has to track the signal to know whether it is static (typically High when paired) or toggling (for unpaired/waiting to pair).

You need to read your module's datasheet to find out the behavior of this signal on your particular module. If you connect an LED to this signal, or your module has one on the board, you can often make a good enough guess by observing it with a stopwatch. Either way, you then need an Arduino function that samples the LED periodically, remembering what state it saw and for how long, to decide whether the LED is blinking or is steady.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.