All posts

Blog

AT commands return ERROR on every line? It is one dropdown, not a dead module

Troniction

A command line sent into a Bluetooth module with no terminating character, and the error that comes back

You held the small button down, powered the module up, and typed AT into the Serial Monitor. Back came ERROR. You tried AT+NAME?, and got ERROR again. You tried it in lowercase, with and without the question mark, and by now you are wondering whether you destroyed the module getting into command mode in the first place.

You almost certainly did not. In the overwhelming majority of these cases the fault is a dropdown at the bottom of the Serial Monitor window that most people never touch: the line ending. Set it wrongly and every single command returns ERROR — not some of them, all of them — which reads exactly like a dead part. For an HC-05 it must say Both NL & CR, and the monitor must be at 38400, not at 9600.

The genuinely maddening part is that the correct setting is different on every module, and on two of them it is the exact opposite. That is the whole of this article.

The all-or-nothing pattern is the diagnosis

Before changing anything, look at how it is failing, because that alone narrows it to two causes.

What you seeWhat it means
Every command returns ERROR, including a bare ATThe module is not parsing anything. Line ending, baud, or you are not in command mode
Every command returns nothing at all — no reply, no errorSame family of causes, or the syntax belongs to a different module
AT answers OK, but one particular command failsYou are in, and talking. That one command does not exist on your module

That third row is the useful boundary. A module that answers OK to a bare AT is listening, at the right speed, in the right mode, with the right line ending. Everything in this article is about getting to that OK.

First, the sixty-second test: are you actually in command mode?

Do this before touching the dropdown, because if you are not in command mode then no setting in the Serial Monitor will produce anything but silence.

On an HC-05, the LED tells you, for free. Out of command mode it flashes fast and continuously. In command mode it slows right down, to a blink roughly every two seconds. If it is still flashing frantically, you are not in AT mode and no amount of retyping will change that.

The HC-05 is the only one of these modules with a real procedure, and the rule is precise:

Hold the button down while you apply power. Not after. Not before.

Press and hold the small button on the breakout board, then plug in the USB — or hold it and press the Arduino's reset button if the module is powered from the board. Get that right and the module comes up in command mode at a fixed 38400, whatever its data rate happens to be set to.

There is a second way in — power it first, then take the KEY pin high — and it is worth knowing only so that you can avoid it. It puts you into command mode at the configured data rate rather than at 38400, which means it works when you already know that rate and fails confusingly when you do not. The hold-during-power-up method is better precisely because it works when you know nothing about the module.

The other modules need no procedure at all. An HC-06 accepts commands whenever it is powered and not connected to anything. A genuine HM-10 and all of its clones do the same. There is no button and no separate speed.

The dropdown, and the four settings that are not the same

Here is the table the whole problem reduces to. It is the single most common cause of ERROR in this subject, and the reason generic advice fails so reliably is that there is no generic answer — there are four.

ModuleSerial Monitor line endingCommand mode baud
HC-05Both NL & CR38400 (button held during power-up)
HC-06 (linvor firmware)No line ending9600 — same as its data rate
Genuine HM-10No line ending9600 (115200 on firmware V700+)
CC41-A / AT-09 / MLT-BT05Both NL & CR9600

Read the last two rows twice. A genuine HM-10 and the clones that are sold as HM-10s want opposite settings. So do the HC-05 and the HC-06, which are one letter apart in the name and are frequently confused for firmware variants of one part. They are not: they are different modules with different command sets.

This is why a perfectly good tutorial produces a perfectly bad result. The author had one module on the desk, set the dropdown once, and never mentioned it again.

Why a line ending decides anything at all

It is worth understanding the mechanism, because it explains the all-or-nothing failure and it stops you hunting for a subtler cause.

AT is a line protocol, inherited more or less unchanged from the Hayes modems of the 1980s. The module does not act on characters as they arrive. It collects them into a buffer and waits for a terminator — a carriage return, or a carriage return and a newline together — and only when that terminator arrives does it look at what it has and try to understand it.

Send AT+NAME=CarBot with no terminator and the module does not reject it. It holds it, waiting for the rest of a line that never comes. Type the next command and that one joins the end of the first, so the buffer now holds two commands run together, which is not a command either. Whatever eventually flushes the buffer produces ERROR, or the module times out silently.

