Hello, followed many tutorials to connect the hc-05 up to arduino but I cant get it to work. I have the same problem has he had: Problem connecting HC-06 to PC - Project Guidance - Arduino Forum. Followed this article: https://tronixlabs.com.au/news/tutorial-using-hc06-bluetooth-to-serial-wireless-uart-adaptors-with-arduino/
I get power on the hc-05 but the light never goes solid or respond to my commands. I can connect my phone to it but the light on hc-05 only blinks fast 2 times, every 2 sec. Please help me.
Code I found online and use:
#include <SoftwareSerial.h>
SoftwareSerial BT(10, 11);
// creates a "virtual" serial port/UART
// connect BT module TX to D10
// connect BT module RX to D11
// connect BT Vcc to 5V, GND to GND
void setup()
{
// set digital pin to control as an output
pinMode(13, OUTPUT);
// set the data rate for the SoftwareSerial port
BT.begin(9600);
// 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...
{
a=(BT.read());
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
}
}
I can connect my phone to it but the light on hc-05 only blinks fast 2 times, every 2 sec. Please help me.
This indicates that the HC05 is connected to the phone. When I run your program as written, and using the Bluetooth terminal program on my phone I see all the functionality.
What app on your phone is sending and receiving the Bluetooth serial. I am using Kai Morich's Serial Bluetooth Terminal.
Thanks for your respnse! I have several apps and I also tried Kai Morich's app but still no response from the arduino. Clearly it is not the code that is wrong as you got it to work. How did you connect it, TX from arduino directly to RX on hc-05 or with the voltage devider (resistors)? And you connected RX and TX to pin 10 and 11?
I have never got the hc-05 to work, maybeI have to edit setting by AT commands? Or should it be good to go out of the box?
Thanks, help is appreciated!
How did you connect it, TX from arduino directly to RX on hc-05 or with the voltage divider (resistors)? And you connected RX and TX to pin 10 and 11?
My power connections to the HC05 were 5V and GND from the Arduino.
D10 directly to HC05 TX and D11 to 1K/2.2K voltage divider to GND. HC05 RX to the center junction of the voltage divider.
I have never got the hc-05 to work, maybe I have to edit setting by AT commands? Or should it be good to go out of the box?
It should be good to go out of the box, at least mine was, but if its some "lowest price first" ebay bargain who knows. We know the code is good.
If the wiring is correct, then you are looking at the module or the arduino. Connected but not responsive is an unusual situation.
It sounds like the module has never worked. Does the terminal app show that you are connected as well as the module with the two quick flashes every two seconds?
You can certainly have an AT adventure, but with good code, good wiring, and connection made I'm not sure if there can be incorrect AT settings.
Ok thanks. I connectedit up excactly the same way as you did. And you sent the numbers 0 and 1 in the terminal app?
And you sent the numbers 0 and 1 in the terminal app?
No the code is written for '1' and '2'.
Offcourse, my bad but it does not work with 2 and 1 eighter:( Did you use Newline CR+LF in the settings? Did you get the "messages" from the arduino in the app?("LED on"/off)
Did you use Newline CR+LF in the settings?
Yes, that I used that setting in my terminal app.
Did you get the "messages" from the arduino in the app?("LED on"/off)
Yes.
What do you see in the app? Can you see connection messages?
What is the response of the Arduino--does the led go on and off.
What do you see in the app? Can you see connection messages?
What is the response of the Arduino--does the led go on and off.
I dont get any response. See picture. The led on arduino always stays low. I also tried an AT mode code but cant get any response from the module.
// Sketc: basicSerialWithNL_001
//
// Uses hardware serial to talk to the host computer and software serial
// for communication with the Bluetooth module
// Intended for Bluetooth devices that require line end characters "\r\n"
//
// Pins
// Arduino 5V out TO BT VCC
// Arduino GND to BT GND
// Arduino D9 to BT RX through a voltage divider
// Arduino D8 BT TX (no need voltage divider)
//
// When a command is entered in the serial monitor on the computer
// the Arduino will relay it to the bluetooth module and display the result.
//
#include <SoftwareSerial.h>
SoftwareSerial BTserial(10, 11); // RX | TX
const long baudRate = 38400;
char c=' ';
boolean NL = true;
void setup()
{
Serial.begin(9600);
Serial.print("Sketch: "); Serial.println(__FILE__);
Serial.print("Uploaded: "); Serial.println(__DATE__);
Serial.println(" ");
BTserial.begin(baudRate);
Serial.print("BTserial started at "); Serial.println(baudRate);
Serial.println(" ");
}
void loop()
{
// Read from the Bluetooth module and send to the Arduino Serial Monitor
if (BTserial.available())
{
c = BTserial.read();
Serial.write(c);
}
// Read from the Serial Monitor and send to the Bluetooth module
if (Serial.available())
{
c = Serial.read();
BTserial.write(c);
// Echo the user input to the main window. The ">" character indicates the user entered text.
if (NL) { Serial.print(">"); NL = false; }
Serial.write(c);
if (c==10) { NL = true; }
}
}
Can you provide a photograph of your wiring? Anything you can show of the RX and TX connections from the module to the Arduino.
If you are using dupont jumper wires perhaps try changing them.
If I break the Bluetooth RX connection between the module and the arduino D11, I can see the led go on and off, but no typing in the Terminal. If I break the Bluetooth TX and arduino D10 connection I can see what you see.
Once again do yo have Bluetooth TX directly to Arduino D10 and Bluetooth RX to Arduino D11 via voltage divider?
Have tried different cables with still no luck... Here are some pictures of wiring:
I can't see any inline images or attached pictures of wiring. Please try again.
For a "Newbie" you are doing incredibly well with code tags and inline images.
That has me thinking defective hardware rather than defective user 
Thanks, too big image files. Think their uploaded now, but maybe hard to see wiring
Are you using Web Editor and not the IDE?
Shouldn't make a difference, but who knows?
Do you have another Arduino to try?
The external led is a complication. Does it blink with the basic blink sketch? It would not be a bad thing to disconnect it, and use the on board led of the Arduino until things are sorted out.
The bluetooth wiring looks correct to me.
If you unplug the green wire at the BT module RX, you should be able to see the on board led going on and off when you send the 1 and 2 from the phone. Change that one wire from BT TX to D10 again. It doesn't get any simpler than that.
If the built in led does not go on and off, I think there are two possibilities.
The module could be defective and is not outputting on TX.
Another possibility is that your particular Arduino is not recognizing the 3.3v output of the BT module as HIGH. Have you tried different software serial pins, or tried to convert the sketch to hardware serial?
Do you have a scope to use on the TX?
Your wiring may indeed be kosher in principle but slack in fact - which is not very clear from here. There is a lot to go wrong with that breadboard, and you could simplify things somewhat by putting bluetooth into it directly. Further, if you must play around with LEDs, use the one on Arduino as Cattledog suggests. At least it is soldered into place, and that is one more connection to be confident about.
Be aware that the "connected" in your terminal picture merely means that phone is connected to Bluetooth. It guarantees nothing as far as Arduino is concerned.
You might find the following background notes useful.
http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino
which are about as basic as you can get - no LEDs, no software serial, but have a look at the breadboard first.
Thanks for all the advises! After very much trubleshooting i have decided to just replace the hc-05 with an IR-sensor to make my project work for now. I have ordered a new HC-05 from ebay I will try to make it work in the future. Thanks again
There is probably nothing wrong with your HC-05. The only thing I have heard of is a solder bridge on the breakout board between the pins, which was easily identified and fixed.