BT Module Communication - Seeking Guidance

Hello all,

I’m having issues communicating with BT Module HM-19 - the link below has more info on the module.


My test code & schematic are shown at the bottom/attached.

After a few tries I was able to receive a response of “OK” from the test “AT” cmd, but I get no response from any other AT commands.

I did read this regarding the HM-11 module (which I’ve read is the predecessor of this module)

  • “By the way I actually got it working! I had to use the default 115200 baud to send AT commands to change the baud to a lower baud (like 57600) and then it would respond properly.”
    So I tried sending “AT+BAUD#” (# = 0-8) following by “AT+ADDR?” to change the BAUD rate then test if comm started working…to no avail.

This is my first time working w/ a BT module so my knowledge in minimal, but on the rise.

If anyone has any info on how I might be able to move forward, I’d greatly appreciate it.

#include <SoftwareSerial.h>

SoftwareSerial BT(3,2); // RX, TX  

void setup() {  
  Serial.begin(115200);
  BT.begin(9600);
}

void loop() {  
  char c;
  if (Serial.available()) {
    c = Serial.read();
    BT.print(c);
  }
  if (BT.available()) {
    c = BT.read();
    Serial.print(c);    
  }
}

If you change the baud rate, you will have to adjust the baud rate in your BT.begin() command. The comment you mentioned talks about 115200 and going lower but your sketch is at 9600.

I guess I'm not sure how to successfully change the baud rate if no AT commands respond.

The code above is the only that has given me an OK response.

Would I send AT+BAUD# (and get no response), then upload new code with updated baud rate to match and see if I get responses?

If not, do you have an idea how I could try out what was quoted in my original post?

ktevans:

  • "By the way I actually got it working! I had to use the default 115200 baud to send AT commands to change the baud to a lower baud (like 57600) and then it would respond properly."

This reads like nonsense. If you want to send AT commands, you use 9600baud. This is not a default rate, it is actually the only rate. See section 8 p11 of the factory data sheet. Furthermore, that is the rate shown in your code.

What you are doing is not very clear but it probably isn't what you think it is. The AT+ADDR? command simply tells you the mac address, and is of no use at this juncture. By all means change the baud rate if you need to, but it makes no difference while you are in AT mode. The important thing is to use a different programme when you want to actually communicate, which includes the baud rate you set in AT mode.