HC-06 sends data, but is not receiving

Hello,
I want to connect Arduino with my phone (using Serial Bluetooth Terminal for now). I can send data from phone to Arduino without problem, but can’t send data from Arduino (through Serial Port Monitor) to the phone. I’m using AltSoftSerial. I checked wiring 10 times, udes different cables to make sure wires are ok. Can somebody help?
Wiring:

Arduino - HC-06 
8 - TX  | - through Logoc Level Converter
9 - RX  | - through Logoc Level Converter
5V - Vcc  
GND - GND

My code:

#include <AltSoftSerial.h>

AltSoftSerial altSerial;

void setup() {
  Serial.begin(9600);
  altSerial.begin(9600);
  altSerial.println("Hello World");
  pinMode(13, OUTPUT);
}

void loop() {
  byte c;

  if (Serial.available()) {
    digitalWrite(13, HIGH);
    c = Serial.read();
    altSerial.write(c);
    digitalWrite(13, LOW);
    Serial.write(c);
  }
  
  
  if (altSerial.available()) {
    digitalWrite(13, HIGH);
    c = altSerial.read();
    Serial.write(c);
    altSerial.write(c);
    digitalWrite(13, LOW);
  }
  delay(50);

}

Corolan:
I can send data from phone to Arduino without problem,…

8 - TX | - through Logoc Level Converter
9 - RX | - through Logoc Level Converter

That is a surprise. It also conflicts with the heading of this thread, which may be less of a surprise. While a divider on Arduino Tx is a good idea, any converter on Rx is either unnecessary or bad idea and, if you have grief receiving in the future, this is where the problem is likely to be.

I don’t know anything about AltSoftSerial, but I understand it is pin-specific, and therefore equally hardware specific. So, once you have sorted out what you are really doing, and if you are using a newer version of the (assumed) Uno, you might check that your library is compatible with it.

In the meantime, you might change the code to use the plain-vanilla software serial that is included in the IDE. There is nothing in your code that suggests you need AltSoftSerial and, if Software Serial works, you know where the problem was.

Hi, thank You for reply.
I made some addidtional tests.
Using SoftwareSerial did and voltage divider (1 kOhm and 2 kOhm) on Rx pin of HC-06 (leaving Tx pin of HC06 connected directly to Uno) did not helped. Still i can only have one way communication.
I can write text on my phone and it shows in Serial Monitor, but typing anything in Serial Monitor does nothing.
HC06 is pairing correctly with phone (its led is on, not blinking). How could i break something only in one way?

#include <SoftwareSerial.h>


SoftwareSerial mySerial(2, 3);

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);
  mySerial.println("Hello World");
  pinMode(13, OUTPUT);
}

void loop() {
  byte c;

  if (Serial.available()) {
    digitalWrite(13, HIGH);
    c = Serial.read();
    mySerial.write(c);
    digitalWrite(13, LOW);
    Serial.write(c);
  }
 
 
  if (mySerial.available()) {
    digitalWrite(13, HIGH);
    c = mySerial.read();
    Serial.write(c);
    mySerial.write(c);
    digitalWrite(13, LOW);
  }
  delay(50);

}

Corolan:
How could i break something only in one way?

Good question…
One-way traffic, irrespective of the way it is, should be sufficient to prove that all your wiring is kosher.

Further, the fact that you can get signal from phone to monitor confirms that that is too.

Your problem may simply be a bad connection. I never use that LED on pin 13, but if you are, it should be doing something but you say nothing about it. If the LED comes on on receipt of signal, Bluetooth is innocent, and I guess your Arduino<>PC connection is suss.

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

This is Arduino<>phone only, no monitor involved. No software serial either.

Hello Coralan.

Do you have a GPS receiver module?

You can use one to test the HC-05 without using an Arduino & sketch.

You simply connect the two modules via a breadboard or jumpers, give them 5V and pair & connect to an Android phone.

The serial data automatically & continuously generated by the GPS module should appear on the Serial Bluetooth app on the phone. You can also send commands from the phone to the GPS.

This approach gets to the basics and proves a component is working. It also helps one understand what's going on.

P.S. -- I don't used voltage dividers and haven't yet damaged an HC-05. I suppose I should use them, but I don't think it automatically kills a module if I don't.

Good luck,
John.

HillmanImp:
Do you have a GPS receiver module?

Unfortunately, i do not have that kind of module…

Nick_Pyner:
Your problem may simply be a bad connection. I never use that LED on pin 13, but if you are, it should be doing something but you say nothing about it. If the LED comes on on receipt of signal, Bluetooth is innocent, and I guess your Arduino<>PC connection is suss.