That is why the failure is total. You are not sending commands the module dislikes. You are sending the first half of a command, over and over.

The HC-06 running linvor firmware inverts this because it has no terminator at all. It uses a gap in your typing instead: a pause tells it the command has finished. Which leads to the one habit that makes an HC-06 behave:

Leave a second between HC-06 commands. With no line ending to mark the end of one, two commands typed quickly run together into nonsense. This is the single most common reason an HC-06 answers the first command of a session and then ignores everything after it.

The fix, for an HC-05

The HC-05 is what most people are holding, so here it is end to end. Work down the list and stop at the first step that changes the behaviour.

  1. Unplug the module's power. Not the Arduino's — the module's VCC wire, or the USB if the whole board is coming down.
  2. Press and hold the small button on the breakout board, and keep holding it while you restore power.
  3. Release the button. Look at the LED: it should now blink slowly, about once every two seconds.
  4. In the Serial Monitor, set the baud rate to 38400. Not 9600, whatever the module's data rate is.
  5. Set the line-ending dropdown to Both NL & CR.
  6. Type AT in capitals and press enter. You want OK back.

Once AT answers OK, these four cover almost everything anyone actually needs:

CommandDoesReplies
AT+NAME=CarBotRenames the moduleOK
AT+PSWD=4321Sets the pairing PIN — factory default is usually 1234OK
AT+UART=9600,0,0Sets the data rate, not the AT rateOK
AT+VERSION?Reports the firmware+VERSION:…

AT+UART changes the data rate only. The HC-05's command mode stays at 38400 forever, no matter what you set here. Two numbers for one module is the thing that sends people round in circles — and if you change the data rate and then forget what you changed it to, the module becomes indistinguishable from a broken one the next time you pick it up. Write it on the bag.

The second number: 38400, and why it is not the number you read about

If you arrived here from a garbled Serial Monitor you have probably just spent an hour reading about baud rates, and the temptation is to make everything match. Do not. The HC-05 genuinely has two rates — 9600 for data, 38400 for commands — and they are independent.

While we are on it: the widely-repeated claim that 57600 is the correct rate for the HC-05 is simply wrong, and it is repeated everywhere. If what brought you here was symbols rather than ERROR, that one is a single mismatched number rather than anything to do with command mode.

If it is an HC-06, most of the above does not apply

The HC-06 is the friendliest of these and the one whose documentation is most often wrong, because most of what is written about "AT commands on an HC-05" gets applied to it.

  • It is in command mode whenever it is powered and not connected. No button, no procedure.
  • 9600 for data and 9600 for commands. There is no separate rate.
  • No line ending, and no equals sign: AT+NAMEfoo, not AT+NAME=foo.
  • Replies come back with no spaces and no line breaks: OKsetname, OKsetPIN, OK9600.
  • The moment a phone connects, it stops answering AT commands and becomes a wire again.

That last point is the one that wastes an evening. If your commands worked yesterday and are ignored today, something has quietly paired to it. Turn Bluetooth off on the phone, power-cycle the module and try again.

One exception, and it is a real one. Some later boards sold as HC-06s carry HC-05 firmware instead. Such a board reports a version of 3.x rather than linvor, and then wants Both NL & CR — the opposite of everything in this section. If AT+VERSION comes back with a 3.x string, treat the board as an HC-05 for line-ending purposes.

If it is an HM-10, you may not own an HM-10

This is where the inversion bites hardest, and it is worth being precise about, because it looks exactly like incompetence and is not.

The HM-10 sold well, so it was copied — and then the copy was copied. CC41-A, AT-09, MLT-BT05 and outright fakes are all sold as "HM-10", frequently in the same listing at the same price. They use the same four pins and the same wiring, so nothing about how you wired it changes. What changes is the command syntax, and it changes inversely:

Genuine HM-10CC41-A / AT-09 / MLT-BT05
Query formAT+NAME? — with the question markAT+NAME — without it
Line endingNoneBoth NL & CR
CaseUppercase onlyUppercase only
Default nameHMsoftBT05 or MLT-BT05

So a reader with a CC41-A following a genuine-HM-10 tutorial types AT+NAME? with no line ending and gets total silence — not even an error. The obvious conclusion is that the module is dead. It is not. It is foreign.

