Lab

Change baud without locking yourself out

AT+UART= sets the rate the module uses to talk to your Arduino. It takes three positional values — baud, stop bits and parity — and the stop-bit field is 0 for one stop bit, which is the part most often written the wrong way round.

The question worth answering before you press send is whether you can get back in afterwards. Choose HC-05 and set anything you like: its command mode is a fixed 38400 reached by holding the button down while applying power, so the data rate can never lock you out.

Now switch to HC-06 and set 115200. There is no separate command mode: it listens for AT at its data rate. To change it back you must already be talking at the rate you just set — and there is no button to rescue you.

The command is shown with its terminator bytes, because a correctly built command sent with the wrong dropdown fails in exactly the same way as a malformed one, and the two look identical on screen.

MODULE
STOP BITS
NEW DATA RATE
PARITY
SEND EXACTLY THIS
AT+UART=9600,0,0 0D 0A
with the dropdown on Both NL & CR · reply OK
AFTER IT TAKES EFFECT
Your sketch must now open the module at 9600. If that goes wrong you can always get back in: an HC-05's command mode is a fixed 38400 with the button held during power-up, whatever the data rate says.

What this shows

AT+UART sets the rate the module uses to talk to your Arduino. The syntax takes three values — baud, stop bits and parity — and they are positional, so the command is easy to get subtly wrong.

The part worth knowing before you press send is whether the change is reversible. An HC-05's command mode is a fixed 38400 reached by holding the button during power-up, so whatever data rate you set, you can always get back in.

An HC-06 has no separate command mode: it listens for AT at its data rate. Change that rate and you must talk to it at the new rate from then on, including to change it back — and there is no button to rescue you.

The command is shown with its terminator bytes, because a correctly built command sent with the wrong dropdown setting fails in exactly the same way as a malformed one.

Common questions

What is the syntax of AT+UART on an HC-05?
AT+UART=<baud>,<stop>,<parity> — for example AT+UART=9600,0,0 for 9600 baud, one stop bit and no parity. The stop-bit field is 0 for one stop bit and 1 for two, which is the part most often written the wrong way round.
Can I lock myself out by changing the baud rate?
On an HC-06, yes. Its command mode runs at its data rate, so after the change the sketch must open the module at the new rate to talk to it at all. On an HC-05 you cannot: command mode is a fixed 38400 when you hold the button down while applying power, whatever the data rate says.
Why did my sketch stop working after I changed the rate?
Because the module now talks at the new rate and the sketch still opens the port at the old one. Changing the module does not change the code — update the begin() call for the port the module is on to match what you set.
Do I need a line ending for AT+UART?
Yes, the same one the module always needs: Both NL & CR for an HC-05, no line ending for an HC-06. A perfectly formed command with the wrong terminator produces the same silence or ERROR as a malformed one, which is why the two are worth checking together.