Baud rate for hm-10

Hi

I bought an hm-10 bluetooth ble module , and connected it to my arduino nano , when the hm-10 module was set to 9600 baud rate it worked just fine,

The problem is that i've changed the baud rate of the hm-10 module to 38400 with the arduino ide console and now i cant get it back to 9600, because the module doesn't understand the commands from the console (eg. if i write AT+BAUD4 the console just return weird characters)

I tried changing the software serial.begin to 9600 or 38400 but nothing works, my code is

#include <SoftwareSerial.h>

SoftwareSerial miBT(10, 11);

void setup(){

Serial.begin(9600);
Serial.println("Listo");
miBT.begin(9600);

}

void loop(){
if (miBT.available())
Serial.write(miBT.read());

if (Serial.available())
miBT.write(Serial.read());

}

what command did you use to change to 38400 baud?
did it work at 38400?
if you are displaying odd characters you have a baud rate incorrect either on Serial or miBT
try both at 38400, e.g.

Serial.begin(38400);
Serial.println("Listo");
miBT.begin(38400);

remember to change the serial monitor to 38400baud to match Serial

You might not have changed anything - which might explain your problem. Irrespective of what went on - or didn't - HM-10 is in AT mode at power-on by default and the baud rate for configuration is 9600. No exceptions. As stated, ensure baud rate of Arduino Serial and monitor match. Then send AT commands to Bluetooth at 9600. If it doesn't work, there could be something else going on, like wiring.

Hi Horace, i used AT+BAUD2 to change the baud rate, tried changing Serial.begin and miBT.begin to 38400. Tried as well changing the baud option on the console window to 38400, this way i get the "listo" but when i try setting the BAUD, it doesnt work, (nothing is displayed)

Hi nick, something changed because before i set the baud rate for the first time, it was working ok, (and i think the wiring is ok as well as i didnt change it)

Matched the baud rate on both serial and monitor, to 38400 but no characters at all are shown

By all means change the Serial.begin to 38400, even though there is no particular value in it at the moment, but you must match the monitor thereto.

HM-10 is in AT mode by default BUT IF you want to change the baud rate, your software serial miBT must be set to 9600 in order to use it.
NOTE

  1. the above applies irrespective of what the HM-10 baud rate was set to previously

  2. Your two serial channels are unrelated. The settings of one has no bearing on the settings of the other. There was never any need to change the monitor from the default 9600.

Slack wiring is in fact a reasonable explanation of your problem, and the only time you will be trusted on this is when you tell us HM-10 says "OK" !

with an Arduino Due using code

// HM-10 BLE module connected to an Arduni Due
// power HM-10 from 3.3V and connect
// Tx to pin 19 and Rx to pin 18


void setup()
{
  Serial.begin(115200);
  Serial.println("Enter AT commands:");
  Serial1.begin(9600);       // HM-10 default speed in AT command more
}

void loop()
{
  if ( Serial1.available())    // read from HC-05 and send to Arduino Serial Monitor
  Serial.write( Serial1.read());

  if (Serial.available())     // Keep reading from Arduino Serial Monitor and send to HC-05
  Serial1.write(Serial.read());
}
 

put device in command mode by

  1. disconnect from any BLE device
  2. take BRK high

using serial monitor at 9600 baud

  1. enter AT should respond OK
  2. enter AT+BAUD? should respond with OK+Get:0 indicating baudrate is 9600
  3. enter AT+BAUD2 should respond with OK+Get:2 setting baudrate to 38400
    • note baud rate is still 9600
  4. power device OFF then ON
  5. change HM-10 ( Serial1 in above code) baudrate to 38400, build and upload
  6. enter AT and you should get response OK

a problem can occure if you have have the terminal baudrate lower than the HM-10
if a large amount of data is received from the HM-10 the terminal software and hardware buffers can be overrun and information lost
you can get similar problems if the terminal baudrate is higher then the HM-10 and the terminal is downloading large amounts of data
in practice one would use software or hardware flow control

Following exactly this steps (only difference , i working with NANO so i wired 10 and 11 digital pins), when i enter AT, it just responds random characters, thanks for your help anyway. I starting to think it was not a good idea change de default baud rate from the hm-10 module as i cannot communicate with it anymore, (at least with my module, maybe with others this is not a problem, i dont know)

I purchased the old reliable hc-05 and continue from there

Thanks!

Sounds like a really good idea.....
When I finally got an HM-10 going, I thought the only secret was that you needed a BLE-capable terminal. If you've got that, it is just like an HC-0x after all. This does not appear to be the case, and the device does seem to be unreliable if it is used in this simple manner. I thought it might just be me but it isn't worth the effort to prove it, and those who say the HM-10 is fundamentally unsuited for plain-vanilla SPP data comms are probably right.

Even if it is kosher for SPP, I'm sure the HM-10 has nothing to offer over HC-0x except that there are a lot of fake HC-0x around but I am not aware of any fake HM-10.

Exactly, i had to try it, but my project doesnt realy need it, thanks for your help!

the HC-05 implements Bluetooth 2.0
the HM-10 implements Bluetooth 4.0 and BLE (Bluetooth Low Energy)

And to what end? It might be of value if you are stuck with an iPhone, but I imagine there are better options. The HM-10 is price competitive with HC-0x and is been on the market for several years. It should have killed the HC-0x off by now but it hasn't, and for good reason.

Maybe there are some peripherals one might want that are BLE only, but I would imagine that means they won't work with an HM-10 anyway.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.