Add Bluetooth to Your Arduino Project - Arduino+HC-06





Introduction: Add Bluetooth to Your Arduino Project - Arduino+HC-06

Wouldn't you love to switch on and off the lights in your house without having to raise a finger? (well, technically you would have to raise a finger or two, but you get the jist of the story). The good news is that you can. All you needs is an arduino, HC-06 bluetooth module, some relays and a little electrical know-how.

In this tutorial, however, i am going to show you how to setup the HC-06, send some data to the arduino and receive and echo and control an LED via bluetooth. At least this should get you started, before you get to control the whole grid with your HC-06...just kidding.

Step 1: Setup

Setting up the HC-06 is as easy as ABC. All you need to know is the pin configuration. The HC-06 has 6 pins: wakeup, VCC, GND, TXD, RXD and State. Right now I will only deal with 4 pins, which are VCC, GND, TXD and RXD.

Here is how you should connect the Bluetooth module to your Arduino.





The HC-06 acts as a serial port through which you can send and receive data. So using a serial terminal or a Bluetooth customized application on your computer or phone, you can control and monitor your project. I used Teraterm as the serial terminal.
Before, uploading the code to the Arduino, disconnect the HC-06 module, since it shares the tx/rx pins and will interfere with the upload. Connect it back once the code has been uploaded successfully.

Step 2: Echo Code

This code enables you to send a string to the Arduino via Bluetooth and get an echo back on your serial monitor.

NB: if you are using an arduino mega change this line of code while(Serial.available()); to while(Serial.available()>0); otherwise the code will not work

Step 3: LED Code

This code allows you to switch on and off an LED using by sending a command to the Arduino via Bluetooth.

Step 4: Pairing HC-06 to the Computer

Pair the HC-06 with your computer or any other Bluetooth device you have as shown in the video

NB: In the video I say that you should connect your serial terminal program (teraterm) to the INCOMING com port. This is not right. The correct way should be connecting your serial terminal program to the OUTGOING com port.

Step 5:

Once the module is paired. Open Teraterm, or any other serial terminal program you have. Select the serial port that corresponds to the HC-06 (I have explained how to identify that port in the video).

Once you successfully connect to the HC-06 serial port you will be able to send strings to your Arduino and get an echo back. If you have uploaded the second code, you will be able to switch on and off and LED by sending “n” and “f” respectively.

Step 6: Echo Example

Step 7: LED Example

Step 8:

There are many applications of the HC-06. Learn more about it in my next post as I show you how to control an Arduino robot arm via bluetooth. For a more detailed tutorial on the HC-06 visit this link.


  • verry cool thanx i m...-WannaDuino

    WannaDuino made it!


  • Epilog Challenge 9

    Epilog Challenge 9
  • First Time Author Contest 2018

    First Time Author Contest 2018
  • Sew Warm Contest 2018

    Sew Warm Contest 2018

We have a be nice policy.
Please be positive and constructive.




Question, once a HC-06 is connected to an arduino you cannot use USB to upload an updated sketch any longer right? If a simple power interrupt switch was added to the vcc between the Arduino and the HC-06 would that enable the USB again? or must all four lines me disconnected? I have a project I added the HC-06 to but I have to keep disassembling it to temp remove the BT just to push a new sketch up :( wondering if a simple switch could be added to simplify the issue....


I had the exact same issue and the thing that causes the trouble is using pin 0 and 1 . You can use the SoftWareSerial library to enable the usesage of all the pins on your arduino for your bluetooth module. For example insted of using 0 and 1 i use 10 and 11 now for the RX and TX and now it works fine! Hope i helped you with this

Thanks for the great and useful tutorial. I followed instructions and it worked first time. Only got a bit stuck on tera term but found some info on the web. I had bought an HC-05 and wanted to test it quickly and your project was perfect and easy to follow for a beginner like me. Also gave me a chance to learn about Tetra term! Thanks !!

There are many bluetooth terminal apps available for Android too. I was also successful the first time using one of these apps. Of course I was stuck on forgetting to disconnect the HC-06 (if using the standard Arduino Tx/Rx pins) while trying to upload. Oh well.

Yes I see the web is full of interesting apps for Arduino and, in particular bluetooth and/ or bots

Sometimes feel like a kid in a candy shop. I Want to dive in the deep end but better to start with basics first!

When i write something on the bluetooth terminal it answers me back with random letters

Your baud rate on your Serial Monitor doesn't match the program setting or the default. Change it in the bottom right corner of the Serial Monitor screen.

In French : Moi aussi !!! +1

I use mega 2560 but it doesnt work and has alot of errors ... how can i fix it? Please recommend me.

I downloaded your attached ino file and compiled code successfully but unable to upload to my uno board...
Can you plz help me why this is happening? Failed to upload code to uno board.