HC05 Bluetooth connection

Hello,

I recently bought an HC-05 Bluetooth module and an Arduino uno board for a project. Last weekend I started it by first toggling a built-in LED through Bluetooth. It all worked fine with default set up of HC-05 and verified with a new set-up, changes of device name, baud rate and etc, as well. So, I put this aside to continue working at a later time. I have not changed anything since then, and today when I powered up the board again through a USB (just like last time) I am all of a sudden unable to make a connection between my Android device and the module. It keeps giving me an error message “connection failed. Is it a SPP bluetooth module?”. I have restored the module to factory default by issuing an AT command AT+ORGL which returned OK, but this did not seem to fix my issue. This is getting a little bit frustrating as it just stopped working without any change made. It would be appreciated if any of you with more experience with Arduino could help!

Below is the Arduino code I have uploaded to the board. Please note that I have changed the baud rate back to 38400:

//----- library
#include <SoftwareSerial.h> //included this library because the predefined serial communication pins are used when compiling

//----- define
#define LED 13
#define BluetoothRX 5
#define BluetoothTX 6

//----- global variables
char data = 0; //Variable for storing received data

SoftwareSerial Bluetooth(BluetoothRX, BluetoothTX); //set the (RX, TX) pins for serial communication

//----- setup
void setup() {
Bluetooth.begin(38400); //set the baud rate for communication with hc05
pinMode(LED, OUTPUT);
}

//----- loop
void loop(){
if(Bluetooth.available() > 0){ //check if data is available
data = Bluetooth.read(); //read the incoming data
//Serial.println(data); //print the data to the console

if(data == ‘1’){ //turn on the LED if the data is 1
digitalWrite(LED, 1);
}
else if(data == ‘0’){ //turn off the LED if the data is 0
digitalWrite(LED, LOW);
}
}
}

Here is some pictures of my current connection:


Hello,

I recently bought an HC-05 Bluetooth module and an Arduino uno board for a project. Last weekend I started it by first toggling a built-in LED through Bluetooth. It all worked fine with default set up of HC-05 and verified with a new set-up, changes of device name, baud rate and etc, as well. So, I put this aside to continue working at a later time. I have not changed anything since then, and today when I powered up the board again through a USB (just like last time) I am all of a sudden unable to make a connection between my Android device and the module. It keeps giving me an error message “connection failed. Is it a SPP bluetooth module?”. I have restored the module to factory default by issuing an AT command AT+ORGL which returned OK, but this did not seem to fix my issue. This is getting a little bit frustrating as it just stopped working without any change made. It would be appreciated if any of you with more experience with Arduino could help!

Below is the Arduino code I have uploaded to the board. Please note that I have changed the baud rate back to 38400:

//----- library
#include <SoftwareSerial.h> //included this library because the predefined serial communication pins are used when compiling

//----- define
#define LED 13
#define BluetoothRX 5
#define BluetoothTX 6

//----- global variables
char data = 0; //Variable for storing received data

SoftwareSerial Bluetooth(BluetoothRX, BluetoothTX); //set the (RX, TX) pins for serial communication

//----- setup
void setup() {
Bluetooth.begin(38400); //set the baud rate for communication with hc05
pinMode(LED, OUTPUT);
}

//----- loop
void loop(){
if(Bluetooth.available() > 0){ //check if data is available
data = Bluetooth.read(); //read the incoming data
//Serial.println(data); //print the data to the console

if(data == ‘1’){ //turn on the LED if the data is 1
digitalWrite(LED, 1);
}
else if(data == ‘0’){ //turn off the LED if the data is 0
digitalWrite(LED, LOW);
}
}
}

Here is some pictures of my current connection:


You might want to Google 'Martyn Currey HC05' He's done a lot of work all the different Bluetooth modules. I don't recall the one I have having a baud rate of 38400. But it has been awhile so I may be mis-remembering.

Don't cross-post!

Threads merged.

I think either bluetooth is faulty or improperly wired, or all your problems are at the Android end, which is probably procedural. The code is irrelevant, as is the baud rate, since, at this stage, all Arduino does is provide power. The only thing that matters is the status LED, about which you say nothing. Perhaps it is something you need to check.