Arduino and HC-06 bluetooth example

In this example we will add bluetooth support to our Arduino, there are several low cost modules labelled either Hc-05 or HC-06. Here is a picture of one of them


In this example we will connect one of these modules to our Arduino, use the software serial library and using a terminal program send a command via your PC and switch the on board LED on and off. First lets take a look at the schematic



As you can see the connections are as follows in the schematic below

arduino and hc05
arduino and hc05



Upload the following to your Arduino

[codesyntax lang=”cpp”]

#include <SoftwareSerial.h>// import the serial library

SoftwareSerial BT(10, 11); // RX, TX
int ledpin=13; // led on D13 will show blink on / off
int BluetoothData; // the data given from Computer

void setup() 
  // put your setup code here, to run once:
  BT.println("Bluetooth On please press 1 or 0 blink LED ..");

void loop() 
  // put your main code here, to run repeatedly:
  if (BT.available())
      // if number 1 pressed ....
      BT.println("LED  On D13 ON ! ");
    if (BluetoothData=='0')
      // if number 0 pressed ....
      BT.println("LED  On D13 Off ! ");
delay(100);// prepare for next data ...


PC setup

I use software called TeraTerm to show the data received or what we want to send through it . You can download TeraTerm or any terminal emulator software , you can download Tera term  from this link :

To make a link between your Arduino and PC:

I’m using Windows 10 here

1) Go to the  Bluetooth icon , right click and select Add a Bluetooth Device

2) Our bluetooth module will appear as HC-06 , select it and click on the Pair button


3) The pairing code is 1234 . On Windows 10 you will see something like this. Click on next and your ready to go


Now start Tera Term and you will see a bluetooth com port, as you can see in this example on my PC it was COM4

Tera Term New connection
Tera Term New connection

In the terminal send a 0 and 1 and you should see something like this

Tera Term VT
Tera Term VT



Here are links to the HC-05 and HC-06 modules
Bluetooth Module 3.6V-6V HC-06 FZ0405 Free Shipping

HC-05 Wireless Bluetooth RF Transceiver Module


Originally my Windows 10 had no bluetooth capabilities but I added the small module below and this was then present Product – Del Mini USB Bluetooth V4.0 Dongle Dual Mode Wireless Adapter For Laptop PC Feb26

  • Facebook
  • Twitter
  • Linkedin
  • Pinterest
This div height required for enabling the sticky sidebar
Ad Clicks : Ad Views : Ad Clicks : Ad Views :