Hi,
I'm using a Bluetooth HC06 module. Until recently I was able to send data from arduino to computer (Java interface) but since a few days it seems that my PC no longer receives data.
I have tried many different tutorials such as the one below, but still couldn't get anything.
Since it used to work and doesn't work anymore, a possibility could be that the HC06 module was damaged (plugging wrong pins?), but since the HC06 is still detected by my computer, and its led is still blinking, I think this is unlikely. Is there any way to check if the Bluetooth module has been damaged?
Could it be some settings I inadvertently changed?
Any suggestions would really be welcome.
// This program shown how to control arduino from PC Via Bluetooth
// Connect ...
// arduino>>bluetooth
// D11 >>> Rx
// D10 >>> Tx
//Written By Mohannad Rawashdeh
//for http://www.genotronex.com/
// you will need arduino 1.0.1 or higher to run this sketch
#include <SoftwareSerial.h>// import the serial library
SoftwareSerial Genotronex(10, 11); // RX, TX
int ledpin=13; // led on D13 will show blink on / off
int BluetoothData; // the data given from Computer
void setup() {
// put your setup code here, to run once:
//Serial
Serial.begin(9600);
//bluetooth
Genotronex.begin(9600);
//Genotronex.println("Bluetooth On please press 1 or 0 blink LED ..");
pinMode(ledpin,OUTPUT);
}
int time =0;
void loop() {
Genotronex.print(time);
Genotronex.print(",");
Genotronex.println(time);
Serial.print(time);
Serial.print(",");
Serial.println(time);
delay(100);// prepare for next data ...
time++;
}
briandu64:
but since the HC06 is still detected by my computer, and its led is still blinking,
You are right - up to a point. You have proven that bluetooth has power and is ready to connect, but you have not proven the the rx/Tx is OK
Hi Nick_Pyner,
seems like RX/TX are "ok" because, it worked once this afternoon with my Java program. It works once every 3 days or even less, and I don't know why.
On a simpler approach, I can never display any incoming data (arduino -> PC) on the Serial Monitor. Impossible to open the Bluetooth COM (8 in my case) because it's "busy". How can data from the arduino can be vizualized on the PC, using the Serial Monitor?
briandu64:
seems like RX/TX are "ok" because, it worked once this afternoon with my Java program. It works once every 3 days or even less, and I don't know why.
Code either works or it doesn't, so, if it works only once, that is sufficient proof that it is kosher and it is time to look at slack connections.
On a simpler approach, I can never display any incoming data (arduino -> PC) on the Serial Monitor. Impossible to open the Bluetooth COM (8 in my case) because it's "busy". How can data from the arduino can be vizualized on the PC, using the Serial Monitor?
You can never send data to the serial monitor via bluetooth. Use a proper terminal programme, like RealTerm, instead. You are also likely to get value out of using the terminal even via USB cable.
You can never send data to the serial monitor via bluetooth.
Nick, I didn't know, thank you so much for this information. No wonder why I can't see anything.
So I should do more research on how can data be sent to a Java program.
briandu64:
So I should do more research on how can data be sent to a Java program.
Is that a question? If so, I guess the answer is yes, but I really have no idea, and Arduino would neither know nor care what it is talking to, it just sends information to a serial port. I assume java can talk via a serial port.
To get more confidence, you might start with communication to a terminal on a PC or your phone.
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
Hi Nick,
thank you for the documentation.
There might be a problem on the HC06 itself: I have no problem finding it with my Huawei mobile phone, then I pair them, entering the pin number "1234". Seems like there is no problem pairing, but the HC06 led continues flashing.
If I try another pin number, for example "0000" then my Huawei tells me that I have entered the wrong password.
I bought another HC06 and will try it.
briandu64:
Seems like there is no problem pairing, but the HC06 led continues flashing.
This is a contradiction. If the LED is flashing, you do have a problem with pairing.
Be aware of the difference between pairing and connection. There is comment about this on p10.
If I try another pin number, for example "0000" then my Huawei tells me that I have entered the wrong password.
There is a strong suggestion here that 1234 is the correct password.
Nick_Pyner:
There is a strong suggestion here that 1234 is the correct password.
indeed
Nick_Pyner:
This is a contradiction. If the LED is flashing, you do have a problem with pairing.
Be aware of the difference between pairing and connection. There is comment about this on p10.
My mistake, pairing and connecting are not equivalent.
I wired my circuit as on figure page 4 (I doubled and tripled checked wiring), and used the arduino code page 10, but cannot see where things I'm writing in the serial monitor are going.
It seems that Serial.available() is = 0 all the time so the while statement won't execute.

There is a misunderstanding here (surprise). First up, assume there is nothing wrong with code or wiring, and the problem is all procedure.
You appear to be wanting to communicate via the serial monitor using bluetooth. You cannot use the serial monitor. it is not made for that purpose. You can use a proper terminal programme like RealTerm and it has to be setup to run via bluetooth. The ease or otherwise of this is somewhat dependent on the PC.
The programme is only operated at the other end, and Arduino merely teases then regurgitates. Therefore Arduino has, and needs, no cable connection, only wireless. You will probably find this a lot easier using a phone.
I'm trying with Blueterm and Bluetooth Terminal but even though my cellphone can see the bluetooth module HC06 (and my computer), the apps doesn't see anything.
briandu64:
the apps doesn't see anything.
No surprise there. If you look at the top right corner, you will see that it says "not connected". This implies that you need to make the connection. Pairing is not connecting, it is merely saving the address. There is comment on this in the notes.
if I want to connect, I must be able to see other devices and choose which one I want to connect to.
Correct. You do that with the connect option in the terminal menu.