I'm working on a project where I need to have Bluetooth capability on my Arduino Nano to send data from a sensor over to the computer. Unfortunately, I'm having a difficult time figuring out how to establish a connection from the HC-06 to the computer.

I've hooked up the HC-06 to my Arduino in a fashion similar to the picture shown below.

HC-06 to Arduino Nano

I've also been testing it with various code that I've found online that deal with tutorials on the HC-06. The current code I'm working with is below.

#include <SoftwareSerial.h>
SoftwareSerial BT(1, 0); 

void setup()  
  // set digital pin to control as an output
  pinMode(13, OUTPUT);
  // set the data rate for the SoftwareSerial port
  // Send test message to other device
  BT.println("Hello from Arduino");
char a; // stores incoming character from other device
void loop() 
  if (BT.available())
  // if text arrived in from BT serial...
    if (a=='1')
      digitalWrite(13, HIGH);
      BT.println("LED on");
    if (a=='2')
      digitalWrite(13, LOW);
      BT.println("LED off");
    if (a=='?')
      BT.println("Send '1' to turn LED on");
      BT.println("Send '2' to turn LED on");
    // you can add more "if" statements with other characters to add more commands

When I search for a connection on my computer, it finds the HC-06 and I can then attempt to establish a connection. I enter the pairing code of 1234. It then says that a connection has been established so I go into the Bluetooth Services tab where it tells me what COM port to use (either COM7 or COM4 depending on which computer I try it on. I've tried this on two separate computers.)

So, I open a PuTTY session and attempt to connect to the indicated COM port. About 50% of the time, it says that a connection could not be established to the indicated COM port. The other 50% of the time, I am able to open a PuTTY session but then nothing happens. The green LED on the HC-06 continues to blink away no matter what I try to do.

Any help would be VERY appreciated as I feel like I've tried everything I can think of.

Thank you!

  • You double checked the baud speed used in putty? And a=(BT.read()); has unneeded brackets. Remove the outside ones
    – Passerby
    Feb 23, 2016 at 0:08
  • Yeah, I'm setting my PuTTy session at 9600 baud.
    – TheFaceOfBoe
    Feb 23, 2016 at 1:10
  • 1
    Your voltage divider looks wrong. You should be dividing voltages from the Nano to the module and not the other way round. Feb 23, 2016 at 1:14
  • Also why lay SoftwareSerial over those pins? They are already UART pins from what I can see. Feb 23, 2016 at 10:22

2 Answers 2


I agree with TisteAndii's comment. Your voltage divider is in the wrong place. You are dividing down the 3.3V signal from the HC-06 to be a maximum of 2.269 volts. However the Nano requires at least 3.5V to be considered HIGH.

Plus, you are putting 5V from the Nano into the HC-06 which may damage it.


Try changing the order of the pins on the Software Serial declaration, the correct order is (Rx,Tx), so SoftwareSerial BT(0, 1); Or, just forget Software Serial altogether and remove the first two lines and change "BT" to "Serial" to use the hardware UART on those same pins which works better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.