The Bluefruit LE modules use a Hayes AT-style command set to configure the device.

The advantage of an AT style command set is that it's easy to use in machine to machine communication, while still being somewhat user friendly for humans.

Test Command Mode '=?'

'Test' mode is used to check whether or not the specified command exists on the system or not.  

Certain firmware versions or configurations may or may not include a specific command, and you can determine if the command is present by taking the command name and appending '=?' to it, as shown below

AT+BLESTARTADV=?

If the command is present, the device will reply with 'OK'.  If the command is not present, the device will reply with 'ERROR'.

AT+BLESTARTADV=?
OK\r\n
AT+MISSINGCMD=?
ERROR\r\n

Write Command Mode '=xxx'

'Write' mode is used to assign specific value(s) to the command, such as changing the radio's transmit power level using the command we used above.

To write a value to the command, simple append an '=' sign to the command followed by any paramater(s) you wish to write (other than a lone '?' character which will be interpretted as tet mode):

AT+BLEPOWERLEVEL=-8

If the write was successful, you will generally get an 'OK' response on a new line, as shown below:

AT+BLEPOWERLEVEL=-8
OK\r\n

If there was a problem with the command (such as an invalid parameter) you will get an 'ERROR' response on a new line, as shown below:

AT+BLEPOWERLEVEL=3
ERROR\r\n

Note: This particular error was generated because '3' is not a valid value for the AT+BLEPOWERLEVEL command.  Entering '-4', '0' or '4' would succeed since these are all valid values for this command.

Execute Mode

'Execute' mode will cause the specific command to 'run', if possible, and will be used when the command name is entered with no additional parameters.

AT+FACTORYRESET

You might use execute mode to perform a factory reset, for example, by executing the AT+FACTORYRESET command as follows:

AT+FACTORYRESET
OK\r\n

NOTE: Many commands that are meant to be read will perform the same action whether they are sent to the command parser in 'execute' or 'read' mode. For example, the following commands will produce identical results:

AT+BLEGETPOWERLEVEL
-4\r\n
OK\r\n
AT+BLEGETPOWERLEVEL?
-4\r\n
OK\r\n

If the command doesn't support execute mode, the response will normally be 'ERROR' on a new line.

Read Command Mode '?'

'Read' mode is used to read the current value of a command. 

Not every command supports read mode, but you generally use this to retrieve information like the current transmit power level for the radio by appending a '?' to the command, as shown below:

AT+BLEPOWERLEVEL?

If the command doesn't support read mode or if there was a problem with the request, you will normally get an 'ERROR' response.

If the command read was successful, you will normally get the read results followed by 'OK' on a new line, as shown below:

AT+BLEPOWERLEVEL?
-4\r\n
OK\r\n

Note: For simple commands, 'Read' mode and 'Execute' mode behave identically.

This guide was first published on Aug 07, 2015. It was last updated on Mar 08, 2024.

This page (AT Commands) was last updated on Mar 08, 2024.

Text editor powered by tinymce.