Hello,
I'am working on communication between a quadricopter and a phone or computer, and i want to evaluate rate and reliability of bluetooth protocol. I'am using the module HC-06. Default baudrate is 9600. I've successfully exchange datas between arduino and my computer using Processing (running Ubuntu, with HC-06 binded on rfcomm port).
I can have about 350 Hz but some datas are lost. When i send a number list (for instance 1,2, .... n), i read on processing 1,2, 5, 6, 12 ... Some numbers are lost during high rate exchange. Are there solutions for this problem ?
I've then try to change bautrate with AT commands (AT+BAUD8), and the module had answered "OK115200"
Result ... datas received are wrong See on this screenshot :
With this arduino code :
void loop(){
c++;
BT.println(c);
BT.println("AT");
delay(100);
}
Received on processing (see terminal which write all datas received) :
Processing have calculated 20 Hz and not 10 because 2 lines are writtens into each loop ...
But data received is just bullshit. And it's same thing with all baudrates (in processing, see line 16 on screenshot).
However, bluetooth can be appaired with processing only if specified baudrate in arduino code is 115200 !
In setup :
void setup(){
pinMode(BTX, INPUT);
pinMode(BRX, OUTPUT);
BT.begin(115200); //connexion avec le HC06 (BlueThooth en 9600 bauds)
BT.println("Hello from Arduino");
}
The big problem is ... AT commands doesnt work any more ! I think it's because data exchanged are loss or modified such as on this example. This is code for AT commands (it works first time when i've modified baudrate). So ... Have i really lose my module ? Have you an idea to reset baudrate or fix this problem ?
#include <SoftwareSerial.h>
SoftwareSerial hc06(10,11);
void setup(){
Serial.begin(115200);
Serial.println("ENTER AT Commands:");
hc06.begin(115200);
}
void loop(){
if (hc06.available()){
Serial.write(hc06.read());
}
if (Serial.available()){
hc06.write(Serial.read());
}
}
I've try this code with all baudrate available and no answer from arduino ...
Thank you very much !