The test takes about a minute. Open the Serial Monitor at 9600 and work down this list, stopping at the first one that answers:

  1. Send AT+NAME? with the question mark, line ending set to No line ending. A reply of OK+Get:HMSoft means you are holding a genuine HM-10.
  2. No answer? Send AT+NAME without the question mark, line ending set to Both NL & CR. A reply of +NAME=BT05 is a CC41-A or an AT-09; +NAME=MLT-BT05 is an MLT-BT05.
  3. Confirm with the version. AT+VERS? on a genuine module returns an HMSoft string such as HMSoft V540. AT+VERSION on a CC41-A returns +VERSION=Firmware V3.0.6,Bluetooth V4.0 LE.
  4. Suspect a fake if AT+HELP lists a generous set of commands and those commands then return ERROR.

A CC41-A is a good clone and will carry you through any normal project — plenty of people use one happily for years without ever knowing. An MLT-BT05 is fussier and its STATE pin often ships unconnected. The fakes are the only ones that cannot be rescued: they carry silicon that cannot run the firmware, and nothing you type will change that.

What if none of that was it

Work this order, and stop at the first one that changes the behaviour. It runs from the most likely and cheapest to the rarest and most expensive.

#TestIf that is it
1Is the line ending right for your module, per the table above?The single most likely cause, by a distance
2Is the monitor at 38400 for an HC-05 in command mode?Wrong speed — the module hears noise, not commands
3Is the LED blinking slowly, about every two seconds?Not in command mode. Redo the button procedure
4Is something connected to it?An HC-06 with a phone attached ignores you entirely
5Does AT+NAME answer when AT+NAME? does not?It is a clone, and the syntax is inverted
6Does AT+HELP list commands that then fail?It is a fake. Nothing here will help — replace it

And one more thing worth checking before you spend another hour on this: you may not need command mode at all. Every module in this subject works out of the box at 9600, with its factory name and its factory PIN. You need AT mode to rename it, to change its PIN or its data rate, to make an HC-05 into a master so it can call another module, or to find out which module you are actually holding. You do not need it to pair with a phone, to send or receive data, or to get a first project working.

A great many people enter command mode on day one because a tutorial told them to, get ERROR on every line, and conclude the module is broken — when they never needed to be in there at all. If the module has never appeared in your phone's Bluetooth list, that is a different problem with a different fix, and it is almost always power rather than configuration.

Every symptom in this subject sorts the same way, by which part of the chain is misbehaving, on the Arduino Bluetooth fixes index.

Common questions

Why does every command return ERROR, instead of just some of them?
Because the module is not rejecting your command — it is still waiting for it. AT is a line protocol, so the module collects characters until it sees a terminator and only then tries to understand them. Send no terminator and nothing is ever parsed, so the failure is total rather than selective. That all-or-nothing pattern is itself the diagnosis: a module that dislikes one particular command answers the others.
Do I need AT command mode at all to get a first project working?
No, and going in on day one is one of the most common ways to conclude that a working module is broken. Every module here works out of the box at 9600 with its factory name and PIN. You need command mode only to rename it, change its PIN or baud rate, make an HC-05 into a master, or find out which module you actually own.
What baud rate should the Serial Monitor be on for AT commands?
For an HC-05 entered with the button held during power-up, 38400 — regardless of what its data rate is set to. For an HC-06, a genuine HM-10 or any of the clones there is no separate command rate: it is whatever the data rate is, normally 9600. The HC-05 having two different numbers for one module is most of the confusion in this subject.
My commands worked yesterday and are ignored today. What changed?
If it is an HC-06, check whether something has quietly paired to it. The HC-06 accepts AT commands only while it is not connected, and the moment a phone attaches it stops answering and goes back to being a wire. Turn Bluetooth off on the phone, power-cycle the module, and try again.
The LED is still flashing fast. Am I in command mode?
On an HC-05, no. Out of command mode it flashes fast and continuously; in command mode it slows to a blink roughly every two seconds. If it is still flashing frantically, no amount of retyping will help — power it down and start the button procedure again.

Still not connecting?

Arduino Bluetooth — Make It Connect is 62 pages of every way the link fails, why, and the fix — HC-05, HC-06 and HM-10 BLE, including the clone family almost nothing covers. $9.