Arduino Wireless Bluetooth Transceiver Module phone connecting problem

I recently purchased HC-06 Bluetooth Wireless 4 pins. I looked up on internet but I couldn’t successfully make the project I wanted to do. Basically I want to make the LED light turns on every time I press “H” on the phone on Bluetooth terminal on my Sony Xperia P phone. The light of transceiver keep blinking (which I guess it’s standby mode). I used SENA BTerm terminal and tried to connect my transceiver, when asked to put the pin password, I put 1234 because I saw on websites that it is the default password. It said some error and couldn’t connect the transceiver. Can someone tell me why I can’t connect to the transceiver? I’ve provide the code and circuit diagram for you.

char val; // variable to receive data from the serial port
int ledpin = 13; // LED connected to pin 48 (on-board LED)

void setup() {

  pinMode(ledpin, OUTPUT);  // pin 48 (on-board LED) as OUTPUT
  Serial.begin(9600);       // start serial communication at 9600bps


void loop() {

  if( Serial.available() )       // if data is available to read
    val =;         // read it and store it in 'val'
  if( val == 'H' )               // if 'H' was received
    digitalWrite(ledpin, HIGH);  // turn ON the LED
  } else { 
    digitalWrite(ledpin, LOW);   // otherwise turn it OFF
  delay(100);                    // wait 100ms for next reading


The light of transceiver keep blinking (which I guess it's standby mode).

This is correct but you don't say if it stops blinking and goes steady. If it does not go steady, you have not succeeded in pairing.

The wiring looks right. I don't know anything about your phone but it's not an iPhone, so it should be fine.

You might find the following background notes useful

I did solve the problem of connecting. Now it is paired, it was because of the terminal app on the phone. Now I'm facing new problem: I could not turn the LED on when I send the signal. I sent '1' to the wireless bluetooth chip, but nothing happened. I checked my wiring but it was all correct and power runs correctly. How can I solve this problem?

I'm a bit surprised that the terminal app would be the problem. It sounds more like user error. IF you have ensured you have two way traffic, you might find that the app is OK now.

I don't know anything about switching LEDs. I don't even know what sort of signal comes out of the phone, but it might be a very short one. The code looks kosher but it's possible that you can't see what's happening. Try increasing the delay to 1000.

I've tried increase the delay to 1000 but still nothing works. I did connect as diagram I showed, TX to RX and RX to TX.

Since you are using proper hardware serial pins 0,1, use by connecting to PC by USB cable. This will prove the code is kosher. If not, try the code in the link above. This is just to prove two way comms, no LEDs involved.

Since you are using proper hardware serial pins 0,1, use by connecting to PC by USB cable. This will prove the code is kosher. If not, try the code in the link above. This is just to prove two way comms, no LEDs involved.

I tried the code that you provided to test the transceiver. There's an error at the end of uploading the code as picture below saying "avrdude: stk500_getsync(): not in sync: resp=0x00" (I just noticed it also appeared on my code as well), also when I typed in the monitor, nothing comes up.

This is not an error in the code, it is an error in your procedures or installation. Since you are working with blutooth, it might simply be that you are trying to load the code with the bluetooth connected. If so, disconnect it and try again. There are notes about this in the link I posted.

There is a swag of reasons for that error, but this is the simplest and, hopefully, the most likely!

I did try to unplug and plug in again but still doesn't work. Also I ordered the resistors online (that's why I took me sometimes to reply) and tried to wire up like the link you posted, but still showed the same result.
I've noticed something new: I have 4-5 bluetooth apps, however, the one I told you that I can connect it to, it doesn't require the 4 digit pin code, so I could connect it without the password, but other bluetooth apps does require the password, but when I typed 1234(default password), and I failed to connect to the bluetooth chip. I would assume it is because of the app? How do I fix this?

There is a lot of technobabble about "avrdude: stk500_getsync(): not in sync: resp=0x00", so be careful, as most of which is baloney that you can safely ignore. It could simply mean a bad USB cable. You are bound to have several, so try another.

Refusal of the password is more likely to be down to the wrong password than a bad app so try "0000" instead

For “avrdude: stk500_getsync(): not in sync: resp=0x00”, I have tried simple LED code and there was no “avrdude: stk500_getsync(): not in sync: resp=0x00” message show up. So I would assume it is not about the cable.
For password, I’ve tried 0000 but still is not correct

However, I managed to connect and send the data successfully on the apps that did not require the password, what I did was that I unplugged the TX on Arduino while it was uploading. It worked. But when I’ve tried to upload other code to combine the projects, the Arduino acted really weird, it remembered the previous code and did not import the code I wrote. Example, I uploaded pin 13 to blink the light circuit and it worked fine, when I changed the circuit to bluetooth project, the LED on pin 13 still blinking same exact delay that I put in the first time while I did not even connect to the bluetooth and send the data it blinked like the previous circuit (happens to Servo as well)

Is it because of “avrdude: stk500_getsync(): not in sync: resp=0x00”? Is there anyway to fix this issue? Since the computer cannot communicate with the board only specifically on this bluetooth project (because other circuit works).

I'm not sure what is happening, and the IDE can stumble if you stuff up the procedures.

The USB cable connected to PC shares the serial port with bluetooth. Always ensure Blurtooth is disconnected when uploading code from PC, do not try to connect via Bluetooth on the PC while the cable is connected (why would you want to do that anyway?), but note that you can use the serial monitor on PC while Bluetooth is connected to your phone.

You may find that the COM port you think are using is actually inoperative, so check that. The simplest solution is close the IDE and start over. The IDE is not bulletproof. This particularly applies if you are swappoing Arduinos.

I disconnected the bluetooth before I upload the code

I think I've solved the problem. I think the bluetooth model TX and RX mess up the IDE if they are connected while uploading. What I did and successfully fixed the problem was that I disconnected the TX and RX from the board when I'm uploading the code. When it finished uploading (without TX and RX connected), there was no "avrdude: stk500_getsync(): not in sync: resp=0x00" message pop up on IDE. Then I connected the TX and RX pins and started pairing bluetooth, and it works.

Thank you for all the solutions you've provided. Nick_Pyner