Wednesday, July 1, 2015

Test HC-06 Bluetooth Module with Android BluetoothChat

HC-06 is a low cost bluetooth module (slave mode only). This post show how to test it using the Android code sample of BluetoothChat.

Connection on HC-06 Bluetooth module:
VCC - connect to 3.3V
GND - connect to GND
RXD connect to TXD, to make it in loop-back mode.

In Android side, we will use the Android code sample of BluetoothChat. To make it work with HC-06, we have to modify the UUID. Refer to Android document you are connecting to a Bluetooth serial board then try using the well-known SPP UUID 00001101-0000-1000-8000-00805F9B34FB. Open file file in Android Studio, replace the code:
    private static final UUID MY_UUID_SECURE =

    private static final UUID MY_UUID_SECURE =

Then re-build, install and test it.

Test HC-06 Bluetooth Module with Android BluetoothChat
- Power on HC-06 (*caution 3.3V), the HC-06 LED will blink, to show it is not connected.
- Turn on Bluetooth on Android, pair with HC-06 with default password "1234". After paired, the LED on HC-06 still blink.
- Run the BluetoothChat example on Android, connect to HC-06. After connected, the LED stop blinking.
- Now you can enter text to test the bluetooth connection.
- Anything HC-06 received will echo back to Android. But in my test, sometimes the first character will be incorrect.

- Android example to communicate with Bluetooth device, HC-06 Bluetooth Module


Anonymous said...

Thank you this is very helpful

Unknown said...

how to use the android app?

Unknown said...

I tried this and immediately after selecting my device to connect to my phone gives me an update that it connected to a trusted device, but the bluetooth app tells me I am unable to connect is says it is unconnected at the exact same time, what is happening?

Erik said...

hello Brent Grimm,

I no no exact idea, sorry.

But I re-tried the BluetoothChat example recently and found it's problem on new Android Studio/Android version. Please refer to

Can you try to set target sdk version to Android 4.4, to see if any improvement? What device you test on?

I want to know reason also, thx for your comment.

Unknown said...

Oh man I'm so thankful!!

I've been developing an app using code from the BluetoothChat and testing with phones. Now I'm in the final stage, testing with an actual HC06 module and I thought nothing worked. Thanks to your change line everything worked!!!