# Basic project with HC05 Bluetooth

**URL:** <https://forum.arduino.cc/t/basic-project-with-hc05-bluetooth/1006651>\
**Category:** General Guidance\
**Created:** [June 26, 2022, 9:00am UTC](https://forum.arduino.cc/t/basic-project-with-hc05-bluetooth/1006651 "2022-06-26T09:00:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![david1234](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@david1234](https://forum.arduino.cc/u/david1234)\
**Post date:** [June 26, 2022, 9:00am UTC](https://forum.arduino.cc/t/basic-project-with-hc05-bluetooth/1006651/1 "2022-06-26T09:00:06Z")

</div>

Hello,  
I'm tryoing to connect from my PI4 to the Arduino using HC05.  
basic led on\off by sending "1""0" from the pi.

I have connected the HC05 to the Arduino  
TX-\> Rx  
RX-\> Tx  
Vcc - 5V  
Gnd- GND

the HC05 is blinking , when I scan I can see it from my phone\python code  
98:D3:C1:AA:8B:22 - HC-05  
but I can't connect to it  
also I can't see anything in the Serial Monitor

2 questions:

1. do I need to change something in the HC05 defualt setting (I just took it out of the box and start using it , didn't change any setting using AT command)
2. is the code correct?

```cpp
/*
    Bluetooh Basic: LED ON OFF - Avishkar
    Coder - Mayoogh Girish
    Website - http://bit.do/Avishkar
    Download the App :
    This program lets you to control a LED on pin 13 of arduino using a bluetooth module
*/
char Incoming_value = 0; //Variable for storing Incoming_value
void setup()
{
  Serial.begin(9600); //Sets the data rate in bits per second (baud) for serial data transmission
  pinMode(13, OUTPUT); //Sets digital pin 13 as output pin
  Serial.println("Setup Finish!");
}
void loop()
{
  if (Serial.available() > 0)
  {
    Incoming_value = Serial.read(); //Read the incoming data and store it into variable Incoming_value
    Serial.print(Incoming_value); //Print Value of Incoming_value in Serial monitor
    Serial.print("\n"); //New line
    if (Incoming_value == '1') //Checks whether value of Incoming_value is equal to 1
      digitalWrite(13, HIGH); //If value is 1 then LED turns ON
    else if (Incoming_value == '0') //Checks whether value of Incoming_value is equal to 0
      digitalWrite(13, LOW); //If value is 0 then LED turns OFF
  }
  else
  {
    Serial.println("No Data");

  }
}

```

all I get is No Data

Thanks,

---

<div class="post-metadata">

**Author:** ![paulpaulson](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulpaulson/32/363643_2.png) [@paulpaulson](https://forum.arduino.cc/u/paulpaulson)\
**Post date:** [June 26, 2022, 9:30am UTC](https://forum.arduino.cc/t/basic-project-with-hc05-bluetooth/1006651/3 "2022-06-26T09:30:48Z")

</div>

> [@david1234](#):
>
> TX-\> Rx  
> RX-\> Tx

Check this connection again.

---

<div class="post-metadata">

**Author:** ![david1234](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@david1234](https://forum.arduino.cc/u/david1234)\
**Post date:** [June 26, 2022, 10:15am UTC](https://forum.arduino.cc/t/basic-project-with-hc05-bluetooth/1006651/5 "2022-06-26T10:15:12Z")

</div>

thank you ,  
I thought I will see something in the terminal even if the connection is refuse or soemthing  
it's seem that the HC05 doesn't send nothing on errors.

---

<div class="post-metadata">

**Author:** ![Nick\_Pyner](https://avatars.discourse-cdn.com/v4/letter/n/e8c25b/32.png) [@Nick\_Pyner](https://forum.arduino.cc/u/Nick_Pyner)\
**Post date:** [June 27, 2022, 7:08am UTC](https://forum.arduino.cc/t/basic-project-with-hc05-bluetooth/1006651/6 "2022-06-27T07:08:17Z")

</div>

> [@david1234](#):
>
> the HC05 is blinking , when I scan I can see it from my phone\python code  
> 98:D3:C1:AA:8B:22 - HC-05  
> but I can't connect to it

This is unhelpful and obscure, and could be the cause of your problem. Use a standard Android Bluetooth terminal programme after properly pairing with Bluetooth in the phone settings. Don't bother trying to explain why you are using python, you might have good reason for doing so eventually, but you certainly don't at the moment.

The code you post is probably kosher, but you might try disconnecting Bluetooth and seeing if it works by just using the PC keyboard.

It is good practice to use a 1k/2k resistor divider between Arduino Tx and Bluetooth Rx, but this is not likely to be the cause of your problem.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [December 24, 2022, 7:09am UTC](https://forum.arduino.cc/t/basic-project-with-hc05-bluetooth/1006651/7 "2022-12-24T07:09:07Z")

</div>

Closed on December 24, 2022, 7:09am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
