Arduino nano does not interface with HC-05 bluetooth device

Hi!

I am trying to send a simple string from my arduino nano to my mobile phone (i have the "serial bluetooth" app on my phone).

  • The code upload correctly to the arduino
  • the bluetooth app recognises the hc-05 and makes a connection
  • The text "serial started" appears in my serial monitor on my pc

However, the text ".hallo bluetooth device" does not appear on my phone. I have been reading tutorials for like 3 hours straight, yet i have no clue what i am doing wrong. I have checked and double-checked the connections on my breadboard. What am i missing here? Any help greatly appreciated!

Andy

#include <SoftwareSerial.h>
SoftwareSerial mySerial(11, 10); //RX, TX

void setup() {
Serial.begin(9600);
Serial.println("Serial started");
mySerial.begin(38400); //38400 für hc-05
mySerial.write("Hello bluetooth device");
}

void loop() { // run over and over
if (mySerial.available()) {
mySerial.write(Serial.read());
}
}

1.JPG

Is the HC05 configured to run at 38400 baud in data mode?
What pins of the HC05 module are connected to what pins on the Nano?

void loop() { // run over and over
 if (mySerial.available()) {
   mySerial.write(Serial.read());
 }
}

What are you trying to do here? In words this says

"If something is available to read from the phone sent to bluetooth module, don't actually read it, but rather send back to the phone what the Arduino reads from the serial monitor."

Hallo cattledog,

i have attached the wiring diagram in my first post (first attachment), there you can see how the pins are connected.

You are totally right about the loop, this statement makes no sense. However, the setup statement should already prompt sending a message over bluetooth.

Regarding baud rate configuration: I have not been able to access the AT commands yet. The 38400 seem to be standard values for the hc-05 and seem to work fine with just about everyone else using this module.

best regards,
Andy

there you can see how the pins are connected.

1.JPG

The RX/TX attachments look reversed to me. The Module RX needs to be connected to the Arduino TX (pin 10 by the SS constructor) and the Module TX needs to be connected to the Arduino RX (pin 11 by the SS constructor).

If reversing your connections does not fix things, then try the software serial at 9600 baud for the HC05.

Hi!

I just completely re-wired my breadboard (see attached picture), uploaded the sketch again und changed the baudrate of my software-serial to 9600. This did not help, still no sending to the mobile possible.

I am kind of lost now. Do you have any idea what else I could try?

Best regards and thanks so much,
Andreas

HI.
I have had several HC-05 modules and the default baud rate was 9600 for all of them.
John.

Not only have you got the pins the wrong way round, but you are also apparently using the wrong pair of pins.

the bluetooth app recognises the hc-05 and makes a connection

has nothing to do with Arduino other than that it is providing power.

The text "serial started" appears in my serial monitor on my pc

but has nothing to do with Bluetooth. They are just words that you have told Arduino to send to serial monitor.
There is nothing wrong with using a fritzing diagram, but a clearer picture of it would be helpful.

As @Nick_Pyner says, it looks like you have the RX and TX connections still incorrect. The parallax makes it hard to see the actual pins connected.

The software serial constructor is from the point of view of the Arduino.

SoftwareSerial mySerial(11, 10); //RX, TX

Pin D11 is the Arduino RX and should be connected to the module TX. Pin D10 is the Arduino TX and should be connect to the module RX. There is a cross connection of RX/TX between the Arduino and the module. TX>RX and RX>TX

Hey there!

You were right, i mixed up RX and TX. I have corrected this now.

The pictures are indeed a bit messy. I sketched up the current schematics for you in powerpoint:

I might have made a mistake in the voltage divider, as i am using 1500+470+33=2003 Ohm instead of 2kOhm (though i doubt this is the problem). I just ordered some 1kOhm resistors and will check back as soon as i got them (Though the actual value should be well within tolerance, but well, you never know..).

Apart from the connection notice, i still get nothing at all on my bluetooth terminal program on my phone. Even with a wrong baudrate, i should get something?

Alright, i will be waiting for the resistors to arrive. In the meantime, i am soldering pins to a second (fresh, never used) hc-05 module to swap out my old one. You never know, maybe i have fried some pins...?

best regards
Andy

I might have made a mistake in the voltage divider,

Many people run the 5v Arduino TX directly to the HC 05 RX. You might want to try this if for some reason of using wrong resistor values your voltage divider was not delivering a high enough signal level to the HC05 RX.

Apart from the connection notice, i still get nothing at all on my bluetooth terminal program on my phone. Even with a wrong baudrate, i should get something?

I would think so, but it may depend on the terminal app.

I'm not familiar with the Nano and I see that I was wrong about you using the incorrect pins, but they were still the wrong way round. I will blame your crappy picture for that. You don't say, but I hope you aren't using an iPhone.

guys...

i LOVE your work! Thanks soo much for your help!

My hc-05 was broken.

Everything working fine now. Hooked up everything according to the latest schematics in my previous post, but swapped out the hc-05 to another one (i always buy two, cause....). Works fine now.

Oh by the way, i am not using an iphone but an android. Briefly tried out direct connection of rX/tx without the voltage divider, works perfectly as well.

Still, i have no clue why the first HC-05 does not work. I have rarely fried any electronics without noticing and having some "spark-fun", and those devices should not be so sensitive afaik. I did do some resoldering on this module, but it connects fine to my phone, only the rx/tx pins seem to be shot. Strange.

best regards,
and thanks again,
andy

Good job working through your issues.

Still, i have no clue why the first HC-05 does not work. I have rarely fried any electronics without noticing and having some "spark-fun", and those devices should not be so sensitive afaik. I did do some resoldering on this module, but it connects fine to my phone, only the rx/tx pins seem to be shot. Strange.

Since you have nothing to loose but your time, you may want to try and revive the unresponsive module by resetting to factory defaults using AT mode and sending AT+ORGL.

Martyn Currey has a good tutorial here HC-05 with firmware 2.0-20100601 – Martyn Currey

However, If you have indeed broken or shorted a trace with soldering around the rx/tx or there is a true hardware defect with the module, you won't be successful.

neo22:
tried out direct connection of rX/tx without the voltage divider, works perfectly as well.

Using the divider is clearly good practice. I have never heard of anybody actually frying Bluetooth without it. If you Google up the images, about half of them have no divider.