This LED right now only indicates availability of serials, so i know that there were at least attempt at sending data. Have no idea for debugging this situation further to locate error…

Nick_Pyner:
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

I will read it closely and try if it will help.

Nick_Pyner:
This is Arduino<>phone only, no monitor involved. No software serial either.

Sorry, but i did not understood that sentence. What do You mean by “no monitor involved”?

Thank You for Your time.

I mean exactly what it says. Hit reset and

  1. Arduino talks to phone
  2. You use phone to talk to Arduino
  3. Arduino regurgitates what you said

Serial monitor is not involved, as is usually the case in a sensible real-life situation. What the above does is prove that Arduino, Bluetooth, and phone are all doing what they are supposed to do - nothing more, nothing less.

Hi guys,
Still no success.
I tried to use code i found in the internet:

#define ledPin 7
int state = 0;
void setup() {
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);
  Serial.begin(9600); // Default communication rate of the Bluetooth module
}
void loop() {
  if(Serial.available() > 0){ // Checks whether data is comming from the serial port
    state = Serial.read(); // Reads the data from the serial port
 }
 if (state == '0') {
  digitalWrite(ledPin, LOW); // Turn LED OFF
  Serial.println("LED: OFF"); // Send back, to the phone, the String "LED: ON"
  state = 0;
 }
 else if (state == '1') {
  digitalWrite(ledPin, HIGH);
  Serial.println("LED: ON");;
  state = 0;
 } 
}

and i could turn LED on/off, but there was no information back no the phone (Serial.println("LED: ON");//did not show on phone)
Hc06 was connected to 5v and GND pins, its TX was hooked directly to Arduino RX, RX of HC06 was connected through voltage divider (2 and 1 kOhm) to Arduino TX.
I powered Arduino with external 12V power supply. When I left USB cable on i could see this messages on Serial Monitor.
I'm starting to suspect broken hc06. Do anybody know what voltage should be on RX pin of HC06? Mine still has 2.4 V. Should it be so?

It sounds like you might have misread the voltage divider colour code. HC-06 should have a 3.3v signal on Rx. I don't know how you read 2.4v but, if it is true, that is the first thing to fix.

I measured it with multimeter (HC06 RX pin <-> ground).
So i connected HC06 RX pin to Arduino TX pin through voltage divider build with potentiometers so i could manipulate voltage. Though i managed to achieve 3.3 V on HC06 RX pin (R1=375 Ohm R2=4920 Ohm), still no data was received by module. I can send data without problem.

I tried another phone, no change. Maybe it is broken HC06?

If you are using one resistor that is 375 Ohm, the other resistor should be 750 ohm. I won’t ask where the 4920 came from. I don’t think this is really the cause of your problem, but it might be indicative of what is going on and, in the light of it, suspecting a broken HC-06 is the last thing you should do.

However and far be it for me to say it but, while the divider is good practice, you might consider removing this altogether. I have never heard of anybody actually frying Bluetooth by omitting it.

Yeah, i know resistances should be like 1:2, but when i used 1 kOhm and 2 kOhm it gave me wrong voltage - 2.4 V. Resistors was checked with multimeter, so they are OK, and even i the were inverted i should see 5V-3.3V=1.7V, not 2.4V.

it gave me wrong voltage - 2.4 V

You are either misreading the code, or mis-measuring the resistors, or mis-measuring the divider in operation. I suspect the latter. If not, now might be a good time to check the voltage it the top of the divider.
On second thoughts: put the meter back in the bottom drawer, and just use the known 1k/2k divider. There is a pic in my notes that shows which way round to install the divider.

I checked measurements and resistors values. I measured correctly. Connected hc-06 to Arduino withouth dividers or logic converters - still nothing. One way only. With direct connection on rx pin of hc06 there is about 4.6 V should not it be 5V? Without hc06 in circuit there is 5V on Arduino Tx pin.

As I understand it, you are losing 0.4v along the length of presumably short wire. I would not have thought that fatal but it doesn't sound too good and may be indicative of other problems. Are you assembling this gear on a cheap breadboard?

It's bought from good store, other projects i did on it never suffered such loses. Maybe it is a long shot, but i will get another bluetooth module and try it.
If problem will continue to arise, it will mean that problem really is in wires and breadboard (but that seem very unlikely).
It couldn.t be Arduino fault i guess, i tried several two different software serial libraries, used on different pins, with different wires connecting everything. Tried two different power sources, with and without divider or logic converter.
I have no idea what to do next besides buying another BLT module.

Corolan:
buying another BLT module.

Could be right...