Hello, so my questions have to deal with figuring out the AT commands for the HC-06 Bluetooth module for the Arduino. This is my first time dealing with writing any structures for Bluetooth so as such I want to know as much as needed.
Let me also preface with that i've looked at a lot of information on this already,but I have yet to find anything that explains what I'm looking for.
To get down to it, I want to know exactly how to use the AT commands with Arduino. There's many out there that go through a terminal system to execute the commands ,but I want to have the Arduino communicate through the rx tx lines and write some control structures that allow me to create a much more interesting Bluetooth device.
I've been partially successful with this ,but I'm not receiving an OK response from the Bluetooth device and the query commands aren't returning anything to the Arduino nor any terminals.
So in summary my main questions are:
How do I receive a serial response from the HC-06 BT module?
How do I use the AT commands correctly to create a control structure for an arduino based controller or system?
AS A SIDE NOTE HERE , I'm looking to send commands for this project from my Arduino to my cell phone without developing an app to go along with it since I know there are programmatic ways to solve this rather than having to rig up a crude prototype app that drains the battery of my phone.
-see attached document which includes the HC-05 command list which is pretty close to synonymous with the HC-06 . If anyone has documentation for the HC-06 commands please post it below.
That's the end of the questions ,however I'm hoping we can make this a way for others to easily create similar projects.
Thanks!
-Zigler
HC-05 AT Commamd.pdf (83.7 KB)
Did some more digging. Found out the HC-06 is a slave module transceiver. So either I buy a new module for 5-7$ or reverse engineer the firmware to allow me a master/slave mode.. either way for those looking into the same issue. This is the code I wrote after looking at code that another user found from a guy named marguskohv .
void setup() {
Serial.begin(9600);
cm("AT");
cm("AT+NAMEBTCON");
cm("AT+VERSION");
cm("AT+PO");
cm("AT+PE");
cm("AT+PN");
}
void loop(){
}
void cm(String str){
String command = "";
Serial.print(str);
delay(1100);
if (Serial.available()) {
while(Serial.available()) {
delay(3);
command += (char)Serial.read();
}
}
delay(1100);
Serial.println("\n"+command);
delay(1100);
}
Inside are the only AT commands available. I found the sheet for the specific module and was a little disappointed I didn't read more into it.
Hope this helps anyone else. Also the communication code I wrote works for an Arduino uno.
This is incoherent nonsense
writing any structures ........... but I have yet to find anything that explains what I'm looking for.
No surprise there, but if you want to configure and HC-05 or HC-06, there is plenty of stuff around.
http://www.martyncurrey.com/arduino-and-hc-06-zs-040/
I'm looking to send commands for this project from my Arduino to my cell phone without developing an app to go along with it since I know there are programmatic ways to solve this
I won't ask what those ways are, but I suspect you will need to have the phone wake up with the bluetooth in slave mode. Good luck with that.
or reverse engineer the firmware to allow me a master/slave mode
And with that.
I'm sure you will realise it would be better to spend the $5 - eventually. Indeed, in the unlikely event that you are actually capable of reverse engineering it, you will still be better off spending the $5.
code I wrote after looking at code that another user found from a guy named marguskohv ......... the communication code I wrote works for an Arduino uno
I submit you will be better off going direct to Margushkov, who actually knows what he is doing, and the junk code you post may run on a Uno but won't work for either HC-05 or HC-06. With the HC-06, you can only change the baud rate, name, and PIN.